From 7c2d969e85eac7c72f3a289385b2707ea3e77217 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Tue, 14 Aug 2018 18:22:10 -0500 Subject: Added notes about CVE issues. --- release_docs/RELEASE.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 96a91b1..5b42f3d 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -205,6 +205,39 @@ Bug Fixes since HDF5-1.10.2 release (JTH - 2018/08/02, HDFFV-10512) + - User's patches: CVEs + + The following patches have been applied: + + CVE-2018-11202 - NULL pointer dereference was discovered in + H5S_hyper_make_spans in H5Shyper.c (HDFFV-10476) + https://security-tracker.debian.org/tracker/CVE-2018-11202 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11202 + + CVE-2018-11203 - A division by zero was discovered in + H5D__btree_decode_key in H5Dbtree.c (HDFFV-10477) + https://security-tracker.debian.org/tracker/CVE-2018-11203 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11203 + + CVE-2018-11204 - A NULL pointer dereference was discovered in + H5O__chunk_deserialize in H5Ocache.c (HDFFV-10478) + https://security-tracker.debian.org/tracker/CVE-2018-11204 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11204 + + CVE-2018-11206 - An out of bound read was discovered in + H5O_fill_new_decode and H5O_fill_old_decode in H5Ofill.c + (HDFFV-10480) + https://security-tracker.debian.org/tracker/CVE-2018-11206 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11206 + + CVE-2018-11207 - A division by zero was discovered in + H5D__chunk_init in H5Dchunk.c (HDFFV-10481) + https://security-tracker.debian.org/tracker/CVE-2018-11207 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-11207 + + (BMR - 2018/7/22, PR#s: 1134 and 1139, + HDFFV-10476, HDFFV-10477, HDFFV-10478, HDFFV-10480, HDFFV-10481) + - H5Adelete H5Adelete failed when deleting the last "large" attribute that -- cgit v0.12 From 12adeedf6b817d99d00051d0549448f52a65c6a4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 16 Aug 2018 15:06:29 -0500 Subject: HDFFV-10552 fix version script (missed when 1.11 created) --- bin/make_vers | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/make_vers b/bin/make_vers index 7e7fba1..4de2dbd 100755 --- a/bin/make_vers +++ b/bin/make_vers @@ -7,8 +7,8 @@ require 5.003; # is added (like support for 1.4, etc), the min_sup_idx parameter will # need to be decremented. - QAK) -# Max. library "index" (0 = v1.0, 1 = 1.2, etc) -$max_idx = 5; +# Max. library "index" (0 = v1.0, 1 = 1.2, 2 = 1.4, 3 = 1.6, 4 = 1.8, 5 = 1.10, 6 = 1.12, etc) +$max_idx = 6; # Min. supported previous library version "index" (0 = v1.0, 1 = 1.2, etc) $min_sup_idx = 3; @@ -478,7 +478,7 @@ for $file (@ARGV) { } } close SOURCE; - + # Create header files print "Generating '", $prefix, "H5version.h'\n"; create_public($prefix); -- cgit v0.12 From 201d1722dc14f5adb0ab5c42b11fac15e9da8454 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 16 Aug 2018 15:31:02 -0500 Subject: Fix JIRA number format --- release_docs/RELEASE.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 5b42f3d..1e18dfe 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -140,7 +140,7 @@ New Features Change parent class from Exception to RuntimeException. - (ADB - 2018/07/30, HDFFV10534) + (ADB - 2018/07/30, HDFFV-10534) - JNI Read and Write @@ -148,7 +148,7 @@ New Features to correct dataset and attribute reads. New write functions, H5DwriteVL and H5AwriteVL, are under construction. - (ADB - 2018/06/02, HDFFV10519) + (ADB - 2018/06/02, HDFFV-10519) Tools: ------ -- cgit v0.12 From 454b04176ae8daeadcd26bb532ed77c4c051a9c3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 16 Aug 2018 15:45:17 -0500 Subject: Update cmake warnings to match the autotools files better --- CMakeInstallation.cmake | 1 + MANIFEST | 1 + config/cmake/HDFCompilerFlags.cmake | 105 ++++---- release_docs/INSTALL_CMake.txt | 25 ++ release_docs/INSTALL_Warnings.txt | 474 ++++++++++++++++++++++++++++++++++++ 5 files changed, 542 insertions(+), 64 deletions(-) create mode 100644 release_docs/INSTALL_Warnings.txt diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 622f0cf..2339049 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -215,6 +215,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) if (HDF5_PACK_INSTALL_DOCS) set (release_files ${release_files} + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Warnings.txt ${HDF5_SOURCE_DIR}/release_docs/INSTALL_CMake.txt ${HDF5_SOURCE_DIR}/release_docs/HISTORY-1_8.txt ${HDF5_SOURCE_DIR}/release_docs/INSTALL diff --git a/MANIFEST b/MANIFEST index 1165240..046d73b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -445,6 +445,7 @@ ./release_docs/INSTALL_CMake.txt ./release_docs/INSTALL_Cygwin.txt ./release_docs/INSTALL_parallel +./release_docs/INSTALL_Warnings.txt ./release_docs/INSTALL_Windows.txt ./release_docs/RELEASE.txt ./release_docs/USING_HDF5_CMake.txt diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 214afa0..ec13272 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -9,6 +9,8 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # + +message (STATUS "Warnings Configuration:") #----------------------------------------------------------------------------- # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- @@ -45,6 +47,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF) if (HDF5_DISABLE_COMPILER_WARNINGS) + message (STATUS "....Compiler warnings are suppressed") # MSVC uses /w to suppress warnings. It also complains if another # warning level is given, so remove it. if (MSVC) @@ -79,79 +82,55 @@ endif () # break into groups (from the config/gnu-flags file) #----------------------------------------------------------------------------- if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) - if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (CMAKE_C_FLAGS_5 "${CMAKE_C_FLAGS_5} -Wcast-qual") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs") - else () + if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP") + else () + # General flags + # + # Note that some of the flags listed here really should be developer + # flags (listed in a separate variable, below) but we put them here + # because they are not raised by the current code and we'd like to + # know if they do start showing up. + # + # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) + # warnings that are emitted. If you need it, add it at configure time. + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings") + # gcc automatically inlines based on the optimization level + # this is just a failsafe + set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") endif () #----------------------------------------------------------------------------- # Option to allow the user to enable developer warnings + # Developer warnings (suggestions from gcc, not code problems) #----------------------------------------------------------------------------- option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF) if (HDF5_ENABLE_DEV_WARNINGS) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Winline -Waggregate-return") - else () - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-inline -Wno-aggregate-return") - endif () - - # Append warning flags - # Don't use the '-Wtraditional' flag, we're way past having K&R C code - # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional") - # Don't use the '-Wtraditional-conversion' flag, there's too many warnings - # from GCC's assert macro - # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional-conversion") - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #set (H5_CFLAGS "${H5_CFLAGS} -Wfloat-equal -Wmissing-format-attribute -Wpadded") - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wfloat-equal -Wmissing-format-attribute") - - # Append warning flags from gcc-3.2* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wpacked -Wdisabled-optimization") - if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wmissing-noreturn") + message (STATUS "....HDF5 developer group warnings are enabled") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn") else () - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wno-missing-noreturn") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn") endif () - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - set (H5_CFLAGS1_5 "${H5_CFLAGS1_5} -Wformat=2") - - # Append warning flags from gcc-3.3* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wendif-labels") - - # Append warning flags from gcc-3.4* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch") - - # Append more extra warning flags that only gcc4.0+ know about - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros") - - # Append more extra warning flags that only gcc 4.1+ know about - set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wunsafe-loop-optimizations") - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wc++-compat") - # Append more extra warning flags that only gcc 4.2+ know about - set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wstrict-overflow") - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-strict-overflow") - - # Append more extra warning flags that only gcc 4.3+ know about + # Append warning flags that only gcc 4.3+ knows about # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wlogical-op -Wlarger-than=2048 -Wvla") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla") # Append more extra warning flags that only gcc 4.4+ know about - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") # Append more extra warning flags that only gcc 4.5+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) - set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wjump-misses-init -Wunsuffixed-float-constants") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") endif () # Append more extra warning flags that only gcc 4.6+ know about @@ -164,12 +143,6 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () endif () - # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wunreachable-code") - endif () - # Append more extra warning flags that only gcc 4.7+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance") @@ -191,11 +164,9 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # Append more extra warning flags that only gcc 4.9+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time -Wopenmp-simd") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time") endif () - # (There was no release of gcc 5.0) - # Append more extra warning flags that only gcc 5.1+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat") @@ -213,6 +184,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF) if (HDF5_ENABLE_ALL_WARNINGS) + message (STATUS "....All Warnings are enabled") if (MSVC) if (HDF5_ENABLE_DEV_WARNINGS) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") @@ -231,7 +203,7 @@ if (HDF5_ENABLE_ALL_WARNINGS) endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic ${H5_CFLAGS1} ${H5_CFLAGS2}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2}") endif () endif () endif () @@ -241,6 +213,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group zero warnings" OFF) if (HDF5_ENABLE_GROUPZERO_WARNINGS) + message (STATUS "....Group Zero warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1") @@ -250,7 +223,7 @@ if (HDF5_ENABLE_GROUPZERO_WARNINGS) endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0}") endif () endif () endif () @@ -260,6 +233,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF) if (HDF5_ENABLE_GROUPONE_WARNINGS) + message (STATUS "....Group One warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2") @@ -277,6 +251,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF) if (HDF5_ENABLE_GROUPTWO_WARNINGS) + message (STATUS "....Group Two warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") @@ -294,6 +269,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF) if (HDF5_ENABLE_GROUPTHREE_WARNINGS) + message (STATUS "....Group Three warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") @@ -311,6 +287,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) if (HDF5_ENABLE_GROUPFOUR_WARNINGS) + message (STATUS "....Group Four warnings are enabled") if (NOT MSVC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS4}") endif () diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 708e713..728fd05 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -12,6 +12,7 @@ Section IV: Further considerations Section V: Options for building HDF5 Libraries with CMake command line Section VI: CMake option defaults for HDF5 Section VII: User Defined Options for HDF5 Libraries with CMake +Section VIII: User Defined Compile Flags for HDF5 Libraries with CMake ************************************************************************ @@ -663,6 +664,30 @@ Copy the contents of the file, both macro and option, into the UserMacros.cmake file. Then enable the option to the CMake configuration, build and test process. + +======================================================================== +VIII. User Defined Compile Flags for HDF5 Libraries with CMake +======================================================================== + +Custom compiler flags can be added by defining the CMAKE_C_FLAGS and +CMAKE_CXX_FLAGS variables. +Using a cmake script: + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") +Defined on the configure line: + cmake -G "Visual Studio 12 2013" -DCMAKE_C_FLAGS:STRING=-O2 .. + +Debug symbols are enabled with configuration selections Debug or RelWithDebInfo. +The difference between Debug and RelWithDebInfo configurations is that +RelWithDebInfo optimizes the code similar to Release. It produces fully optimized +code, but also creates the symbol table and the debug metadata to give the +debugger input to map the execution back to the original code. +RelwithDebInfo configuration should not affect the performance when the code +is run without a debugger attached. + +The HDF5_ENABLE_COVERAGE option will add "-g -O0 -fprofile-arcs -ftest-coverage" +to CMAKE_C_FLAGS. + + ======================================================================== For further assistance, send email to help@hdfgroup.org ======================================================================== diff --git a/release_docs/INSTALL_Warnings.txt b/release_docs/INSTALL_Warnings.txt new file mode 100644 index 0000000..5fde45f --- /dev/null +++ b/release_docs/INSTALL_Warnings.txt @@ -0,0 +1,474 @@ +*********************************************************************** +* COMPILER WARNINGS OPTIONS +*********************************************************************** + + Table of Contents + +Section I: Managing Warnings +Section II: Default Warnings +Section III: All Warnings +Section IV: Group 0 Warnings +Section V: Group 1 Warnings +Section VI: Group 2 Warnings +Section VII: Group 3 Warnings +Section VIII: Group 4 Warnings +Section IX: Disable Warnings + +************************************************************************ + + +======================================================================== +I. Managing Warnings +======================================================================== +Compiler warnings are managed by setting the compiler flags variables. + +Autotools uses the H5_CFLAGS and H5_CXXFLAGS, both variables set the flags nearly + identical, along with H5_FCFLAGS for Fortran. Autotools uses the type + and version of the compiler to determine which warning flags are used. + However, there is an option, enable-developer-warnings, to enable extra + flags for developers. + +CMake uses the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS, both sets are nearly + identical, along with CMAKE_Fortran_FLAGS for Fortran. CMake has a + minimum set of flags for GNU type compilers and for MSVC compilers. In + addition, CMake breaks the list of flags into groups. The groups for + GNU are roughly associated with the version of the compiler, while + the MSVC groups are associated with the warning levels for the + Microsoft compilers. The CMake option for enabling extra developer + warnings is HDF5_ENABLE_DEV_WARNINGS. + +Custom settings can be used by setting; + Environment variables H5_CFLAGS and H5_CXXFLAGS for Autotools + CMake defines CMAKE_C_FLAGS and CMAKE_CXX_FLAGS for CMake + + +======================================================================== +II. Default Warnings +======================================================================== + +-------------------------------------------------- +Autotools UNIX warnings added to H5_CFLAGS +-------------------------------------------------- + -std=c99 + + the following warning switches should not raise warnings by the current code + -pedantic + -Wall + -Wextra + -Wbad-function-cast + -Wc++-compat + -Wcast-align + -Wcast-qual + -Wconversion + -Wdeclaration-after-statement + -Wdisabled-optimization + -Wfloat-equal + -Wformat=2 + -Winit-self + -Winvalid-pch + -Wmissing-declarations + -Wmissing-include-dirs + -Wmissing-prototypes + -Wnested-externs + -Wold-style-definition + -Wpacked + -Wpointer-arith + -Wredundant-decls + -Wshadow + -Wstrict-prototypes + -Wswitch-default + -Wswitch-enum + -Wundef + -Wunused-macros + -Wunsafe-loop-optimizations + -Wwrite-strings + + enable-developer-warnings=ON + -Winline + -Waggregate-return + -Wmissing-format-attribute + -Wmissing-noreturn + enable-developer-warnings=OFF + -Wno-inline + -Wno-aggregate-return + -Wno-missing-format-attribute + -Wno-missing-noreturn + +IF GCC <= 4.3 + -Wno-long-long + -Wvolatile-register-var + -Wstrict-overflow + +IF GCC <= 4.4 + -Wno-long-long + -Wvolatile-register-var + -Wstrict-overflow + -Wlogical-op + -Wvla + +IF GCC <= 4.5 + -Wno-long-long + -Wvolatile-register-var + -Wstrict-overflow + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + +IF GCC <= 4.6 + -Wno-long-long + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-aliasing + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + +IF GCC <= 4.7 + -Wno-long-long + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-aliasing + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + enable-developer-warnings=ON: + -Wsuggest-attribute=const + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + +IF GCC <= 4.8 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + +IF GCC <= 4.9 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + +IF GCC < 5 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + -Wdate-time + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + +IF GCC < 6 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + -Wdate-time + -Warray-bounds=2 + -Wc99-c11-compat + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + +IF GCC < 7 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + -Wdate-time + -Warray-bounds=2 + -Wc99-c11-compat + -Wnull-dereference + -Wunused-const-variable + -Wduplicated-cond -Whsa + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + + +-------------------------------------------- +CMake warnings added to CMAKE_C_FLAGS +-------------------------------------------- + +IF GNU GCC + -pedantic + -Wall + -Wextra + -Wbad-function-cast + -Wc++-compat + -Wcast-align + -Wcast-qual + -Wconversion + -Wdeclaration-after-statement + -Wdisabled-optimization + -Wfloat-equal + -Wformat=2 + -Winit-self + -Winvalid-pch + -Wmissing-declarations + -Wmissing-include-dirs + -Wmissing-prototypes + -Wnested-externs + -Wold-style-definition + -Wpacked + -Wpointer-arith + -Wredundant-decls + -Wshadow + -Wstrict-prototypes + -Wswitch-default + -Wswitch-enum + -Wundef + -Wunused-macros + -Wunsafe-loop-optimizations + -Wwrite-strings + + -fmessage-length=0 + HDF5_ENABLE_DEV_WARNINGS=ON + -Winline + -Waggregate-return + HDF5_ENABLE_DEV_WARNINGS=OFF + -Wno-unused-parameter + -Wno-inline + -Wno-aggregate-return + + +======================================================================== +III. All Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_DEV_WARNINGS:BOOL=OFF + For Visual Studio: + /W3 + +HDF5_ENABLE_ALL_WARNINGS:BOOL=ON + For Visual Studio: + /Wall + /wd4668 + + For GNU GCC + Group 0 flags + Group 1 flags + Group 2 flags + + +======================================================================== +IV. Group 0 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPZERO_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPZERO_WARNINGS:BOOL=ON + For Visual Studio + /W1 + + For GNU GCC + Default Warnings + + +======================================================================== +V. Group 1 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPONE_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPONE_WARNINGS:BOOL=ON + For Visual Studio + /W2 + + For GNU GCC + IF GCC >= 4.3 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + IF GCC >= 4.4 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + IF GCC >= 4.5 + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + + +======================================================================== +VI. Group 2 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPTWO_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPTWO_WARNINGS:BOOL=ON + For Visual Studio + /W3 + + For GNU GCC + IF GCC >= 4.6 + -Wdouble-promotion + -Wtrampolines + enable-developer-warnings=ON: + -Wsuggest-attribute=const + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + IF GCC >= 4.7 + -Wstack-usage=8192 + -Wvector-operation-performance + enable-developer-warnings=ON: + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + enable-developer-warnings=OFF: + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + IF GCC >= 4.8 + enable-developer-warnings=ON: + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=format + IF GCC >= 4.8 + -Wdate-time + + +======================================================================== +VII. Group 3 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPTHREE_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPTHREE_WARNINGS:BOOL=ON + For Visual Studio + /W4 + + For GNU GCC + IF GCC >= 5.1 + -Warray-bounds=2 + -Wc99-c11-compat + + +======================================================================== +VIII. Group 4 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPFOUR_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPFOUR_WARNINGS:BOOL=ON + For GNU GCC + IF GCC >= 6.0 + -Wnull-dereference + -Wunused-const-variable + -Wduplicated-cond + -Whsa + + +======================================================================== +IX. Disable Warnings in CMake +======================================================================== + +Default: HDF5_DISABLE_COMPILER_WARNINGS:BOOL=OFF + +HDF5_DISABLE_COMPILER_WARNINGS:BOOL=ON + For Visual Studio + HDF5_WARNINGS_BLOCKED:BOOL=ON + /W0 + + For GNU GCC + -w + + +======================================================================== +For further assistance, send email to help@hdfgroup.org +======================================================================== + -- cgit v0.12 From a6100a3445921480a9d65dbfc49e7600e7923bd5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 17 Aug 2018 14:12:11 -0500 Subject: HDFFV-10536 callback crash fixed by using stack structure --- java/src/jni/h5Imp.c | 1 - java/src/jni/h5aImp.c | 22 +++++++++++++++------- java/src/jni/h5dImp.c | 15 +++++++++++---- java/src/jni/h5eImp.c | 18 +++++++++++++----- java/src/jni/h5fImp.c | 7 +++---- java/src/jni/h5gImp.c | 1 - java/src/jni/h5iImp.c | 1 - java/src/jni/h5lImp.c | 29 ++++++++++++++++++----------- java/src/jni/h5oImp.c | 21 ++++++++++++++------- java/src/jni/h5pImp.c | 30 ++++++++++++++++++++---------- java/src/jni/h5plImp.c | 1 - java/src/jni/h5rImp.c | 1 - java/src/jni/h5sImp.c | 1 - java/src/jni/h5tImp.c | 1 - java/src/jni/h5util.c | 1 - release_docs/RELEASE.txt | 10 ++++++++++ 16 files changed, 104 insertions(+), 56 deletions(-) diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c index 2eeb075..1ad6b17 100644 --- a/java/src/jni/h5Imp.c +++ b/java/src/jni/h5Imp.c @@ -36,7 +36,6 @@ extern "C" { #include "h5Imp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index c0dc182..aba2240 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -29,7 +29,11 @@ extern "C" { #include "h5aImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; #ifdef __cplusplus #define CBENVPTR (cbenv) @@ -53,7 +57,8 @@ static herr_t H5AwriteVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjec static herr_t H5AwriteVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf); static herr_t H5AreadVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf); static herr_t H5AreadVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf); -static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data); + +static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data); /* @@ -1138,7 +1143,7 @@ Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist static herr_t H5A_iterate_cb - (hid_t g_id, const char *name, const H5A_info_t *info, void *op_data) { + (hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data) { JNIEnv *cbenv; jint status = -1; jclass cls; @@ -1147,6 +1152,9 @@ H5A_iterate_cb jmethodID constructor; jvalue args[4]; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); @@ -1195,14 +1203,14 @@ Java_hdf_hdf5lib_H5_H5Aiterate hsize_t start_idx = (hsize_t)idx; herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); } /* end if */ else { - status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data); + status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); @@ -1224,9 +1232,9 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name const char *lName; hsize_t start_idx = (hsize_t)idx; herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); @@ -1234,7 +1242,7 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index cea6bb4..f984948 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -30,7 +30,11 @@ extern "C" { #include "h5dImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; #ifdef __cplusplus #ifdef _WINDOWS @@ -1888,7 +1892,7 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent static herr_t H5D_iterate_cb - (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *op_data) { + (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) { JNIEnv *cbenv; jint status; jclass cls; @@ -1896,6 +1900,9 @@ H5D_iterate_cb jbyteArray elemArray; jlongArray pointArray; jsize size; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { JVMPTR->DetachCurrentThread(JVMPAR); @@ -1958,9 +1965,9 @@ Java_hdf_hdf5lib_H5_H5Diterate herr_t status = -1; jboolean isCopy; jbyte *buffP; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Diterate: op_data is NULL"); @@ -1977,7 +1984,7 @@ Java_hdf_hdf5lib_H5_H5Diterate h5JNIFatalError(env, "H5Diterate: buf not pinned"); } /* end if */ else { - status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)op_data); + status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)&wrapper); if (status < 0) { ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT); diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 10a02b0..9c80461 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -40,7 +40,11 @@ extern "C" { #include "h5eImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; #ifdef __cplusplus #define CBENVPTR (cbenv) @@ -60,7 +64,7 @@ extern jobject visit_callback; /* Local Prototypes */ /********************/ -static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *op_data); +static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -475,7 +479,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1num static herr_t H5E_walk_cb - (int nindx, const H5E_error2_t *info, void *op_data) + (int nindx, const H5E_error2_t *info, void *cb_data) { JNIEnv *cbenv; jint status = -1; @@ -485,6 +489,9 @@ H5E_walk_cb jmethodID constructor; jvalue args[7]; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); @@ -532,13 +539,14 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2 (JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data) { + cb_wrapper wrapper = {callback_op, op_data}; + ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Ewalk2: op_data or callback_op is NULL"); } /* end if */ - else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)op_data) < 0) + else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)&wrapper) < 0) h5libraryError(env); } /* end iJava_hdf_hdf5lib_H5_H5Ewalk2f */ diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 8cf5252..9d68290 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -29,7 +29,6 @@ extern "C" { #include "h5util.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 @@ -541,7 +540,7 @@ Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass cls, jlong file_id) { if (H5Fstart_swmr_write((hid_t)file_id) < 0) h5libraryError(env); @@ -554,7 +553,7 @@ Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass cls, jlong file_id) { if (H5Fstart_mdc_logging((hid_t)file_id) < 0) h5libraryError(env); @@ -580,7 +579,7 @@ Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status - (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status) + (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status) { hbool_t is_enabled; hbool_t is_currently_logging; diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c index 41ec382..42c042a 100644 --- a/java/src/jni/h5gImp.c +++ b/java/src/jni/h5gImp.c @@ -30,7 +30,6 @@ extern "C" { #include "h5gImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c index 47574ca..b8bd1cd 100644 --- a/java/src/jni/h5iImp.c +++ b/java/src/jni/h5iImp.c @@ -28,7 +28,6 @@ extern "C" { #include "h5iImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index f1734fd..e1ec3bd 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -28,13 +28,17 @@ extern "C" { #include "h5lImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; /********************/ /* Local Prototypes */ /********************/ -static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data); +static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -541,7 +545,7 @@ Java_hdf_hdf5lib_H5_H5Lmove static herr_t H5L_iterate_cb - (hid_t g_id, const char *name, const H5L_info_t *info, void *op_data) + (hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data) { JNIEnv *cbenv; jint status; @@ -551,6 +555,9 @@ H5L_iterate_cb jmethodID constructor; jvalue args[5]; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); @@ -600,15 +607,15 @@ Java_hdf_hdf5lib_H5_H5Lvisit jobject callback_op, jobject op_data) { herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Lvisit: op_data or callback_op is NULL"); } /* end if */ else { - status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data); + status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); } /* end else */ @@ -628,9 +635,9 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name { herr_t status = -1; const char *lName; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Lvisit_by_name: op_data or callback_op is NULL"); @@ -638,7 +645,7 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); @@ -662,15 +669,15 @@ Java_hdf_hdf5lib_H5_H5Literate { hsize_t start_idx = (hsize_t)idx; herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate: op_data or callback_op is NULL"); } /* end if */ else { - status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data); + status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); @@ -694,7 +701,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name const char *lName; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; + cb_wrapper wrapper = {callback_op, op_data}; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); @@ -702,7 +709,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index 6093e46..1de505a 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -27,13 +27,17 @@ extern "C" { #include "h5oImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; /********************/ /* Local Prototypes */ /********************/ -static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *op_data); +static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -330,7 +334,7 @@ Java_hdf_hdf5lib_H5_H5Olink static herr_t H5O_iterate_cb - (hid_t g_id, const char *name, const H5O_info_t *info, void *op_data) + (hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data) { JNIEnv *cbenv; jint status = -1; @@ -343,6 +347,9 @@ H5O_iterate_cb jobject ihinfobuf1; jobject ihinfobuf2; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { /* printf("JNI H5O_iterate_cb error: AttachCurrentThread failed\n"); */ @@ -448,9 +455,9 @@ Java_hdf_hdf5lib_H5_H5Ovisit jobject callback_op, jobject op_data, jint fields) { herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Ovisit: op_data is NULL"); @@ -459,7 +466,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit h5nullArgument(env, "H5Ovisit: callback_op is NULL"); } /* end if */ else { - status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields); + status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields); if (status < 0) h5libraryError(env); @@ -480,9 +487,9 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name { herr_t status = -1; const char *lName; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL"); @@ -495,7 +502,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields, (hid_t)access_id); + status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index 3ff7436..e6d1be8 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5pImp.h" extern JavaVM *jvm; -extern jobject visit_callback; extern jobject copy_callback; extern jobject close_callback; extern jobject create_callback; @@ -36,6 +35,11 @@ extern jobject get_callback; extern jobject set_callback; extern jobject delete_callback; +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; + /********************/ /* Local Prototypes */ /********************/ @@ -52,7 +56,7 @@ static herr_t H5P_prp_get_func_cb(hid_t prop_id, const char *name, size_t size, static herr_t H5P_prp_set_func_cb(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P_prp_delete_func_cb(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *op_data); +static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -5042,7 +5046,7 @@ H5P_cls_copy_cb } /* end if */ JVMPTR->DetachCurrentThread(JVMPAR); return (herr_t)status; -} /* end H5P_cls_ccopy_cb */ +} /* end H5P_cls_copy_cb */ static herr_t H5P_cls_close_cb @@ -5158,13 +5162,16 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options static herr_t H5D_append_cb - (hid_t dataset_id, hsize_t *cur_dims, void *op_data) + (hid_t dataset_id, hsize_t *cur_dims, void *cb_data) { JNIEnv *cbenv; jint status = -1; jclass cls; jmethodID mid; jlongArray cur_dimsArray; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { JVMPTR->DetachCurrentThread(JVMPAR); @@ -5199,9 +5206,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush (JNIEnv *env, jclass clss, jlong plist_id, jint ndims, jlongArray boundary, jobject callback_op, jobject op_data) { herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Pset_append_flush: op_data is NULL"); @@ -5210,7 +5217,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush h5nullArgument(env, "H5Pset_append_flush: callback_op is NULL"); } /* end if */ else { - status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)op_data); + status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); @@ -5603,13 +5610,16 @@ Java_hdf_hdf5lib_H5_H5Pinsert2 static herr_t H5P_iterate_cb - (hid_t prop_id, const char *name, void *op_data) + (hid_t prop_id, const char *name, void *cb_data) { JNIEnv *cbenv; jint status = -1; jclass cls; jmethodID mid; jstring str; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; /* fprintf(stderr, "\nJNI H5P_iterate_cb entered\n"); fflush(stderr); */ if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { @@ -5656,9 +5666,9 @@ Java_hdf_hdf5lib_H5_H5Piterate herr_t status = -1; jint *theArray = NULL; jboolean isCopy; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Piterate: op_data is NULL"); @@ -5668,7 +5678,7 @@ Java_hdf_hdf5lib_H5_H5Piterate } /* end else if */ else { if (idx == NULL) { - status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)op_data); + status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper); } /* end if */ else { theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR idx, &isCopy); @@ -5676,7 +5686,7 @@ Java_hdf_hdf5lib_H5_H5Piterate h5JNIFatalError(env, "H5Piterate: idx not pinned"); } /* end if */ else - status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)op_data); + status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper); } /* end else */ if (status < 0) { diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c index ffd5b7a..d551120 100644 --- a/java/src/jni/h5plImp.c +++ b/java/src/jni/h5plImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5plImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index b250550..5f2b86d 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5rImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index 10f69eb..a4b4848 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5sImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 7b4af56..307f1a5 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -30,7 +30,6 @@ extern "C" { #include "h5tImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 33dca7f..42f8a5c 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -33,7 +33,6 @@ hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */ int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */ JavaVM *jvm; -jobject visit_callback; jobject copy_callback; jobject close_callback; jobject create_callback; diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 1e18dfe..3d42284 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -136,6 +136,16 @@ New Features Java Library: ---------------- + - Java iterator callbacks + + Change global callback object to a small stack structure in order + to fix a runtime crash. This crash was discovered when iterating + through a file with nested group members. The global variable + visit_callback is overwritten when recursion starts. When recursion + completes, visit_callback will be pointing to the wrong callback method. + + (ADB - 2018/08/15, HDFFV-10536) + - Java HDFLibraryException class Change parent class from Exception to RuntimeException. -- cgit v0.12 From ae7da889ece8ea6cfe3207f146ee991951b5ce66 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 17 Aug 2018 14:48:43 -0500 Subject: HDFFV-10552 Add missing HDF5_USE_110[2]_API_DEFAULT option --- CMakeLists.txt | 20 ++++++++++++++++++++ config/cmake/H5pubconf.h.in | 3 +++ configure.ac | 13 ++++++++++--- release_docs/INSTALL_CMake.txt | 2 ++ release_docs/RELEASE.txt | 10 ++++++++++ 5 files changed, 45 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cdb31c..b76f332 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -620,6 +620,26 @@ if (HDF5_USE_18_API_DEFAULT) endif () #----------------------------------------------------------------------------- +# Option to use 1.10.x API +#----------------------------------------------------------------------------- +option (HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" OFF) +set (H5_USE_110_API_DEFAULT 0) +if (HDF5_USE_110_API_DEFAULT) + set (H5_USE_110_API_DEFAULT 1) + set (DEFAULT_API_VERSION "v110") +endif () + +#----------------------------------------------------------------------------- +# Option to use 1.12.x API +#----------------------------------------------------------------------------- +option (HDF5_USE_112_API_DEFAULT "Use the HDF5 1.12.x API by default" ON) +set (H5_USE_112_API_DEFAULT 0) +if (HDF5_USE_112_API_DEFAULT) + set (H5_USE_112_API_DEFAULT 1) + set (DEFAULT_API_VERSION "v112") +endif () + +#----------------------------------------------------------------------------- # Include user macros #----------------------------------------------------------------------------- include (UserMacros.cmake) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index ccfe581..1d73bba 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -669,6 +669,9 @@ /* Define using v1.8 public API symbols by default */ #cmakedefine H5_USE_18_API_DEFAULT @H5_USE_18_API_DEFAULT@ +/* Define using v1.10 public API symbols by default */ +#cmakedefine H5_USE_110_API_DEFAULT @H5_USE_110_API_DEFAULT@ + /* Define if a memory checking tool will be used on the library, to cause library to be very picky about memory operations and also disable the internal free list manager code. */ diff --git a/configure.ac b/configure.ac index ff0f284..fc82636 100644 --- a/configure.ac +++ b/configure.ac @@ -3191,10 +3191,10 @@ esac AC_SUBST([DEFAULT_API_VERSION]) AC_MSG_CHECKING([which version of public symbols to use by default]) AC_ARG_WITH([default-api-version], - [AS_HELP_STRING([--with-default-api-version=(v16|v18|v110)], + [AS_HELP_STRING([--with-default-api-version=(v16|v18|v110|v112)], [Specify default release version of public symbols - [default=v110]])],, - [withval=v110]) + [default=v112]])],, + [withval=v112]) if test "X$withval" = "Xv16"; then AC_MSG_RESULT([v16]) @@ -3209,6 +3209,13 @@ elif test "X$withval" = "Xv18"; then elif test "X$withval" = "Xv110"; then AC_MSG_RESULT([v110]) DEFAULT_API_VERSION=v110 + AC_DEFINE([USE_110_API_DEFAULT], [1], + [Define using v1.10 public API symbols by default]) +elif test "X$withval" = "Xv112"; then + AC_MSG_RESULT([v112]) + DEFAULT_API_VERSION=v112 + AC_DEFINE([USE_112_API_DEFAULT], [1], + [Define using v1.12 public API symbols by default]) else AC_MSG_ERROR([invalid version of public symbols given]) fi diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 728fd05..ba77ac4 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -619,6 +619,8 @@ HDF_TEST_EXPRESS "Control testing framework (0-3)" HDF5_TEST_VFD "Execute tests with different VFDs" OFF HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF +HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" OFF +HDF5_USE_112_API_DEFAULT "Use the HDF5 1.12.x API by default" ON HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 3d42284..49ad436 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,16 @@ New Features Configuration: ------------- + - Add missing USE_110_API_DEFAULT option. + + Option USE_110_API_DEFAULT sets the default version of + versioned APIs. The bin/makevers perl script did not set + the maxidx variable correctly when the 1.10 branch was + created. This caused the versioning process to always use + the latest version of any API. + + (ADB - 2018/08/17, HDFFV-10552) + - Added configuration checks for the following MPI functions: MPI_Mprobe - Used for the Parallel Compression feature -- cgit v0.12 From caa4324217914227ad5a9ea83215a0508226d725 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 20 Aug 2018 08:19:02 -0500 Subject: HDFFV-10553 Update html tags --- java/src/hdf/overview.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html index 9c19442..a66e7b0 100644 --- a/java/src/hdf/overview.html +++ b/java/src/hdf/overview.html @@ -6,18 +6,19 @@ The Java HD5 Interface (JHI5) is a Java package (hdf.hdf5lib) that ``wraps around'' the HDF5 library. -

There are a large number of functions in the HDF5 +

There are a large number of functions in the HDF5 library (version 1.10). Some of the functions are not supported in JHI5. Most of the unsupported functions have C function pointers, which is not currently -implemented in JHI5. +implemented in JHI5.

-
+
+ -
Java HD5 Interface (JHI5)
-
Note: The JHI5 does not support HDF4 or earlier.
+
To Obtain -The JHI5 is included with the HDF5 library. +The JHI5 is included with the HDF5 library. -- cgit v0.12 From b33fdb17c35e1ba1e267a7a67426304da5166fc6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 20 Aug 2018 11:25:09 -0500 Subject: HDFFV-10547 requires updated examples version --- config/cmake/scripts/HDF5options.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 82ab04a..c5f08ed 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -63,6 +63,9 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") +#### package examples #### +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.10.9-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") + ############################################################################################# ### disable test program builds -- cgit v0.12 From c78f43b25eafc4f1b12f58f19397a236a2c246c5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 20 Aug 2018 12:01:49 -0500 Subject: Fix quote --- java/src/hdf/overview.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html index a66e7b0..52dabf7 100644 --- a/java/src/hdf/overview.html +++ b/java/src/hdf/overview.html @@ -14,7 +14,7 @@ implemented in JHI5.

- -- cgit v0.12 From 732aae11c53fb63cdab58735604babbfd4d5db44 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 20 Aug 2018 15:07:19 -0500 Subject: HDFFV-10547 develop needs 1.12 default option --- config/cmake/H5pubconf.h.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 1d73bba..2ddb740 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -672,6 +672,9 @@ /* Define using v1.10 public API symbols by default */ #cmakedefine H5_USE_110_API_DEFAULT @H5_USE_110_API_DEFAULT@ +/* Define using v1.12 public API symbols by default */ +#cmakedefine H5_USE_112_API_DEFAULT @H5_USE_112_API_DEFAULT@ + /* Define if a memory checking tool will be used on the library, to cause library to be very picky about memory operations and also disable the internal free list manager code. */ -- cgit v0.12 From f356d587a286f6407c9693c34201c89ea3adbbe1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 20 Aug 2018 18:26:57 -0500 Subject: Update fortran windows 10 version --- release_docs/RELEASE.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 49ad436..579308c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -479,9 +479,9 @@ Supported Platforms Visual Studio 2015 w/ Intel C, Fortran 2017 (cmake) Visual Studio 2015 w/ MSMPI 8 (cmake) - Windows 10 Visual Studio 2015 w/ Intel Fortran 16 (cmake) + Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake) - Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 16 (cmake) + Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake) Visual Studio 2017 w/ Intel Fortran 18 (cmake) Mac OS X Yosemite 10.10.5 Apple clang/clang++ version 6.1 from Xcode 7.0 -- cgit v0.12 From 085ec19a21b5e6bde5dc300e725bca9a82e8c445 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 21 Aug 2018 10:03:26 -0500 Subject: Fix OSX SIP for libs --- java/src/hdf/overview.html | 2 +- java/test/junit.sh.in | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html index 52dabf7..edb1b76 100644 --- a/java/src/hdf/overview.html +++ b/java/src/hdf/overview.html @@ -12,7 +12,7 @@ of the unsupported functions have C function pointers, which is not currently implemented in JHI5.

Java HD5 Interface (JHI5)
Note: The JHI5 does not support HDF4 or earlier.
- +
Java HD5 Interface (JHI5)Java HDF5 Interface (JHI5)
Note: The JHI5 does not support HDF4 or earlier. diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 5d69bee..64d9f21 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -41,6 +41,7 @@ myos=`uname -s` # where the libs exist HDFLIB_HOME="$top_srcdir/java/lib" BLDLIBDIR="$top_builddir/hdf5/lib" +BLDINSDIR="$top_builddir/../hdf5/lib" BLDDIR="." HDFTEST_HOME="$top_srcdir/java/test" JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar @@ -125,9 +126,9 @@ COPY_LIBFILES_TO_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDINSDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $BLDLIBDIR + $CP -f $tstfile $BLDINSDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." @@ -281,13 +282,8 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) - LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + LD_LIBRARY_PATH=$BLDLIBDIR:$BLDINSDIR:$LD_LIBRARY_PATH ;; esac -- cgit v0.12 From fbd17f62ea505face5fb650d78a47135e288f0b6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 21 Aug 2018 10:22:15 -0500 Subject: Add installib path to test command --- java/test/junit.sh.in | 144 +++++++++++++++++++++++++------------------------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 64d9f21..dcf62ec 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -289,9 +289,9 @@ esac export LD_LIBRARY_PATH -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5" TESTING JUnit-TestH5 -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5 > JUnit-TestH5.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5 > JUnit-TestH5.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -310,9 +310,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5.txt JUnit-TestH5.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams" TESTING JUnit-TestH5Eparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams > JUnit-TestH5Eparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams > JUnit-TestH5Eparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -331,9 +331,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Eparams.txt JUnit-TestH5Eparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eregister" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eregister" TESTING JUnit-TestH5Eregister -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eregister > JUnit-TestH5Eregister.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eregister > JUnit-TestH5Eregister.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -352,9 +352,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Eregister.txt JUnit-TestH5Eregister.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fparams" TESTING JUnit-TestH5Fparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fparams > JUnit-TestH5Fparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fparams > JUnit-TestH5Fparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -373,9 +373,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Fparams.txt JUnit-TestH5Fparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fbasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fbasic" TESTING JUnit-TestH5Fbasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fbasic > JUnit-TestH5Fbasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fbasic > JUnit-TestH5Fbasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -394,9 +394,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Fbasic.txt JUnit-TestH5Fbasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5F" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5F" TESTING JUnit-TestH5F -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5F > JUnit-TestH5F.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5F > JUnit-TestH5F.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -415,9 +415,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5F.txt JUnit-TestH5F.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fswmr" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fswmr" TESTING JUnit-TestH5Fswmr -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fswmr > JUnit-TestH5Fswmr.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fswmr > JUnit-TestH5Fswmr.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -436,9 +436,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Fswmr.txt JUnit-TestH5Fswmr.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Gbasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Gbasic" TESTING JUnit-TestH5Gbasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Gbasic > JUnit-TestH5Gbasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Gbasic > JUnit-TestH5Gbasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -457,9 +457,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Gbasic.txt JUnit-TestH5Gbasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5G" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5G" TESTING JUnit-TestH5G -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5G > JUnit-TestH5G.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5G > JUnit-TestH5G.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -478,9 +478,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5G.txt JUnit-TestH5G.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Sbasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Sbasic" TESTING JUnit-TestH5Sbasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Sbasic > JUnit-TestH5Sbasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Sbasic > JUnit-TestH5Sbasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -499,9 +499,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Sbasic.txt JUnit-TestH5Sbasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5S" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5S" TESTING JUnit-TestH5S -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5S > JUnit-TestH5S.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5S > JUnit-TestH5S.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -520,9 +520,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5S.txt JUnit-TestH5S.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tparams" TESTING JUnit-TestH5Tparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tparams > JUnit-TestH5Tparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tparams > JUnit-TestH5Tparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -541,9 +541,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Tparams.txt JUnit-TestH5Tparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tbasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tbasic" TESTING JUnit-TestH5Tbasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tbasic > JUnit-TestH5Tbasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tbasic > JUnit-TestH5Tbasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -562,9 +562,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Tbasic.txt JUnit-TestH5Tbasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5T" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5T" TESTING JUnit-TestH5T -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5T > JUnit-TestH5T.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5T > JUnit-TestH5T.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -583,9 +583,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5T.txt JUnit-TestH5T.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dparams" TESTING JUnit-TestH5Dparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dparams > JUnit-TestH5Dparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dparams > JUnit-TestH5Dparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -604,9 +604,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Dparams.txt JUnit-TestH5Dparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5D" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5D" TESTING JUnit-TestH5D -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5D > JUnit-TestH5D.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5D > JUnit-TestH5D.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -625,9 +625,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5D.txt JUnit-TestH5D.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist" TESTING JUnit-TestH5Dplist -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist > JUnit-TestH5Dplist.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist > JUnit-TestH5Dplist.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -646,9 +646,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Dplist.txt JUnit-TestH5Dplist.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lparams" TESTING JUnit-TestH5Lparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lparams > JUnit-TestH5Lparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lparams > JUnit-TestH5Lparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -667,9 +667,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Lparams.txt JUnit-TestH5Lparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lbasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lbasic" TESTING JUnit-TestH5Lbasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lbasic > JUnit-TestH5Lbasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lbasic > JUnit-TestH5Lbasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -688,9 +688,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Lbasic.txt JUnit-TestH5Lbasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lcreate" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lcreate" TESTING JUnit-TestH5Lcreate -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lcreate > JUnit-TestH5Lcreate.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lcreate > JUnit-TestH5Lcreate.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -709,9 +709,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Lcreate.txt JUnit-TestH5Lcreate.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5R" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5R" TESTING JUnit-TestH5R -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5R > JUnit-TestH5R.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5R > JUnit-TestH5R.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -730,9 +730,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5R.txt JUnit-TestH5R.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P" TESTING JUnit-TestH5P -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P > JUnit-TestH5P.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P > JUnit-TestH5P.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -751,9 +751,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5P.txt JUnit-TestH5P.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PData" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PData" TESTING JUnit-TestH5PData -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PData > JUnit-TestH5PData.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PData > JUnit-TestH5PData.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -772,9 +772,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5PData.txt JUnit-TestH5PData.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapl" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapl" TESTING JUnit-TestH5Pfapl -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapl > JUnit-TestH5Pfapl.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapl > JUnit-TestH5Pfapl.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -793,9 +793,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Pfapl.txt JUnit-TestH5Pfapl.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pvirtual" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pvirtual" TESTING JUnit-TestH5Pvirtual -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pvirtual > JUnit-TestH5Pvirtual.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pvirtual > JUnit-TestH5Pvirtual.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -814,9 +814,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Pvirtual.txt JUnit-TestH5Pvirtual.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Plist" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Plist" TESTING JUnit-TestH5Plist -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Plist > JUnit-TestH5Plist.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Plist > JUnit-TestH5Plist.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -835,9 +835,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Plist.txt JUnit-TestH5Plist.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5A" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5A" TESTING JUnit-TestH5A -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5A > JUnit-TestH5A.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5A > JUnit-TestH5A.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -856,9 +856,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5A.txt JUnit-TestH5A.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams" TESTING JUnit-TestH5Oparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams > JUnit-TestH5Oparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams > JUnit-TestH5Oparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -877,9 +877,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Oparams.txt JUnit-TestH5Oparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Obasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Obasic" TESTING JUnit-TestH5Obasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Obasic > JUnit-TestH5Obasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Obasic > JUnit-TestH5Obasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -898,9 +898,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Obasic.txt JUnit-TestH5Obasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocreate" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocreate" TESTING JUnit-TestH5Ocreate -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocreate > JUnit-TestH5Ocreate.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocreate > JUnit-TestH5Ocreate.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -919,9 +919,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Ocreate.txt JUnit-TestH5Ocreate.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy" TESTING JUnit-TestH5Ocopy -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy > JUnit-TestH5Ocopy.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy > JUnit-TestH5Ocopy.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -940,9 +940,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Ocopy.txt JUnit-TestH5Ocopy.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PL" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PL" TESTING JUnit-TestH5PL -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PL > JUnit-TestH5PL.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PL > JUnit-TestH5PL.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -961,9 +961,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5PL.txt JUnit-TestH5PL.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z" TESTING JUnit-TestH5Z -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z > JUnit-TestH5Z.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z > JUnit-TestH5Z.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -984,9 +984,9 @@ fi if test "X-$BUILD_MODE" = "X-production" ; then if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" TESTING JUnit-TestH5E - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) + ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -1007,9 +1007,9 @@ if test "X-$BUILD_MODE" = "X-production" ; then fi if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" TESTING JUnit-TestH5Edefault - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) + ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -1030,9 +1030,9 @@ if test "X-$BUILD_MODE" = "X-production" ; then fi fi if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate" + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate" TESTING JUnit-TestH5Giterate - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate > JUnit-TestH5Giterate.ext) + ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate > JUnit-TestH5Giterate.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -- cgit v0.12 From 9d1dae5daf69d1e67967d89aa894c70460790577 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 22 Aug 2018 12:13:53 -0500 Subject: Fix for packaging prefix in examples --- config/cmake/HDF5_Examples.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index eb57685..2853878 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -48,7 +48,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${ ################################################################## if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") + set(INSTALLDIR "C:/Program Files/@CPACK_PACKAGE_VENDOR@/@CPACK_PACKAGE_NAME@/@CPACK_PACKAGE_VERSION@") endif() if(NOT DEFINED CTEST_SOURCE_NAME) -- cgit v0.12 From 0483f47192df44235154954256fa0b927fb7c94f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 22 Aug 2018 14:10:38 -0500 Subject: Use project vars --- config/cmake/HDF5_Examples.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 2853878..bbe632c 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -48,7 +48,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${ ################################################################## if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "C:/Program Files/@CPACK_PACKAGE_VENDOR@/@CPACK_PACKAGE_NAME@/@CPACK_PACKAGE_VERSION@") + set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") endif() if(NOT DEFINED CTEST_SOURCE_NAME) -- cgit v0.12 From d20fd310e42b73e9037fb1a3bcc5e55d5e5c5162 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 23 Aug 2018 07:37:00 -0500 Subject: Change prefix in example scripts to relative path to bin. This was done for 1.8, and works wherever installed without the need to replace the original prefix. --- c++/examples/run-c++-ex.sh.in | 2 +- examples/run-c-ex.sh.in | 2 +- fortran/examples/run-fortran-ex.sh.in | 2 +- hl/c++/examples/run-hlc++-ex.sh.in | 2 +- hl/examples/run-hlc-ex.sh.in | 2 +- hl/fortran/examples/run-hlfortran-ex.sh.in | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/c++/examples/run-c++-ex.sh.in b/c++/examples/run-c++-ex.sh.in index f0d3e93..d975924 100644 --- a/c++/examples/run-c++-ex.sh.in +++ b/c++/examples/run-c++-ex.sh.in @@ -32,7 +32,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../..}" AR="@AR@" RANLIB="@RANLIB@" H5TOOL="h5c++" # The tool name diff --git a/examples/run-c-ex.sh.in b/examples/run-c-ex.sh.in index 4d5d594..209cdd7 100644 --- a/examples/run-c-ex.sh.in +++ b/examples/run-c-ex.sh.in @@ -31,7 +31,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../..}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/fortran/examples/run-fortran-ex.sh.in b/fortran/examples/run-fortran-ex.sh.in index cace1ae..da0c357 100644 --- a/fortran/examples/run-fortran-ex.sh.in +++ b/fortran/examples/run-fortran-ex.sh.in @@ -32,7 +32,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../..}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/c++/examples/run-hlc++-ex.sh.in b/hl/c++/examples/run-hlc++-ex.sh.in index 9539724..eb688a1 100644 --- a/hl/c++/examples/run-hlc++-ex.sh.in +++ b/hl/c++/examples/run-hlc++-ex.sh.in @@ -31,7 +31,7 @@ EXIT_SUCCESS=0 EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../../..}" AR="@AR@" RANLIB="@RANLIB@" H5TOOL="h5c++" # The tool name diff --git a/hl/examples/run-hlc-ex.sh.in b/hl/examples/run-hlc-ex.sh.in index b12955f..f51b165 100644 --- a/hl/examples/run-hlc-ex.sh.in +++ b/hl/examples/run-hlc-ex.sh.in @@ -31,7 +31,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../../..}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/fortran/examples/run-hlfortran-ex.sh.in b/hl/fortran/examples/run-hlfortran-ex.sh.in index c8f41f8..5f12ef0 100644 --- a/hl/fortran/examples/run-hlfortran-ex.sh.in +++ b/hl/fortran/examples/run-hlfortran-ex.sh.in @@ -32,7 +32,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-@prefix@}" +prefix="${prefix:-../../../..}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" -- cgit v0.12 From 2417775bb30df026868a547300b54635036f768c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 23 Aug 2018 08:58:35 -0500 Subject: DT location incorrect --- java/test/junit.sh.in | 149 +++++++++++++++++++++++++------------------------- 1 file changed, 74 insertions(+), 75 deletions(-) diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index dcf62ec..8587ca9 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -41,7 +41,6 @@ myos=`uname -s` # where the libs exist HDFLIB_HOME="$top_srcdir/java/lib" BLDLIBDIR="$top_builddir/hdf5/lib" -BLDINSDIR="$top_builddir/../hdf5/lib" BLDDIR="." HDFTEST_HOME="$top_srcdir/java/test" JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar @@ -126,9 +125,9 @@ COPY_LIBFILES_TO_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDINSDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $BLDINSDIR + $CP -f $tstfile $BLDLIBDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." @@ -289,9 +288,9 @@ esac export LD_LIBRARY_PATH -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5" TESTING JUnit-TestH5 -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5 > JUnit-TestH5.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5 > JUnit-TestH5.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -310,9 +309,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5.txt JUnit-TestH5.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams" TESTING JUnit-TestH5Eparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams > JUnit-TestH5Eparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams > JUnit-TestH5Eparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -331,9 +330,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Eparams.txt JUnit-TestH5Eparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eregister" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eregister" TESTING JUnit-TestH5Eregister -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eregister > JUnit-TestH5Eregister.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eregister > JUnit-TestH5Eregister.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -352,9 +351,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Eregister.txt JUnit-TestH5Eregister.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fparams" TESTING JUnit-TestH5Fparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fparams > JUnit-TestH5Fparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fparams > JUnit-TestH5Fparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -373,9 +372,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Fparams.txt JUnit-TestH5Fparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fbasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fbasic" TESTING JUnit-TestH5Fbasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fbasic > JUnit-TestH5Fbasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fbasic > JUnit-TestH5Fbasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -394,9 +393,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Fbasic.txt JUnit-TestH5Fbasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5F" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5F" TESTING JUnit-TestH5F -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5F > JUnit-TestH5F.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5F > JUnit-TestH5F.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -415,9 +414,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5F.txt JUnit-TestH5F.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fswmr" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fswmr" TESTING JUnit-TestH5Fswmr -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fswmr > JUnit-TestH5Fswmr.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fswmr > JUnit-TestH5Fswmr.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -436,9 +435,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Fswmr.txt JUnit-TestH5Fswmr.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Gbasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Gbasic" TESTING JUnit-TestH5Gbasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Gbasic > JUnit-TestH5Gbasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Gbasic > JUnit-TestH5Gbasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -457,9 +456,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Gbasic.txt JUnit-TestH5Gbasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5G" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5G" TESTING JUnit-TestH5G -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5G > JUnit-TestH5G.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5G > JUnit-TestH5G.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -478,9 +477,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5G.txt JUnit-TestH5G.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Sbasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Sbasic" TESTING JUnit-TestH5Sbasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Sbasic > JUnit-TestH5Sbasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Sbasic > JUnit-TestH5Sbasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -499,9 +498,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Sbasic.txt JUnit-TestH5Sbasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5S" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5S" TESTING JUnit-TestH5S -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5S > JUnit-TestH5S.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5S > JUnit-TestH5S.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -520,9 +519,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5S.txt JUnit-TestH5S.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tparams" TESTING JUnit-TestH5Tparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tparams > JUnit-TestH5Tparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tparams > JUnit-TestH5Tparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -541,9 +540,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Tparams.txt JUnit-TestH5Tparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tbasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tbasic" TESTING JUnit-TestH5Tbasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tbasic > JUnit-TestH5Tbasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tbasic > JUnit-TestH5Tbasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -562,9 +561,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Tbasic.txt JUnit-TestH5Tbasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5T" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5T" TESTING JUnit-TestH5T -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5T > JUnit-TestH5T.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5T > JUnit-TestH5T.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -583,9 +582,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5T.txt JUnit-TestH5T.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dparams" TESTING JUnit-TestH5Dparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dparams > JUnit-TestH5Dparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dparams > JUnit-TestH5Dparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -604,9 +603,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Dparams.txt JUnit-TestH5Dparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5D" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5D" TESTING JUnit-TestH5D -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5D > JUnit-TestH5D.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5D > JUnit-TestH5D.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -625,9 +624,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5D.txt JUnit-TestH5D.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist" TESTING JUnit-TestH5Dplist -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist > JUnit-TestH5Dplist.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist > JUnit-TestH5Dplist.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -646,9 +645,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Dplist.txt JUnit-TestH5Dplist.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lparams" TESTING JUnit-TestH5Lparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lparams > JUnit-TestH5Lparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lparams > JUnit-TestH5Lparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -667,9 +666,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Lparams.txt JUnit-TestH5Lparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lbasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lbasic" TESTING JUnit-TestH5Lbasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lbasic > JUnit-TestH5Lbasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lbasic > JUnit-TestH5Lbasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -688,9 +687,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Lbasic.txt JUnit-TestH5Lbasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lcreate" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lcreate" TESTING JUnit-TestH5Lcreate -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lcreate > JUnit-TestH5Lcreate.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lcreate > JUnit-TestH5Lcreate.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -709,9 +708,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Lcreate.txt JUnit-TestH5Lcreate.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5R" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5R" TESTING JUnit-TestH5R -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5R > JUnit-TestH5R.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5R > JUnit-TestH5R.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -730,9 +729,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5R.txt JUnit-TestH5R.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P" TESTING JUnit-TestH5P -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P > JUnit-TestH5P.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P > JUnit-TestH5P.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -751,9 +750,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5P.txt JUnit-TestH5P.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PData" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PData" TESTING JUnit-TestH5PData -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PData > JUnit-TestH5PData.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PData > JUnit-TestH5PData.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -772,9 +771,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5PData.txt JUnit-TestH5PData.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapl" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapl" TESTING JUnit-TestH5Pfapl -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapl > JUnit-TestH5Pfapl.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapl > JUnit-TestH5Pfapl.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -793,9 +792,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Pfapl.txt JUnit-TestH5Pfapl.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pvirtual" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pvirtual" TESTING JUnit-TestH5Pvirtual -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pvirtual > JUnit-TestH5Pvirtual.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pvirtual > JUnit-TestH5Pvirtual.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -814,9 +813,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Pvirtual.txt JUnit-TestH5Pvirtual.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Plist" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Plist" TESTING JUnit-TestH5Plist -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Plist > JUnit-TestH5Plist.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Plist > JUnit-TestH5Plist.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -835,9 +834,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Plist.txt JUnit-TestH5Plist.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5A" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5A" TESTING JUnit-TestH5A -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5A > JUnit-TestH5A.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5A > JUnit-TestH5A.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -856,9 +855,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5A.txt JUnit-TestH5A.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams" TESTING JUnit-TestH5Oparams -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams > JUnit-TestH5Oparams.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams > JUnit-TestH5Oparams.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -877,9 +876,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Oparams.txt JUnit-TestH5Oparams.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Obasic" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Obasic" TESTING JUnit-TestH5Obasic -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Obasic > JUnit-TestH5Obasic.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Obasic > JUnit-TestH5Obasic.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -898,9 +897,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Obasic.txt JUnit-TestH5Obasic.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocreate" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocreate" TESTING JUnit-TestH5Ocreate -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocreate > JUnit-TestH5Ocreate.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocreate > JUnit-TestH5Ocreate.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -919,9 +918,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Ocreate.txt JUnit-TestH5Ocreate.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy" TESTING JUnit-TestH5Ocopy -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy > JUnit-TestH5Ocopy.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy > JUnit-TestH5Ocopy.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -940,9 +939,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Ocopy.txt JUnit-TestH5Ocopy.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PL" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PL" TESTING JUnit-TestH5PL -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PL > JUnit-TestH5PL.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PL > JUnit-TestH5PL.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -961,9 +960,9 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5PL.txt JUnit-TestH5PL.out |sed 's/^/ /' fi -echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z" +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z" TESTING JUnit-TestH5Z -($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z > JUnit-TestH5Z.ext) +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z > JUnit-TestH5Z.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -984,9 +983,9 @@ fi if test "X-$BUILD_MODE" = "X-production" ; then if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" TESTING JUnit-TestH5E - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) + ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -1007,9 +1006,9 @@ if test "X-$BUILD_MODE" = "X-production" ; then fi if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" TESTING JUnit-TestH5Edefault - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) + ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ @@ -1030,9 +1029,9 @@ if test "X-$BUILD_MODE" = "X-production" ; then fi fi if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate" + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate" TESTING JUnit-TestH5Giterate - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR:$BLDINSDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate > JUnit-TestH5Giterate.ext) + ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate > JUnit-TestH5Giterate.ext) # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -- cgit v0.12 From a87f597d89ce1ba34410de8407bb80346578b3da Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 23 Aug 2018 09:40:22 -0500 Subject: Correct name of osx installer --- config/cmake_ext_mod/HDFMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 791fe2e..f1d5e1d 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -280,7 +280,7 @@ macro (HDF_README_PROPERTIES target_fortran) endif () elseif (APPLE) set (BINARY_EXAMPLE_ENDING "tar.gz") - set (BINARY_INSTALL_ENDING "dmg") + set (BINARY_INSTALL_ENDING "sh") # if packaging changes - use dmg set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") else () -- cgit v0.12 From 0651432031c7525f05ab1700619250cfb6d15db1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 23 Aug 2018 13:19:35 -0500 Subject: Remove obsolete var --- java/test/junit.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 8587ca9..21025c7 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -282,7 +282,7 @@ fi case $os_name in *) - LD_LIBRARY_PATH=$BLDLIBDIR:$BLDINSDIR:$LD_LIBRARY_PATH + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; esac -- cgit v0.12 From d9d78f705ed2311737a127f985c6e4c81e2be58e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 23 Aug 2018 14:21:16 -0500 Subject: Only remove test jars --- java/test/junit.sh.in | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 21025c7..4f76d4e 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -59,11 +59,13 @@ LIST_LIBRARY_FILES=" $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* " -LIST_JAR_FILES=" +LIST_JAR_TESTFILES=" $HDFLIB_HOME/hamcrest-core.jar $HDFLIB_HOME/junit.jar -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +" +LIST_JAR_FILES=" $top_builddir/java/src/$JARFILE " LIST_DATA_FILES=" @@ -109,6 +111,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Giterate.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_JARFILES="$LIST_JAR_FILES" COPY_LIBFILES_TO_BLDLIBDIR() @@ -138,6 +141,29 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi done # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done for tstfile in $COPY_JARFILES do # ignore '#' comment @@ -172,7 +198,10 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } -- cgit v0.12 From 22eda96a9c2b7d0ad45b5cf50a84458497ee9609 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 23 Aug 2018 14:53:05 -0500 Subject: Correct name of test jar --- java/test/junit.sh.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 4f76d4e..02d0147 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -62,8 +62,8 @@ $top_builddir/java/src/jni/.libs/libhdf5_java.* LIST_JAR_TESTFILES=" $HDFLIB_HOME/hamcrest-core.jar $HDFLIB_HOME/junit.jar -$HDFLIB_HOME/slf4j-api-1.7.5.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar " LIST_JAR_FILES=" $top_builddir/java/src/$JARFILE -- cgit v0.12 From 958c7bd8335d4348218f75d52e4fb51192526c14 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 23 Aug 2018 16:30:13 -0500 Subject: Same changes needed for examples as test --- java/examples/datasets/JavaDatasetExample.sh.in | 45 ++++++++++++++++++----- java/examples/datatypes/JavaDatatypeExample.sh.in | 43 +++++++++++++++++----- java/examples/groups/JavaGroupExample.sh.in | 45 +++++++++++++++++------ java/examples/intro/JavaIntroExample.sh.in | 43 +++++++++++++++++----- 4 files changed, 136 insertions(+), 40 deletions(-) diff --git a/java/examples/datasets/JavaDatasetExample.sh.in b/java/examples/datasets/JavaDatasetExample.sh.in index cb16d45..f5c63cd 100644 --- a/java/examples/datasets/JavaDatasetExample.sh.in +++ b/java/examples/datasets/JavaDatasetExample.sh.in @@ -52,12 +52,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Checksum.txt @@ -83,6 +85,7 @@ $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Soint.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -110,6 +113,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -117,11 +144,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -215,14 +245,9 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH - ;; + ;; esac export LD_LIBRARY_PATH diff --git a/java/examples/datatypes/JavaDatatypeExample.sh.in b/java/examples/datatypes/JavaDatatypeExample.sh.in index 033442a..447512a 100644 --- a/java/examples/datatypes/JavaDatatypeExample.sh.in +++ b/java/examples/datatypes/JavaDatatypeExample.sh.in @@ -49,12 +49,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt @@ -80,6 +82,7 @@ $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_VLString.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -107,6 +110,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -114,11 +141,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -211,11 +241,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 36df02e..7bcd7c5 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -51,15 +51,13 @@ test -d $BLDREFDIR || mkdir -p $BLDREFDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " -LIST_REF_FILES=" -$HDFTEST_HOME/h5ex_g_iterate.h5 -$HDFTEST_HOME/h5ex_g_visit.h5 +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar " LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Create.txt @@ -75,6 +73,7 @@ $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Visit.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -102,6 +101,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -109,11 +132,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -257,11 +283,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; diff --git a/java/examples/intro/JavaIntroExample.sh.in b/java/examples/intro/JavaIntroExample.sh.in index 077146d..1886485 100644 --- a/java/examples/intro/JavaIntroExample.sh.in +++ b/java/examples/intro/JavaIntroExample.sh.in @@ -49,12 +49,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt $HDFTEST_HOME/../testfiles/examples.intro.H5_CreateAttribute.txt @@ -69,6 +71,7 @@ $HDFTEST_HOME/../testfiles/examples.intro.H5_ReadWrite.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -96,6 +99,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -103,11 +130,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -200,11 +230,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; -- cgit v0.12 From 510950623a180603a8af1c5d0fefd50a0ffd7b56 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 23 Aug 2018 17:26:33 -0500 Subject: Add testfiles to data copy --- java/examples/groups/JavaGroupExample.sh.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 7bcd7c5..b4e21bd 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -60,6 +60,8 @@ $HDFLIB_HOME/slf4j-api-1.7.25.jar $HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar " LIST_DATA_FILES=" +$HDFTEST_HOME/h5ex_g_iterate.h5 +$HDFTEST_HOME/h5ex_g_visit.h5 $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Create.txt $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Iterate.txt $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Compact.txt @@ -178,6 +180,7 @@ CLEAN_DATAFILES_AND_BLDDIR() $RM $BLDDIR/examples.groups.H5Ex_G_*.txt $RM $BLDDIR/H5Ex_G_*.out $RM $BLDDIR/H5Ex_G_*.h5 + $RM $BLDDIR/h5ex_g_*.h5 SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` -- cgit v0.12 From c9b37b93e92b29b92707eef4195e2465b5fbb7fe Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 23 Aug 2018 21:22:32 -0500 Subject: change FILE path --- java/examples/groups/H5Ex_G_Iterate.java | 2 +- java/examples/groups/H5Ex_G_Visit.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/examples/groups/H5Ex_G_Iterate.java b/java/examples/groups/H5Ex_G_Iterate.java index 3c9ca82..df1a1b8 100644 --- a/java/examples/groups/H5Ex_G_Iterate.java +++ b/java/examples/groups/H5Ex_G_Iterate.java @@ -25,7 +25,7 @@ import java.util.HashMap; import java.util.Map; public class H5Ex_G_Iterate { - private static String FILENAME = "groups/h5ex_g_iterate.h5"; + private static String FILENAME = "./h5ex_g_iterate.h5"; private static String DATASETNAME = "/"; enum H5O_type { diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java index f91c707..4719705 100644 --- a/java/examples/groups/H5Ex_G_Visit.java +++ b/java/examples/groups/H5Ex_G_Visit.java @@ -34,7 +34,7 @@ import java.util.ArrayList; public class H5Ex_G_Visit { - private static String FILE = "groups/h5ex_g_visit.h5"; + private static String FILE = "./h5ex_g_visit.h5"; public static void main(String[] args) { try { -- cgit v0.12 From a02414cc24e01096a239fc774ce94c38655f53ce Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 23 Aug 2018 21:27:32 -0500 Subject: Revert testfile FILE change --- java/examples/groups/H5Ex_G_Iterate.java | 2 +- java/examples/groups/H5Ex_G_Visit.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/examples/groups/H5Ex_G_Iterate.java b/java/examples/groups/H5Ex_G_Iterate.java index df1a1b8..3c9ca82 100644 --- a/java/examples/groups/H5Ex_G_Iterate.java +++ b/java/examples/groups/H5Ex_G_Iterate.java @@ -25,7 +25,7 @@ import java.util.HashMap; import java.util.Map; public class H5Ex_G_Iterate { - private static String FILENAME = "./h5ex_g_iterate.h5"; + private static String FILENAME = "groups/h5ex_g_iterate.h5"; private static String DATASETNAME = "/"; enum H5O_type { diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java index 4719705..f91c707 100644 --- a/java/examples/groups/H5Ex_G_Visit.java +++ b/java/examples/groups/H5Ex_G_Visit.java @@ -34,7 +34,7 @@ import java.util.ArrayList; public class H5Ex_G_Visit { - private static String FILE = "./h5ex_g_visit.h5"; + private static String FILE = "groups/h5ex_g_visit.h5"; public static void main(String[] args) { try { -- cgit v0.12 From 4cd10fa88e5089c4e5eba091222c4c39db9c64e5 Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Sat, 25 Aug 2018 22:54:30 -0500 Subject: Add fix for HDFFV-10501 Add test for HDFFV-10501 fix Add release note for HDFFV-10501 fix --- release_docs/RELEASE.txt | 18 +++++ src/H5Dmpio.c | 15 +--- testpar/CMakeLists.txt | 1 + testpar/Makefile.am | 2 +- testpar/t_coll_md_read.c | 200 +++++++++++++++++++++++++++++++++++++++++++++++ testpar/testphdf5.c | 3 + testpar/testphdf5.h | 1 + 7 files changed, 225 insertions(+), 15 deletions(-) create mode 100644 testpar/t_coll_md_read.c diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 579308c..516010f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -199,6 +199,24 @@ Bug Fixes since HDF5-1.10.2 release Library ------- + - A bug was discovered in the parallel library where an application + would hang if a collective read/write of a chunked dataset occurred + when collective metadata reads were enabled and some of the ranks + had no selection in the dataset's dataspace. The ranks which had no + selection in the dataset's dataspace called H5D__chunk_addrmap() to + retrieve the lowest chunk address in the dataset. This is because we + require reads/writes to be performed in strictly non-decreasing order + of chunk address in the file. + + When the chunk index used was a version 1 or 2 B-tree, these + non-participating ranks would issue a collective MPI_Bcast() call + that the participating ranks would not issue, causing the hang. Since + the non-participating ranks are not actually reading/writing anything, + the H5D__chunk_addrmap() call can be safely removed and the address used + for the read/write can be set to an arbitrary number (0 was chosen). + + (JTH - 2018/08/25, HDFFV-10501) + - Java HDF5LibraryException class The error minor and major values would be lost after the diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 5ebdc06..4a7c5ac 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -1146,20 +1146,7 @@ if(H5DEBUG(D)) mpi_buf_count = (hsize_t)1; } /* end if */ else { /* no selection at all for this process */ - /* Allocate chunking information */ - if(NULL == (total_chunk_addr_array = (haddr_t *)H5MM_malloc(sizeof(haddr_t) * total_chunks))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate total chunk address arraybuffer") - - /* Retrieve chunk address map */ - if(H5D__chunk_addrmap(io_info, total_chunk_addr_array) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") - - /* Get chunk with lowest address */ - ctg_store.contig.dset_addr = HADDR_MAX; - for(u = 0; u < total_chunks; u++) - if(total_chunk_addr_array[u] < ctg_store.contig.dset_addr) - ctg_store.contig.dset_addr = total_chunk_addr_array[u]; - HDassert(ctg_store.contig.dset_addr != HADDR_MAX); + ctg_store.contig.dset_addr = 0; /* Set the MPI datatype */ chunk_final_ftype = MPI_BYTE; diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index c08a69e..0b3cbe3 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -17,6 +17,7 @@ set (testphdf5_SOURCES ${HDF5_TEST_PAR_SOURCE_DIR}/t_chunk_alloc.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_filter_read.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_prop.c + ${HDF5_TEST_PAR_SOURCE_DIR}/t_coll_md_read.c ) #-- Adding test for testhdf5 diff --git a/testpar/Makefile.am b/testpar/Makefile.am index 5c7cb26..7262ca6 100644 --- a/testpar/Makefile.am +++ b/testpar/Makefile.am @@ -29,7 +29,7 @@ check_PROGRAMS = $(TEST_PROG_PARA) testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \ t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \ - t_prop.c + t_prop.c t_coll_md_read.c # The tests all depend on the hdf5 library and the test library LDADD = $(LIBH5TEST) $(LIBHDF5) diff --git a/testpar/t_coll_md_read.c b/testpar/t_coll_md_read.c new file mode 100644 index 0000000..e3e2d9f --- /dev/null +++ b/testpar/t_coll_md_read.c @@ -0,0 +1,200 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * A test suite to test HDF5's collective metadata read capabilities, as enabled + * by making a call to H5Pset_all_coll_metadata_ops(). + */ + +#include "testphdf5.h" + +#include +#include +#include + +/* + * Define the non-participating process as the "last" + * rank to avoid any weirdness potentially caused by + * an if (mpi_rank == 0) check. + */ +#define PARTIAL_NO_SELECTION_NO_SEL_PROCESS (mpi_rank == mpi_size - 1) +#define PARTIAL_NO_SELECTION_DATASET_NAME "partial_no_selection_dset" +#define PARTIAL_NO_SELECTION_DATASET_NDIMS 2 +#define PARTIAL_NO_SELECTION_Y_DIM_SCALE 5 +#define PARTIAL_NO_SELECTION_X_DIM_SCALE 5 + +/* + * A test for issue HDFFV-10501. A parallel hang was reported which occurred + * in linked-chunk I/O when collective metadata reads are enabled and some ranks + * do not have any selection in a dataset's dataspace, while others do. The ranks + * which have no selection during the read/write operation called H5D__chunk_addrmap() + * to retrieve the lowest chunk address, since we require that the read/write be done + * in strictly non-decreasing order of chunk address. For version 1 and 2 B-trees, + * this caused the non-participating ranks to issue a collective MPI_Bcast() call + * which the other ranks did not issue, thus causing a hang. + * + * However, since these ranks are not actually reading/writing anything, this call + * can simply be removed and the address used for the read/write can be set to an + * arbitrary number (0 was chosen). + */ +void test_partial_no_selection_coll_md_read(void) +{ + const char *filename; + hsize_t *dataset_dims = NULL; + hsize_t max_dataset_dims[PARTIAL_NO_SELECTION_DATASET_NDIMS]; + hsize_t sel_dims[1]; + hsize_t chunk_dims[PARTIAL_NO_SELECTION_DATASET_NDIMS] = { PARTIAL_NO_SELECTION_Y_DIM_SCALE, PARTIAL_NO_SELECTION_X_DIM_SCALE }; + hsize_t start[PARTIAL_NO_SELECTION_DATASET_NDIMS]; + hsize_t stride[PARTIAL_NO_SELECTION_DATASET_NDIMS]; + hsize_t count[PARTIAL_NO_SELECTION_DATASET_NDIMS]; + hsize_t block[PARTIAL_NO_SELECTION_DATASET_NDIMS]; + hid_t file_id = -1; + hid_t fapl_id = -1; + hid_t dset_id = -1; + hid_t dcpl_id = -1; + hid_t dxpl_id = -1; + hid_t fspace_id = -1; + hid_t mspace_id = -1; + int mpi_rank, mpi_size; + void *data = NULL; + void *read_buf = NULL; + + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + + filename = GetTestParameters(); + + fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); + VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); + + /* + * Even though the testphdf5 framework currently sets collective metadata reads + * on the FAPL, we call it here just to be sure this is futureproof, since + * demonstrating this issue relies upon it. + */ + VRFY((H5Pset_all_coll_metadata_ops(fapl_id, true) >= 0), "Set collective metadata reads succeeded"); + + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + VRFY((file_id >= 0), "H5Fcreate succeeded"); + + dataset_dims = malloc(PARTIAL_NO_SELECTION_DATASET_NDIMS * sizeof(*dataset_dims)); + VRFY((dataset_dims != NULL), "malloc succeeded"); + + dataset_dims[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE * mpi_size; + dataset_dims[1] = PARTIAL_NO_SELECTION_X_DIM_SCALE * mpi_size; + max_dataset_dims[0] = H5S_UNLIMITED; + max_dataset_dims[1] = H5S_UNLIMITED; + + fspace_id = H5Screate_simple(PARTIAL_NO_SELECTION_DATASET_NDIMS, dataset_dims, max_dataset_dims); + VRFY((fspace_id >= 0), "H5Screate_simple succeeded"); + + /* + * Set up chunking on the dataset in order to reproduce the problem. + */ + dcpl_id = H5Pcreate(H5P_DATASET_CREATE); + VRFY((dcpl_id >= 0), "H5Pcreate succeeded"); + + VRFY((H5Pset_chunk(dcpl_id, PARTIAL_NO_SELECTION_DATASET_NDIMS, chunk_dims) >= 0), "H5Pset_chunk succeeded"); + + dset_id = H5Dcreate2(file_id, PARTIAL_NO_SELECTION_DATASET_NAME, H5T_NATIVE_INT, fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); + VRFY((dset_id >= 0), "H5Dcreate2 succeeded"); + + /* + * Setup hyperslab selection to split the dataset among the ranks. + * + * The ranks will write rows across the dataset. + */ + start[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE * mpi_rank; + start[1] = 0; + stride[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE; + stride[1] = PARTIAL_NO_SELECTION_X_DIM_SCALE; + count[0] = 1; + count[1] = mpi_size; + block[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE; + block[1] = PARTIAL_NO_SELECTION_X_DIM_SCALE; + + VRFY((H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, stride, count, block) >= 0), "H5Sselect_hyperslab succeeded"); + + sel_dims[0] = count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE); + + mspace_id = H5Screate_simple(1, sel_dims, NULL); + VRFY((mspace_id >= 0), "H5Screate_simple succeeded"); + + data = calloc(1, count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int)); + VRFY((data != NULL), "calloc succeeded"); + + dxpl_id = H5Pcreate(H5P_DATASET_XFER); + VRFY((dxpl_id >= 0), "H5Pcreate succeeded"); + + /* + * Enable collective access for the data transfer. + */ + VRFY((H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) >= 0), "H5Pset_dxpl_mpio succeeded"); + + VRFY((H5Dwrite(dset_id, H5T_NATIVE_INT, mspace_id, fspace_id, dxpl_id, data) >= 0), "H5Dwrite succeeded"); + + VRFY((H5Fflush(file_id, H5F_SCOPE_GLOBAL) >= 0), "H5Fflush succeeded"); + + /* + * Ensure that linked-chunk I/O is performed since this is + * the particular code path where the issue lies and we don't + * want the library doing multi-chunk I/O behind our backs. + */ + VRFY((H5Pset_dxpl_mpio_chunk_opt(dxpl_id, H5FD_MPIO_CHUNK_ONE_IO) >= 0), "H5Pset_dxpl_mpio_chunk_opt succeeded"); + + read_buf = malloc(count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int)); + VRFY((read_buf != NULL), "malloc succeeded"); + + /* + * Make sure to call H5Sselect_none() on the non-participating process. + */ + if (PARTIAL_NO_SELECTION_NO_SEL_PROCESS) { + VRFY((H5Sselect_none(fspace_id) >= 0), "H5Sselect_none succeeded"); + VRFY((H5Sselect_none(mspace_id) >= 0), "H5Sselect_none succeeded"); + } + + /* + * Finally have each rank read their section of data back from the dataset. + */ + VRFY((H5Dread(dset_id, H5T_NATIVE_INT, mspace_id, fspace_id, dxpl_id, read_buf) >= 0), "H5Dread succeeded"); + + /* + * Check data integrity just to be sure. + */ + if (!PARTIAL_NO_SELECTION_NO_SEL_PROCESS) { + VRFY((!memcmp(data, read_buf, count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int))), "memcmp succeeded"); + } + + if (dataset_dims) { + free(dataset_dims); + dataset_dims = NULL; + } + + if (data) { + free(data); + data = NULL; + } + + if (read_buf) { + free(read_buf); + read_buf = NULL; + } + + VRFY((H5Sclose(fspace_id) >= 0), "H5Sclose succeeded"); + VRFY((H5Sclose(mspace_id) >= 0), "H5Sclose succeeded"); + VRFY((H5Pclose(dcpl_id) >= 0), "H5Pclose succeeded"); + VRFY((H5Pclose(dxpl_id) >= 0), "H5Pclose succeeded"); + VRFY((H5Dclose(dset_id) >= 0), "H5Dclose succeeded"); + VRFY((H5Pclose(fapl_id) >= 0), "H5Pclose succeeded"); + VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded"); +} diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 87d9056..69b66ae 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -547,6 +547,9 @@ int main(int argc, char **argv) AddTest("denseattr", test_dense_attr, NULL, "Store Dense Attributes", PARATESTFILE); + AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL, + "Collective Metadata read with some ranks having no selection", PARATESTFILE); + /* Display testing information */ TestInfo(argv[0]); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 322cb9b..176574e 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -294,6 +294,7 @@ void file_image_daisy_chain_test(void); void compress_readAll(void); #endif /* H5_HAVE_FILTER_DEFLATE */ void test_dense_attr(void); +void test_partial_no_selection_coll_md_read(void); /* commonly used prototypes */ hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type); -- cgit v0.12 From 726642498c8e383d1657f6d66802832e8052b3e6 Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Sat, 25 Aug 2018 23:05:55 -0500 Subject: Remove now-unused local variable --- src/H5Dmpio.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 4a7c5ac..eb687d2 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -925,7 +925,6 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ hbool_t chunk_final_ftype_is_derived = FALSE; H5D_storage_t ctg_store; /* Storage info for "fake" contiguous dataset */ size_t total_chunks; - haddr_t *total_chunk_addr_array = NULL; MPI_Datatype *chunk_mtype = NULL; MPI_Datatype *chunk_ftype = NULL; MPI_Aint *chunk_disp_array = NULL; @@ -1174,8 +1173,6 @@ if(H5DEBUG(D)) HDfprintf(H5DEBUG(D),"before freeing memory inside H5D_link_collective_io ret_value = %d\n", ret_value); #endif /* Release resources */ - if(total_chunk_addr_array) - H5MM_xfree(total_chunk_addr_array); if(chunk_addr_info_array) H5MM_xfree(chunk_addr_info_array); if(chunk_mtype) -- cgit v0.12 From 556bfd498cd88339244d8d9b5c2c030e8d18bcbf Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Mon, 27 Aug 2018 08:56:17 -0500 Subject: Update MANIFEST file for new t_coll_md_read.c file Remove old line from copyright notice --- MANIFEST | 1 + testpar/t_coll_md_read.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST b/MANIFEST index 046d73b..f011e94 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1248,6 +1248,7 @@ ./testpar/t_cache_image.c ./testpar/t_chunk_alloc.c ./testpar/t_coll_chunk.c +./testpar/t_coll_md_read.c ./testpar/t_dset.c ./testpar/t_file.c ./testpar/t_file_image.c diff --git a/testpar/t_coll_md_read.c b/testpar/t_coll_md_read.c index e3e2d9f..f945d2b 100644 --- a/testpar/t_coll_md_read.c +++ b/testpar/t_coll_md_read.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * -- cgit v0.12 From 763b95c6b0f027025a5a5bfb203b77317ffa2368 Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Mon, 27 Aug 2018 15:13:54 -0500 Subject: Update RELEASE.txt with suggested changes --- release_docs/RELEASE.txt | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 516010f..a0446e2 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -34,6 +34,7 @@ CONTENTS - New Features - Support for new platforms and languages +- Bug Fixes since HDF5-1.10.3 - Bug Fixes since HDF5-1.10.2 - Supported Platforms - Tested Configuration Features Summary @@ -194,7 +195,7 @@ Support for new platforms, languages and compilers. ======================================= - -Bug Fixes since HDF5-1.10.2 release +Bug Fixes since HDF5-1.10.3 release ================================== Library @@ -217,6 +218,50 @@ Bug Fixes since HDF5-1.10.2 release (JTH - 2018/08/25, HDFFV-10501) + Configuration + ------------- + - + + Performance + ------------- + - + + Fortran + -------- + - + + Tools + ----- + - + + High-Level APIs: + ------ + - + + Fortran High-Level APIs: + ------ + - + + Documentation + ------------- + - + + F90 APIs + -------- + - + + C++ APIs + -------- + - + + Testing + ------- + +Bug Fixes since HDF5-1.10.2 release +================================== + + Library + ------- - Java HDF5LibraryException class The error minor and major values would be lost after the -- cgit v0.12 From 27af9a7922550a71a2e9d2b9f6a9f60aef0b4dda Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 28 Aug 2018 10:54:42 -0500 Subject: HD prefix and whitespace --- hl/src/H5DS.c | 106 +- hl/test/test_ds.c | 112 +- hl/test/test_lite.c | 86 +- java/examples/groups/JavaGroupExample.sh.in | 29 +- java/src/jni/h5dImp.c | 2 +- java/src/jni/h5pImp.c | 4 +- java/src/jni/h5sImp.c | 6 +- java/src/jni/h5util.c | 10 +- test/Makefile.am | 10 +- test/cache_logging.c | 12 +- test/genall5.c | 3220 +++++++++++---------------- test/ohdr.c | 4 +- test/tmisc.c | 2 +- test/tunicode.c | 6 +- test/tvltypes.c | 22 +- test/vfd.c | 22 +- testpar/t_cache.c | 2 +- testpar/t_dset.c | 1050 ++++----- tools/lib/h5tools_utils.h | 2 +- tools/src/h5diff/h5diff_common.c | 6 +- tools/src/h5import/h5import.c | 302 +-- tools/src/h5stat/h5stat.c | 88 +- tools/test/h5import/h5importtest.c | 4 +- tools/test/perform/perf.c | 70 +- 24 files changed, 2337 insertions(+), 2840 deletions(-) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index d86cc98..067992f 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -241,7 +241,7 @@ herr_t H5DSattach_scale(hid_t did, if (has_dimlist == 0) { - dims[0] = (hsize_t)rank; + dims[0] = (hsize_t)rank; /* space for the attribute */ if((sid = H5Screate_simple(1, dims, NULL)) < 0) @@ -556,9 +556,9 @@ out: * * Date: December 20, 2004 * -* Comments: +* Comments: * -* Modifications: Function didn't delete DIMENSION_LIST attribute, when +* Modifications: Function didn't delete DIMENSION_LIST attribute, when * all dimension scales were detached from a dataset; added. * 2010/05/13 EIP * @@ -706,24 +706,24 @@ herr_t H5DSdetach_scale(hid_t did, /* same object, reset */ if(dsid_oi.fileno == tmp_oi.fileno && dsid_oi.addr == tmp_oi.addr) { - /* If there are more than one reference in the VL element + /* If there are more than one reference in the VL element and the reference we found is not the last one, copy the last one to replace the found one since the order - of the references doesn't matter according to the spec; - reduce the size of the VL element by 1; - if the length of the element becomes 0, free the pointer + of the references doesn't matter according to the spec; + reduce the size of the VL element by 1; + if the length of the element becomes 0, free the pointer and reset to NULL */ size_t len = buf[idx].len; - if(j < len - 1) - ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; + if(j < len - 1) + ((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1]; len = --buf[idx].len; if(len == 0) { - HDfree(buf[idx].p); + HDfree(buf[idx].p); buf[idx].p = NULL; } - /* Since a reference to a dim. scale can be inserted only once, + /* Since a reference to a dim. scale can be inserted only once, we do not need to continue the search if it is found */ found_ds = 1; break; @@ -736,16 +736,16 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* Write the attribute, but check first, if we have any scales left, - because if not, we should delete the attribute according to the spec */ + because if not, we should delete the attribute according to the spec */ for(i = 0; i < rank; i++) { if(buf[i].len > 0) { have_ds = 1; - break; + break; } } - if(have_ds) { + if(have_ds) { if(H5Awrite(aid, tid, buf) < 0) - goto out; + goto out; } else { if(H5Adelete(did, DIMENSION_LIST) < 0) @@ -1123,7 +1123,7 @@ htri_t H5DSis_attached(hid_t did, if (dsbuf == NULL) goto out; - if (H5Aread(aid,ntid,dsbuf) < 0) + if (H5Aread(aid,ntid,dsbuf) < 0) goto out; /*------------------------------------------------------------------------- @@ -1445,7 +1445,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) if (H5I_DATASET != it) return FAIL; - if (label == NULL) + if (label == NULL) return FAIL; /* get dataset space */ @@ -1502,7 +1502,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) goto out; for (i = 0; i < (unsigned int) rank; i++) - u.const_buf[i] = NULL; + u.const_buf[i] = NULL; /* store the label information in the required index */ u.const_buf[idx] = label; @@ -1532,7 +1532,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) else { - + if ((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0) goto out; @@ -1541,7 +1541,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) /* allocate and initialize */ u.buf = (char **) HDmalloc((size_t) rank * sizeof(char *)); - + if (u.buf == NULL) goto out; @@ -1626,7 +1626,7 @@ out: * Comments: * * Modifications: -* JIRA HDFFV-7673: Added a check to see if the label name exists, +* JIRA HDFFV-7673: Added a check to see if the label name exists, * if not then returns zero. July 30, 2011. MSB * *------------------------------------------------------------------------- @@ -1714,26 +1714,26 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) if (buf[idx] != NULL) { /* get the real string length */ - nbytes = strlen(buf[idx]); + nbytes = HDstrlen(buf[idx]); - /* compute the string length which will fit into the user's buffer */ - copy_len = MIN(size-1, nbytes); + /* compute the string length which will fit into the user's buffer */ + copy_len = MIN(size-1, nbytes); - /* copy all/some of the name */ - if (label) - { - memcpy(label, buf[idx], copy_len); - - /* terminate the string */ - label[copy_len] = '\0'; - } + /* copy all/some of the name */ + if (label) + { + HDmemcpy(label, buf[idx], copy_len); + + /* terminate the string */ + label[copy_len] = '\0'; + } } /* free all the ptr's from the H5Aread() */ for (i = 0; i < rank; i++) { if (buf[i]) - HDfree(buf[i]); + HDfree(buf[i]); } /* close */ @@ -1867,7 +1867,7 @@ ssize_t H5DSget_scale_name(hid_t did, /* copy all/some of the name */ if (name) { - memcpy(name, buf, copy_len); + HDmemcpy(name, buf, copy_len); /* terminate the string */ name[copy_len]='\0'; @@ -1951,33 +1951,33 @@ htri_t H5DSis_scale(hid_t did) if((tid = H5Aget_type(aid)) < 0) goto out; - /* check to make sure attribute is a string */ - if(H5T_STRING != H5Tget_class(tid)) - goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(tid)) + goto out; - /* check to make sure string is null-terminated */ - if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) - goto out; + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) + goto out; - /* allocate buffer large enough to hold string */ - if((storage_size = H5Aget_storage_size(aid)) == 0) - goto out; + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; - buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); - if(buf == NULL) - goto out; + buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(buf == NULL) + goto out; - /* Read the attribute */ + /* Read the attribute */ if(H5Aread(aid, tid, buf) < 0) - goto out; + goto out; - /* compare strings */ + /* compare strings */ if(HDstrncmp(buf, DIMENSION_SCALE_CLASS, MIN(HDstrlen(DIMENSION_SCALE_CLASS),HDstrlen(buf)))==0) is_ds = 1; else is_ds = 0; - HDfree(buf); + HDfree(buf); if(H5Tclose(tid) < 0) goto out; @@ -2236,8 +2236,8 @@ out: static hid_t H5DS_get_REFLIST_type(void) { - hid_t ntid_t = -1; - + hid_t ntid_t = -1; + /* Build native type that corresponds to compound datatype used to store ds_list_t structure in the REFERENCE_LIST attribute */ @@ -2257,5 +2257,5 @@ out: H5Tclose(ntid_t); } H5E_END_TRY; return FAIL; -} +} diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 49dc72f..95178fc 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -186,11 +186,11 @@ int main(void) if(nerrors) goto error; - printf("All dimension scales tests passed.\n"); + HDprintf("All dimension scales tests passed.\n"); return 0; error: - printf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); return 1; } @@ -1110,7 +1110,7 @@ herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *sc if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) { if(H5DSis_attached(did, dsid, idx) == 1) { if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) { - name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char)); + name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char)); if(name_out != NULL) { if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) >= 0) { if(HDstrncmp(scalename, name_out, (size_t)name_len)==0) { @@ -1156,7 +1156,7 @@ static int test_detachscales(void) sprintf(dname,"D%d", i); if(H5LTmake_dataset_int(fid, dname, rank3, dims, buf) < 0) goto out; - } + } /* create datasets and make them dim. scales */ for (i=0; i < 4; i++) { @@ -1164,11 +1164,11 @@ static int test_detachscales(void) if(H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0) goto out; } - /* attach scales to the first dataset; first dimension will have + /* attach scales to the first dataset; first dimension will have two scales attached */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) { for (i=0; i<4; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, (unsigned int) i%3) < 0) @@ -1185,7 +1185,7 @@ static int test_detachscales(void) /* attach scales to the second dataset */ if((did = H5Dopen2(fid, "D1", H5P_DEFAULT)) >= 0) { for (i=0; i<3; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, (unsigned int) i) < 0) @@ -1206,20 +1206,20 @@ static int test_detachscales(void) goto out; for (i=0; i<2; i++) { - sprintf(dname, "D%d", i); + HDsprintf(dname, "D%d", i); if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSdetach_scale(did, dsid, (unsigned int)0) < 0) goto out; if(H5Dclose(did) < 0) goto out; - } + } /* Check that attribute "REFERENCE_LIST" doesn't exist anymore */ if(H5Aexists(dsid, REFERENCE_LIST)!= 0) goto out; if(H5Dclose(dsid) < 0) goto out; - /* Check that DS3 is the only dim. scale attached to the first + /* Check that DS3 is the only dim. scale attached to the first dimension of D0 */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) < 0) goto out; @@ -1232,11 +1232,11 @@ static int test_detachscales(void) if(H5Dclose(dsid) < 0) goto out; - /* Detach the rest of the scales DS3, DS1, DS2 from D0 and make + /* Detach the rest of the scales DS3, DS1, DS2 from D0 and make sure that attribute "DIMENSION_LIST" doesn't exist anymore */ if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) { for (i=1; i<4; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto out; if(H5DSdetach_scale(did, dsid, (unsigned int) i%3) < 0) @@ -1253,7 +1253,7 @@ static int test_detachscales(void) else goto out; - + PASSED(); H5Fclose(fid); @@ -2873,10 +2873,10 @@ static int test_simple(void) if((sid = H5Screate_simple(rank,dims,NULL)) < 0) goto out; for(i = 0; i < 5; i++) { - sprintf(dname,"dset_%d",i); + HDsprintf(dname,"dset_%d",i); if((did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - sprintf(sname,"ds_%d",i); + HDsprintf(sname,"ds_%d",i); if((dsid = H5Dcreate2(gid, sname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5DSset_scale(dsid,"scale") < 0) @@ -2893,11 +2893,11 @@ static int test_simple(void) */ for(i = 0; i < 5; i++) { - sprintf(dname, "dset_%d", i); + HDsprintf(dname, "dset_%d", i); if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for(j = 0; j < 5; j++) { - sprintf(sname, "ds_%d", j); + HDsprintf(sname, "ds_%d", j); if((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did, dsid, DIM0) < 0) @@ -2915,7 +2915,7 @@ static int test_simple(void) */ for(i = 0; i < 5; i++) { - sprintf(dname, "dset_%d", i); + HDsprintf(dname, "dset_%d", i); if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for(j = 0; j < 5; j++) { @@ -2938,7 +2938,7 @@ static int test_simple(void) */ for(i=0; i<5; i++) { - sprintf(dname,"dset_%d",i); + HDsprintf(dname,"dset_%d",i); if((did = H5Dopen2(gid,dname, H5P_DEFAULT)) < 0) goto out; for(j=0; j<5; j++) { @@ -3541,7 +3541,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor for(i=0; i /dev/null @@ -206,9 +209,9 @@ COPY_REFFILES_TO_BLDREFDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $BLDREFDIR + $CP -f $tstfile $BLDITERDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." @@ -220,16 +223,16 @@ COPY_REFFILES_TO_BLDREFDIR() done } -CLEAN_REFFILES_AND_BLDREFDIR() +CLEAN_ITERFILES_AND_BLDITERDIR() { # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail SDIR=`$DIRNAME $HDFTEST_HOME/h5ex_g_iterate.h5` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDREFDIR + $RM $BLDITERDIR fi } @@ -252,7 +255,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@ # prepare for test COPY_LIBFILES_TO_BLDLIBDIR COPY_DATAFILES_TO_BLDDIR -COPY_REFFILES_TO_BLDREFDIR +COPY_REFFILES_TO_BLDITERDIR CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE"" @@ -366,7 +369,7 @@ fi # Clean up temporary files/directories CLEAN_LIBFILES_AND_BLDLIBDIR CLEAN_DATAFILES_AND_BLDDIR -CLEAN_REFFILES_AND_BLDREFDIR +CLEAN_REFFILES_AND_BLDITERDIR # Report test results and exit if test $nerrors -eq 0 ; then diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index f984948..652c873 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -1109,7 +1109,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); if (utf8) { - strncpy(&c_buf[i * str_len], utf8, str_len); + HDstrncpy(&c_buf[i * str_len], utf8, str_len); } /* end if */ ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index e6d1be8..52008ce 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -3881,7 +3881,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); if (utf8) { - member_name[i] = (char*)HDmalloc(strlen(utf8) + 1); + member_name[i] = (char*)HDmalloc(HDstrlen(utf8) + 1); if (member_name[i]) { strcpy(member_name[i], utf8); } /* end if */ @@ -4189,7 +4189,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config h5JNIFatalError(env, "H5Pset_mdc_config: out of memory trace_file_name"); return; } /* end if */ - strncpy(cacheinfo.trace_file_name, str, 1025); + HDstrncpy(cacheinfo.trace_file_name, str, 1025); ENVPTR->ReleaseStringUTFChars(ENVPAR j_str, str); if(ENVPTR->ExceptionOccurred(ENVONLY)) { h5JNIFatalError(env, "H5Pset_mdc_config: loading trace_file_name failed"); diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index a4b4848..65cdd7b 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -571,7 +571,7 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple h5JNIFatalError(env, "H5Pset_simple_extent: dims not pinned"); return -1; } /* end if */ - sa = lp = (hsize_t *) malloc((size_t)rank * sizeof(hsize_t)); + sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)); if (sa == NULL) { ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); h5JNIFatalError(env, "H5Sset_simple_extent: dims not converted to hsize_t"); @@ -1017,7 +1017,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist h5JNIFatalError(env, "H5Sget_select_hyper_blocklist: buf not pinned"); } /* end if */ else { - ba = (hsize_t *) malloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t)); + ba = (hsize_t *) HDmalloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t)); if (ba == NULL) { ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); h5JNIFatalError(env, "H5Screate-simple: buffer not converted to hsize_t"); @@ -1135,7 +1135,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds return -1; } /* end if */ rank = (int) ENVPTR->GetArrayLength(ENVPAR start); - strt = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)); + strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); if (strt == NULL) { ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); h5JNIFatalError(env, "H5Sget_select_bounds: start not converted to hsize_t"); diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 42f8a5c..fd34ba1 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -1768,7 +1768,7 @@ h5str_render_bin_output if (H5Tis_variable_str(tid)) { s = *(char**) mem; if (s != NULL) - size = strlen(s); + size = HDstrlen(s); } else { s = (char *) mem; @@ -2129,11 +2129,11 @@ render_bin_output_region_data_points ret_value = -1; HDfree(dims1); - } /* end if((dims1 = (hsize_t *) malloc(sizeof(hsize_t) * ndims)) != NULL) */ + } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ else ret_value = -1; HDfree(region_buf); - } /* end if((region_buf = malloc(type_size * (size_t)npoints)) != NULL) */ + } /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */ else ret_value = -1; @@ -2436,7 +2436,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex H5Tclose(p_type); n = ENVPTR->GetArrayLength(ENVPAR buf); - rdata = (char *)malloc((size_t)n * size); + rdata = (char *)HDmalloc((size_t)n * size); if (rdata == NULL) { h5JNIFatalError(env, "H5AreadComplex: failed to allocate buff for read"); } /* end if */ @@ -2952,7 +2952,7 @@ obj_info_all if (retVal < 0) { *(datainfo->otype+datainfo->count) = -1; *(datainfo->ltype+datainfo->count) = -1; - *(datainfo->objname+datainfo->count) = (char *)HDmalloc(strlen(name)+1); + *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1); HDstrcpy(*(datainfo->objname+datainfo->count), name); *(datainfo->objno+datainfo->count) = (unsigned long)-1; } /* end if */ diff --git a/test/Makefile.am b/test/Makefile.am index b9aa3fb..d4db6d0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -56,11 +56,11 @@ TEST_PROG= testhdf5 \ evict_on_close farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith page_buffer \ dtypes dsets cmpd_dset filter_fail extend direct_chunk external efc \ - objcopy links unlink twriteorder big mtime fillval mount \ - flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ - enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \ - reserved cross_read freespace mf vds file_image unregister \ - cache_logging cork swmr + objcopy links unlink twriteorder big mtime fillval mount \ + flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ + enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \ + reserved cross_read freespace mf vds file_image unregister \ + cache_logging cork swmr # List programs to be built when testing here. # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. diff --git a/test/cache_logging.c b/test/cache_logging.c index b4ed53b..1eb9d41 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -65,16 +65,16 @@ test_logging_api(void) start_on_access_out = TRUE; location = NULL; size = 999; - if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, + if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, &start_on_access_out) < 0) TEST_ERROR; - if(size != strlen(LOG_LOCATION) + 1) + if(size != HDstrlen(LOG_LOCATION) + 1) TEST_ERROR; /* Check to make sure that the property list getter works */ if(NULL == (location = (char *)HDcalloc(size, sizeof(char)))) TEST_ERROR; - if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, + if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size, &start_on_access_out) < 0) TEST_ERROR; if((is_enabled != is_enabled_out) @@ -159,17 +159,17 @@ main(void) /* Reset library */ h5_reset(); - printf("Testing basic metadata cache logging functionality.\n"); + HDprintf("Testing basic metadata cache logging functionality.\n"); nerrors += test_logging_api(); if(nerrors) { - printf("***** %d Metadata cache logging TEST%s FAILED! *****\n", + HDprintf("***** %d Metadata cache logging TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); return 1; } - printf("All Metadata Cache Logging tests passed.\n"); + HDprintf("All Metadata Cache Logging tests passed.\n"); return 0; } diff --git a/test/genall5.c b/test/genall5.c index 37bab7a..4cc0a2d 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -12,11 +12,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Programmer: John Mainzer - * 9/23/15 + * 9/23/15 * - * This file contains a heavily edited and functionaly reduce - * version of the test code first written by Quincey in a file - * of the same name. + * This file contains a heavily edited and functionaly reduce + * version of the test code first written by Quincey in a file + * of the same name. */ #include "cache_common.h" @@ -32,7 +32,7 @@ * Function: ns_grp_0 * * Purpose: Create an empty "new style" group at the specified location - * in the specified file. + * in the specified file. * * If pass is false on entry, do nothing. * @@ -48,70 +48,59 @@ */ void -ns_grp_0(hid_t fid, const char *group_name) -{ +ns_grp_0(hid_t fid, const char *group_name) { hid_t gid = -1; hid_t gcpl = -1; herr_t ret; - if ( pass ) { - + if (pass) { gcpl = H5Pcreate(H5P_GROUP_CREATE); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Pcreate() failed"; - } - assert(gcpl > 0); + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pcreate() failed"; + } + HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Pset_link_creation_order() failed"; - } - assert(ret >= 0); + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pset_link_creation_order() failed"; + } + HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Gcreate2() failed"; + if (gid <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Gcreate2() failed"; } - assert(gid > 0); + HDassert(gid > 0); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Pclose(gcpl) failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Pclose(gcpl) failed"; } - assert(ret >= 0); + HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_0: H5Gclose(gid) failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_0: H5Gclose(gid) failed"; } - assert(ret >= 0); + HDassert(ret >= 0); } return; @@ -138,97 +127,81 @@ ns_grp_0(hid_t fid, const char *group_name) *------------------------------------------------------------------------- */ -void vrfy_ns_grp_0(hid_t fid, const char *group_name) -{ +void vrfy_ns_grp_0(hid_t fid, const char *group_name) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; unsigned crt_order_flags = 0; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Gopen2() failed"; + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Gopen2() failed"; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Gget_create_plist() failed"; + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Gget_create_plist() failed"; } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Pget_link_creation_order() failed"; + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Pget_link_creation_order() failed"; } - else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_0: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags) { + pass = FALSE; + failure_mssg = + "vrfy_ns_grp_0: H5P_CRT_ORDER_TRACKED != crt_order_flags"; } HDassert(ret >= 0); HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_0: H5Pclose() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_0: H5Pclose() failed"; } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: H5Gget_info() failed"; } - else if ( H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type ) { - + else if (H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_0: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; + failure_mssg = + "vrfy_ns_grp_0: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; } - else if ( 0 != grp_info.nlinks ) { - + else if (0 != grp_info.nlinks) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: 0 != grp_info.nlinks"; } - else if ( 0 != grp_info.max_corder ) { - + else if (0 != grp_info.max_corder) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: 0 != grp_info.max_corder"; } - else if ( FALSE != grp_info.mounted ) { - + else if ( FALSE != grp_info.mounted) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: FALSE != grp_info.mounted"; } @@ -240,12 +213,10 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) HDassert(false == grp_info.mounted); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_0: H5Gclose() failed"; } @@ -253,15 +224,14 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) } return; - } /* vrfy_ns_grp_0() */ /*------------------------------------------------------------------------- * Function: ns_grp_c * - * Purpose: Create a compact "new style" group, with 'nlinks' - * soft/hard/external links in it in the specified file. + * Purpose: Create a compact "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -276,68 +246,57 @@ void vrfy_ns_grp_0(hid_t fid, const char *group_name) *------------------------------------------------------------------------- */ -void -ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) -{ +void +ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; unsigned max_compact; unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gcpl = H5Pcreate(H5P_GROUP_CREATE); - if ( gcpl <= 0 ) { - + if (gcpl <= 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pcreate(H5P_GROUP_CREATE) failed"; } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pset_link_creation_order() failed"; } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); - if ( gid <= 0 ) { - + if (gid <= 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Gcreate2() failed"; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { max_compact = 0; ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pget_link_phase_change() failed"; } - else if ( nlinks <= 0 ) { - + else if (nlinks <= 0) { pass = FALSE; failure_mssg = "ns_grp_c: nlinks <= 0"; } - else if ( nlinks >= max_compact ) { - + else if (nlinks >= max_compact) { pass = FALSE; failure_mssg = "ns_grp_c: nlinks >= max_compact"; } @@ -348,72 +307,59 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { char linkname[16]; - sprintf(linkname, "%u", u); + HDsprintf(linkname, "%u", u); - if(0 == (u % 3)) { - - ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); - - if ( ret < 0 ) { + if (0 == (u % 3)) { + ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Lcreate_soft() failed"; } HDassert(ret >= 0); } /* end if */ - else if(1 == (u % 3)) { - - ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); - - if ( ret < 0 ) { + else if (1 == (u % 3)) { + ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, + H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Lcreate_hard() failed"; } HDassert(ret >= 0); } /* end else-if */ else { - HDassert(2 == (u % 3)); - ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); - - if ( ret < 0 ) { + ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Lcreate_external() failed"; } HDassert(ret >= 0); } /* end else */ - u++; - + u++; } /* end while() */ - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Pclose(gcpl) failed"; } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "ns_grp_c: H5Gclose(gid) failed"; } @@ -428,8 +374,8 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) /*------------------------------------------------------------------------- * Function: vrfy_ns_grp_c * - * Purpose: Verify a compact "new style" group, with 'nlinks' - * soft/hard/external links in it in the specified file. + * Purpose: Verify a compact "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -445,8 +391,7 @@ ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) */ void -vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) -{ +vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; @@ -454,89 +399,73 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - + if (gid <= 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gopen2() failed"; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - + if (gcpl <= 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gget_create_plist(gid) failed"; } - assert(gcpl > 0); + HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Pget_link_creation_order() failed"; } - else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { - + else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + failure_mssg = "vrfy_ns_grp_c: H5P_CRT_ORDER_TRACKED != crt_order_flags"; } HDassert(ret >= 0); HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Pclose() failed"; } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gget_info() failed"; } - else if ( H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type ) { - + else if (H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; + failure_mssg = + "vrfy_ns_grp_c: H5G_STORAGE_TYPE_COMPACT != grp_info.storage_type"; } - else if ( nlinks != grp_info.nlinks ) { - + else if (nlinks != grp_info.nlinks) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: nlinks != grp_info.nlinks"; } - else if ( nlinks != grp_info.max_corder ) { - + else if (nlinks != grp_info.max_corder) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: nlinks != grp_info.max_corder"; } - else if ( FALSE != grp_info.mounted ) { - + else if ( FALSE != grp_info.mounted) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: FALSE != grp_info.mounted"; } @@ -549,42 +478,36 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { H5L_info_t lnk_info; char linkname[16]; htri_t link_exists; - sprintf(linkname, "%u", u); + HDsprintf(linkname, "%u", u); link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); - if ( link_exists < 0 ) { - + if (link_exists < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lexists() failed"; } HDassert(link_exists >= 0); - memset(&lnk_info, 0, sizeof(grp_info)); + HDmemset(&lnk_info, 0, sizeof(grp_info)); ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lget_info() failed"; } - else if ( TRUE != lnk_info.corder_valid ) { - + else if ( TRUE != lnk_info.corder_valid) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: TRUE != lnk_info.corder_valid"; } - else if ( u != lnk_info.corder ) { - + else if (u != lnk_info.corder) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: u != lnk_info.corder"; } - else if ( H5T_CSET_ASCII != lnk_info.cset ) { - + else if (H5T_CSET_ASCII != lnk_info.cset) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5T_CSET_ASCII != lnk_info.cset"; } @@ -593,75 +516,62 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) HDassert(u == lnk_info.corder); HDassert(H5T_CSET_ASCII == lnk_info.cset); - if ( 0 == (u % 3) ) { - + if (0 == (u % 3)) { char *slinkval; - if ( H5L_TYPE_SOFT != lnk_info.type ) { - + if (H5L_TYPE_SOFT != lnk_info.type) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_SOFT != lnk_info.type"; } - else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { - + else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: (strlen(group_name) + 1) != lnk_info.u.val_size"; + failure_mssg = "vrfy_ns_grp_c: (HDstrlen(group_name) + 1) != lnk_info.u.val_size"; } HDassert(H5L_TYPE_SOFT == lnk_info.type); - HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); + HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size); - slinkval = (char *)malloc(lnk_info.u.val_size); - - if ( ! slinkval ) { + slinkval = (char *) HDmalloc(lnk_info.u.val_size); + if (!slinkval) { pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: malloc of slinkval failed"; + failure_mssg = "vrfy_ns_grp_c: HDmalloc of slinkval failed"; } HDassert(slinkval); - ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lget_val() failed"; } - else if ( 0 != strcmp(slinkval, group_name) ) { - + else if (0 != HDstrcmp(slinkval, group_name)) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: 0 != strcmp(slinkval, group_name)"; + failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(slinkval, group_name)"; } HDassert(ret >= 0); - HDassert(0 == strcmp(slinkval, group_name)); + HDassert(0 == HDstrcmp(slinkval, group_name)); - free(slinkval); + HDfree(slinkval); } /* end if */ - else if(1 == (u % 3)) { - + else if (1 == (u % 3)) { H5O_info_t root_oinfo; - if ( H5L_TYPE_HARD != lnk_info.type ) { - + if (H5L_TYPE_HARD != lnk_info.type) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_HARD != lnk_info.type"; } HDassert(H5L_TYPE_HARD == lnk_info.type); - memset(&root_oinfo, 0, sizeof(root_oinfo)); + HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Oget_info() failed."; } - else if ( root_oinfo.addr != lnk_info.u.address ) { - + else if (root_oinfo.addr != lnk_info.u.address) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address"; + failure_mssg = "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address"; } HDassert(ret >= 0); HDassert(root_oinfo.addr == lnk_info.u.address); @@ -673,83 +583,70 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) HDassert(2 == (u % 3)); - if ( H5L_TYPE_EXTERNAL != lnk_info.type ) { - + if (H5L_TYPE_EXTERNAL != lnk_info.type) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: H5L_TYPE_EXTERNAL != lnk_info.type"; + failure_mssg = "vrfy_ns_grp_c: H5L_TYPE_EXTERNAL != lnk_info.type"; } HDassert(H5L_TYPE_EXTERNAL == lnk_info.type); - elinkval = malloc(lnk_info.u.val_size); - - if ( ! elinkval ) { + elinkval = HDmalloc(lnk_info.u.val_size); + if (!elinkval) { pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: malloc of elinkval failed."; + failure_mssg = "vrfy_ns_grp_c: HDmalloc of elinkval failed."; } HDassert(elinkval); - ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - + ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lget_val() failed."; } HDassert(ret >= 0); - ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, - NULL, &file, &path); - if ( ret < 0 ) { - + ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, &file, &path); + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Lunpack_elink_val() failed."; } - else if ( 0 != strcmp(file, "external.h5") ) { - + else if (0 != HDstrcmp(file, "external.h5")) { pass = FALSE; - failure_mssg = - "vrfy_ns_grp_c: 0 != strcmp(file, \"external.h5\")"; + failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(file, \"external.h5\")"; } - else if ( 0 != strcmp(path, "/ext") ) { - + else if (0 != HDstrcmp(path, "/ext")) { pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: 0 != strcmp(path, \"/ext\")"; + failure_mssg = "vrfy_ns_grp_c: 0 != HDstrcmp(path, \"/ext\")"; } HDassert(ret >= 0); - HDassert(0 == strcmp(file, "external.h5")); - HDassert(0 == strcmp(path, "/ext")); + HDassert(0 == HDstrcmp(file, "external.h5")); + HDassert(0 == HDstrcmp(path, "/ext")); - free(elinkval); + HDfree(elinkval); } /* end else */ - u++; - + u++; } /* end while */ - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - + if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Gclose() failed."; } - assert(ret >= 0); + HDassert(ret >= 0); } return; - } /* vrfy_ns_grp_c() */ /*------------------------------------------------------------------------- * Function: ns_grp_d * - * Purpose: Create a dense "new style" group, with 'nlinks' - * (soft/hard/external) links in it in the specified file. + * Purpose: Create a dense "new style" group, with 'nlinks' + * (soft/hard/external) links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -765,153 +662,130 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) */ void -ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) -{ +ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; unsigned max_compact; unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gcpl = H5Pcreate(H5P_GROUP_CREATE); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pcreate() failed."; - } + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pcreate() failed."; + } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_link_creation_order(gcpl, H5P_CRT_ORDER_TRACKED); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pset_link_creation_order() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pset_link_creation_order() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, gcpl, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Gcreate2() failed."; - } + if (gid <= 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Gcreate2() failed."; + } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { max_compact = 0; ret = H5Pget_link_phase_change(gcpl, &max_compact, NULL); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pget_link_phase_change() failed."; - } - else if ( nlinks <= max_compact ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: nlinks <= max_compact"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pget_link_phase_change() failed."; + } + else if (nlinks <= max_compact) { + pass = FALSE; + failure_mssg = "ns_grp_d: nlinks <= max_compact"; + } HDassert(ret >= 0); HDassert(nlinks > max_compact); } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { char linkname[16]; - sprintf(linkname, "%u", u); - - if(0 == (u % 3)) { - - ret = H5Lcreate_soft(group_name, gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); + HDsprintf(linkname, "%u", u); - if ( ret < 0 ) { + if (0 == (u % 3)) { + ret = H5Lcreate_soft(group_name, gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); - pass = FALSE; - failure_mssg = "ns_grp_d: H5Lcreate_soft() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_soft() failed."; + } HDassert(ret >= 0); } /* end if */ - else if(1 == (u % 3)) { - - ret = H5Lcreate_hard(fid, "/", gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); - - if ( ret < 0 ) { + else if (1 == (u % 3)) { + ret = H5Lcreate_hard(fid, "/", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); - pass = FALSE; - failure_mssg = "ns_grp_d: H5Lcreate_hard() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_hard() failed."; + } HDassert(ret >= 0); } /* end else-if */ else { - HDassert(2 == (u % 3)); - ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, - H5P_DEFAULT, H5P_DEFAULT); - - if ( ret < 0 ) { + ret = H5Lcreate_external("external.h5", "/ext", gid, linkname, + H5P_DEFAULT, H5P_DEFAULT); - pass = FALSE; - failure_mssg = "ns_grp_d: H5Lcreate_external() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Lcreate_external() failed."; + } HDassert(ret >= 0); } /* end else */ u++; - } /* end while */ - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ns_grp_d: H5Gclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ns_grp_d: H5Gclose() failed."; + } HDassert(ret >= 0); } return; - } /* ns_grp_d() */ /*------------------------------------------------------------------------- * Function: vrfy_ns_grp_d * - * Purpose: Verify a dense "new style" group, with 'nlinks' - * soft/hard/external links in it in the specified file. + * Purpose: Verify a dense "new style" group, with 'nlinks' + * soft/hard/external links in it in the specified file. * * If pass is false on entry, do nothing. * @@ -928,8 +802,7 @@ ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) void -vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) -{ +vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; @@ -937,93 +810,75 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gopen2() failed."; + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gopen2() failed."; } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gget_create_plist() failed."; + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gget_create_plist() failed."; } - assert(gcpl > 0); + HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5Pget_link_creation_order() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Pget_link_creation_order() failed."; } - else if ( H5P_CRT_ORDER_TRACKED != crt_order_flags ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5P_CRT_ORDER_TRACKED != crt_order_flags"; + else if (H5P_CRT_ORDER_TRACKED != crt_order_flags) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5P_CRT_ORDER_TRACKED != crt_order_flags"; } HDassert(ret >= 0); HDassert(H5P_CRT_ORDER_TRACKED == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gget_info() failed."; - } - else if ( H5G_STORAGE_TYPE_DENSE != grp_info.storage_type ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5G_STORAGE_TYPE_DENSE != grp_info.storage_type"; - } - else if ( nlinks != grp_info.nlinks ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.nlinks"; - } - else if ( nlinks != grp_info.max_corder ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.max_corder"; - } - else if ( FALSE != grp_info.mounted ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: FALSE != grp_info.mounted"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gget_info() failed."; + } + else if (H5G_STORAGE_TYPE_DENSE != grp_info.storage_type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5G_STORAGE_TYPE_DENSE != grp_info.storage_type"; + } + else if (nlinks != grp_info.nlinks) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.nlinks"; + } + else if (nlinks != grp_info.max_corder) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: nlinks != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: FALSE != grp_info.mounted"; + } HDassert(ret >= 0); HDassert(H5G_STORAGE_TYPE_DENSE == grp_info.storage_type); HDassert(nlinks == grp_info.nlinks); @@ -1032,116 +887,100 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { H5L_info_t lnk_info; char linkname[16]; htri_t link_exists; - sprintf(linkname, "%u", u); + HDsprintf(linkname, "%u", u); link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); - if ( link_exists < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Lexists() failed."; - } + if (link_exists < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lexists() failed."; + } HDassert(link_exists >= 0); - memset(&lnk_info, 0, sizeof(grp_info)); + HDmemset(&lnk_info, 0, sizeof(grp_info)); ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Lget_info() failed."; - } - else if ( TRUE != lnk_info.corder_valid ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: TRUE != lnk_info.corder_valid"; - } - else if ( u != lnk_info.corder ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: u != lnk_info.corder"; - } - else if ( H5T_CSET_ASCII != lnk_info.cset ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5T_CSET_ASCII != lnk_info.cset"; - } - HDassert(ret >= 0); - HDassert(true == lnk_info.corder_valid); - HDassert(u == lnk_info.corder); - HDassert(H5T_CSET_ASCII == lnk_info.cset); - - if(0 == (u % 3)) { - char *slinkval; - - if ( H5L_TYPE_SOFT != lnk_info.type ) { + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lget_info() failed."; + } + else if (TRUE != lnk_info.corder_valid) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: TRUE != lnk_info.corder_valid"; + } + else if (u != lnk_info.corder) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: u != lnk_info.corder"; + } + else if (H5T_CSET_ASCII != lnk_info.cset) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5T_CSET_ASCII != lnk_info.cset"; + } + HDassert(ret >= 0); + HDassert(true == lnk_info.corder_valid); + HDassert(u == lnk_info.corder); + HDassert(H5T_CSET_ASCII == lnk_info.cset); - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; - } - else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { + if (0 == (u % 3)) { + char *slinkval; - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; - } + if (H5L_TYPE_SOFT != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; + } + else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_SOFT != lnk_info.type"; + } HDassert(H5L_TYPE_SOFT == lnk_info.type); - HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); + HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size); - slinkval = (char *)malloc(lnk_info.u.val_size); + slinkval = (char *) HDmalloc(lnk_info.u.val_size); - if ( ! slinkval ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: malloc of slinkval failed"; - } + if (!slinkval) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: HDmalloc of slinkval failed"; + } HDassert(slinkval); - ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Lget_val() failed"; - } - else if ( 0 != strcmp(slinkval, group_name) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: 0 != strcmp(slinkval, group_name)"; - } + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Lget_val() failed"; + } + else if (0 != HDstrcmp(slinkval, group_name)) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(slinkval, group_name)"; + } HDassert(ret >= 0); - HDassert(0 == strcmp(slinkval, group_name)); + HDassert(0 == HDstrcmp(slinkval, group_name)); - free(slinkval); + HDfree(slinkval); } /* end if */ - else if(1 == (u % 3)) { + else if (1 == (u % 3)) { H5O_info_t root_oinfo; - if ( H5L_TYPE_HARD != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_HARD != lnk_info.type"; - } + if (H5L_TYPE_HARD != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_HARD != lnk_info.type"; + } HDassert(H5L_TYPE_HARD == lnk_info.type); - memset(&root_oinfo, 0, sizeof(root_oinfo)); + HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed."; - } - else if ( root_oinfo.addr != lnk_info.u.address ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: root_oinfo.addr != lnk_info.u.address"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed."; + } + else if (root_oinfo.addr != lnk_info.u.address) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: root_oinfo.addr != lnk_info.u.address"; + } HDassert(ret >= 0); HDassert(root_oinfo.addr == lnk_info.u.address); } /* end else-if */ @@ -1152,72 +991,58 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) HDassert(2 == (u % 3)); - if ( H5L_TYPE_EXTERNAL != lnk_info.type ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: H5L_TYPE_EXTERNAL != lnk_info.type"; - } + if (H5L_TYPE_EXTERNAL != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5L_TYPE_EXTERNAL != lnk_info.type"; + } HDassert(H5L_TYPE_EXTERNAL == lnk_info.type); - elinkval = malloc(lnk_info.u.val_size); - - if ( ! elinkval ) { + elinkval = HDmalloc(lnk_info.u.val_size); - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: malloc of elinkval failed."; - } + if (!elinkval) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: HDmalloc of elinkval failed."; + } HDassert(elinkval); - ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, - H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; + ret = H5Lget_val(gid, linkname, elinkval, lnk_info.u.val_size, + H5P_DEFAULT); + if (ret < 0) { + pass = FALSE; failure_mssg = "vrfy_ns_grp_d: H5Lget_val failed."; } HDassert(ret >= 0); - ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, - &file, &path); - if ( ret < 0 ) { - - pass = FALSE; + ret = H5Lunpack_elink_val(elinkval, lnk_info.u.val_size, NULL, &file, &path); + if (ret < 0) { + pass = FALSE; failure_mssg = "vrfy_ns_grp_d: H5Lunpack_elink_val failed."; } - else if ( 0 != strcmp(file, "external.h5") ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: 0 != strcmp(file, \"external.h5\")."; + else if (0 != HDstrcmp(file, "external.h5")) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(file, \"external.h5\")."; + } + else if (0 != HDstrcmp(path, "/ext")) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: 0 != HDstrcmp(path, \"/ext\")"; } - else if ( 0 != strcmp(path, "/ext") ) { - - pass = FALSE; - failure_mssg = - "vrfy_ns_grp_d: 0 != strcmp(path, \"/ext\")"; - } HDassert(ret >= 0); - HDassert(0 == strcmp(file, "external.h5")); - HDassert(0 == strcmp(path, "/ext")); - - free(elinkval); + HDassert(0 == HDstrcmp(file, "external.h5")); + HDassert(0 == HDstrcmp(path, "/ext")); + HDfree(elinkval); } /* end else */ - u++; - + u++; } /* end while() */ - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ns_grp_d: H5Gclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Gclose() failed."; + } HDassert(ret >= 0); } @@ -1254,21 +1079,17 @@ os_grp_0(hid_t fid, const char *group_name) herr_t ret; if ( pass ) { /* get the file's file access property list */ - fapl = H5Fget_access_plist(fid); if ( fapl <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fget_access_plist() failed."; } HDassert(fapl > 0); } - - if ( pass ) { /* get low and high bounds from fapl */ + if ( pass ) { /* get low and high bounds from fapl */ ret = H5Pget_libver_bounds(fapl, &low, &high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1)."; } @@ -1276,11 +1097,9 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { /* turn file format latest off */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1)."; } @@ -1289,11 +1108,8 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { - - gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT); + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if ( gid <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Gcreate2() failed."; } @@ -1301,11 +1117,9 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { - ret = H5Gclose(gid); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Gclose() failed."; } @@ -1313,11 +1127,9 @@ os_grp_0(hid_t fid, const char *group_name) } if ( pass ) { /* restore low and high bounds */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, low, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1)."; } @@ -1326,7 +1138,6 @@ os_grp_0(hid_t fid, const char *group_name) } return; - } /* os_grp_0() */ @@ -1349,98 +1160,83 @@ os_grp_0(hid_t fid, const char *group_name) */ void -vrfy_os_grp_0(hid_t fid, const char *group_name) -{ +vrfy_os_grp_0(hid_t fid, const char *group_name) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; unsigned crt_order_flags = 0; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gopen2() failed."; - } + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gopen2() failed."; + } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gget_create_plist() failed."; - } + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gget_create_plist() failed."; + } HDassert(gcpl > 0); } - if ( pass ) { + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Pget_link_creation_order() failed"; - } - else if ( 0 != crt_order_flags ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: 0 != crt_order_flags"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Pget_link_creation_order() failed"; + } + else if (0 != crt_order_flags) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != crt_order_flags"; + } HDassert(ret >= 0); HDassert(0 == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gget_info() failed."; - } - else if ( H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; - } - else if ( 0 != grp_info.nlinks ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: 0 != grp_info.nlinks"; - } - else if ( 0 != grp_info.max_corder ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: 0 != grp_info.max_corder"; - } - else if ( FALSE != grp_info.mounted ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: FALSE != grp_info.mounted"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gget_info() failed."; + } + else if (H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; + } + else if (0 != grp_info.nlinks) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != grp_info.nlinks"; + } + else if (0 != grp_info.max_corder) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: 0 != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: FALSE != grp_info.mounted"; + } HDassert(ret >= 0); HDassert(H5G_STORAGE_TYPE_SYMBOL_TABLE == grp_info.storage_type); HDassert(0 == grp_info.nlinks); @@ -1448,28 +1244,25 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) HDassert(false == grp_info.mounted); } - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_0: H5Gclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_0: H5Gclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_os_grp_0() */ /*------------------------------------------------------------------------- * Function: os_grp_n * - * Purpose: Create an "old style" group, with 'nlinks' soft/hard - * links in it. + * Purpose: Create an "old style" group, with 'nlinks' soft/hard + * links in it. * * If pass is false on entry, do nothing. * @@ -1484,7 +1277,7 @@ vrfy_os_grp_0(hid_t fid, const char *group_name) *------------------------------------------------------------------------- */ -void +void os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) { hid_t gid = -1; @@ -1494,10 +1287,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) herr_t ret; if ( pass ) { /* get the file's file access property list */ - fapl = H5Fget_access_plist(fid); if ( fapl <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_n: H5Fget_access_plist() failed."; } @@ -1505,10 +1296,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } if ( pass ) { /* get low and high bounds from fapl */ - ret = H5Pget_libver_bounds(fapl, &low, &high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1)."; } @@ -1516,11 +1305,9 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } if ( pass ) { /* turn file format latest off */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1)."; } @@ -1529,11 +1316,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } if ( pass ) { - - gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, - H5P_DEFAULT); + gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if ( gid <= 0 ) { - pass = FALSE; failure_mssg = "os_grp_n: H5Gcreate2() failed."; } @@ -1544,58 +1328,46 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) u = 0; while ( ( pass ) && ( u < nlinks ) ) { - char linkname[32]; - sprintf(linkname, "ln%d_%u", proc_num, u); + HDsprintf(linkname, "ln%d_%u", proc_num, u); if(0 == (u % 2)) { - - ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); + ret = H5Lcreate_soft(group_name, gid, linkname, H5P_DEFAULT, H5P_DEFAULT); if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "os_grp_n: H5Lcreate_soft() failed."; + pass = FALSE; + failure_mssg = "os_grp_n: H5Lcreate_soft() failed."; } HDassert(ret >= 0); } /* end if */ else { - HDassert(1 == (u % 2)); - ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, - H5P_DEFAULT); + ret = H5Lcreate_hard(fid, "/", gid, linkname, H5P_DEFAULT, H5P_DEFAULT); if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "os_grp_n: H5Lcreate_hard() failed."; + pass = FALSE; + failure_mssg = "os_grp_n: H5Lcreate_hard() failed."; } HDassert(ret >= 0); } /* end else */ - u++; - + u++; } /* end while */ if ( pass ) { - ret = H5Gclose(gid); if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "os_grp_n: H5Gclose() failed."; + pass = FALSE; + failure_mssg = "os_grp_n: H5Gclose() failed."; } - assert(ret >= 0); + HDassert(ret >= 0); } if ( pass ) { /* restore low and high bounds */ - if(low >= H5F_LIBVER_V18) { ret = H5Fset_libver_bounds(fid, low, high); if ( ret < 0 ) { - pass = FALSE; failure_mssg = "os_grp_n: H5Fset_libver_bounds() failed(2)."; } @@ -1626,8 +1398,8 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) *------------------------------------------------------------------------- */ void -vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) -{ +vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, + unsigned nlinks) { hid_t gid = -1; hid_t gcpl = -1; H5G_info_t grp_info; @@ -1635,92 +1407,76 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { gid = H5Gopen2(fid, group_name, H5P_DEFAULT); - if ( gid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gopen2() failed"; - } + if (gid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gopen2() failed"; + } HDassert(gid > 0); } - if ( pass ) { - + if (pass) { gcpl = H5Gget_create_plist(gid); - if ( gcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gget_create_plist() failed"; - } + if (gcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gget_create_plist() failed"; + } HDassert(gcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pget_link_creation_order(gcpl, &crt_order_flags); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Pget_link_creation_order"; - } - else if ( 0 != crt_order_flags ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: 0 != crt_order_flags"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Pget_link_creation_order"; + } + else if (0 != crt_order_flags) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != crt_order_flags"; + } HDassert(ret >= 0); HDassert(0 == crt_order_flags); } - if ( pass ) { - + if (pass) { ret = H5Pclose(gcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Pclose() failed"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Pclose() failed"; + } HDassert(ret >= 0); } - if ( pass ) { - - memset(&grp_info, 0, sizeof(grp_info)); + if (pass) { + HDmemset(&grp_info, 0, sizeof(grp_info)); ret = H5Gget_info(gid, &grp_info); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gget_info() failed"; - } - else if ( H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; - } - else if ( nlinks != grp_info.nlinks ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: nlinks != grp_info.nlinks"; - } - else if ( 0 != grp_info.max_corder ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: 0 != grp_info.max_corder"; - } - else if ( FALSE != grp_info.mounted ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: FALSE != grp_info.mounted"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gget_info() failed"; + } + else if (H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5G_STORAGE_TYPE_SYMBOL_TABLE != grp_info.storage_type"; + } + else if (nlinks != grp_info.nlinks) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: nlinks != grp_info.nlinks"; + } + else if (0 != grp_info.max_corder) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != grp_info.max_corder"; + } + else if ( FALSE != grp_info.mounted) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: FALSE != grp_info.mounted"; + } HDassert(ret >= 0); HDassert(H5G_STORAGE_TYPE_SYMBOL_TABLE == grp_info.storage_type); HDassert(nlinks == grp_info.nlinks); @@ -1729,137 +1485,117 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) } u = 0; - while ( ( pass ) && ( u < nlinks ) ) { - + while ((pass) && (u < nlinks)) { H5L_info_t lnk_info; char linkname[32]; htri_t link_exists; - sprintf(linkname, "ln%d_%u", proc_num, u); + HDsprintf(linkname, "ln%d_%u", proc_num, u); link_exists = H5Lexists(gid, linkname, H5P_DEFAULT); - if ( link_exists < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Lexists() failed"; + if (link_exists < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lexists() failed"; } HDassert(link_exists >= 0); - memset(&lnk_info, 0, sizeof(grp_info)); + HDmemset(&lnk_info, 0, sizeof(grp_info)); ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Lget_info() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lget_info() failed"; } - else if ( FALSE != lnk_info.corder_valid ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: FALSE != lnk_info.corder_valid"; + else if ( FALSE != lnk_info.corder_valid) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: FALSE != lnk_info.corder_valid"; } - else if ( H5T_CSET_ASCII != lnk_info.cset ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5T_CSET_ASCII != lnk_info.cset"; + else if (H5T_CSET_ASCII != lnk_info.cset) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5T_CSET_ASCII != lnk_info.cset"; } HDassert(ret >= 0); HDassert(false == lnk_info.corder_valid); HDassert(H5T_CSET_ASCII == lnk_info.cset); - if(0 == (u % 2)) { + if (0 == (u % 2)) { char *slinkval; - if ( H5L_TYPE_SOFT != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5L_TYPE_SOFT != lnk_info.type"; + if (H5L_TYPE_SOFT != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5L_TYPE_SOFT != lnk_info.type"; } - else if ( (strlen(group_name) + 1) != lnk_info.u.val_size ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: (strlen(group_name) + 1) != lnk_info.u.val_size"; + else if ((HDstrlen(group_name) + 1) != lnk_info.u.val_size) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: (HDstrlen(group_name) + 1) != lnk_info.u.val_size"; } HDassert(H5L_TYPE_SOFT == lnk_info.type); - HDassert((strlen(group_name) + 1) == lnk_info.u.val_size); + HDassert((HDstrlen(group_name) + 1) == lnk_info.u.val_size); - slinkval = (char *)malloc(lnk_info.u.val_size); + slinkval = (char *) HDmalloc(lnk_info.u.val_size); - if ( ! slinkval ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: malloc of slinkval failed"; + if (!slinkval) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: HDmalloc of slinkval failed"; } HDassert(slinkval); - ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, - H5P_DEFAULT); + ret = H5Lget_val(gid, linkname, slinkval, lnk_info.u.val_size, + H5P_DEFAULT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Lget_val() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Lget_val() failed"; } - else if ( 0 != strcmp(slinkval, group_name) ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: 0 != strcmp(slinkval, group_name)"; + else if (0 != HDstrcmp(slinkval, group_name)) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: 0 != HDstrcmp(slinkval, group_name)"; } HDassert(ret >= 0); - HDassert(0 == strcmp(slinkval, group_name)); + HDassert(0 == HDstrcmp(slinkval, group_name)); - free(slinkval); + HDfree(slinkval); } /* end if */ else { H5O_info_t root_oinfo; HDassert(1 == (u % 2)); - if ( H5L_TYPE_HARD != lnk_info.type ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5L_TYPE_HARD != lnk_info.type"; + if (H5L_TYPE_HARD != lnk_info.type) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5L_TYPE_HARD != lnk_info.type"; } HDassert(H5L_TYPE_HARD == lnk_info.type); - memset(&root_oinfo, 0, sizeof(root_oinfo)); + HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed."; } - else if ( root_oinfo.addr != lnk_info.u.address ) { - - pass = FALSE; - failure_mssg = - "vrfy_os_grp_n: root_oinfo.addr != lnk_info.u.address"; + else if (root_oinfo.addr != lnk_info.u.address) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: root_oinfo.addr != lnk_info.u.address"; } HDassert(ret >= 0); HDassert(root_oinfo.addr == lnk_info.u.address); } /* end else */ - u++; - + u++; } /* end while */ - if ( pass ) { - + if (pass) { ret = H5Gclose(gid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_os_grp_n: H5Gclose() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Gclose() failed."; } HDassert(ret >= 0); } return; - } /* vrfy_os_grp_n() */ @@ -1867,8 +1603,8 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) * Function: ds_ctg_i * * Purpose: Create a contiguous dataset w/int datatype. Write data - * to the data set or not as indicated by the write_data - * parameter. + * to the data set or not as indicated by the write_data + * parameter. * * If pass is false on entry, do nothing. * @@ -1882,106 +1618,91 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) * *------------------------------------------------------------------------- */ -void -ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *wdata = NULL; unsigned u; hid_t dsid = -1; hid_t sid = -1; - hsize_t dims[1] = {DSET_DIMS}; + hsize_t dims[1] = { DSET_DIMS }; herr_t ret; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Screate_simple() failed"; + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Screate_simple() failed"; } HDassert(sid > 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); - - if ( dsid <= 0 ) { + if (pass) { + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Dcreate2() failed"; + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dcreate2() failed"; } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Sclose() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Sclose() failed"; } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (int *)malloc(sizeof(int) * DSET_DIMS); + if ((pass) && (write_data)) { + wdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - if ( ! wdata ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: malloc of wdata failed."; + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_ctg_i: HDmalloc of wdata failed."; } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) - - wdata[u] = (int)u; + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) + wdata[u] = (int) u; - ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, wdata); + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Dwrite() failed."; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dwrite() failed."; } HDassert(ret >= 0); - free(wdata); - } - - if ( pass ) { + HDfree(wdata); + } + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_i: H5Dclose() failed"; + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_i: H5Dclose() failed"; } HDassert(ret >= 0); } return; - } /* ds_ctg_i */ /*------------------------------------------------------------------------- * Function: vrfy_ds_ctg_i * - * Purpose: Validate a contiguous datasets w/int datatypes. Validate - * data if indicated via the write_data parameter. + * Purpose: Validate a contiguous datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -1995,9 +1716,8 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *rdata = NULL; unsigned u; hid_t dsid = -1; @@ -2011,225 +1731,187 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) htri_t type_equal; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_space() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_space() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Sget_simple_extent_dims() failed"; - } - else if ( DSET_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != dims[0]"; - } - else if ( DSET_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != dims[0]"; + } + else if ( DSET_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: DSET_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_DIMS == dims[0]); HDassert(DSET_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, H5T_NATIVE_INT); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: type not H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: type not H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Tclose() failed."; - } - assert(ret >= 0); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Tclose() failed."; + } + HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_space_status() failed."; - } - else if ( write_data && ( allocation != H5D_SPACE_STATUS_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_ctg_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; - } - else if ( !write_data && - ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_space_status() failed."; + } + else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if (!write_data + && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } HDassert(ret >= 0); - HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || - (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) + || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_CONTIGUOUS != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5D_CONTIGUOUS != layout"; - } + if (H5D_CONTIGUOUS != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5D_CONTIGUOUS != layout"; + } HDassert(H5D_CONTIGUOUS == layout); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { + if ((pass) && (write_data)) { + rdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - rdata = (int *)malloc(sizeof(int) * DSET_DIMS); - - if ( ! rdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dread() failed."; - } + if ((pass) && (write_data)) { + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, rdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) { - - if ( (int)u != rdata[u] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: u != rdata[u]."; - break; - } - HDassert((int)u == rdata[u]); - } + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) { + if ((int) u != rdata[u]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: u != rdata[u]."; + break; + } + HDassert((int )u == rdata[u]); + } - free(rdata); + HDfree(rdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_i: H5Dclose() failed"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_i: H5Dclose() failed"; + } HDassert(ret >= 0); } @@ -2242,8 +1924,8 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) * Function: ds_chk_i * * Purpose: Create a chunked dataset w/int datatype. Write data - * to the data set or not as indicated by the write_data - * parameter. + * to the data set or not as indicated by the write_data + * parameter. * * If pass is false on entry, do nothing. * @@ -2257,142 +1939,121 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *wdata = NULL; unsigned u; hid_t dsid = -1; hid_t dcpl = -1; hid_t sid = -1; - hsize_t dims[1] = {DSET_DIMS}; - hsize_t chunk_dims[1] = {DSET_CHUNK_DIMS}; + hsize_t dims[1] = { DSET_DIMS }; + hsize_t chunk_dims[1] = { DSET_CHUNK_DIMS }; herr_t ret; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Screate_simple() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Screate_simple() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { dcpl = H5Pcreate(H5P_DATASET_CREATE); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Pcreate() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pcreate() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_chunk(dcpl, 1, chunk_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Pset_chunk() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pset_chunk() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, - H5P_DEFAULT, dcpl, H5P_DEFAULT); - - if ( dsid <= 0 ) { + if (pass) { + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, + H5P_DEFAULT, dcpl, H5P_DEFAULT); - pass = FALSE; - failure_mssg = "ds_chk_i: H5Dcreate2() failed"; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dcreate2() failed"; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (int *)malloc(sizeof(int) * DSET_DIMS); + if ((pass) && (write_data)) { + wdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - if ( ! wdata ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: malloc of wdata failed."; - } + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_chk_i: HDmalloc of wdata failed."; + } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) - wdata[u] = (int)u; - - ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, wdata); - if ( ret < 0 ) { + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) + wdata[u] = (int) u; - pass = FALSE; - failure_mssg = "ds_chk_i: H5Dwrite() failed."; - } + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dwrite() failed."; + } HDassert(ret >= 0); - - free(wdata); + HDfree(wdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_chk_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_chk_i: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* ds_chk_i */ /*------------------------------------------------------------------------- * Function: vrfy_ds_chk_i * - * Purpose: Validate a chunked datasets w/int datatypes. Validate - * data if indicated via the write_data parameter. + * Purpose: Validate a chunked datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -2406,9 +2067,8 @@ ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *rdata = NULL; unsigned u; hid_t dsid = -1; @@ -2422,249 +2082,204 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) htri_t type_equal; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_space() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_space() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Sget_simple_extent_dims() failed"; - } - else if ( DSET_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != dims[0]"; - } - else if ( DSET_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != dims[0]"; + } + else if ( DSET_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: DSET_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_DIMS == dims[0]); HDassert(DSET_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, H5T_NATIVE_INT); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: tid != H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: tid != H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_space_status() failed."; - } - else if ( write_data && ( allocation != H5D_SPACE_STATUS_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_chk_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; - } - else if ( !write_data && - ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_space_status() failed."; + } + else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if (!write_data && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } HDassert(ret >= 0); - HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || - (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) + || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_CHUNKED != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5D_CHUNKED != layout"; - } + if (H5D_CHUNKED != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5D_CHUNKED != layout"; + } HDassert(H5D_CHUNKED == layout); } - if ( pass ) { - + if (pass) { ret = H5Pget_chunk(dcpl, 1, chunk_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Pget_chunk"; - } - else if ( DSET_CHUNK_DIMS != chunk_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: "; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Pget_chunk"; + } + else if ( DSET_CHUNK_DIMS != chunk_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: "; + } HDassert(ret >= 0); HDassert(DSET_CHUNK_DIMS == chunk_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { + if ((pass) && (write_data)) { + rdata = (int *) HDmalloc(sizeof(int) * DSET_DIMS); - rdata = (int *)malloc(sizeof(int) * DSET_DIMS); - - if ( ! rdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dread() failed."; - } + if ((pass) && (write_data)) { + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_DIMS; u++) { - - if ( (int)u != rdata[u] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: u != rdata[u]"; - break; - } - HDassert((int)u == rdata[u]); + if ((pass) && (write_data)) { + for (u = 0; u < DSET_DIMS; u++) { + if ((int) u != rdata[u]) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: u != rdata[u]"; + break; + } + HDassert((int )u == rdata[u]); } - free(rdata); + HDfree(rdata); } /* end if */ - - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_chk_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_chk_i: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_ds_chk_i() */ @@ -2672,8 +2287,8 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) * Function: ds_cpt_i * * Purpose: Create a compact dataset w/int datatype. Write data - * to the data set or not as indicated by the write_data - * parameter. + * to the data set or not as indicated by the write_data + * parameter. * * If pass is false on entry, do nothing. * @@ -2687,129 +2302,110 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *wdata = NULL; unsigned u; hid_t dsid = -1; hid_t dcpl = -1; hid_t sid = -1; - hsize_t dims[1] = {DSET_COMPACT_DIMS}; + hsize_t dims[1] = { DSET_COMPACT_DIMS }; herr_t ret; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Screate_simple() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Screate_simple() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { dcpl = H5Pcreate(H5P_DATASET_CREATE); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Pcreate() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pcreate() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { ret = H5Pset_layout(dcpl, H5D_COMPACT); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Pset_layout() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pset_layout() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, - H5P_DEFAULT, dcpl, H5P_DEFAULT); - - if ( dsid <= 0 ) { + if (pass) { + dsid = H5Dcreate2(fid, dset_name, H5T_NATIVE_INT, sid, + H5P_DEFAULT, dcpl, H5P_DEFAULT); - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Dcreate2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dcreate2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - wdata = (int *)malloc(sizeof(int) * DSET_COMPACT_DIMS); + if ((pass) && (write_data)) { + wdata = (int *) HDmalloc(sizeof(int) * DSET_COMPACT_DIMS); - if ( ! wdata ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: malloc of wdata failed."; - } + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_cpt_i: HDmalloc of wdata failed."; + } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_COMPACT_DIMS; u++) - wdata[u] = (int)u; - - ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, wdata); + if ((pass) && (write_data)) { + for (u = 0; u < DSET_COMPACT_DIMS; u++) + wdata[u] = (int) u; - if ( ret < 0 ) { + ret = H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wdata); - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Dwrite() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dwrite() failed."; + } HDassert(ret >= 0); - free(wdata); + HDfree(wdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_cpt_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_cpt_i: H5Dclose() failed."; + } HDassert(ret >= 0); } @@ -2821,8 +2417,8 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) /*------------------------------------------------------------------------- * Function: vrfy_ds_cpt_i * - * Purpose: Validate a compact datasets w/int datatypes. Validate - * data if indicated via the write_data parameter. + * Purpose: Validate a compact datasets w/int datatypes. Validate + * data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -2836,9 +2432,8 @@ ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) { int *rdata = NULL; unsigned u; hid_t dsid = -1; @@ -2850,234 +2445,197 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) int ndims; hsize_t dims[1], max_dims[1]; htri_t type_equal; - herr_t ret; - - if ( pass ) { + herr_t ret; + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_space() failed."; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_space() failed."; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Sget_simple_extent_dims() failed"; - } - else if ( DSET_COMPACT_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != dims[0]"; - } - else if ( DSET_COMPACT_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Sget_simple_extent_dims() failed"; + } + else if ( DSET_COMPACT_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != dims[0]"; + } + else if ( DSET_COMPACT_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: DSET_COMPACT_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_COMPACT_DIMS == dims[0]); HDassert(DSET_COMPACT_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, H5T_NATIVE_INT); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: type != H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: type != H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_space_status() failed."; - } - else if ( H5D_SPACE_STATUS_ALLOCATED != allocation ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_cpt_i: H5D_SPACE_STATUS_ALLOCATED != allocation"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_space_status() failed."; + } + else if (H5D_SPACE_STATUS_ALLOCATED != allocation) { + pass = FALSE; + failure_mssg = + "vrfy_ds_cpt_i: H5D_SPACE_STATUS_ALLOCATED != allocation"; + } HDassert(ret >= 0); HDassert(H5D_SPACE_STATUS_ALLOCATED == allocation); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_COMPACT != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5D_COMPACT != layout"; - } + if (H5D_COMPACT != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5D_COMPACT != layout"; + } HDassert(H5D_COMPACT == layout); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Pclose() failed."; + } HDassert(ret >= 0); - } - - if ( ( pass ) && ( write_data ) ) { - - rdata = (int *)malloc(sizeof(int) * DSET_COMPACT_DIMS); + } - if ( ! rdata ) { + if ((pass) && (write_data)) { + rdata = (int *) HDmalloc(sizeof(int) * DSET_COMPACT_DIMS); - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dread() failed."; - } + if ((pass) && (write_data)) { + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, rdata); + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_COMPACT_DIMS; u++) { - - if ( (int)u != rdata[u] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: (int)u != rdata[u]"; - break; - } - HDassert((int)u == rdata[u]); + if ((pass) && (write_data)) { + for (u = 0; u < DSET_COMPACT_DIMS; u++) { + if ((int) u != rdata[u]) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: (int)u != rdata[u]"; + break; + } + HDassert((int )u == rdata[u]); } - free(rdata); + HDfree(rdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_cpt_i: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_cpt_i: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_ds_cpt_i() */ /*------------------------------------------------------------------------- * Function: ds_ctg_v * - * Purpose: Create a contiguous dataset w/variable-length datatype. - * Write data to the data set or not as indicated by the - * write_data parameter. + * Purpose: Create a contiguous dataset w/variable-length datatype. + * Write data to the data set or not as indicated by the + * write_data parameter. * * If pass is false on entry, do nothing. * @@ -3091,166 +2649,142 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) { hid_t dsid = -1; hid_t sid = -1; hid_t tid = -1; - hsize_t dims[1] = {DSET_SMALL_DIMS}; + hsize_t dims[1] = { DSET_SMALL_DIMS }; herr_t ret; hvl_t *wdata = NULL; unsigned u; - if ( pass ) { - + if (pass) { sid = H5Screate_simple(1, dims, NULL); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Screate_simple"; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Screate_simple"; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { tid = H5Tvlen_create(H5T_NATIVE_INT); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Tvlen_create() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Tvlen_create() failed."; + } HDassert(tid > 0); } - if ( pass ) { - - dsid = H5Dcreate2(fid, dset_name, tid, sid, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); - - if ( dsid <= 0 ) { + if (pass) { + dsid = H5Dcreate2(fid, dset_name, tid, sid, H5P_DEFAULT, + H5P_DEFAULT, H5P_DEFAULT); - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dcreate2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dcreate2() failed."; + } HDassert(dsid > 0); } - if ( ( pass ) && ( write_data ) ) { + if ((pass) && (write_data)) { + wdata = (hvl_t *) HDmalloc(sizeof(hvl_t) * DSET_SMALL_DIMS); - wdata = (hvl_t *)malloc(sizeof(hvl_t) * DSET_SMALL_DIMS); - - if ( ! wdata ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: malloc of wdata failed."; - } + if (!wdata) { + pass = FALSE; + failure_mssg = "ds_ctg_v: HDmalloc of wdata failed."; + } HDassert(wdata); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_SMALL_DIMS; u++) { - + if ((pass) && (write_data)) { + for (u = 0; u < DSET_SMALL_DIMS; u++) { int *tdata; unsigned len; unsigned v; len = (u % 10) + 1; - tdata = (int *)malloc(sizeof(int) * len); + tdata = (int *) HDmalloc(sizeof(int) * len); - if ( !tdata ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: malloc of tdata failed."; - break; - } + if (!tdata) { + pass = FALSE; + failure_mssg = "ds_ctg_v: HDmalloc of tdata failed."; + break; + } HDassert(tdata); - for(v = 0; v < len; v++) - tdata[v] = (int)(u + v); + for (v = 0; v < len; v++) + tdata[v] = (int) (u + v); - wdata[u].len = len; - wdata[u].p = tdata; + wdata[u].len = len; + wdata[u].p = tdata; } /* end for */ } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dwrite(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dwrite() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dwrite() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, wdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dvlen_reclaim() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dvlen_reclaim() failed."; + } HDassert(ret >= 0); - free(wdata); - + HDfree(wdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( sid < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Sclose() failed."; - } + if (sid < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( tid < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Tclose() failed."; - } + if (tid < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "ds_ctg_v: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "ds_ctg_v: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* ds_ctg_v() */ /*------------------------------------------------------------------------- * Function: vrfy_ds_ctg_v * - * Purpose: Validate a contiguous datasets w/variable-length datatypes. - * Validate data if indicated via the write_data parameter. + * Purpose: Validate a contiguous datasets w/variable-length datatypes. + * Validate data if indicated via the write_data parameter. * * If pass is false on entry, do nothing. * @@ -3264,9 +2798,8 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) * *------------------------------------------------------------------------- */ -void -vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) -{ +void +vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) { hid_t dsid = -1; hid_t sid = -1; hid_t tid = -1; @@ -3281,283 +2814,240 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) unsigned u; herr_t ret; - if ( pass ) { - + if (pass) { dsid = H5Dopen2(fid, dset_name, H5P_DEFAULT); - if ( dsid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dopen2() failed."; - } + if (dsid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dopen2() failed."; + } HDassert(dsid > 0); } - if ( pass ) { - + if (pass) { sid = H5Dget_space(dsid); - if ( sid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_space() failed"; - } + if (sid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_space() failed"; + } HDassert(sid > 0); } - if ( pass ) { - + if (pass) { ndims = H5Sget_simple_extent_ndims(sid); - if ( 1 != ndims ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: 1 != ndims"; - } + if (1 != ndims) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: 1 != ndims"; + } HDassert(1 == ndims); } - if ( pass ) { - + if (pass) { ret = H5Sget_simple_extent_dims(sid, dims, max_dims); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Sget_simple_extent_dims() failed."; - } - else if ( DSET_SMALL_DIMS != dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != dims[0]"; - } - else if ( DSET_SMALL_DIMS != max_dims[0] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != max_dims[0]"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Sget_simple_extent_dims() failed."; + } + else if ( DSET_SMALL_DIMS != dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != dims[0]"; + } + else if ( DSET_SMALL_DIMS != max_dims[0]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: DSET_SMALL_DIMS != max_dims[0]"; + } HDassert(ret >= 0); HDassert(DSET_SMALL_DIMS == dims[0]); HDassert(DSET_SMALL_DIMS == max_dims[0]); } - if ( pass ) { - + if (pass) { tid = H5Dget_type(dsid); - if ( tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_type() failed."; - } + if (tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_type() failed."; + } HDassert(tid > 0); } - if ( pass ) { - + if (pass) { tmp_tid = H5Tvlen_create(H5T_NATIVE_INT); - if ( tmp_tid <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Tvlen_create() failed."; - } + if (tmp_tid <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tvlen_create() failed."; + } HDassert(tmp_tid > 0); } - if ( pass ) { - + if (pass) { type_equal = H5Tequal(tid, tmp_tid); - if ( 1 != type_equal ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: type != vlen H5T_NATIVE_INT"; - } + if (1 != type_equal) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: type != vlen H5T_NATIVE_INT"; + } HDassert(1 == type_equal); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tmp_tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dget_space_status(dsid, &allocation); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_space_status() failed"; - } - else if ( write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED) ) { - - pass = FALSE; - failure_mssg = - "vrfy_ds_ctg_v: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; - } - else if ( !write_data && - ( allocation != H5D_SPACE_STATUS_NOT_ALLOCATED ) ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_space_status() failed"; + } + else if (write_data && (allocation != H5D_SPACE_STATUS_ALLOCATED)) { + pass = FALSE; + failure_mssg = + "vrfy_ds_ctg_v: write_data && allocation != H5D_SPACE_STATUS_ALLOCATED"; + } + else if (!write_data + && (allocation != H5D_SPACE_STATUS_NOT_ALLOCATED)) { + pass = FALSE; + failure_mssg = + "vrfy_ds_ctg_v: !write_data && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED"; + } HDassert(ret >= 0); - HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) || - (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); + HDassert((write_data && allocation == H5D_SPACE_STATUS_ALLOCATED) + || (!write_data && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED)); } - if ( pass ) { - + if (pass) { dcpl = H5Dget_create_plist(dsid); - if ( dcpl <= 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dget_create_plist() failed."; - } + if (dcpl <= 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dget_create_plist() failed."; + } HDassert(dcpl > 0); } - if ( pass ) { - + if (pass) { layout = H5Pget_layout(dcpl); - if ( H5D_CONTIGUOUS != layout ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5D_CONTIGUOUS != layout"; - } + if (H5D_CONTIGUOUS != layout) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5D_CONTIGUOUS != layout"; + } HDassert(H5D_CONTIGUOUS == layout); } - if ( pass ) { - + if (pass) { ret = H5Pclose(dcpl); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Pclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Pclose() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { + if ((pass) && (write_data)) { + rdata = (hvl_t *) HDmalloc(sizeof(hvl_t) * DSET_SMALL_DIMS); - rdata = (hvl_t *)malloc(sizeof(hvl_t) * DSET_SMALL_DIMS); - - if ( !rdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: malloc of rdata failed."; - } + if (!rdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: HDmalloc of rdata failed."; + } HDassert(rdata); } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dread(dsid, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dread() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dread() failed."; + } HDassert(ret >= 0); } - if ( ( pass ) && ( write_data ) ) { - - for(u = 0; u < DSET_SMALL_DIMS; u++) { + if ((pass) && (write_data)) { + for (u = 0; u < DSET_SMALL_DIMS; u++) { unsigned len; unsigned v; - len = (unsigned)rdata[u].len; - for(v = 0; v < len; v++) { - int *tdata = (int *)rdata[u].p; - - if ( !tdata ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: !tdata"; - break; - } - else if ( (int)(u + v) != tdata[v] ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: (int)(u + v) != tdata[v]"; - break; - } + len = (unsigned) rdata[u].len; + for (v = 0; v < len; v++) { + int *tdata = (int *) rdata[u].p; + + if (!tdata) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: !tdata"; + break; + } + else if ((int) (u + v) != tdata[v]) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: (int)(u + v) != tdata[v]"; + break; + } HDassert(tdata); - HDassert((int)(u + v) == tdata[v]); + HDassert((int )(u + v) == tdata[v]); } /* end for */ } /* end for */ } - if ( ( pass ) && ( write_data ) ) { - + if ((pass) && (write_data)) { ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, rdata); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dvlen_reclaim() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dvlen_reclaim() failed."; + } HDassert(ret >= 0); - free(rdata); + HDfree(rdata); } /* end if */ - if ( pass ) { - + if (pass) { ret = H5Sclose(sid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Sclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Sclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Tclose(tid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Tclose() failed."; + } HDassert(ret >= 0); } - if ( pass ) { - + if (pass) { ret = H5Dclose(dsid); - if ( ret < 0 ) { - - pass = FALSE; - failure_mssg = "vrfy_ds_ctg_v: H5Dclose() failed."; - } + if (ret < 0) { + pass = FALSE; + failure_mssg = "vrfy_ds_ctg_v: H5Dclose() failed."; + } HDassert(ret >= 0); } return; - } /* vrfy_ds_ctg_v() */ - + /*------------------------------------------------------------------------- * Function: create_zoo * @@ -3596,203 +3086,202 @@ create_zoo(hid_t fid, const char *base_path, int proc_num) /* Add & verify an empty "new style" group */ if ( pass ) { - sprintf(full_path, "%s/A", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/A", base_path); + HDassert(HDstrlen(full_path) < 1024); ns_grp_0(fid, full_path); } if ( pass ) { - sprintf(full_path, "%s/A", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/A", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_0(fid, full_path); } /* Add & verify a compact "new style" group (3 link messages) */ if ( pass ) { - sprintf(full_path, "%s/B", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/B", base_path); + HDassert(HDstrlen(full_path) < 1024); ns_grp_c(fid, full_path, 3); } if ( pass ) { - sprintf(full_path, "%s/B", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/B", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_c(fid, full_path, 3); } - /* Add & verify a dense "new style" group (w/300 links, in v2 B-tree & + /* Add & verify a dense "new style" group (w/300 links, in v2 B-tree & * fractal heap) */ if ( pass ) { - sprintf(full_path, "%s/C", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/C", base_path); + HDassert(HDstrlen(full_path) < 1024); ns_grp_d(fid, full_path, 300); } if ( pass ) { - sprintf(full_path, "%s/C", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/C", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_d(fid, full_path, 300); } /* Add & verify an empty "old style" group to file */ if ( pass ) { - sprintf(full_path, "%s/D", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/D", base_path); + HDassert(HDstrlen(full_path) < 1024); os_grp_0(fid, full_path); } if ( pass ) { - sprintf(full_path, "%s/D", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/D", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_0(fid, full_path); } - /* Add & verify an "old style" group (w/300 links, in v1 B-tree & - * local heap) to file + /* Add & verify an "old style" group (w/300 links, in v1 B-tree & + * local heap) to file */ if ( pass ) { - sprintf(full_path, "%s/E", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/E", base_path); + HDassert(HDstrlen(full_path) < 1024); os_grp_n(fid, full_path, proc_num, 300); } if ( pass ) { - sprintf(full_path, "%s/E", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/E", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_n(fid, full_path, proc_num, 300); } - /* Add & verify a contiguous dataset w/integer datatype (but no data) - * to file + /* Add & verify a contiguous dataset w/integer datatype (but no data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/F", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/F", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_i(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/F", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/F", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, FALSE); } - /* Add & verify a contiguous dataset w/integer datatype (with data) - * to file + /* Add & verify a contiguous dataset w/integer datatype (with data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/G", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/G", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_i(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/G", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/G", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, TRUE); } - /* Add & verify a chunked dataset w/integer datatype (but no data) - * to file + /* Add & verify a chunked dataset w/integer datatype (but no data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/H", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/H", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_chk_i(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/H", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/H", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, FALSE); } - /* Add & verify a chunked dataset w/integer datatype (and data) - * to file + /* Add & verify a chunked dataset w/integer datatype (and data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/I", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/I", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_chk_i(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/I", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/I", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, TRUE); } - /* Add & verify a compact dataset w/integer datatype (but no data) - * to file + /* Add & verify a compact dataset w/integer datatype (but no data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/J", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/J", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_cpt_i(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/J", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/J", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, FALSE); } - /* Add & verify a compact dataset w/integer datatype (and data) - * to file + /* Add & verify a compact dataset w/integer datatype (and data) + * to file */ if ( pass ) { - sprintf(full_path, "%s/K", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/K", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_cpt_i(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/K", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/K", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, TRUE); } - /* Add & verify a contiguous dataset w/variable-length datatype - * (but no data) to file + /* Add & verify a contiguous dataset w/variable-length datatype + * (but no data) to file */ if ( pass ) { - sprintf(full_path, "%s/L", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/L", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_v(fid, full_path, FALSE); } if ( pass ) { - sprintf(full_path, "%s/L", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/L", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, FALSE); } - /* Add & verify a contiguous dataset w/variable-length datatype - * (and data) to file + /* Add & verify a contiguous dataset w/variable-length datatype + * (and data) to file */ if ( pass ) { - sprintf(full_path, "%s/M", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/M", base_path); + HDassert(HDstrlen(full_path) < 1024); ds_ctg_v(fid, full_path, TRUE); } if ( pass ) { - sprintf(full_path, "%s/M", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/M", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, TRUE); } return; - } /* create_zoo() */ - + /*------------------------------------------------------------------------- * Function: validate_zoo * - * Purpose: Given the path to a group in which a "zoo" has been - * constructed, validate the objects in the "zoo". + * Purpose: Given the path to a group in which a "zoo" has been + * constructed, validate the objects in the "zoo". * * If pass is false on entry, do nothing. * @@ -3824,116 +3313,115 @@ validate_zoo(hid_t fid, const char *base_path, int proc_num) /* validate an empty "new style" group */ if ( pass ) { - sprintf(full_path, "%s/A", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/A", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_0(fid, full_path); } /* validate a compact "new style" group (3 link messages) */ if ( pass ) { - sprintf(full_path, "%s/B", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/B", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_c(fid, full_path, 3); } - /* validate a dense "new style" group (w/300 links, in v2 B-tree & + /* validate a dense "new style" group (w/300 links, in v2 B-tree & * fractal heap) */ if ( pass ) { - sprintf(full_path, "%s/C", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/C", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ns_grp_d(fid, full_path, 300); } /* validate an empty "old style" group in file */ if ( pass ) { - sprintf(full_path, "%s/D", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/D", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_0(fid, full_path); } - /* validate an "old style" group (w/300 links, in v1 B-tree & + /* validate an "old style" group (w/300 links, in v1 B-tree & * local heap) */ if ( pass ) { - sprintf(full_path, "%s/E", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/E", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_os_grp_n(fid, full_path, proc_num, 300); } - /* validate a contiguous dataset w/integer datatype (but no data) - * in file. + /* validate a contiguous dataset w/integer datatype (but no data) + * in file. */ if ( pass ) { - sprintf(full_path, "%s/F", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/F", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, FALSE); } - /* validate a contiguous dataset w/integer datatype (with data) - * in file. + /* validate a contiguous dataset w/integer datatype (with data) + * in file. */ if ( pass ) { - sprintf(full_path, "%s/G", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/G", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_i(fid, full_path, TRUE); } - /* validate a chunked dataset w/integer datatype (but no data) - * in file + /* validate a chunked dataset w/integer datatype (but no data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/H", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/H", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, FALSE); } - /* validate a chunked dataset w/integer datatype (and data) - * in file + /* validate a chunked dataset w/integer datatype (and data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/I", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/I", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_chk_i(fid, full_path, TRUE); } - /* Validate a compact dataset w/integer datatype (but no data) - * in file + /* Validate a compact dataset w/integer datatype (but no data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/J", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/J", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, FALSE); } - /* validate a compact dataset w/integer datatype (and data) - * in file + /* validate a compact dataset w/integer datatype (and data) + * in file */ if ( pass ) { - sprintf(full_path, "%s/K", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/K", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_cpt_i(fid, full_path, TRUE); } - /* validate a contiguous dataset w/variable-length datatype - * (but no data) to file + /* validate a contiguous dataset w/variable-length datatype + * (but no data) to file */ if ( pass ) { - sprintf(full_path, "%s/L", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/L", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, FALSE); } - /* validate a contiguous dataset w/variable-length datatype - * (and data) to file + /* validate a contiguous dataset w/variable-length datatype + * (and data) to file */ if ( pass ) { - sprintf(full_path, "%s/M", base_path); - HDassert(strlen(full_path) < 1024); + HDsprintf(full_path, "%s/M", base_path); + HDassert(HDstrlen(full_path) < 1024); vrfy_ds_ctg_v(fid, full_path, TRUE); } return; - } /* validate_zoo() */ diff --git a/test/ohdr.c b/test/ohdr.c index 146245f..669b1e0 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -470,8 +470,8 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) /* create a different name for a local copy of the data file to be opened with rd/wr file permissions in case build and test are done in the source directory. */ - HDstrncpy(testfile, FILE_BOGUS, strlen(FILE_BOGUS)); - testfile[strlen(FILE_BOGUS)]='\0'; + HDstrncpy(testfile, FILE_BOGUS, HDstrlen(FILE_BOGUS)); + testfile[HDstrlen(FILE_BOGUS)]='\0'; HDstrncat(testfile, ".copy", 5); /* Make a copy of the data file from svn. */ diff --git a/test/tmisc.c b/test/tmisc.c index 1e62302..22e1aad 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2272,7 +2272,7 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char CHECK_PTR(user_block, "HDcalloc"); /* Copy in the user block data */ - HDmemcpy(user_block, str, strlen(str)); + HDmemcpy(user_block, str, HDstrlen(str)); /* Open the new file */ new_fp = HDfopen(new_name,"wb"); diff --git a/test/tunicode.c b/test/tunicode.c index 85f5af0..e0e1f24 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -164,7 +164,7 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string, each with a * terminating NULL. It will look like "abcdefg\0abcdefg\0". */ strncpy(buf, new_string, big_len); - strncpy(&buf[big_len], new_string, big_len); + HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tconvert"); @@ -226,8 +226,8 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string. * It will look like "abcdefghabcdefgh". */ - strncpy(buf, new_string, big_len); - strncpy(&buf[big_len], new_string, big_len); + HDstrncpy(buf, new_string, big_len); + HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tconvert"); diff --git a/test/tvltypes.c b/test/tvltypes.c index e5a3d34..91ef0c2 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -467,7 +467,7 @@ test_vltypes_vlen_atomic(void) /* Try to call H5Dvlen_get_buf with bad dataspace */ H5E_BEGIN_TRY { - ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); + ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_get_buf_size"); @@ -499,7 +499,7 @@ test_vltypes_vlen_atomic(void) /* Try to reclaim read data using "bad" dataspace with no extent * Should fail */ H5E_BEGIN_TRY { - ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata); + ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_reclaim"); @@ -1205,9 +1205,9 @@ test_vltypes_compound_vlstr(void) wdata[i].v.p=(s2*)HDmalloc((i+L3_INCM)*sizeof(s2)); wdata[i].v.len=i+L3_INCM; for(t1=(s2 *)((wdata[i].v).p), j=0; j<(i+L3_INCM); j++, t1++) { - strcat(str, "m"); - t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1); - strcpy(t1->string, str); + HDstrcat(str, "m"); + t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1); + HDstrcpy(t1->string, str); /*t1->color = red;*/ t1->color = blue; } @@ -1348,7 +1348,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata[i].v.p), t2=(s2 *)(rdata[i].v.p), j=0; jstring, t2->string) ) { + if( HDstrcmp(t1->string, t2->string) ) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ @@ -1368,14 +1368,14 @@ test_vltypes_compound_vlstr(void) CHECK(ret, FAIL, "H5Dvlen_reclaim"); /* Use this part for new data */ - strcpy(str, "bbbbbbbb\0"); + HDstrcpy(str, "bbbbbbbb\0"); for(i=0; istring = (char*)HDmalloc(strlen(str)*sizeof(char)+1); - strcpy(t1->string, str); + HDstrcat(str, "pp"); + t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1); + HDstrcpy(t1->string, str); t1->color = green; } } /* end for */ @@ -1406,7 +1406,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; jstring, t2->string) ) { + if( HDstrcmp(t1->string, t2->string) ) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ diff --git a/test/vfd.c b/test/vfd.c index 5d5ebfc..dfc5047 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -149,7 +149,7 @@ test_sec2(void) /* There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. - * + * * Currently it should be around 2 KB. */ if(H5Fget_filesize(fid, &file_size) < 0) @@ -258,7 +258,7 @@ test_core(void) | H5FD_FEAT_ACCUMULATE_METADATA | H5FD_FEAT_DATA_SIEVE | H5FD_FEAT_AGGREGATE_SMALLDATA - | H5FD_FEAT_ALLOW_FILE_IMAGE + | H5FD_FEAT_ALLOW_FILE_IMAGE | H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS)) TEST_ERROR @@ -341,7 +341,7 @@ test_core(void) /* There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. - * + * * TODO: Needs justification of why is this is a reasonable size. */ if(H5Fget_filesize(fid, &file_size) < 0) @@ -379,7 +379,7 @@ test_core(void) for(i = 0; i < CORE_DSET_DIM1; i++) for(j = 0; j < CORE_DSET_DIM2; j++) *pw++ = val++; - HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); + HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); /* Create the dataspace */ dims[0] = CORE_DSET_DIM1; @@ -469,7 +469,7 @@ test_core(void) TEST_ERROR; /* Read the data back from the dataset */ - HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); + HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int)); if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0) TEST_ERROR; @@ -488,7 +488,7 @@ test_core(void) /* Check file size API. * There is no garantee the size of metadata in file is constant. * Just try to check if it's reasonable. - * + * * TODO: Needs justification of why is this is a reasonable size. */ if(H5Fget_filesize(fid, &file_size) < 0) @@ -1330,7 +1330,7 @@ test_multi(void) if((atype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR; - if(H5Tset_size(atype, strlen(meta) + 1) < 0) + if(H5Tset_size(atype, HDstrlen(meta) + 1) < 0) TEST_ERROR; if(H5Tset_strpad(atype, H5T_STR_NULLTERM) < 0) @@ -1385,7 +1385,7 @@ error: * Purpose: Tests the backward compatibility for MULTI driver. * See if we can open files created with v1.6 library. * The source file was created by the test/file_handle.c - * of the v1.6 library. This test verifies the fix for + * of the v1.6 library. This test verifies the fix for * Issue 2598. In v1.6 library, there was EOA for the whole * MULTI file saved in the super block. We took it out in * v1.8 library because it's meaningless for the MULTI file. @@ -1446,7 +1446,7 @@ test_multi_compat(void) h5_fixname(FILENAME[9], fapl, newname, sizeof newname); - /* Make copy for the data file in the build directory, to protect the + /* Make copy for the data file in the build directory, to protect the * original file in the source directory */ sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); @@ -1483,7 +1483,7 @@ test_multi_compat(void) if(H5Fclose(file) < 0) TEST_ERROR; - /* Reopen the file for adding another dataset. The new EOA for metadata file + /* Reopen the file for adding another dataset. The new EOA for metadata file * should be written to the file */ if((file=H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; @@ -1510,7 +1510,7 @@ test_multi_compat(void) if(H5Fclose(file) < 0) TEST_ERROR; - /* Reopen the file for read only again. Verify the library can handle + /* Reopen the file for read only again. Verify the library can handle * the EOA correctly */ if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; diff --git a/testpar/t_cache.c b/testpar/t_cache.c index caa578e..c27fc23 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7134,7 +7134,7 @@ trace_file_check(int metadata_write_strategy) if ( HDfgets(buffer, 255, trace_file_ptr) != NULL ) { - actual_line_len = strlen(buffer); + actual_line_len = HDstrlen(buffer); } else { diff --git a/testpar/t_dset.c b/testpar/t_dset.c index b315772..281d027 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -36,83 +36,91 @@ * Setup the dimensions of the hyperslab. * Two modes--by rows or by columns. * Assume dimension rank is 2. - * BYROW divide into slabs of rows - * BYCOL divide into blocks of columns - * ZROW same as BYROW except process 0 gets 0 rows - * ZCOL same as BYCOL except process 0 gets 0 columns + * BYROW divide into slabs of rows + * BYCOL divide into blocks of columns + * ZROW same as BYROW except process 0 gets 0 rows + * ZCOL same as BYCOL except process 0 gets 0 columns */ static void slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], - hsize_t stride[], hsize_t block[], int mode) + hsize_t stride[], hsize_t block[], int mode) { - switch (mode){ + switch (mode) { case BYROW: - /* Each process takes a slabs of rows. */ - block[0] = dim0/mpi_size; - block[1] = dim1; - stride[0] = block[0]; - stride[1] = block[1]; - count[0] = 1; - count[1] = 1; - start[0] = mpi_rank*block[0]; - start[1] = 0; -if(VERBOSE_MED) printf("slab_set BYROW\n"); - break; + /* Each process takes a slabs of rows. */ + block[0] = dim0 / mpi_size; + block[1] = dim1; + stride[0] = block[0]; + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = mpi_rank * block[0]; + start[1] = 0; + if (VERBOSE_MED) + HDprintf("slab_set BYROW\n"); + break; case BYCOL: - /* Each process takes a block of columns. */ - block[0] = dim0; - block[1] = dim1/mpi_size; - stride[0] = block[0]; - stride[1] = block[1]; - count[0] = 1; - count[1] = 1; - start[0] = 0; - start[1] = mpi_rank*block[1]; -if(VERBOSE_MED) printf("slab_set BYCOL\n"); - break; + /* Each process takes a block of columns. */ + block[0] = dim0; + block[1] = dim1 / mpi_size; + stride[0] = block[0]; + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = 0; + start[1] = mpi_rank * block[1]; + if (VERBOSE_MED) + HDprintf("slab_set BYCOL\n"); + break; case ZROW: - /* Similar to BYROW except process 0 gets 0 row */ - block[0] = (mpi_rank ? dim0/mpi_size : 0); - block[1] = dim1; - stride[0] = (mpi_rank ? block[0] : 1); /* avoid setting stride to 0 */ - stride[1] = block[1]; - count[0] = 1; - count[1] = 1; - start[0] = (mpi_rank? mpi_rank*block[0] : 0); - start[1] = 0; -if(VERBOSE_MED) printf("slab_set ZROW\n"); - break; + /* Similar to BYROW except process 0 gets 0 row */ + block[0] = (mpi_rank ? dim0 / mpi_size : 0); + block[1] = dim1; + stride[0] = (mpi_rank ? block[0] : 1); /* avoid setting stride to 0 */ + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = (mpi_rank ? mpi_rank * block[0] : 0); + start[1] = 0; + if (VERBOSE_MED) + HDprintf("slab_set ZROW\n"); + break; case ZCOL: - /* Similar to BYCOL except process 0 gets 0 column */ - block[0] = dim0; - block[1] = (mpi_rank ? dim1/mpi_size : 0); - stride[0] = block[0]; - stride[1] = (mpi_rank ? block[1] : 1); /* avoid setting stride to 0 */ - count[0] = 1; - count[1] = 1; - start[0] = 0; - start[1] = (mpi_rank? mpi_rank*block[1] : 0); -if(VERBOSE_MED) printf("slab_set ZCOL\n"); - break; + /* Similar to BYCOL except process 0 gets 0 column */ + block[0] = dim0; + block[1] = (mpi_rank ? dim1 / mpi_size : 0); + stride[0] = block[0]; + stride[1] = (mpi_rank ? block[1] : 1); /* avoid setting stride to 0 */ + count[0] = 1; + count[1] = 1; + start[0] = 0; + start[1] = (mpi_rank ? mpi_rank * block[1] : 0); + if (VERBOSE_MED) + HDprintf("slab_set ZCOL\n"); + break; default: - /* Unknown mode. Set it to cover the whole dataset. */ - printf("unknown slab_set mode (%d)\n", mode); - block[0] = dim0; - block[1] = dim1; - stride[0] = block[0]; - stride[1] = block[1]; - count[0] = 1; - count[1] = 1; - start[0] = 0; - start[1] = 0; -if(VERBOSE_MED) printf("slab_set wholeset\n"); - break; + /* Unknown mode. Set it to cover the whole dataset. */ + HDprintf("unknown slab_set mode (%d)\n", mode); + block[0] = dim0; + block[1] = dim1; + stride[0] = block[0]; + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = 0; + start[1] = 0; + if (VERBOSE_MED) + HDprintf("slab_set wholeset\n"); + break; } -if(VERBOSE_MED){ - printf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], - (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], - (unsigned long)(block[0]*block[1]*count[0]*count[1])); + if (VERBOSE_MED) { + HDprintf( + "start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long) start[0], (unsigned long) start[1], + (unsigned long) count[0], (unsigned long) count[1], + (unsigned long) stride[0], (unsigned long) stride[1], + (unsigned long) block[0], (unsigned long) block[1], + (unsigned long) (block[0] * block[1] * count[0] * count[1])); } } @@ -123,7 +131,7 @@ void point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], - size_t num_points, + size_t num_points, hsize_t coords[], int order) { @@ -153,13 +161,13 @@ void point_set(hsize_t start[], } if(VERBOSE_MED) { - printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total datapoints=%lu\n", + HDprintf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total datapoints=%lu\n", (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], (unsigned long)(block[0] * block[1] * count[0] * count[1])); k = 0; for(i = 0; i < num_points ; i++) { - printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + HDprintf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); k += 2; } } @@ -177,10 +185,10 @@ dataset_fill(hsize_t start[], hsize_t block[], DATATYPE * dataset) /* put some trivial data in the data_array */ for (i=0; i < block[0]; i++){ - for (j=0; j < block[1]; j++){ - *dataptr = (DATATYPE)((i+start[0])*100 + (j+start[1]+1)); - dataptr++; - } + for (j=0; j < block[1]; j++){ + *dataptr = (DATATYPE)((i+start[0])*100 + (j+start[1]+1)); + dataptr++; + } } } @@ -195,19 +203,19 @@ dataset_print(hsize_t start[], hsize_t block[], DATATYPE * dataset) hsize_t i, j; /* print the column heading */ - printf("%-8s", "Cols:"); + HDprintf("%-8s", "Cols:"); for (j=0; j < block[1]; j++){ - printf("%3lu ", (unsigned long)(start[1]+j)); + HDprintf("%3lu ", (unsigned long)(start[1]+j)); } - printf("\n"); + HDprintf("\n"); /* print the slab data */ for (i=0; i < block[0]; i++){ - printf("Row %2lu: ", (unsigned long)(i+start[0])); - for (j=0; j < block[1]; j++){ - printf("%03d ", *dataptr++); - } - printf("\n"); + HDprintf("Row %2lu: ", (unsigned long)(i+start[0])); + for (j=0; j < block[1]; j++){ + HDprintf("%03d ", *dataptr++); + } + HDprintf("\n"); } } @@ -223,35 +231,35 @@ dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[] /* print it if VERBOSE_MED */ if(VERBOSE_MED) { - printf("dataset_vrfy dumping:::\n"); - printf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], - (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); - printf("original values:\n"); - dataset_print(start, block, original); - printf("compared values:\n"); - dataset_print(start, block, dataset); + HDprintf("dataset_vrfy dumping:::\n"); + HDprintf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); + HDprintf("original values:\n"); + dataset_print(start, block, original); + HDprintf("compared values:\n"); + dataset_print(start, block, dataset); } vrfyerrs = 0; for (i=0; i < block[0]; i++){ - for (j=0; j < block[1]; j++){ - if(*dataset != *original){ - if(vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ - printf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n", - (unsigned long)i, (unsigned long)j, - (unsigned long)(i+start[0]), (unsigned long)(j+start[1]), - *(original), *(dataset)); - } - dataset++; - original++; - } - } + for (j=0; j < block[1]; j++){ + if(*dataset != *original){ + if(vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ + HDprintf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n", + (unsigned long)i, (unsigned long)j, + (unsigned long)(i+start[0]), (unsigned long)(j+start[1]), + *(original), *(dataset)); + } + dataset++; + original++; + } + } } if(vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) - printf("[more errors ...]\n"); + HDprintf("[more errors ...]\n"); if(vrfyerrs) - printf("%d errors found in dataset_vrfy\n", vrfyerrs); + HDprintf("%d errors found in dataset_vrfy\n", vrfyerrs); return(vrfyerrs); } @@ -272,20 +280,20 @@ void dataset_writeInd(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - hsize_t dims[RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ + hid_t acc_tpl; /* File access templates */ + hid_t sid; /* Dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ + hsize_t dims[RANK]; /* dataset dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ const char *filename; - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -293,7 +301,7 @@ dataset_writeInd(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Independent write test on file %s\n", filename); + HDprintf("Independent write test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -332,12 +340,12 @@ dataset_writeInd(void) /* create a dataset collectively */ dataset1 = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dataset1 >= 0), "H5Dcreate2 succeeded"); /* create another dataset collectively */ dataset2 = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dataset2 >= 0), "H5Dcreate2 succeeded"); @@ -366,28 +374,28 @@ dataset_writeInd(void) /* write data independently */ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 succeeded"); /* write data independently */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite dataset2 succeeded"); /* setup dimensions again to write with zero rows for process 0 */ if(VERBOSE_MED) - printf("writeInd by some with zero row\n"); + HDprintf("writeInd by some with zero row\n"); slab_set(mpi_rank, mpi_size, start, count, stride, block, ZROW); ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* need to make mem_dataspace to match for process 0 */ if(MAINPROCESS){ - ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); } MESG("writeInd by some with zero row"); if((mpi_rank/2)*2 != mpi_rank){ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 by ZROW succeeded"); } #ifdef BARRIER_CHECKS @@ -418,19 +426,19 @@ void dataset_readInd(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ + hid_t acc_tpl; /* File access templates */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ + DATATYPE *data_array1 = NULL; /* data buffer */ + DATATYPE *data_origin1 = NULL; /* expected data buffer */ const char *filename; - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -438,7 +446,7 @@ dataset_readInd(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Independent read test on file %s\n", filename); + HDprintf("Independent read test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -489,7 +497,7 @@ dataset_readInd(void) /* read data independently */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), ""); /* verify the read data with original expected data */ @@ -498,7 +506,7 @@ dataset_readInd(void) /* read data independently */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), ""); /* verify the read data with original expected data */ @@ -540,28 +548,28 @@ void dataset_writeAll(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t sid; /* Dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2, dataset3, dataset4; /* Dataset ID */ hid_t dataset5, dataset6, dataset7; /* Dataset ID */ - hid_t datatype; /* Datatype ID */ - hsize_t dims[RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ + hid_t datatype; /* Datatype ID */ + hsize_t dims[RANK]; /* dataset dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ const char *filename; - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ size_t num_points; /* for point selection */ hsize_t *coords = NULL; /* for point selection */ hsize_t current_dims; /* for point selection */ int i; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -569,7 +577,7 @@ dataset_writeAll(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Collective write test on file %s\n", filename); + HDprintf("Collective write test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -669,8 +677,8 @@ dataset_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* set up the collective transfer properties list */ @@ -687,23 +695,23 @@ dataset_writeAll(void) /* write data collectively */ MESG("writeAll by Row"); ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 succeeded"); /* setup dimensions again to writeAll with zero rows for process 0 */ if(VERBOSE_MED) - printf("writeAll by some with zero row\n"); + HDprintf("writeAll by some with zero row\n"); slab_set(mpi_rank, mpi_size, start, count, stride, block, ZROW); ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* need to make mem_dataspace to match for process 0 */ if(MAINPROCESS){ - ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); } MESG("writeAll by some with zero row"); ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 by ZROW succeeded"); /* release all temporary handles. */ @@ -720,8 +728,8 @@ dataset_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* create a file dataspace independently */ @@ -738,8 +746,8 @@ dataset_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* set up the collective transfer properties list */ @@ -755,23 +763,23 @@ dataset_writeAll(void) /* write data independently */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset2 succeeded"); /* setup dimensions again to writeAll with zero columns for process 0 */ if(VERBOSE_MED) - printf("writeAll by some with zero col\n"); + HDprintf("writeAll by some with zero col\n"); slab_set(mpi_rank, mpi_size, start, count, stride, block, ZCOL); ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* need to make mem_dataspace to match for process 0 */ if(MAINPROCESS){ - ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); } MESG("writeAll by some with zero col"); ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 by ZCOL succeeded"); /* release all temporary handles. */ @@ -789,8 +797,8 @@ dataset_writeAll(void) file_dataspace = H5Dget_space (dataset3); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); if(MAINPROCESS) { - ret = H5Sselect_none(file_dataspace); - VRFY((ret >= 0), "H5Sselect_none file_dataspace succeeded"); + ret = H5Sselect_none(file_dataspace); + VRFY((ret >= 0), "H5Sselect_none file_dataspace succeeded"); } /* end if */ else { ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); @@ -801,16 +809,16 @@ dataset_writeAll(void) mem_dataspace = H5Screate_simple (RANK, block, NULL); VRFY((mem_dataspace >= 0), ""); if(MAINPROCESS) { - ret = H5Sselect_none(mem_dataspace); - VRFY((ret >= 0), "H5Sselect_none mem_dataspace succeeded"); + ret = H5Sselect_none(mem_dataspace); + VRFY((ret >= 0), "H5Sselect_none mem_dataspace succeeded"); } /* end if */ /* fill the local slab with some trivial data */ dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* end if */ /* set up the collective transfer properties list */ @@ -827,13 +835,13 @@ dataset_writeAll(void) /* write data collectively */ MESG("writeAll with none"); ret = H5Dwrite(dataset3, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset3 succeeded"); /* write data collectively (with datatype conversion) */ MESG("writeAll with none"); ret = H5Dwrite(dataset3, H5T_NATIVE_UCHAR, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset3 succeeded"); /* release all temporary handles. */ @@ -850,8 +858,8 @@ dataset_writeAll(void) file_dataspace = H5Dget_space (dataset4); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); if(MAINPROCESS) { - ret = H5Sselect_none(file_dataspace); - VRFY((ret >= 0), "H5Sselect_all file_dataspace succeeded"); + ret = H5Sselect_none(file_dataspace); + VRFY((ret >= 0), "H5Sselect_all file_dataspace succeeded"); } /* end if */ else { ret = H5Sselect_all(file_dataspace); @@ -862,8 +870,8 @@ dataset_writeAll(void) mem_dataspace = H5Screate(H5S_SCALAR); VRFY((mem_dataspace >= 0), ""); if(MAINPROCESS) { - ret = H5Sselect_none(mem_dataspace); - VRFY((ret >= 0), "H5Sselect_all mem_dataspace succeeded"); + ret = H5Sselect_none(mem_dataspace); + VRFY((ret >= 0), "H5Sselect_all mem_dataspace succeeded"); } /* end if */ else { ret = H5Sselect_all(mem_dataspace); @@ -874,8 +882,8 @@ dataset_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* end if */ /* set up the collective transfer properties list */ @@ -891,13 +899,13 @@ dataset_writeAll(void) /* write data collectively */ MESG("writeAll with scalar dataspace"); ret = H5Dwrite(dataset4, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset4 succeeded"); /* write data collectively (with datatype conversion) */ MESG("writeAll with scalar dataspace"); ret = H5Dwrite(dataset4, H5T_NATIVE_UCHAR, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset4 succeeded"); /* release all temporary handles. */ @@ -907,7 +915,7 @@ dataset_writeAll(void) if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); block[0] = 1; @@ -922,15 +930,15 @@ dataset_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* Dataset5: point selection in File - Hyperslab selection in Memory*/ /* create a file dataspace independently */ point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER); file_dataspace = H5Dget_space (dataset5); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); VRFY((ret >= 0), "H5Sselect_elements succeeded"); @@ -1005,7 +1013,7 @@ dataset_writeAll(void) start[1] = 0; point_set (start, count, stride, block, num_points, coords, IN_ORDER); file_dataspace = H5Dget_space (dataset7); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); VRFY((ret >= 0), "H5Sselect_elements succeeded"); @@ -1075,25 +1083,25 @@ void dataset_readAll(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2, dataset5, dataset6, dataset7; /* Dataset ID */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ + DATATYPE *data_array1 = NULL; /* data buffer */ + DATATYPE *data_origin1 = NULL; /* expected data buffer */ const char *filename; - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ size_t num_points; /* for point selection */ hsize_t *coords = NULL; /* for point selection */ hsize_t current_dims; /* for point selection */ int i,j,k; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -1101,7 +1109,7 @@ dataset_readAll(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Collective read test on file %s\n", filename); + HDprintf("Collective read test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -1174,8 +1182,8 @@ dataset_readAll(void) dataset_fill(start, block, data_origin1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_origin1); + MESG("data_array created"); + dataset_print(start, block, data_origin1); } /* set up the collective transfer properties list */ @@ -1191,7 +1199,7 @@ dataset_readAll(void) /* read data collectively */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset1 succeeded"); /* verify the read data with original expected data */ @@ -1200,18 +1208,18 @@ dataset_readAll(void) /* setup dimensions again to readAll with zero columns for process 0 */ if(VERBOSE_MED) - printf("readAll by some with zero col\n"); + HDprintf("readAll by some with zero col\n"); slab_set(mpi_rank, mpi_size, start, count, stride, block, ZCOL); ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* need to make mem_dataspace to match for process 0 */ if(MAINPROCESS){ - ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); } MESG("readAll by some with zero col"); ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset1 by ZCOL succeeded"); /* verify the read data with original expected data */ @@ -1242,8 +1250,8 @@ dataset_readAll(void) dataset_fill(start, block, data_origin1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_origin1); + MESG("data_array created"); + dataset_print(start, block, data_origin1); } /* set up the collective transfer properties list */ @@ -1259,7 +1267,7 @@ dataset_readAll(void) /* read data collectively */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset2 succeeded"); /* verify the read data with original expected data */ @@ -1268,18 +1276,18 @@ dataset_readAll(void) /* setup dimensions again to readAll with zero rows for process 0 */ if(VERBOSE_MED) - printf("readAll by some with zero row\n"); + HDprintf("readAll by some with zero row\n"); slab_set(mpi_rank, mpi_size, start, count, stride, block, ZROW); ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); /* need to make mem_dataspace to match for process 0 */ if(MAINPROCESS){ - ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); } MESG("readAll by some with zero row"); ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset1 by ZROW succeeded"); /* verify the read data with original expected data */ @@ -1293,9 +1301,9 @@ dataset_readAll(void) if(data_array1) free(data_array1); if(data_origin1) free(data_origin1); - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + data_origin1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); block[0] = 1; @@ -1310,8 +1318,8 @@ dataset_readAll(void) dataset_fill(start, block, data_origin1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_origin1); + MESG("data_array created"); + dataset_print(start, block, data_origin1); } /* Dataset5: point selection in memory - Hyperslab selection in file*/ @@ -1344,7 +1352,7 @@ dataset_readAll(void) xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread dataset5 succeeded"); - + ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); if(ret) nerrors++; @@ -1355,7 +1363,7 @@ dataset_readAll(void) if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* Dataset6: point selection in File - Point selection in Memory*/ @@ -1400,7 +1408,7 @@ dataset_readAll(void) H5Pclose(xfer_plist); if(data_array1) free(data_array1); - data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + data_array1 = (DATATYPE *)HDmalloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* Dataset7: point selection in memory - All selection in file*/ @@ -1488,25 +1496,25 @@ void extend_writeInd(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ + hid_t acc_tpl; /* File access templates */ + hid_t sid; /* Dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ const char *filename; - hsize_t dims[RANK]; /* dataset dim sizes */ + hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t max_dims[RANK] = - {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - hsize_t chunk_dims[RANK]; /* chunk sizes */ - hid_t dataset_pl; /* dataset create prop. list */ + {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ + hsize_t chunk_dims[RANK]; /* chunk sizes */ + hid_t dataset_pl; /* dataset create prop. list */ - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK]; /* for hyperslab setting */ - hsize_t stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK]; /* for hyperslab setting */ + hsize_t stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -1514,7 +1522,7 @@ extend_writeInd(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent write test on file %s\n", filename); + HDprintf("Extend independent write test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -1567,7 +1575,7 @@ extend_writeInd(void) /* set up dataset storage chunk sizes and creation property list */ if(VERBOSE_MED) - printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); + HDprintf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); dataset_pl = H5Pcreate(H5P_DATASET_CREATE); VRFY((dataset_pl >= 0), "H5Pcreate succeeded"); ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims); @@ -1603,8 +1611,8 @@ extend_writeInd(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* create a memory dataspace independently */ @@ -1625,7 +1633,7 @@ extend_writeInd(void) /* write data independently */ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite succeeded"); /* release resource */ @@ -1643,8 +1651,8 @@ extend_writeInd(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* create a memory dataspace independently */ @@ -1664,7 +1672,7 @@ extend_writeInd(void) /* write data independently. Should fail. */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret < 0), "H5Dwrite failed as expected"); /* restore auto error reporting */ @@ -1685,7 +1693,7 @@ extend_writeInd(void) /* write data independently */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dwrite succeeded"); /* release resource */ @@ -1719,25 +1727,25 @@ extend_writeInd2(void) { const char *filename; hid_t fid; /* HDF5 file ID */ - hid_t fapl; /* File access templates */ - hid_t fs; /* File dataspace ID */ - hid_t ms; /* Memory dataspace ID */ - hid_t dataset; /* Dataset ID */ - hsize_t orig_size=10; /* Original dataset dim size */ - hsize_t new_size=20; /* Extended dataset dim size */ + hid_t fapl; /* File access templates */ + hid_t fs; /* File dataspace ID */ + hid_t ms; /* Memory dataspace ID */ + hid_t dataset; /* Dataset ID */ + hsize_t orig_size=10; /* Original dataset dim size */ + hsize_t new_size=20; /* Extended dataset dim size */ hsize_t one=1; - hsize_t max_size = H5S_UNLIMITED; /* dataset maximum dim size */ - hsize_t chunk_size = 16384; /* chunk size */ - hid_t dcpl; /* dataset create prop. list */ + hsize_t max_size = H5S_UNLIMITED; /* dataset maximum dim size */ + hsize_t chunk_size = 16384; /* chunk size */ + hid_t dcpl; /* dataset create prop. list */ int written[10], /* Data to write */ retrieved[10]; /* Data read in */ int mpi_size, mpi_rank; /* MPI settings */ int i; /* Local index variable */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent write test #2 on file %s\n", filename); + HDprintf("Extend independent write test #2 on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -1794,10 +1802,10 @@ extend_writeInd2(void) written[i] = i; MESG("data array initialized"); if(VERBOSE_MED) { - MESG("writing at offset zero: "); + MESG("writing at offset zero: "); for(i = 0; i < (int)orig_size; i++) - printf("%s%d", i?", ":"", written[i]); - printf("\n"); + HDprintf("%s%d", i?", ":"", written[i]); + HDprintf("\n"); } ret = H5Dwrite(dataset, H5T_NATIVE_INT, ms, fs, H5P_DEFAULT, written); VRFY((ret >= 0), "H5Dwrite succeeded"); @@ -1809,15 +1817,15 @@ extend_writeInd2(void) VRFY((ret >= 0), "H5Dread succeeded"); for (i=0; i<(int)orig_size; i++) if(written[i]!=retrieved[i]) { - printf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n",__LINE__, + HDprintf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n",__LINE__, i,written[i], i,retrieved[i]); nerrors++; } if(VERBOSE_MED){ - MESG("read at offset zero: "); + MESG("read at offset zero: "); for (i=0; i<(int)orig_size; i++) - printf("%s%d", i?", ":"", retrieved[i]); - printf("\n"); + HDprintf("%s%d", i?", ":"", retrieved[i]); + HDprintf("\n"); } /* ------------------------- @@ -1837,10 +1845,10 @@ extend_writeInd2(void) written[i] = orig_size + i; MESG("data array re-initialized"); if(VERBOSE_MED) { - MESG("writing at offset 10: "); + MESG("writing at offset 10: "); for (i=0; i<(int)orig_size; i++) - printf("%s%d", i?", ":"", written[i]); - printf("\n"); + HDprintf("%s%d", i?", ":"", written[i]); + HDprintf("\n"); } ret = H5Sselect_hyperslab(fs, H5S_SELECT_SET, &orig_size, NULL, &one, &orig_size); VRFY((ret >= 0), "H5Sselect_hyperslab succeeded"); @@ -1854,15 +1862,15 @@ extend_writeInd2(void) VRFY((ret >= 0), "H5Dread succeeded"); for (i=0; i<(int)orig_size; i++) if(written[i]!=retrieved[i]) { - printf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n",__LINE__, + HDprintf("Line #%d: written!=retrieved: written[%d]=%d, retrieved[%d]=%d\n",__LINE__, i,written[i], i,retrieved[i]); nerrors++; } if(VERBOSE_MED){ - MESG("read at offset 10: "); + MESG("read at offset 10: "); for (i=0; i<(int)orig_size; i++) - printf("%s%d", i?", ":"", retrieved[i]); - printf("\n"); + HDprintf("%s%d", i?", ":"", retrieved[i]); + HDprintf("\n"); } @@ -1879,22 +1887,22 @@ extend_writeInd2(void) void extend_readInd(void) { - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - hsize_t dims[RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_array2 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ + hid_t fid; /* HDF5 file ID */ + hid_t acc_tpl; /* File access templates */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ + hsize_t dims[RANK]; /* dataset dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ + DATATYPE *data_array2 = NULL; /* data buffer */ + DATATYPE *data_origin1 = NULL; /* expected data buffer */ const char *filename; - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -1902,7 +1910,7 @@ extend_readInd(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent read test on file %s\n", filename); + HDprintf("Extend independent read test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -1974,13 +1982,13 @@ extend_readInd(void) /* fill dataset with test data */ dataset_fill(start, block, data_origin1); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* read data independently */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dread succeeded"); /* verify the read data with original expected data */ @@ -2009,13 +2017,13 @@ extend_readInd(void) /* fill dataset with test data */ dataset_fill(start, block, data_origin1); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* read data independently */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array1); + H5P_DEFAULT, data_array1); VRFY((ret >= 0), "H5Dread succeeded"); /* verify the read data with original expected data */ @@ -2058,26 +2066,26 @@ void extend_writeAll(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t sid; /* Dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ const char *filename; - hsize_t dims[RANK]; /* dataset dim sizes */ + hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t max_dims[RANK] = - {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - hsize_t chunk_dims[RANK]; /* chunk sizes */ - hid_t dataset_pl; /* dataset create prop. list */ + {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ + hsize_t chunk_dims[RANK]; /* chunk sizes */ + hid_t dataset_pl; /* dataset create prop. list */ - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK]; /* for hyperslab setting */ - hsize_t stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK]; /* for hyperslab setting */ + hsize_t stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -2085,7 +2093,7 @@ extend_writeAll(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent write test on file %s\n", filename); + HDprintf("Extend independent write test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -2138,7 +2146,7 @@ extend_writeAll(void) /* set up dataset storage chunk sizes and creation property list */ if(VERBOSE_MED) - printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); + HDprintf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); dataset_pl = H5Pcreate(H5P_DATASET_CREATE); VRFY((dataset_pl >= 0), "H5Pcreate succeeded"); ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims); @@ -2174,8 +2182,8 @@ extend_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* create a memory dataspace independently */ @@ -2207,7 +2215,7 @@ extend_writeAll(void) /* write data collectively */ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite succeeded"); /* release resource */ @@ -2226,8 +2234,8 @@ extend_writeAll(void) dataset_fill(start, block, data_array1); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* create a memory dataspace independently */ @@ -2258,7 +2266,7 @@ extend_writeAll(void) /* write data independently. Should fail. */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret < 0), "H5Dwrite failed as expected"); /* restore auto error reporting */ @@ -2279,7 +2287,7 @@ extend_writeAll(void) /* write data independently */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite succeeded"); /* release resource */ @@ -2308,23 +2316,23 @@ extend_writeAll(void) void extend_readAll(void) { - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ + hid_t fid; /* HDF5 file ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ + hid_t dataset1, dataset2; /* Dataset ID */ const char *filename; - hsize_t dims[RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_array2 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ + hsize_t dims[RANK]; /* dataset dim sizes */ + DATATYPE *data_array1 = NULL; /* data buffer */ + DATATYPE *data_array2 = NULL; /* data buffer */ + DATATYPE *data_origin1 = NULL; /* expected data buffer */ - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -2332,7 +2340,7 @@ extend_readAll(void) filename = GetTestParameters(); if(VERBOSE_MED) - printf("Extend independent read test on file %s\n", filename); + HDprintf("Extend independent read test on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -2404,8 +2412,8 @@ extend_readAll(void) /* fill dataset with test data */ dataset_fill(start, block, data_origin1); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* set up the collective transfer properties list */ @@ -2421,7 +2429,7 @@ extend_readAll(void) /* read data collectively */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread succeeded"); /* verify the read data with original expected data */ @@ -2451,8 +2459,8 @@ extend_readAll(void) /* fill dataset with test data */ dataset_fill(start, block, data_origin1); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("data_array created"); + dataset_print(start, block, data_array1); } /* set up the collective transfer properties list */ @@ -2468,7 +2476,7 @@ extend_readAll(void) /* read data collectively */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((ret >= 0), "H5Dread succeeded"); /* verify the read data with original expected data */ @@ -2505,27 +2513,27 @@ void compress_readAll(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ + hid_t acc_tpl; /* File access templates */ hid_t dcpl; /* Dataset creation property list */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t dataspace; /* Dataspace ID */ - hid_t dataset; /* Dataset ID */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t dataspace; /* Dataspace ID */ + hid_t dataset; /* Dataset ID */ int rank=1; /* Dataspace rank */ hsize_t dim=dim0; /* Dataspace dimensions */ unsigned u; /* Local index variable */ unsigned chunk_opts; /* Chunk options */ unsigned disable_partial_chunk_filters; /* Whether filters are disabled on partial chunks */ - DATATYPE *data_read = NULL; /* data buffer */ + DATATYPE *data_read = NULL; /* data buffer */ DATATYPE *data_orig = NULL; /* expected data buffer */ const char *filename; MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; int mpi_size, mpi_rank; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ filename = GetTestParameters(); if(VERBOSE_MED) - printf("Collective chunked dataset read test on file %s\n", filename); + HDprintf("Collective chunked dataset read test on file %s\n", filename); /* Retrieve MPI parameters */ MPI_Comm_size(comm,&mpi_size); @@ -2646,7 +2654,7 @@ compress_readAll(void) /* Verify data read */ for(u=0; u= 0), "H5Pcreate succeeded"); ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims); @@ -2789,8 +2797,8 @@ none_selection_chunk(void) dataset_fill(mstart, block, data_origin); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(mstart, block, data_origin); + MESG("data_array created"); + dataset_print(mstart, block, data_origin); } } @@ -2824,12 +2832,12 @@ none_selection_chunk(void) /* write data collectively */ ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_origin); + xfer_plist, data_origin); VRFY((ret >= 0), "H5Dwrite succeeded"); /* read data independently */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array); + H5P_DEFAULT, data_array); VRFY((ret >= 0), ""); /* verify the read data with original expected data */ @@ -2846,12 +2854,12 @@ none_selection_chunk(void) /* write data collectively */ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_origin); + xfer_plist, data_origin); VRFY((ret >= 0), "H5Dwrite succeeded"); /* read data independently */ ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - H5P_DEFAULT, data_array); + H5P_DEFAULT, data_array); VRFY((ret >= 0), ""); /* verify the read data with original expected data */ @@ -2883,20 +2891,20 @@ none_selection_chunk(void) if(data_array) HDfree(data_array); } - + /* Function: test_actual_io_mode * - * Purpose: tests one specific case of collective I/O and checks that the + * Purpose: tests one specific case of collective I/O and checks that the * actual_chunk_opt_mode property and the actual_io_mode * properties in the DXPL have the correct values. * * Input: selection_mode: changes the way processes select data from the space, as well * as some dxpl flags to get collective I/O to break in different ways. - * + * * The relevant I/O function and expected response for each mode: * TEST_ACTUAL_IO_MULTI_CHUNK_IND: * H5D_mpi_chunk_collective_io, each process reports independent I/O - * + * * TEST_ACTUAL_IO_MULTI_CHUNK_COL: * H5D_mpi_chunk_collective_io, each process reports collective I/O * @@ -2908,7 +2916,7 @@ none_selection_chunk(void) * collective, the rest report independent I/O * * TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND: - * Same test TEST_ACTUAL_IO_MULTI_CHUNK_IND. + * Same test TEST_ACTUAL_IO_MULTI_CHUNK_IND. * Set directly go to multi-chunk-io without num threshold calc. * TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL: * Same test TEST_ACTUAL_IO_MULTI_CHUNK_COL. @@ -2933,20 +2941,20 @@ none_selection_chunk(void) * * Note: DIRECT_MULTI_CHUNK_MIX and DIRECT_MULTI_CHUNK_MIX_DISAGREE * is not needed as they are covered by DIRECT_CHUNK_MIX and - * MULTI_CHUNK_MIX_DISAGREE cases. _DIRECT_ cases are only for testing + * MULTI_CHUNK_MIX_DISAGREE cases. _DIRECT_ cases are only for testing * path way to multi-chunk-io by H5FD_MPIO_CHUNK_MULTI_IO insted of num-threshold. * * Modification: - * - Refctore to remove multi-chunk-without-opimization test and update for - * testing direct to multi-chunk-io + * - Refctore to remove multi-chunk-without-opimization test and update for + * testing direct to multi-chunk-io * Programmer: Jonathan Kim * Date: 2012-10-10 * - * + * * Programmer: Jacob Gruber * Date: 2011-04-06 */ -static void +static void test_actual_io_mode(int selection_mode) { H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = -1; H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = -1; @@ -2960,7 +2968,7 @@ test_actual_io_mode(int selection_mode) { hbool_t multi_chunk_io; hbool_t is_chunked; hbool_t is_collective; - int mpi_size = -1; + int mpi_size = -1; int mpi_rank = -1; int length; int * buffer; @@ -2985,12 +2993,12 @@ test_actual_io_mode(int selection_mode) { hsize_t block[RANK]; char message[256]; herr_t ret; - + /* Set up some flags to make some future if statements slightly more readable */ direct_multi_chunk_io = ( selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND || selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL ); - + /* Note: RESET performs the same tests as MULTI_CHUNK_MIX_DISAGREE and then * tests independent I/O */ @@ -3000,11 +3008,11 @@ test_actual_io_mode(int selection_mode) { selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX || selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE || selection_mode == TEST_ACTUAL_IO_RESET ); - + is_chunked = ( selection_mode != TEST_ACTUAL_IO_CONTIGUOUS && selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE); - + is_collective = selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE; /* Set up MPI parameters */ @@ -3012,7 +3020,7 @@ test_actual_io_mode(int selection_mode) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Barrier(MPI_COMM_WORLD); - + HDassert(mpi_size >= 1); mpi_comm = MPI_COMM_WORLD; @@ -3029,7 +3037,7 @@ test_actual_io_mode(int selection_mode) { fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); VRFY((fid >= 0), "H5Fcreate succeeded"); - /* Create the basic Space */ + /* Create the basic Space */ dims[0] = dim0; dims[1] = dim1; sid = H5Screate_simple (RANK, dims, NULL); @@ -3057,10 +3065,10 @@ test_actual_io_mode(int selection_mode) { file_space = H5Dget_space(dataset); VRFY((file_space >= 0), "H5Dget_space succeeded"); - /* Choose a selection method based on the type of I/O we want to occur, + /* Choose a selection method based on the type of I/O we want to occur, * and also set up some selection-dependeent test info. */ switch(selection_mode) { - + /* Independent I/O with optimization */ case TEST_ACTUAL_IO_MULTI_CHUNK_IND: case TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND: @@ -3069,7 +3077,7 @@ test_actual_io_mode(int selection_mode) { * independent. */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - + test_name = "Multi Chunk - Independent"; actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; @@ -3083,7 +3091,7 @@ test_actual_io_mode(int selection_mode) { * selections to each chunk, the operation is purely collective. */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - + test_name = "Multi Chunk - Collective"; actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; if(mpi_size > 1) @@ -3091,7 +3099,7 @@ test_actual_io_mode(int selection_mode) { else actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; break; - + /* Mixed I/O with optimization */ case TEST_ACTUAL_IO_MULTI_CHUNK_MIX: /* A chunk will be assigned collective I/O only if it is selected by each @@ -3102,7 +3110,7 @@ test_actual_io_mode(int selection_mode) { * assigned independent I/O. Each process will access one chunk collectively * and at least one chunk independently, reporting mixed I/O. */ - + if(mpi_rank == 0) { /* Select the first column */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); @@ -3117,7 +3125,7 @@ test_actual_io_mode(int selection_mode) { start[0] = 0; start[1] = mpi_rank*block[1]; } - + test_name = "Multi Chunk - Mixed"; actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; actual_io_mode_expected = H5D_MPIO_CHUNK_MIXED; @@ -3127,7 +3135,7 @@ test_actual_io_mode(int selection_mode) { * performed. To acheive this, we have RESET perform collective I/O (which would change * the values from the defaults) followed by independent I/O (which should report the * default values). RESET doesn't need to have a unique selection, so we reuse - * MULTI_CHUMK_MIX_DISAGREE, which was chosen because it is a complex case that works + * MULTI_CHUMK_MIX_DISAGREE, which was chosen because it is a complex case that works * on all builds. The independent section of RESET can be found at the end of this function. */ case TEST_ACTUAL_IO_RESET: @@ -3136,7 +3144,7 @@ test_actual_io_mode(int selection_mode) { case TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE: /* A chunk will be assigned collective I/O only if it is selected by each * process. To get mixed I/O with disagreement, assign process n to the - * first chunk and the nth chunk. The first chunk, selected by all, is + * first chunk and the nth chunk. The first chunk, selected by all, is * assgigned collective I/O, while each other process gets independent I/O. * Since the root process with only access the first chunk, it will report * collective I/O. The subsequent processes will access the first chunk @@ -3158,13 +3166,13 @@ test_actual_io_mode(int selection_mode) { start[0] = 0; start[1] = mpi_rank*block[1]; } - + /* If the testname was not already set by the RESET case */ if (selection_mode == TEST_ACTUAL_IO_RESET) test_name = "RESET"; else test_name = "Multi Chunk - Mixed (Disagreement)"; - + actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; if(mpi_size > 1) { if(mpi_rank == 0) @@ -3174,14 +3182,14 @@ test_actual_io_mode(int selection_mode) { } else actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; - - break; + + break; /* Linked Chunk I/O */ - case TEST_ACTUAL_IO_LINK_CHUNK: + case TEST_ACTUAL_IO_LINK_CHUNK: /* Nothing special; link chunk I/O is forced in the dxpl settings. */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - + test_name = "Link Chunk"; actual_chunk_opt_mode_expected = H5D_MPIO_LINK_CHUNK; actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE; @@ -3192,7 +3200,7 @@ test_actual_io_mode(int selection_mode) { /* A non overlapping, regular selection in a contiguous dataset leads to * collective I/O */ slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - + test_name = "Contiguous"; actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; actual_io_mode_expected = H5D_MPIO_CONTIGUOUS_COLLECTIVE; @@ -3200,7 +3208,7 @@ test_actual_io_mode(int selection_mode) { case TEST_ACTUAL_IO_NO_COLLECTIVE: slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - + test_name = "Independent"; actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; @@ -3215,13 +3223,13 @@ test_actual_io_mode(int selection_mode) { ret = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - + /* Create a memory dataspace mirroring the dataset and select the same hyperslab - * as in the file space. + * as in the file space. */ mem_space = H5Screate_simple (RANK, dims, NULL); VRFY((mem_space >= 0), "mem_space created"); - + ret = H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); @@ -3230,22 +3238,22 @@ test_actual_io_mode(int selection_mode) { /* Allocate and initialize the buffer */ buffer = (int *)HDmalloc(sizeof(int) * length); - VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); - for(i = 0; i < length; i++) + VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); + for(i = 0; i < length; i++) buffer[i] = i; /* Set up the dxpl for the write */ dxpl_write = H5Pcreate(H5P_DATASET_XFER); VRFY((dxpl_write >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - + /* Set collective I/O properties in the dxpl. */ if(is_collective) { /* Request collective I/O */ ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - - /* Set the threshold number of processes per chunk to twice mpi_size. - * This will prevent the threshold from ever being met, thus forcing + + /* Set the threshold number of processes per chunk to twice mpi_size. + * This will prevent the threshold from ever being met, thus forcing * multi chunk io instead of link chunk io. * This is via deault. */ @@ -3283,12 +3291,12 @@ test_actual_io_mode(int selection_mode) { ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_write, &actual_chunk_opt_mode_write); VRFY((ret >= 0), "retriving actual chunk opt mode succeeded" ); - + /* Read */ ret = H5Dread(dataset, data_type, mem_space, file_space, dxpl_read, buffer); if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout); VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded"); - + /* Retreive Actual io values */ ret = H5Pget_mpio_actual_io_mode(dxpl_read, &actual_io_mode_read); VRFY((ret >= 0), "retriving actual io mode succeeded" ); @@ -3304,9 +3312,9 @@ test_actual_io_mode(int selection_mode) { /* Test values */ if(actual_chunk_opt_mode_expected != (H5D_mpio_actual_chunk_opt_mode_t) -1 && actual_io_mode_expected != (H5D_mpio_actual_io_mode_t) -1) { - sprintf(message, "Actual Chunk Opt Mode has the correct value for %s.\n",test_name); + HDsprintf(message, "Actual Chunk Opt Mode has the correct value for %s.\n",test_name); VRFY((actual_chunk_opt_mode_write == actual_chunk_opt_mode_expected), message); - sprintf(message, "Actual IO Mode has the correct value for %s.\n",test_name); + HDsprintf(message, "Actual IO Mode has the correct value for %s.\n",test_name); VRFY((actual_io_mode_write == actual_io_mode_expected), message); } else { HDfprintf(stderr, "%s %d -> (%d,%d)\n", test_name, mpi_rank, @@ -3338,7 +3346,7 @@ test_actual_io_mode(int selection_mode) { "actual_chunk_opt_mode has correct value for reset write (independent)"); VRFY(actual_io_mode_write == H5D_MPIO_NO_COLLECTIVE, "actual_io_mode has correct value for reset write (independent)"); - + /* Read */ ret = H5Dread(dataset, data_type, H5S_ALL, H5S_ALL, dxpl_read, buffer); VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded"); @@ -3348,7 +3356,7 @@ test_actual_io_mode(int selection_mode) { VRFY( (ret >= 0), "retriving actual io mode succeeded" ); ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_read, &actual_chunk_opt_mode_read); VRFY( (ret >= 0), "retriving actual chunk opt mode succeeded" ); - + VRFY(actual_chunk_opt_mode_read == H5D_MPIO_NO_CHUNK_OPTIMIZATION, "actual_chunk_opt_mode has correct value for reset read (independent)"); VRFY(actual_io_mode_read == H5D_MPIO_NO_COLLECTIVE, @@ -3370,10 +3378,10 @@ test_actual_io_mode(int selection_mode) { return; } - + /* Function: actual_io_mode_tests * - * Purpose: Tests all possible cases of the actual_io_mode property. + * Purpose: Tests all possible cases of the actual_io_mode property. * * Programmer: Jacob Gruber * Date: 2011-04-06 @@ -3384,10 +3392,10 @@ actual_io_mode_tests(void) { int mpi_rank = -1; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_size(MPI_COMM_WORLD, &mpi_rank); - + test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE); - - /* + + /* * Test multi-chunk-io via proc_num threshold */ test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_IND); @@ -3398,10 +3406,10 @@ actual_io_mode_tests(void) { test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX); else HDfprintf(stdout, "Multi Chunk Mixed test requires 3 proceses minimum\n"); - + test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); - /* + /* * Test multi-chunk-io via setting direct property */ test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); @@ -3409,31 +3417,31 @@ actual_io_mode_tests(void) { test_actual_io_mode(TEST_ACTUAL_IO_LINK_CHUNK); test_actual_io_mode(TEST_ACTUAL_IO_CONTIGUOUS); - + test_actual_io_mode(TEST_ACTUAL_IO_RESET); return; } -/* +/* * Function: test_no_collective_cause_mode * - * Purpose: - * tests cases for broken collective I/O and checks that the + * Purpose: + * tests cases for broken collective I/O and checks that the * H5Pget_mpio_no_collective_cause properties in the DXPL have the correct values. * - * Input: + * Input: * selection_mode: various mode to cause broken collective I/O * Note: Originally, each TEST case is supposed to be used alone. * After some discussion, this is updated to take multiple TEST cases - * with '|'. However there is no error check for any of combined + * with '|'. However there is no error check for any of combined * test cases, so a tester is responsible to understand and feed * proper combination of TESTs if needed. * - * + * * TEST_COLLECTIVE: * Test for regular collective I/O without cause of breaking. * Just to test normal behavior. - * + * * TEST_SET_INDEPENDENT: * Test for Independent I/O as the cause of breaking collective I/O. * @@ -3445,7 +3453,7 @@ actual_io_mode_tests(void) { * * TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES: * Test for NULL dataspace as the cause of breaking collective I/O. - * + * * TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT: * Test for Compact layout as the cause of breaking collective I/O. * @@ -3454,17 +3462,17 @@ actual_io_mode_tests(void) { * * TEST_FILTERS: * Test for using filter (checksum) as the cause of breaking collective I/O. - * Note: TEST_FILTERS mode will not work until H5Dcreate and H5write is supported for mpio and filter feature. Use test_no_collective_cause_mode_filter() function instead. + * Note: TEST_FILTERS mode will not work until H5Dcreate and H5write is supported for mpio and filter feature. Use test_no_collective_cause_mode_filter() function instead. + * * - * * Programmer: Jonathan Kim * Date: Aug, 2012 */ #define DSET_NOCOLCAUSE "nocolcause" #define NELM 2 #define FILE_EXTERNAL "nocolcause_extern.data" -static void -test_no_collective_cause_mode(int selection_mode) +static void +test_no_collective_cause_mode(int selection_mode) { uint32_t no_collective_cause_local_write = 0; uint32_t no_collective_cause_local_read = 0; @@ -3478,7 +3486,7 @@ test_no_collective_cause_mode(int selection_mode) const char * test_name; hbool_t is_chunked=1; hbool_t is_independent=0; - int mpi_size = -1; + int mpi_size = -1; int mpi_rank = -1; int length; int * buffer; @@ -3502,7 +3510,7 @@ test_no_collective_cause_mode(int selection_mode) H5Z_filter_t filter_info; #endif /* LATER */ /* set to global value as default */ - int l_facc_type = facc_type; + int l_facc_type = facc_type; char message[256]; /* Set up MPI parameters */ @@ -3564,7 +3572,7 @@ test_no_collective_cause_mode(int selection_mode) sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); } - + filename = (const char *)GetTestParameters(); HDassert(filename != NULL); @@ -3589,20 +3597,19 @@ test_no_collective_cause_mode(int selection_mode) /* Create the dataset */ - dataset = H5Dcreate2(fid, "nocolcause", data_type, sid, H5P_DEFAULT, - dcpl, H5P_DEFAULT); + dataset = H5Dcreate2(fid, "nocolcause", data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded"); - /* - * Set expected causes and some tweaks based on the type of test + /* + * Set expected causes and some tweaks based on the type of test */ if (selection_mode & TEST_DATATYPE_CONVERSION) { test_name = "Broken Collective I/O - Datatype Conversion"; no_collective_cause_local_expected |= H5D_MPIO_DATATYPE_CONVERSION; no_collective_cause_global_expected |= H5D_MPIO_DATATYPE_CONVERSION; /* set different sign to trigger type conversion */ - data_type = H5T_NATIVE_UINT; + data_type = H5T_NATIVE_UINT; } if (selection_mode & TEST_DATA_TRANSFORMS) { @@ -3667,14 +3674,14 @@ test_no_collective_cause_mode(int selection_mode) /* Allocate and initialize the buffer */ buffer = (int *)HDmalloc(sizeof(int) * length); - VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); - for(i = 0; i < length; i++) + VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); + for(i = 0; i < length; i++) buffer[i] = i; /* Set up the dxpl for the write */ dxpl_write = H5Pcreate(H5P_DATASET_XFER); VRFY((dxpl_write >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - + if(is_independent) { /* Set Independent I/O */ ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_INDEPENDENT); @@ -3684,17 +3691,17 @@ test_no_collective_cause_mode(int selection_mode) /* Set Collective I/O */ ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - + } if (selection_mode & TEST_DATA_TRANSFORMS) { - ret = H5Pset_data_transform (dxpl_write, "x+1"); + ret = H5Pset_data_transform (dxpl_write, "x+1"); VRFY((ret >= 0), "H5Pset_data_transform succeeded"); } /*--------------------- * Test Write access - *---------------------*/ + *---------------------*/ /* Write */ ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl_write, buffer); @@ -3709,7 +3716,7 @@ test_no_collective_cause_mode(int selection_mode) /*--------------------- * Test Read access - *---------------------*/ + *---------------------*/ /* Make a copy of the dxpl to test the read operation */ dxpl_read = H5Pcopy(dxpl_write); @@ -3720,7 +3727,7 @@ test_no_collective_cause_mode(int selection_mode) if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout); VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded"); - + /* Get the cause of broken collective I/O */ ret = H5Pget_mpio_no_collective_cause (dxpl_read, &no_collective_cause_local_read, &no_collective_cause_global_read); VRFY((ret >= 0), "retriving no collective cause succeeded" ); @@ -3730,13 +3737,13 @@ test_no_collective_cause_mode(int selection_mode) "reading and writing are the same for local cause of Broken Collective I/O"); VRFY((no_collective_cause_global_read == no_collective_cause_global_write), "reading and writing are the same for global cause of Broken Collective I/O"); - + /* Test values */ - memset (message, 0, sizeof (message)); - sprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n",test_name); + HDmemset (message, 0, sizeof (message)); + HDsprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n",test_name); VRFY((no_collective_cause_local_write == no_collective_cause_local_expected), message); - memset (message, 0, sizeof (message)); - sprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n",test_name); + HDmemset (message, 0, sizeof (message)); + HDsprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n",test_name); VRFY((no_collective_cause_global_write == no_collective_cause_global_expected), message); /* Release some resources */ @@ -3768,28 +3775,28 @@ test_no_collective_cause_mode(int selection_mode) } -/* +/* * Function: test_no_collective_cause_mode_filter * - * Purpose: - * Test specific for using filter as a caus of broken collective I/O and + * Purpose: + * Test specific for using filter as a caus of broken collective I/O and * checks that the H5Pget_mpio_no_collective_cause properties in the DXPL * have the correct values. * - * NOTE: - * This is a temporary function. + * NOTE: + * This is a temporary function. * test_no_collective_cause_mode(TEST_FILTERS) will replace this when * H5Dcreate and H5write support for mpio and filter feature. * - * Input: + * Input: * TEST_FILTERS_READ: * Test for using filter (checksum) as the cause of breaking collective I/O. - * + * * Programmer: Jonathan Kim * Date: Aug, 2012 */ -static void -test_no_collective_cause_mode_filter(int selection_mode) +static void +test_no_collective_cause_mode_filter(int selection_mode) { uint32_t no_collective_cause_local_read = 0; uint32_t no_collective_cause_local_expected = 0; @@ -3799,7 +3806,7 @@ test_no_collective_cause_mode_filter(int selection_mode) const char * filename; const char * test_name; hbool_t is_chunked=1; - int mpi_size = -1; + int mpi_size = -1; int mpi_rank = -1; int length; int * buffer; @@ -3829,7 +3836,7 @@ test_no_collective_cause_mode_filter(int selection_mode) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Barrier(MPI_COMM_WORLD); - + HDassert(mpi_size >= 1); mpi_comm = MPI_COMM_WORLD; @@ -3855,12 +3862,12 @@ test_no_collective_cause_mode_filter(int selection_mode) VRFY(0, "Unexpected mode, only test for TEST_FILTERS_READ."); } - /* Create the basic Space */ + /* Create the basic Space */ dims[0] = dim0; dims[1] = dim1; sid = H5Screate_simple (RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded"); - + filename = (const char *)GetTestParameters(); HDassert(filename != NULL); @@ -3883,8 +3890,7 @@ test_no_collective_cause_mode_filter(int selection_mode) /* Create the dataset */ - dataset = H5Dcreate2(fid, DSET_NOCOLCAUSE, data_type, sid, H5P_DEFAULT, - dcpl, H5P_DEFAULT); + dataset = H5Dcreate2(fid, DSET_NOCOLCAUSE, data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded"); #ifdef LATER /* fletcher32 */ @@ -3907,16 +3913,16 @@ test_no_collective_cause_mode_filter(int selection_mode) /* Allocate and initialize the buffer */ buffer = (int *)HDmalloc(sizeof(int) * length); - VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); - for(i = 0; i < length; i++) + VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); + for(i = 0; i < length; i++) buffer[i] = i; /* Set up the dxpl for the write */ dxpl = H5Pcreate(H5P_DATASET_XFER); VRFY((dxpl >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - + if (selection_mode == TEST_FILTERS_READ) { - /* To test read in collective I/O mode , write in independent mode + /* To test read in collective I/O mode , write in independent mode * because write fails with mpio + filter */ ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_INDEPENDENT); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); @@ -3926,7 +3932,7 @@ test_no_collective_cause_mode_filter(int selection_mode) ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); } - + /* Write */ ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl, buffer); @@ -3967,17 +3973,17 @@ test_no_collective_cause_mode_filter(int selection_mode) if(ret < 0) H5Eprint2(H5E_DEFAULT, stdout); VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded"); - + /* Get the cause of broken collective I/O */ ret = H5Pget_mpio_no_collective_cause (dxpl, &no_collective_cause_local_read, &no_collective_cause_global_read); VRFY((ret >= 0), "retriving no collective cause succeeded" ); /* Test values */ - memset (message, 0, sizeof (message)); - sprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n",test_name); + HDmemset (message, 0, sizeof (message)); + HDsprintf(message, "Local cause of Broken Collective I/O has the correct value for %s.\n",test_name); VRFY((no_collective_cause_local_read == (uint32_t)no_collective_cause_local_expected), message); - memset (message, 0, sizeof (message)); - sprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n",test_name); + HDmemset (message, 0, sizeof (message)); + HDsprintf(message, "Global cause of Broken Collective I/O has the correct value for %s.\n",test_name); VRFY((no_collective_cause_global_read == (uint32_t)no_collective_cause_global_expected), message); /* Release some resources */ @@ -4003,16 +4009,16 @@ test_no_collective_cause_mode_filter(int selection_mode) /* Function: no_collective_cause_tests * - * Purpose: Tests cases for broken collective IO. + * Purpose: Tests cases for broken collective IO. * * Programmer: Jonathan Kim * Date: Aug, 2012 */ -void -no_collective_cause_tests(void) +void +no_collective_cause_tests(void) { - /* - * Test individual cause + /* + * Test individual cause */ test_no_collective_cause_mode (TEST_COLLECTIVE); test_no_collective_cause_mode (TEST_SET_INDEPENDENT); @@ -4022,15 +4028,15 @@ no_collective_cause_tests(void) test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT); test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL); #ifdef LATER /* fletcher32 */ - /* TODO: use this instead of below TEST_FILTERS_READ when H5Dcreate and + /* TODO: use this instead of below TEST_FILTERS_READ when H5Dcreate and * H5Dwrite is ready for mpio + filter feature. */ /* test_no_collective_cause_mode (TEST_FILTERS); */ test_no_collective_cause_mode_filter (TEST_FILTERS_READ); -#endif /* LATER */ +#endif /* LATER */ - /* - * Test combined causes + /* + * Test combined causes */ test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION); test_no_collective_cause_mode (TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); @@ -4054,22 +4060,22 @@ void dataset_atomicity(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t sid; /* Dataspace ID */ - hid_t dataset1; /* Dataset IDs */ - hsize_t dims[RANK]; /* dataset dim sizes */ - int *write_buf = NULL; /* data buffer */ - int *read_buf = NULL; /* data buffer */ + hid_t acc_tpl; /* File access templates */ + hid_t sid; /* Dataspace ID */ + hid_t dataset1; /* Dataset IDs */ + hsize_t dims[RANK]; /* dataset dim sizes */ + int *write_buf = NULL; /* data buffer */ + int *read_buf = NULL; /* data buffer */ int buf_size; hid_t dataset2; - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* Memory dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* Memory dataspace ID */ hsize_t start[RANK]; hsize_t stride[RANK]; hsize_t count[RANK]; hsize_t block[RANK]; const char *filename; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; int i, j, k; hbool_t atomicity = FALSE; @@ -4079,11 +4085,11 @@ dataset_atomicity(void) dim0 = 64; dim1 = 32; filename = GetTestParameters(); if (facc_type != FACC_MPIO) { - printf("Atomicity tests will not work without the MPIO VFD\n"); + HDprintf("Atomicity tests will not work without the MPIO VFD\n"); return; } if(VERBOSE_MED) - printf("atomic writes to file %s\n", filename); + HDprintf("atomic writes to file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -4134,7 +4140,7 @@ dataset_atomicity(void) H5P_DEFAULT, write_buf); VRFY((ret >= 0), "H5Dwrite dataset2 succeeded"); } - + ret = H5Dclose(dataset1); VRFY((ret >= 0), "H5Dclose succeeded"); ret = H5Dclose(dataset2); @@ -4149,8 +4155,8 @@ dataset_atomicity(void) /* make sure setting atomicity fails on a serial file ID */ /* file locking allows only one file open (serial) for writing */ if(MAINPROCESS){ - fid=H5Fopen(filename,H5F_ACC_RDWR,H5P_DEFAULT); - VRFY((fid >= 0), "H5Fopen succeeed"); + fid=H5Fopen(filename,H5F_ACC_RDWR,H5P_DEFAULT); + VRFY((fid >= 0), "H5Fopen succeeed"); } /* should fail */ @@ -4158,8 +4164,8 @@ dataset_atomicity(void) VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed"); if(MAINPROCESS){ - ret = H5Fclose(fid); - VRFY((ret >= 0), "H5Fclose succeeded"); + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); } MPI_Barrier (comm); @@ -4215,23 +4221,23 @@ dataset_atomicity(void) if(VERBOSE_MED) { i=0;j=0;k=0; for (i=0 ; i= 0), "H5Pclose succeeded"); - atFileSpace = H5Screate_simple(1, atDims, NULL); + atFileSpace = H5Screate_simple(1, atDims, NULL); VRFY((atFileSpace > 0), "H5Screate_simple succeeded"); atid = H5Acreate2(gid, "bar", H5T_STD_U64LE, atFileSpace, H5P_DEFAULT, H5P_DEFAULT); VRFY((atid > 0), "H5Acreate succeeded"); diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index a31ba3a..4c2bf1e 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -157,7 +157,7 @@ typedef struct { /* obtain link info from H5tools_get_symlink_info() */ typedef struct { H5O_type_t trg_type; /* OUT: target type */ - char *trg_path; /* OUT: target obj path. This must be freed + char *trg_path; /* OUT: target obj path. This must be freed * when used with H5tools_get_symlink_info() */ haddr_t objno; /* OUT: target object address */ unsigned long fileno; /* OUT: File number that target object is located in */ diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 8f09c81..0c1521e 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -350,7 +350,7 @@ check_n_input( const char *str ) unsigned i; char c; - for (i = 0; i < strlen(str); i++) { + for (i = 0; i < HDstrlen(str); i++) { c = str[i]; if (i == 0) { if (c < 49 || c > 57) /* ascii values between 1 and 9 */ @@ -387,7 +387,7 @@ check_p_input( const char *str ) the atof return value on a hexadecimal input is different on some systems; we do a character check for this */ - if (strlen(str) > 2 && str[0] == '0' && str[1] == 'x') + if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x') return -1; x = atof(str); @@ -421,7 +421,7 @@ check_d_input( const char *str ) the atof return value on a hexadecimal input is different on some systems; we do a character check for this */ - if (strlen(str) > 2 && str[0] == '0' && str[1] == 'x') + if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x') return -1; x = atof(str); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 76e78af..3b64a0e 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -494,7 +494,7 @@ static int readIntegerData(FILE *strm, struct Input *in) return (-1); } #ifdef H5DEBUGIMPORT - printf("readIntegerData %d (0x%.8X)\n", *in08, *in08); + HDprintf("readIntegerData %d (0x%.8X)\n", *in08, *in08); #endif } break; @@ -531,7 +531,7 @@ static int readIntegerData(FILE *strm, struct Input *in) */ *in16 = temp16; #ifdef H5DEBUGIMPORT - printf("readIntegerData %d (0x%.8X)\n", *in16, temp16); + HDprintf("readIntegerData %d (0x%.8X)\n", *in16, temp16); #endif } break; @@ -567,7 +567,7 @@ static int readIntegerData(FILE *strm, struct Input *in) */ *in32 = temp32; #ifdef H5DEBUGIMPORT - printf("readIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32); + HDprintf("readIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32); #endif } break; @@ -605,7 +605,7 @@ static int readIntegerData(FILE *strm, struct Input *in) */ *in64 = temp64; #ifdef H5DEBUGIMPORT - printf("readIntegerData %d (0x%.8X)\n", *in64, temp64); + HDprintf("readIntegerData %d (0x%.8X)\n", *in64, temp64); #endif } break; @@ -701,7 +701,7 @@ static int readUIntegerData(FILE *strm, struct Input *in) */ *in16 = temp16; #ifdef H5DEBUGIMPORT - printf("readUIntegerData %d (0x%.4X = 0x%.4X)\n", *in16, *in16, temp16); + HDprintf("readUIntegerData %d (0x%.4X = 0x%.4X)\n", *in16, *in16, temp16); #endif } break; @@ -737,7 +737,7 @@ static int readUIntegerData(FILE *strm, struct Input *in) */ *in32 = temp32; #ifdef H5DEBUGIMPORT - printf("readUIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32); + HDprintf("readUIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32); #endif } break; @@ -775,7 +775,7 @@ static int readUIntegerData(FILE *strm, struct Input *in) */ *in64 = temp64; #ifdef H5DEBUGIMPORT - printf("readUIntegerData %ld (0x%.8X = 0x%.8X)\n", *in64, *in64, temp64); + HDprintf("readUIntegerData %ld (0x%.8X = 0x%.8X)\n", *in64, *in64, temp64); #endif } break; @@ -855,7 +855,7 @@ static int readFloatData(FILE *strm, struct Input *in) */ *bfp32 = temp32; #ifdef H5DEBUGIMPORT - printf("readFloatData %ld (0x%.8X = 0x%.8X)\n", *bfp32, *bfp32, temp32); + HDprintf("readFloatData %ld (0x%.8X = 0x%.8X)\n", *bfp32, *bfp32, temp32); #endif } break; @@ -907,7 +907,7 @@ static int readFloatData(FILE *strm, struct Input *in) */ *bfp64 = temp64; #ifdef H5DEBUGIMPORT - printf("readFloatData %ld (0x%.16lX)\n", *bfp64, temp64); + HDprintf("readFloatData %ld (0x%.16lX)\n", *bfp64, temp64); #endif } break; @@ -1099,7 +1099,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) *------------------------------------------------------------------------- */ #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING\n"); + HDprintf("processStrHDFData DATATYPE STRING\n"); #endif if ((type_id = H5Tcopy(H5T_C_S1)) < 0) @@ -1136,7 +1136,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) } H5E_END_TRY; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING groups created\n"); + HDprintf("processStrHDFData DATATYPE STRING groups created\n"); #endif if ((space_id = H5Screate_simple(in->rank, in->sizeOfDimension, NULL)) < 0) @@ -1149,7 +1149,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) goto out; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING ready to process strings\n"); + HDprintf("processStrHDFData DATATYPE STRING ready to process strings\n"); #endif line = 0; j = 0; @@ -1159,36 +1159,36 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) str2 = NULL; str3 = NULL; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING[%llu]={%s}\n", (unsigned long long)line, str1); + HDprintf("processStrHDFData DATATYPE STRING[%llu]={%s}\n", (unsigned long long)line, str1); #endif /* process string to remove the first and last quote char */ str2 = strchr(str1, '"'); if (str2 != NULL) { #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2); + HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2); #endif str2++; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2); + HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2); #endif str3 = strrchr(str2, '"'); if (str3 != NULL) { #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str3), str3); + HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str3), str3); #endif *str3 = '\0'; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", strlen(str2), str2); + HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2); #endif - if(strlen(str2) > 0) { + if(HDstrlen(str2) > 0) { hid_t fspace_id; hsize_t start[1]; hsize_t count[1] = { 1 }; #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING[%llu] store %s\n", (unsigned long long)line, str2); + HDprintf("processStrHDFData DATATYPE STRING[%llu] store %s\n", (unsigned long long)line, str2); #endif if ((fspace_id = H5Dget_space(dset_id)) < 0) goto out; @@ -1210,7 +1210,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) j++; } #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING eof reached\n"); + HDprintf("processStrHDFData DATATYPE STRING eof reached\n"); #endif /* close */ @@ -1223,7 +1223,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) out: #ifdef H5DEBUGIMPORT - printf("processStrHDFData DATATYPE STRING error exit\n"); + HDprintf("processStrHDFData DATATYPE STRING error exit\n"); #endif /* disable error reporting */ H5E_BEGIN_TRY @@ -1437,7 +1437,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } in->inputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif in->inputArchitecture = 0; /* default to NATIVE */ @@ -1450,7 +1450,7 @@ static int processConfigurationFile(char *infile, struct Input *in) if((scanret == 1) && !HDstrcmp("HDF5", key)) { #ifdef H5DEBUGIMPORT int pndx; - printf("\nh5dump file\n"); + HDprintf("\nh5dump file\n"); #endif in->h5dumpInput = 1; scanret = fscanf(strm, "%s", temp); /* filename */ @@ -1459,7 +1459,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (scanret == 1) { if(!HDstrcmp("DATASET", key)) { /* PATH */ #ifdef H5DEBUGIMPORT - printf("h5dump DATASET key\n"); + HDprintf("h5dump DATASET key\n"); #endif if (in->configOptionVector[PATH] == 1) { (void) HDfprintf(stderr, err3a, infile); @@ -1470,7 +1470,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASET %s found\n", temp); + HDprintf("h5dump DATASET %s found\n", temp); #endif if (parsePathInfo(&in->path, temp) == -1) { (void) HDfprintf(stderr, err3b, infile); @@ -1479,12 +1479,12 @@ static int processConfigurationFile(char *infile, struct Input *in) in->configOptionVector[PATH] = 1; scanret = fscanf(strm, "%s", temp); /* start bracket */ #ifdef H5DEBUGIMPORT - printf("h5dump DATASET %s found\n", temp); + HDprintf("h5dump DATASET %s found\n", temp); #endif } /* if(!HDstrcmp("DATASET", key)) PATH */ else if(!HDstrcmp("DATATYPE", key)) { /* INPUT-CLASS */ #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE key\n"); + HDprintf("h5dump DATATYPE key\n"); #endif if (in->configOptionVector[INPUT_CLASS] == 1) { (void) HDfprintf(stderr, err4a, infile); @@ -1496,14 +1496,14 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE %s found\n", temp); + HDprintf("h5dump DATATYPE %s found\n", temp); #endif if ((kindex = getInputClassType(in, temp)) == -1) { (void) HDfprintf(stderr, err4b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE type %d inputClass\n", in->inputClass); + HDprintf("h5dump DATATYPE type %d inputClass\n", in->inputClass); #endif in->configOptionVector[INPUT_CLASS] = 1; @@ -1519,21 +1519,21 @@ static int processConfigurationFile(char *infile, struct Input *in) in->outputClass = 2; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE type %d outputClass\n", in->outputClass); + HDprintf("h5dump DATATYPE type %d outputClass\n", in->outputClass); #endif if(in->inputClass == 5) { /* STRING */ int get_next_prop = 1; in->outputClass = -1; #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING found\n"); + HDprintf("h5dump DATATYPE STRING found\n"); #endif if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING %s found\n", temp); + HDprintf("h5dump DATATYPE STRING %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* string properties */ (void) HDfprintf(stderr, "%s", err18); @@ -1546,7 +1546,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING STRSIZE %s found\n", temp); + HDprintf("h5dump DATATYPE STRING STRSIZE %s found\n", temp); #endif if (HDstrcmp("H5T_VARIABLE;", temp)) { char *more = temp; @@ -1556,7 +1556,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING %d InputSize\n", in->inputSize); + HDprintf("h5dump DATATYPE STRING %d InputSize\n", in->inputSize); #endif } } @@ -1566,7 +1566,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING STRPAD %s found\n", temp); + HDprintf("h5dump DATATYPE STRING STRPAD %s found\n", temp); #endif } else if(!HDstrcmp("CSET", key)) { /* CSET */ @@ -1575,7 +1575,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING CSET %s found\n", temp); + HDprintf("h5dump DATATYPE STRING CSET %s found\n", temp); #endif } @@ -1585,7 +1585,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING CTYPE %s found\n", temp); + HDprintf("h5dump DATATYPE STRING CTYPE %s found\n", temp); #endif } /* if(!HDstrcmp("CSET", key)) */ if (fscanf(strm, "%s", temp) != 1) { @@ -1593,7 +1593,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE STRING %s found\n", temp); + HDprintf("h5dump DATATYPE STRING %s found\n", temp); #endif if(!HDstrcmp("}", temp)) { /* end bracket */ get_next_prop = 0; @@ -1605,7 +1605,7 @@ static int processConfigurationFile(char *infile, struct Input *in) hsize_t temp_dims[MAX_NUM_DIMENSION]; #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE key\n"); + HDprintf("h5dump DATASPACE key\n"); #endif if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); @@ -1621,21 +1621,21 @@ static int processConfigurationFile(char *infile, struct Input *in) else if(!HDstrcmp("SIMPLE", temp)) { /* SIMPLE */ int icount = 0; #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE found\n"); + HDprintf("h5dump DATASPACE SIMPLE found\n"); #endif if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp("(", temp)) { /* start paren */ int get_next_dim = 1; @@ -1646,7 +1646,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif while (get_next_dim) { char *more = temp; @@ -1656,7 +1656,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp(")", temp)) { /* end paren */ in->rank = ++icount; @@ -1676,17 +1676,17 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %ld rank\n", in->rank); + HDprintf("h5dump DATASPACE SIMPLE %ld rank\n", in->rank); #endif for (i = 0; i < in->rank; i++) { in->sizeOfDimension[i] = temp_dims[i]; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE dims[%ld]:", in->rank); + HDprintf("h5dump DATASPACE SIMPLE dims[%ld]:", in->rank); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld", in->sizeOfDimension[pndx]); + HDprintf(" %ld", in->sizeOfDimension[pndx]); } - printf("\n"); + HDprintf("\n"); #endif in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ @@ -1699,7 +1699,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp("/", temp)) { /* / max dims */ if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { @@ -1710,25 +1710,25 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp("(", temp)) { /* start paren */ int get_next_dim = 1; int i = 0; #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE process max dim values\n"); + HDprintf("h5dump DATASPACE SIMPLE process max dim values\n"); #endif if (fscanf(strm, "%s", temp) != 1) { /* max dim with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif while (get_next_dim) { #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE get max dim value\n"); + HDprintf("h5dump DATASPACE SIMPLE get max dim value\n"); #endif if(!HDstrcmp("H5S_UNLIMITED", temp) || !HDstrcmp("H5S_UNLIMITED,", temp)) { /* unlimited */ in->maxsizeOfDimension[i] = H5S_UNLIMITED; @@ -1743,7 +1743,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif if(!HDstrcmp(")", temp)) { /* end paren */ get_next_dim = 0; @@ -1757,12 +1757,12 @@ static int processConfigurationFile(char *infile, struct Input *in) } } /* while (get_next_dim) */ #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE maxdims[%ld]:", in->rank); + HDprintf("h5dump DATASPACE SIMPLE maxdims[%ld]:", in->rank); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld", in->maxsizeOfDimension[pndx]); + HDprintf(" %ld", in->maxsizeOfDimension[pndx]); } - printf("\n"); - printf("h5dump DATASPACE SIMPLE get max dim finished\n"); + HDprintf("\n"); + HDprintf("h5dump DATASPACE SIMPLE get max dim finished\n"); #endif } /* if(!HDstrcmp("(", key)) start paren */ else { @@ -1771,7 +1771,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } scanret = fscanf(strm, "%s", temp); /* end bracket */ #ifdef H5DEBUGIMPORT - printf("h5dump DATASPACE SIMPLE %s found\n", temp); + HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif } /* if(!HDstrcmp("/", key)) max dims separator */ } /* else if(!HDstrcmp("SIMPLE", key)) */ @@ -1782,21 +1782,21 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* else if(!HDstrcmp("DATASPACE", key)) RANK and DIMENSIONS */ else if(!HDstrcmp("STORAGE_LAYOUT", key)) { /* CHUNKED-DIMENSION-SIZES */ #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT key\n"); + HDprintf("h5dump STORAGE_LAYOUT key\n"); #endif if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* CHUNKED */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp); #endif if(!HDstrcmp("CHUNKED", temp)) { /* CHUNKED */ if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { @@ -1808,7 +1808,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif if(!HDstrcmp("(", temp)) { /* start paren */ int get_next_dim = 1; @@ -1819,7 +1819,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif while (get_next_dim) { char *more = temp; @@ -1829,7 +1829,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif if(!HDstrcmp(")", temp)) { /* end paren */ in->configOptionVector[RANK] = 1; @@ -1844,11 +1844,11 @@ static int processConfigurationFile(char *infile, struct Input *in) } } /* while (get_next_dim) */ #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED dims [%ld]:", in->rank); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED dims [%ld]:", in->rank); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld", in->sizeOfChunk[pndx]); + HDprintf(" %ld", in->sizeOfChunk[pndx]); } - printf("\n"); + HDprintf("\n"); #endif in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ @@ -1861,7 +1861,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif if(!HDstrcmp("SIZE", temp)) { /* SIZE */ if (fscanf(strm, "%d", (&ival)) != 1) { @@ -1869,7 +1869,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED SIZE %d found\n", ival); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED SIZE %d found\n", ival); #endif } while (HDstrcmp("}", temp)) { @@ -1878,7 +1878,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); + HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif } in->configOptionVector[CHUNK] = 1; @@ -1886,53 +1886,53 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* else if(!HDstrcmp("STORAGE_LAYOUT", key)) CHUNKED-DIMENSION-SIZES */ else if(!HDstrcmp("FILTERS", key)) { /* FILTERS */ #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS key\n"); + HDprintf("h5dump FILTERS key\n"); #endif if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS %s found\n", temp); + HDprintf("h5dump FILTERS %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS %s found\n", temp); + HDprintf("h5dump FILTERS %s found\n", temp); #endif if(!HDstrcmp("COMPRESSION", temp)) { /* COMPRESSION */ #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION found\n"); + HDprintf("h5dump FILTERS COMPRESSION found\n"); #endif if (fscanf(strm, "%s", temp) != 1) { /* DEFLATE */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION %s found\n", temp); + HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* bgin bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION %s found\n", temp); + HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* LEVEL */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION %s found\n", temp); + HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif if (fscanf(strm, "%d", (&ival)) != 1) { (void) HDfprintf(stderr, "%s", err19); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival); + HDprintf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival); #endif in->compressionParam = ival; if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ @@ -1940,20 +1940,20 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS COMPRESSION %s found\n", temp); + HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif in->compressionType = 0; /* ONLY GZIP supported */ in->configOptionVector[COMPRESS] = 1; } else if(!HDstrcmp("CONTIGUOUS", temp)) { /* CONTIGUOUS */ #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS CONTIGUOUS found\n"); + HDprintf("h5dump FILTERS CONTIGUOUS found\n"); #endif in->configOptionVector[COMPRESS] = 0; } else if(!HDstrcmp("NONE", temp)) { /* NONE */ #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS NONE found\n"); + HDprintf("h5dump FILTERS NONE found\n"); #endif in->configOptionVector[COMPRESS] = 0; } @@ -1962,28 +1962,28 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump FILTERS %s found\n", temp); + HDprintf("h5dump FILTERS %s found\n", temp); #endif } else if(!HDstrcmp("SUBSET", key)) { /* reduce dimensions */ hsize_t temp_dims[MAX_NUM_DIMENSION]; int get_next_prop = 1; #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET key\n"); + HDprintf("h5dump SUBSET key\n"); #endif if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err20, infile); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET %s found\n", temp); + HDprintf("h5dump SUBSET %s found\n", temp); #endif if (fscanf(strm, "%s", temp) != 1) { /* SUBSET keyword */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET %s found\n", temp); + HDprintf("h5dump SUBSET %s found\n", temp); #endif while (get_next_prop) { if(!HDstrcmp("COUNT", temp)) { /* COUNT */ @@ -1993,7 +1993,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET %s found\n", temp); + HDprintf("h5dump SUBSET %s found\n", temp); #endif if(!HDstrcmp("(", temp)) { /* start paren */ int get_next_dim = 1; @@ -2004,7 +2004,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET COUNT [%s] found\n", temp); + HDprintf("h5dump SUBSET COUNT [%s] found\n", temp); #endif while (get_next_dim) { char *more = temp; @@ -2014,7 +2014,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET COUNT %s found\n", temp); + HDprintf("h5dump SUBSET COUNT %s found\n", temp); #endif if(!HDstrcmp(");", temp)) { /* end paren */ in->rank = ++icount; @@ -2033,11 +2033,11 @@ static int processConfigurationFile(char *infile, struct Input *in) in->sizeOfDimension[i] = temp_dims[i]; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET COUNT dims: [%d]", in->rank); + HDprintf("h5dump SUBSET COUNT dims: [%d]", in->rank); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld", in->sizeOfDimension[pndx]); + HDprintf(" %ld", in->sizeOfDimension[pndx]); } - printf("\n"); + HDprintf("\n"); #endif in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ @@ -2049,7 +2049,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET %s found\n", temp); + HDprintf("h5dump SUBSET %s found\n", temp); #endif if(!HDstrcmp("(", temp)) { /* start paren */ int get_next_dim = 1; @@ -2060,7 +2060,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET BLOCK [%s] found\n", temp); + HDprintf("h5dump SUBSET BLOCK [%s] found\n", temp); #endif while (get_next_dim) { char *more = temp; @@ -2070,7 +2070,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET BLOCK %s found\n", temp); + HDprintf("h5dump SUBSET BLOCK %s found\n", temp); #endif if(!HDstrcmp(");", temp)) { /* end paren */ in->rank = ++icount; @@ -2089,11 +2089,11 @@ static int processConfigurationFile(char *infile, struct Input *in) in->sizeOfDimension[i] = in->sizeOfDimension[i] * temp_dims[i]; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET BLOCK dims: [%d]", in->rank); + HDprintf("h5dump SUBSET BLOCK dims: [%d]", in->rank); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld", in->sizeOfDimension[pndx]); + HDprintf(" %ld", in->sizeOfDimension[pndx]); } - printf("\n"); + HDprintf("\n"); #endif in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ @@ -2103,7 +2103,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } #ifdef H5DEBUGIMPORT - printf("h5dump SUBSET %s found\n", temp); + HDprintf("h5dump SUBSET %s found\n", temp); #endif if(!HDstrcmp("}", temp)) { /* end bracket */ get_next_prop = 0; @@ -2112,7 +2112,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* else if(!HDstrcmp("SUBSET", key)) */ else if(!HDstrcmp("DATA", key)) { /* FINSHED */ #ifdef H5DEBUGIMPORT - printf("h5dump DATA key\n"); + HDprintf("h5dump DATA key\n"); #endif scanret = 0; break; @@ -2120,32 +2120,32 @@ static int processConfigurationFile(char *infile, struct Input *in) scanret = fscanf(strm, "%s", key); } #ifdef H5DEBUGIMPORT - printf("h5dump path"); + HDprintf("h5dump path"); for (pndx = 0; pndx < in->path.count; pndx++) { - printf(" : %s", in->path.group[pndx]); - } - printf("\n"); - printf("h5dump inputClass=%d\n", in->inputClass); - printf("h5dump inputSize=%d\n", in->inputSize); - printf("h5dump inputArchitecture=%d\n", in->inputArchitecture); - printf("h5dump inputByteOrder=%d\n", in->inputByteOrder); - printf("h5dump rank=%d\n", in->rank); - printf("h5dump outputClass=%d\n", in->outputClass); - printf("h5dump outputSize=%d\n", in->outputSize); - printf("h5dump outputArchitecture=%d\n", in->outputArchitecture); - printf("h5dump outputByteOrder=%d\n", in->outputByteOrder); - printf("h5dump compressionType=%d\n", in->compressionType); - printf("h5dump compressionParam=%d\n", in->compressionParam); - printf("h5dump externFilename=%s\n", in->externFilename); - printf("h5dump sizeOfDimensions:\n"); + HDprintf(" : %s", in->path.group[pndx]); + } + HDprintf("\n"); + HDprintf("h5dump inputClass=%d\n", in->inputClass); + HDprintf("h5dump inputSize=%d\n", in->inputSize); + HDprintf("h5dump inputArchitecture=%d\n", in->inputArchitecture); + HDprintf("h5dump inputByteOrder=%d\n", in->inputByteOrder); + HDprintf("h5dump rank=%d\n", in->rank); + HDprintf("h5dump outputClass=%d\n", in->outputClass); + HDprintf("h5dump outputSize=%d\n", in->outputSize); + HDprintf("h5dump outputArchitecture=%d\n", in->outputArchitecture); + HDprintf("h5dump outputByteOrder=%d\n", in->outputByteOrder); + HDprintf("h5dump compressionType=%d\n", in->compressionType); + HDprintf("h5dump compressionParam=%d\n", in->compressionParam); + HDprintf("h5dump externFilename=%s\n", in->externFilename); + HDprintf("h5dump sizeOfDimensions:\n"); for (pndx = 0; pndx < in->rank; pndx++) { - printf(" %ld\n", in->sizeOfDimension[pndx]); + HDprintf(" %ld\n", in->sizeOfDimension[pndx]); } #endif } else { #ifdef H5DEBUGIMPORT - printf("original option keyword parsing\n"); + HDprintf("original option keyword parsing\n"); #endif while (scanret == 1) { if ((kindex = mapKeywordToIndex(key)) == -1) { @@ -2655,7 +2655,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2676,7 +2676,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2697,7 +2697,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2718,7 +2718,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2739,7 +2739,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2760,7 +2760,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2781,7 +2781,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2802,7 +2802,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 4; @@ -2823,7 +2823,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2844,7 +2844,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2865,7 +2865,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2886,7 +2886,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2907,7 +2907,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2928,7 +2928,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2949,7 +2949,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -2970,7 +2970,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 7; @@ -3111,7 +3111,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 3; @@ -3132,7 +3132,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 3; @@ -3153,7 +3153,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 3; @@ -3174,7 +3174,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = 3; @@ -3250,7 +3250,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3269,7 +3269,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3288,7 +3288,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3307,7 +3307,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3326,7 +3326,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3345,7 +3345,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3364,7 +3364,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3383,7 +3383,7 @@ static int getInputClassType(struct Input *in, char * buffer) } in->outputByteOrder = kindex; #ifdef H5DEBUGIMPORT - printf("h5dump inputByteOrder %d\n", in->inputByteOrder); + HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder); #endif kindex = -1; @@ -3422,9 +3422,9 @@ static int getInputClassType(struct Input *in, char * buffer) if (in->configOptionVector[OUTPUT_SIZE] == 0) in->outputSize = in->inputSize; #ifdef H5DEBUGIMPORT - printf("h5dump DATATYPE InClass %d inputSize\n", in->inputSize); - printf("h5dump DATATYPE InClass %d outputSize\n", in->outputSize); - printf("h5dump DATATYPE InClass %d outputArchitecture\n", in->outputArchitecture); + HDprintf("h5dump DATATYPE InClass %d inputSize\n", in->inputSize); + HDprintf("h5dump DATATYPE InClass %d outputSize\n", in->outputSize); + HDprintf("h5dump DATATYPE InClass %d outputArchitecture\n", in->outputArchitecture); #endif in->inputClass = kindex; @@ -4631,7 +4631,7 @@ static int process(struct Options *opt) intype = createInputDataType(in); outtype = createOutputDataType(in); #ifdef H5DEBUGIMPORT - printf("process intype %ld outtype %ld\n", intype, outtype); + HDprintf("process intype %ld outtype %ld\n", intype, outtype); #endif /* create property list */ diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index ff67cf1..dc1dc4a 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -24,11 +24,11 @@ /* Parameters to control statistics gathered */ /* Default threshold for small groups/datasets/attributes */ -#define DEF_SIZE_SMALL_GROUPS 10 -#define DEF_SIZE_SMALL_DSETS 10 -#define DEF_SIZE_SMALL_ATTRS 10 +#define DEF_SIZE_SMALL_GROUPS 10 +#define DEF_SIZE_SMALL_DSETS 10 +#define DEF_SIZE_SMALL_ATTRS 10 -#define SIZE_SMALL_SECTS 10 +#define SIZE_SMALL_SECTS 10 #define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to accommodate for user-define filters + one @@ -74,7 +74,7 @@ typedef struct iter_t { ohdr_info_t group_ohdr_info; /* Object header information for groups */ hsize_t max_attrs; /* Maximum attributes from a group */ - unsigned long *num_small_attrs; /* Size of small attributes tracked */ + unsigned long *num_small_attrs; /* Size of small attributes tracked */ unsigned attr_nbins; /* Number of bins for attribute counts */ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */ @@ -83,7 +83,7 @@ typedef struct iter_t { hsize_t max_dset_dims; /* Maximum dimension size of dataset */ unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */ unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */ - unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */ + unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */ unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */ dtype_info_t *dset_type_info; /* Pointer to dataset datatype information found */ unsigned dset_dim_nbins; /* Number of bins for dataset dimensions */ @@ -103,9 +103,9 @@ typedef struct iter_t { hsize_t super_ext_size; /* superblock extension size */ hsize_t ublk_size; /* user block size (if exists) */ H5F_fspace_strategy_t fs_strategy; /* File space management strategy */ - hbool_t fs_persist; /* Free-space persist or not */ + hbool_t fs_persist; /* Free-space persist or not */ hsize_t fs_threshold; /* Free-space section threshold */ - hsize_t fsp_size; /* File space page size */ + hsize_t fsp_size; /* File space page size */ hsize_t free_space; /* Amount of freespace in the file */ hsize_t free_hdr; /* Size of free space manager metadata in the file */ unsigned long num_small_sects[SIZE_SMALL_SECTS]; /* Size of small free-space sections */ @@ -136,9 +136,9 @@ static int display_dset_metadata = FALSE; /* display file space info f static int display_object = FALSE; /* not implemented yet */ /* Initialize threshold for small groups/datasets/attributes */ -static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS; -static int sdsets_threshold = DEF_SIZE_SMALL_DSETS; -static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS; +static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS; +static int sdsets_threshold = DEF_SIZE_SMALL_DSETS; +static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS; /* a structure for handling the order command-line parameters come in */ struct handler_t { @@ -257,7 +257,7 @@ leave(int ret) } - + /*------------------------------------------------------------------------- * Function: usage * @@ -297,7 +297,7 @@ static void usage(const char *prog) HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); } - + /*------------------------------------------------------------------------- * Function: ceil_log10 * @@ -324,7 +324,7 @@ ceil_log10(unsigned long x) return ret; } /* ceil_log10() */ - + /*------------------------------------------------------------------------- * Function: attribute_stats * @@ -374,7 +374,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) return 0; } /* end attribute_stats() */ - + /*------------------------------------------------------------------------- * Function: group_stats * @@ -456,7 +456,7 @@ done: return ret_value; } /* end group_stats() */ - + /*------------------------------------------------------------------------- * Function: dataset_stats * @@ -648,7 +648,7 @@ done: return ret_value; } /* end dataset_stats() */ - + /*------------------------------------------------------------------------- * Function: datatype_stats * @@ -680,7 +680,7 @@ done: return ret_value; } /* end datatype_stats() */ - + /*------------------------------------------------------------------------- * Function: obj_stats * @@ -736,7 +736,7 @@ done: return ret_value; } /* end obj_stats() */ - + /*------------------------------------------------------------------------- * Function: lnk_stats * @@ -834,7 +834,7 @@ freespace_stats(hid_t fid, iter_t *iter) return 0; } /* end freespace_stats() */ - + /*------------------------------------------------------------------------- * Function: hand_free * @@ -863,7 +863,7 @@ hand_free(struct handler_t *hand) } /* end if */ } /* end hand_free() */ - + /*------------------------------------------------------------------------- * Function: parse_command_line * @@ -1041,7 +1041,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: iter_free * @@ -1106,7 +1106,7 @@ iter_free(iter_t *iter) } /* end if */ } /* end iter_free() */ - + /*------------------------------------------------------------------------- * Function: print_file_info * @@ -1138,7 +1138,7 @@ print_file_info(const iter_t *iter) return 0; } /* print_file_info() */ - + /*------------------------------------------------------------------------- * Function: print_file_metadata * @@ -1198,7 +1198,7 @@ print_file_metadata(const iter_t *iter) return 0; } /* print_file_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_group_info * @@ -1255,7 +1255,7 @@ print_group_info(const iter_t *iter) return 0; } /* print_group_info() */ - + /*------------------------------------------------------------------------- * Function: print_group_metadata * @@ -1282,7 +1282,7 @@ print_group_metadata(const iter_t *iter) return 0; } /* print_group_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_dataset_info * @@ -1369,7 +1369,7 @@ print_dataset_info(const iter_t *iter) return 0; } /* print_dataset_info() */ - + /*------------------------------------------------------------------------- * Function: print_dataset_metadata * @@ -1398,7 +1398,7 @@ print_dset_metadata(const iter_t *iter) return 0; } /* print_dset_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_dset_dtype_meta * @@ -1439,7 +1439,7 @@ print_dset_dtype_meta(const iter_t *iter) return 0; } /* print_dset_dtype_meta() */ - + /*------------------------------------------------------------------------- * Function: print_attr_info * @@ -1488,7 +1488,7 @@ print_attr_info(const iter_t *iter) return 0; } /* print_attr_info() */ - + /*------------------------------------------------------------------------- * Function: print_freespace_info * @@ -1538,7 +1538,7 @@ print_freespace_info(const iter_t *iter) return 0; } /* print_freespace_info() */ - + /*------------------------------------------------------------------------- * Function: print_storage_summary * @@ -1602,7 +1602,7 @@ print_storage_summary(const iter_t *iter) return 0; } /* print_storage_summary() */ - + /*------------------------------------------------------------------------- * Function: print_file_statistics * @@ -1649,7 +1649,7 @@ print_file_statistics(const iter_t *iter) if(display_summary) print_storage_summary(iter); } /* print_file_statistics() */ - + /*------------------------------------------------------------------------- * Function: print_object_statistics * @@ -1672,7 +1672,7 @@ print_object_statistics(const char *name) printf("Object name %s\n", name); } /* print_object_statistics() */ - + /*------------------------------------------------------------------------- * Function: print_statistics * @@ -1698,7 +1698,7 @@ print_statistics(const char *name, const iter_t *iter) print_file_statistics(iter); } /* print_statistics() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -1733,7 +1733,7 @@ main(int argc, const char *argv[]) /* Disable tools error reporting */ H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - + HDmemset(&iter, 0, sizeof(iter)); if(parse_command_line(argc, argv, &hand) < 0) @@ -1780,15 +1780,15 @@ main(int argc, const char *argv[]) iter.free_hdr = finfo.free.meta_size; } /* end else */ - iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long)); - iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); - iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long)); + iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long)); + iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); + iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long)); - if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { - error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); + if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { + error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); h5tools_setstatus(EXIT_FAILURE); - goto done; - } + goto done; + } if((fcpl = H5Fget_create_plist(fid)) < 0) warn_msg("Unable to retrieve file creation property\n"); diff --git a/tools/test/h5import/h5importtest.c b/tools/test/h5import/h5importtest.c index 489bc01..bbb67b6 100644 --- a/tools/test/h5import/h5importtest.c +++ b/tools/test/h5import/h5importtest.c @@ -71,9 +71,9 @@ main(void) volatile uint32_t ibyte=0x01234567; /* 0 for big endian, 1 for little endian. */ if ((*((uint8_t*)(&ibyte))) == 0x67) - strncpy(machine_order, "LE", 2); + HDstrncpy(machine_order, "LE", 2); else - strncpy(machine_order, "BE", 2); + HDstrncpy(machine_order, "BE", 2); /* diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index b421328..c6e62d5 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -63,13 +63,13 @@ #define H5FATAL 1 #define VRFY(val, mesg, fatal) do { \ if (!val) { \ - printf("Proc %d: ", mynod); \ + printf("Proc %d: ", mynod); \ printf("*** Assertion failed (%s) at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ - if (fatal){ \ + if (fatal){ \ fflush(stdout); \ goto die_jar_jar_die; \ - } \ + } \ } \ } while(0) #define RANK 1 @@ -180,38 +180,38 @@ int main(int argc, char **argv) /* setup file access template with parallel IO access. */ if (opt_split_vfd){ - hid_t mpio_pl; - - mpio_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL); - VRFY((ret >= 0), "", H5FATAL); - - /* set optional allocation alignment */ - if (opt_alignment*opt_threshold != 1){ - ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); - VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); - } - - /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL); - ret = H5Pclose(mpio_pl); - VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL); + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL); + VRFY((ret >= 0), "", H5FATAL); + + /* set optional allocation alignment */ + if (opt_alignment*opt_threshold != 1){ + ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); + VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); + } + + /* setup file access template */ + acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL); + ret = H5Pclose(mpio_pl); + VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL); }else{ - /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL); - VRFY((ret >= 0), "", H5FATAL); - - /* set optional allocation alignment */ - if (opt_alignment*opt_threshold != 1){ - ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); - VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); - } + /* setup file access template */ + acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL); + VRFY((ret >= 0), "", H5FATAL); + + /* set optional allocation alignment */ + if (opt_alignment*opt_threshold != 1){ + ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); + VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); + } } h5_fixname_no_suffix(FILENAME[0], acc_tpl, filename, sizeof filename); @@ -225,7 +225,7 @@ int main(int argc, char **argv) sid = H5Screate_simple(RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL); dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL); /* create the memory dataspace and the file dataspace */ -- cgit v0.12 From ff13ed67a9ce20e5f598bd46cd6dd544b5237e22 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 28 Aug 2018 12:08:06 -0500 Subject: Fix typo --- java/examples/groups/JavaGroupExample.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index a4d3959..0e2d002 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -369,7 +369,7 @@ fi # Clean up temporary files/directories CLEAN_LIBFILES_AND_BLDLIBDIR CLEAN_DATAFILES_AND_BLDDIR -CLEAN_REFFILES_AND_BLDITERDIR +CLEAN_ITERFILES_AND_BLDITERDIR # Report test results and exit if test $nerrors -eq 0 ; then -- cgit v0.12 From e6f8a55d8c42270efd7c870b7cee07b0d4ba7d08 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 29 Aug 2018 23:06:50 -0500 Subject: Correct default API version for develop to 112. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index fc82636..cedfcfd 100644 --- a/configure.ac +++ b/configure.ac @@ -3225,7 +3225,7 @@ fi ## if the user insists on doing this via the --enable-unsupported configure ## flag, we'll let them. if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then - if test "X${DEFAULT_API_VERSION}" != "Xv110" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then + if test "X${DEFAULT_API_VERSION}" != "Xv112" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then AC_MSG_ERROR([Removing old public API symbols not allowed when using them as default public API symbols. Use --enable-unsupported to override this error.]) fi fi -- cgit v0.12 From 370db827ee908f290a7939a0ff392c18a1beb0db Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 30 Aug 2018 08:29:21 -0500 Subject: Call new function --- java/examples/groups/JavaGroupExample.sh.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 0e2d002..1f7e578 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -256,6 +256,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@ COPY_LIBFILES_TO_BLDLIBDIR COPY_DATAFILES_TO_BLDDIR COPY_REFFILES_TO_BLDITERDIR +COPY_ITERFILES_TO_BLDITERDIR CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE"" @@ -367,6 +368,7 @@ else fi # Clean up temporary files/directories +CLEAN_ITERFILES_AND_BLDITERDIR CLEAN_LIBFILES_AND_BLDLIBDIR CLEAN_DATAFILES_AND_BLDDIR CLEAN_ITERFILES_AND_BLDITERDIR -- cgit v0.12 From cd35778542c3c6e51ad334e6e4cf4be9f08bcaf8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 30 Aug 2018 08:38:28 -0500 Subject: Correct names --- java/examples/groups/JavaGroupExample.sh.in | 3 --- 1 file changed, 3 deletions(-) diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 1f7e578..9d4673f 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -148,7 +148,6 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() } COPY_DATAFILES="$LIST_DATA_FILES" -COPY_ITERFILES="$LIST_ITER_FILES" COPY_DATAFILES_TO_BLDDIR() { @@ -255,7 +254,6 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@ # prepare for test COPY_LIBFILES_TO_BLDLIBDIR COPY_DATAFILES_TO_BLDDIR -COPY_REFFILES_TO_BLDITERDIR COPY_ITERFILES_TO_BLDITERDIR CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE"" @@ -371,7 +369,6 @@ fi CLEAN_ITERFILES_AND_BLDITERDIR CLEAN_LIBFILES_AND_BLDLIBDIR CLEAN_DATAFILES_AND_BLDDIR -CLEAN_ITERFILES_AND_BLDITERDIR # Report test results and exit if test $nerrors -eq 0 ; then -- cgit v0.12 From 67220d101fbea90eab1c5bda0af531d39829c170 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 30 Aug 2018 18:53:58 -0500 Subject: Java must use shared libs to allow dlopen calls --- java/src/jni/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index a0228e1..009cdc9 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -50,7 +50,7 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS}) target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE ${HDF5_BINARY_DIR} ${HDF5_JAVA_JNI_SOURCE_DIR}) TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED) -target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) +target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED "JAVA") -- cgit v0.12 From 05c5d40dd51bfe875a41df8a9d02b93f22e6bdfb Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 31 Aug 2018 13:29:36 -0500 Subject: Cleanup and add intermediate dir for java --- CMakeLists.txt | 4 ++-- java/examples/datasets/CMakeLists.txt | 2 +- java/examples/datatypes/CMakeLists.txt | 2 +- java/examples/groups/CMakeLists.txt | 2 +- java/examples/intro/CMakeLists.txt | 2 +- java/src/jni/CMakeLists.txt | 12 ------------ java/test/CMakeLists.txt | 2 +- tools/CMakeLists.txt | 3 --- 8 files changed, 7 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b76f332..6f87568 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -548,11 +548,11 @@ else () endif () include (${HDF_RESOURCES_DIR}/HDFCompilerFlags.cmake) +set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH}) #----------------------------------------------------------------------------- # Option to Enable MPI Parallel #----------------------------------------------------------------------------- -set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH}) option (HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF) if (HDF5_ENABLE_PARALLEL) find_package(MPI REQUIRED) @@ -586,7 +586,7 @@ if (HDF5_ENABLE_PARALLEL) set (LARGE_PARALLEL_IO OFF) endif () else () - message (STATUS "Parallel libraries not found") + message (FATAL_ERROR "Parallel libraries not found") endif () endif () diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 1375372..41c73ab 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -80,7 +80,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_PROGRAM=examples.datasets.${resultfile}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=datasets/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 4a8b2a4..5e4e885 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -65,7 +65,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_PROGRAM=examples.datatypes.${resultfile}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=datatypes/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 2c5d33b..593eaea 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -64,7 +64,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_PROGRAM=examples.groups.${resultfile}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=groups/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 8d56b86..d9cab84 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -66,7 +66,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_PROGRAM=examples.intro.${resultfile}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=intro/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 009cdc9..7b95e0b 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -54,18 +54,6 @@ target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED "JAVA") -if (WIN32) - get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE) - set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}$<$:_D>") - # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}") - if (BUILD_TESTING) - add_custom_target (HDF5_JAVA_JNI-Test-Copy ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} - COMMENT "Copying ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" - ) - add_dependencies (HDF5_JAVA_JNI-Test-Copy ${HDF5_JAVA_JNI_LIB_TARGET}) - endif () -endif () #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index b76f572..5ef0ca3 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -111,7 +111,7 @@ foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}" -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore" -D "TEST_PROGRAM=test.${test_file}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}" -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test" -D "TEST_OUTPUT=JUnit-${test_file}.out" # -D "TEST_LOG_LEVEL=trace" diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 7d41c8f..400039e 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_TOOLS C) -# -------------------------------------------------------------------- -# If testing was NOT enabled, then we need to build the tools library -# -------------------------------------------------------------------- add_subdirectory (lib) #-- Add the test sources -- cgit v0.12 From 55e0b1e81e6180caef4eefe94abb135d31ecbfba Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 31 Aug 2018 14:05:25 -0500 Subject: Use different variable --- java/examples/datasets/CMakeLists.txt | 2 +- java/examples/datatypes/CMakeLists.txt | 2 +- java/examples/groups/CMakeLists.txt | 2 +- java/test/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 41c73ab..1b43d00 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -80,7 +80,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_PROGRAM=examples.datasets.${resultfile}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_BUILD_TYPE}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=datasets/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 5e4e885..beacd7a 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -65,7 +65,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_PROGRAM=examples.datatypes.${resultfile}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_BUILD_TYPE}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=datatypes/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 593eaea..d406cab 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -64,7 +64,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_PROGRAM=examples.groups.${resultfile}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_BUILD_TYPE}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=groups/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 5ef0ca3..710a5e0 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -111,7 +111,7 @@ foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}" -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore" -D "TEST_PROGRAM=test.${test_file}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_BUILD_TYPE}" -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test" -D "TEST_OUTPUT=JUnit-${test_file}.out" # -D "TEST_LOG_LEVEL=trace" -- cgit v0.12 From a20168db02dc1016fd41220187781dd505076c06 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 31 Aug 2018 14:45:32 -0500 Subject: Fix one more intermediate location --- java/examples/intro/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index d9cab84..8c9485f 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -66,7 +66,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_PROGRAM=examples.intro.${resultfile}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_BUILD_TYPE}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=intro/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -- cgit v0.12 From fed65c435acfcc52ecaf6cf8e92d12f5833f9d02 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 31 Aug 2018 19:01:43 -0500 Subject: Move muti-config dir setting to root process --- config/cmake_ext_mod/HDFMacros.cmake | 7 ++++--- java/examples/datatypes/CMakeLists.txt | 2 +- java/examples/groups/CMakeLists.txt | 2 +- java/examples/intro/CMakeLists.txt | 2 +- java/test/CMakeLists.txt | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index f1d5e1d..aa18022 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -380,13 +380,14 @@ macro (HDF_DIR_PATHS package_prefix) set (CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules." ) - if (WIN32) - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE}) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) set (CMAKE_PDB_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." ) else () - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE}) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) endif () else () # if we are externally configured, but the project uses old cmake scripts diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index beacd7a..4a8b2a4 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -65,7 +65,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_PROGRAM=examples.datatypes.${resultfile}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_BUILD_TYPE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=datatypes/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index d406cab..2c5d33b 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -64,7 +64,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_PROGRAM=examples.groups.${resultfile}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_BUILD_TYPE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=groups/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 8c9485f..8d56b86 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -66,7 +66,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_PROGRAM=examples.intro.${resultfile}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_BUILD_TYPE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=intro/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 710a5e0..b76f572 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -111,7 +111,7 @@ foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}" -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore" -D "TEST_PROGRAM=test.${test_file}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_BUILD_TYPE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test" -D "TEST_OUTPUT=JUnit-${test_file}.out" # -D "TEST_LOG_LEVEL=trace" -- cgit v0.12 From b951d1eae261611d79f204ed8f91beb2d36b53ee Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 31 Aug 2018 20:52:15 -0500 Subject: Remove another extra path var --- java/examples/datasets/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 1b43d00..1375372 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -80,7 +80,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" -D "TEST_PROGRAM=examples.datasets.${resultfile}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}/${HDF_CFG_BUILD_TYPE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" -D "TEST_OUTPUT=datasets/${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -- cgit v0.12 From fddbbc158d170b4e3a7ffd663f9799fd7e01a6a0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 31 Aug 2018 21:00:16 -0500 Subject: HDFFV-10568 fix hdf5_java library dependency --- release_docs/RELEASE.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a0446e2..5150349 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -147,6 +147,15 @@ New Features Java Library: ---------------- + - JNI native library dependencies + + The build for the hdf5_java native library used the wrong + hdf5 target library for CMake builds. Correcting the hdf5_java + library to build with the shared hdf5 library required testing + paths to change also. + + (ADB - 2018/08/31, HDFFV-10568) + - Java iterator callbacks Change global callback object to a small stack structure in order -- cgit v0.12 From 1d2beee51f38ec4a3eda17ca564755f1711c2f44 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 4 Sep 2018 11:43:07 -0500 Subject: HDFFV-10569 Add unsupported option notes to docs --- config/cmake/scripts/HDF5options.cmake | 17 +++++ release_docs/INSTALL | 112 ++++++++++++++++++--------------- release_docs/INSTALL_CMake.txt | 14 +++++ 3 files changed, 94 insertions(+), 49 deletions(-) diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index c5f08ed..3e6aad0 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -67,6 +67,23 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.10.9-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") ############################################################################################# +### 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”) + +############################################################################################# +### 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_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”) + +############################################################################################# ### disable test program builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") diff --git a/release_docs/INSTALL b/release_docs/INSTALL index baad559..5c54698 100644 --- a/release_docs/INSTALL +++ b/release_docs/INSTALL @@ -2,11 +2,11 @@ Instructions for the Installation of HDF5 Software ================================================== -This file provides instructions for installing the HDF5 software. +This file provides instructions for installing the HDF5 software. For help with installing, questions can be posted to the HDF Forum or sent to the HDF Helpdesk: - HDF Forum: https://forum.hdfgroup.org/ + HDF Forum: https://forum.hdfgroup.org/ HDF Helpdesk: https://portal.hdfgroup.org/display/support/The+HDF+Help+Desk CONTENTS @@ -52,8 +52,8 @@ CONTENTS 1. Obtaining HDF5 The latest supported public release of HDF5 is available from - https://www.hdfgroup.org/downloads/hdf5/. For Unix and UNIX-like - platforms, it is available in tar format compressed with gzip. + https://www.hdfgroup.org/downloads/hdf5/. For Unix and UNIX-like + platforms, it is available in tar format compressed with gzip. For Microsoft Windows, it is in ZIP format. @@ -77,14 +77,14 @@ CONTENTS $ tar zxf hdf5-X.Y.Z.tar.gz above refers to the configure flags appropriate - to your installation. For example, to install HDF5 with the - Fortran and C++ interfaces and with SZIP compression, the + to your installation. For example, to install HDF5 with the + Fortran and C++ interfaces and with SZIP compression, the configure line might read as follows: - + $ ./configure --prefix=/usr/local/hdf5 --enable-fortran \ --enable-cxx --with-szlib=PATH_TO_SZIP - In this case, PATH_TO_SZIP would be replaced with the path to the + In this case, PATH_TO_SZIP would be replaced with the path to the installed location of the SZIP library. 2.1. Windows @@ -101,7 +101,7 @@ CONTENTS 3. HDF5 dependencies 3.1. Zlib - The HDF5 library includes a predefined compression filter that + The HDF5 library includes a predefined compression filter that uses the "deflate" method for chunked datasets. If zlib-1.1.2 or later is found, HDF5 will use it. Otherwise, HDF5's predefined compression method will degenerate to a no-op; the compression @@ -122,17 +122,17 @@ CONTENTS include the Szip library with the encoder enabled. These can be found here: - https://www.hdfgroup.org/downloads/hdf5/ + https://www.hdfgroup.org/downloads/hdf5/ To configure the HDF5 library with the Szip compression filter, use the '--with-szlib=/PATH_TO_SZIP' flag. For more information, see section 4.3.7, "Specifying other libraries and headers." Please notice that if HDF5 configure cannot find a valid Szip library, - configure will not fail; in this case, the compression filter will + configure will not fail; in this case, the compression filter will not be available to the applications. - To check if Szip compression was successfully configured in, + To check if Szip compression was successfully configured in, check the "I/O filters (external):" line in the configure output, summary section, printed to the standard output. @@ -188,7 +188,7 @@ CONTENTS detects various features of the host system and creates the Makefiles. On most systems it should be sufficient to say: - $ ./configure + $ ./configure Or $ sh configure @@ -218,15 +218,15 @@ CONTENTS before the library and executables are built. HDF5 can be installed into a different location than the prefix - specified at configure time; see section 4.6, "Installing HDF5," + specified at configure time; see section 4.6, "Installing HDF5," for more details. 4.3.2. Using an alternate C compiler By default, configure will look for the C compiler by trying `gcc' and `cc'. However, if the environment variable "CC" is set - then its value is used as the C compiler. For instance, one would - use the following line to specify the native C compiler on a system - that also has the GNU gcc compiler (users of csh and derivatives + then its value is used as the C compiler. For instance, one would + use the following line to specify the native C compiler on a system + that also has the GNU gcc compiler (users of csh and derivatives will need to prefix the commands below with `env'): $ CC=cc ./configure @@ -257,7 +257,7 @@ CONTENTS $ ./configure --enable-fortran $ ./configure --enable-cxx $ ./configure --enable-java - + Configuration will halt if a working Fortran 90 or 95 compiler or C++ compiler is not found. Currently, the Fortran configure tests for these compilers in order: f90, pgf90, f95. To use an @@ -267,7 +267,7 @@ CONTENTS 4.3.5. Specifying other programs - The build system has been tuned for use with GNU make but also + The build system has been tuned for use with GNU make but also works with other versions of make. If the `make' command runs a non-GNU version but a GNU version is available under a different name (perhaps `gmake'), then HDF5 can be configured to use it by @@ -286,8 +286,8 @@ CONTENTS during `make install' (described below) with a BSD-compatible install program detected automatically by configure. If none is found, the shell script bin/install-sh is used. Configure does not - check that the install script actually works; if a bad install is - detected on your system (e.g., on the ASCI blue machine as of + check that the install script actually works; if a bad install is + detected on your system (e.g., on the ASCI blue machine as of March 2, 1999) you have two choices: 1. Copy the bin/install-sh program to your $HOME/bin @@ -310,11 +310,11 @@ CONTENTS LDFLAGS=-L/home/robb/lib \ ./configure - HDF5 uses the zlib library to support the HDF5 deflate - data compression filter. Configure searches the standard places - (plus those specified above with the CPPFLAGS and LDFLAGS variables) - for the zlib headers and library. The search can be disabled by - specifying `--without-zlib' or alternate directories can be specified + HDF5 uses the zlib library to support the HDF5 deflate + data compression filter. Configure searches the standard places + (plus those specified above with the CPPFLAGS and LDFLAGS variables) + for the zlib headers and library. The search can be disabled by + specifying `--without-zlib' or alternate directories can be specified with `--with-zlib=INCDIR,LIBDIR' or through the CPPFLAGS and LDFLAGS variables: @@ -324,8 +324,8 @@ CONTENTS LDFLAGS=-L/usr/unsup/lib \ ./configure - HDF5 includes Szip as a predefined compression method (see 3.2). - To enable Szip compression, the HDF5 library must be configured + HDF5 includes Szip as a predefined compression method (see 3.2). + To enable Szip compression, the HDF5 library must be configured and built using the Szip library: $ ./configure --with-szlib=/Szip_Install_Directory @@ -350,10 +350,10 @@ CONTENTS The library can be compiled to provide symbolic debugging support so it can be debugged with gdb, dbx, ddd, etc., or it can be compiled with various optimizations. To compile for symbolic - debugging (the default for snapshots), say - `--enable-build-mode=production'; to compile with optimizations - (the default for supported public releases), - say `--enable-build-mode=production'. On some systems the + debugging (the default for snapshots), say + `--enable-build-mode=production'; to compile with optimizations + (the default for supported public releases), + say `--enable-build-mode=production'. On some systems the library can also be compiled for profiling with gprof by saying `--enable-production=profile'. @@ -362,13 +362,13 @@ CONTENTS $ ./configure --enable-production=profile #for use with gprof Regardless of whether support for symbolic debugging is enabled, - the library can also perform runtime debugging of certain packages - (such as type conversion execution times and extensive invariant - condition checking). To enable this debugging, supply a - comma-separated list of package names to the `--enable-internal-debug' - switch. + the library can also perform runtime debugging of certain packages + (such as type conversion execution times and extensive invariant + condition checking). To enable this debugging, supply a + comma-separated list of package names to the `--enable-internal-debug' + switch. - Debugging can be disabled by saying `--disable-internal-debug'. + Debugging can be disabled by saying `--disable-internal-debug'. The default debugging level for snapshots is a subset of the available packages; the default for supported releases is no debugging (debugging can incur a significant runtime penalty). @@ -378,10 +378,10 @@ CONTENTS $ ./configure --enable-internal-debug=all #debug all packages $ ./configure --disable-internal-debug #no debugging - HDF5 can also print a trace of all API function calls, their + HDF5 can also print a trace of all API function calls, their arguments, and the return values. To enable or disable the ability to trace the API say `--enable-trace' (the default for - snapthots) or `--disable-trace' (the default for public releases). + snapthots) or `--disable-trace' (the default for public releases). The tracing must also be enabled at runtime to see any output. 4.3.9. Parallel versus serial library @@ -389,25 +389,39 @@ CONTENTS parallelism on a distributed multi-processor system. Read the file INSTALL_parallel for detailed information. + The threadsafe, C++ and Java interfaces are not compatible + with the parallel option. + Unless --enable-unsupported has been specified on the configure line, + the following options must be disabled: + --enable-threadsafe, --enable-cxx, --enable-java + + 4.3.10. Threadsafe capability The HDF5 library can be configured to be thread-safe (on a very large scale) with the `--enable-threadsafe' flag to the configure script. Some platforms may also require the '-with-pthread=INC,LIB' (or '--with-pthread=DIR') flag to the configure script. - For further information, see: + For further information, see: https://portal.hdfgroup.org/display/knowledge/Questions+about+thread-safety+and+concurrent+access + The high-level, C++, Fortran and Java interfaces are not compatible + with the thread-safety option because the lock is not hoisted + into the higher-level API calls. + Unless --enable-unsupported has been specified on the configure line, + the following options must be disabled: + --enable-hl, --enable-cxx, --enable-fortran, --enable-java + 4.3.11. Backward compatibility The 1.10 version of the HDF5 library can be configured to operate - identically to the v1.8 library with the + identically to the v1.8 library with the --with-default-api-version=v18 - configure flag, or identically to the v1.6 library with the + configure flag, or identically to the v1.6 library with the --with-default-api-version=v16 configure flag. This allows existing code to be compiled with the - v1.10 library without requiring immediate changes to the application - source code. For additional configuration options and other details, + v1.10 library without requiring immediate changes to the application + source code. For additional configuration options and other details, see "API Compatibility Macros": https://portal.hdfgroup.org/display/HDF5/API+Compatibility+Macros @@ -487,7 +501,7 @@ CONTENTS $ make install prefix=NEW_DIR - where NEW_DIR is the new directory where you wish to install HDF5. + where NEW_DIR is the new directory where you wish to install HDF5. If you do not use the deploy script, you should run h5redeploy in NEW_DIR/bin directory. This utility will fix the h5cc, h5fc and h5c++ scripts to reflect the new NEW_DIR location. @@ -510,7 +524,7 @@ CONTENTS The configuration information: ./src/H5pubconf.h - + The support programs that are useful are: ./tools/h5ls/h5ls (list file contents) ./tools/h5dump/h5dump (dump file contents) @@ -518,12 +532,12 @@ CONTENTS ./tools/misc/h5debug (low-level file debugging) ./tools/h5import/h5import (imports data to HDF5 file) ./tools/h5diff/h5diff (compares two HDF5 files) - ./tools/gifconv/h52gif (HDF5 to GIF converter) + ./tools/gifconv/h52gif (HDF5 to GIF converter) ./tools/gifconv/gif2h5 (GIF to HDF5 converter) 5. Using the Library - + For information on using HDF5 see the documentation, tutorials and examples found here: diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index ba77ac4..28afc16 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -652,6 +652,20 @@ NOTE: flag is not available on windows and some modern linux systems will ignore the flag. + ---------------- Unsupported Library Options --------------------- + The threadsafe, C++ and Java interfaces are not compatible + with the HDF5_ENABLE_PARALLEL option. + Unless ALLOW_UNSUPPORTED has been specified, + the following options must be disabled: + HDF5_ENABLE_THREADSAFE, HDF5_BUILD_CPP_LIB, HDF5_BUILD_JAVA + + The high-level, C++, Fortran and Java interfaces are not compatible + with the HDF5_ENABLE_THREADSAFE option because the lock is not hoisted + into the higher-level API calls. + Unless ALLOW_UNSUPPORTED has been specified, + the following options must be disabled: + HDF5_BUILD_HL_LIB, HDF5_BUILD_CPP_LIB, HDF5_BUILD_FORTRAN, HDF5_BUILD_JAVA + ======================================================================== VII. User Defined Options for HDF5 Libraries with CMake -- cgit v0.12 From c9771263ae300a65f6f9ae518da766a314002bed Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 5 Sep 2018 16:30:09 -0500 Subject: Minor text corrections --- release_docs/INSTALL_CMake.txt | 4 ++-- release_docs/USING_CMake_Examples.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 28afc16..1d6797c 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -492,7 +492,7 @@ These five steps are described in detail below. Release and build the solution. 3.2.1 The external libraries (zlib and szip) can be configured - to allow building the libraries by downloading from an GIT repository. + to allow building the libraries by downloading from a GIT repository. The option is 'HDF5_ALLOW_EXTERNAL_SUPPORT'; by adding the following configuration option: -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="GIT" @@ -509,7 +509,7 @@ These five steps are described in detail below. adding the following configuration option: -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" - The options to control the SVN URL (config/cmake/cacheinit.cmake + The options to control the TGZ URL (config/cmake/cacheinit.cmake file) are: ZLIB_TGZ_NAME:STRING="zlib_src.ext" SZIP_TGZ_NAME:STRING="szip_src.ext" diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index 6f744d9..d5fae39 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -46,7 +46,7 @@ Default installation process: Copy HDF5_Examples.cmake to this directory. The default source folder is defined as "HDF5Examples". It can be changed with the CTEST_SOURCE_NAME script option. - The default installation folder is defined as "@CMAKE_INSTALL_PREFIX@". + The default installation folder is defined for the platform. It can be changed with the INSTALLDIR script option. (Note: Windows has issues with spaces and paths -The path will need to be set correctly.) -- cgit v0.12 From dfa58496a1f8d667de72a11affe0f5a2e3ae4558 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Mon, 17 Sep 2018 16:09:59 -0500 Subject: Update COPYING file with new HDF5 license. --- COPYING | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/COPYING b/COPYING index c668565..560e8c4 100644 --- a/COPYING +++ b/COPYING @@ -3,7 +3,7 @@ HDF5 (Hierarchical Data Format 5) Software Library and Utilities ----------------------------------------------------------------------------- HDF5 (Hierarchical Data Format 5) Software Library and Utilities -Copyright (c) 2006, The HDF Group. +Copyright (c) 2006-2018, The HDF Group. NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities Copyright (c) 1998-2006, The Board of Trustees of the University of Illinois. @@ -21,27 +21,27 @@ provided that the following conditions are met: this list of conditions, and the following disclaimer in the documentation and/or materials provided with the distribution. -3. In addition, redistributions of modified forms of the source or binary - code must carry prominent notices stating that the original code was - changed and the date of the change. - -4. All publications or advertising materials mentioning features or use of - this software are asked, but not required, to acknowledge that it was - developed by The HDF Group and by the National Center for Supercomputing - Applications at the University of Illinois at Urbana-Champaign and - credit the contributors. - -5. Neither the name of The HDF Group, the name of the University, nor the +3. Neither the name of The HDF Group, the name of the University, nor the name of any Contributor may be used to endorse or promote products derived from this software without specific prior written permission from The HDF Group, the University, or the Contributor, respectively. DISCLAIMER: THIS SOFTWARE IS PROVIDED BY THE HDF GROUP AND THE CONTRIBUTORS -"AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. In no -event shall The HDF Group or the Contributors be liable for any damages -suffered by the users arising out of the use of this software, even if -advised of the possibility of such damage. +"AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO +EVENT SHALL THE HDF GROUP OR THE CONTRIBUTORS BE LIABLE FOR ANY DAMAGES +SUFFERED BY THE USERS ARISING OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +You are under no obligation whatsoever to provide any bug fixes, patches, or +upgrades to the features, functionality or performance of the source code +("Enhancements") to anyone; however, if you choose to make your Enhancements +available either publicly, or directly to The HDF Group, without imposing a +separate written license agreement for such Enhancements, then you hereby +grant the following license: a non-exclusive, royalty-free perpetual license +to install, use, modify, prepare derivative works, incorporate into other +computer software, distribute, and sublicense such enhancements or derivative +works thereof, in binary and source code form. ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- @@ -55,9 +55,9 @@ http://support.hdfgroup.org/ftp/HDF5/releases/COPYING_LBNL_HDF5. ----------------------------------------------------------------------------- Contributors: National Center for Supercomputing Applications (NCSA) at -the University of Illinois, Fortner Software, Unidata Program Center (netCDF), -The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler (gzip), -and Digital Equipment Corporation (DEC). +the University of Illinois, Fortner Software, Unidata Program Center +(netCDF), The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler +(gzip), and Digital Equipment Corporation (DEC). ----------------------------------------------------------------------------- @@ -98,8 +98,9 @@ and/or accompanying materials: ----------------------------------------------------------------------------- HDF5 is available with the SZIP compression library but SZIP is not part -of HDF5 and has separate copyright and license terms. See “Szip Compression -in HDF Products” (https://support.hdfgroup.org/doc_resource/SZIP/) for further details. +of HDF5 and has separate copyright and license terms. See SZIP Compression +in HDF Products (www.hdfgroup.org/doc_resource/SZIP/) for further details. ----------------------------------------------------------------------------- + -- cgit v0.12 From 99f743ed1abd9603a9ba903d578349fb4ade8f17 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 5 Sep 2018 16:37:49 -0500 Subject: HDFFV-9059 Allow detect to take a file as an argument --- release_docs/RELEASE.txt | 11 +- src/CMakeLists.txt | 12 +- src/H5detect.c | 707 +++++++++++++++++++++-------------------------- src/H5make_libsettings.c | 254 ++++++++--------- 4 files changed, 468 insertions(+), 516 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 5150349..c8c7d5c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -148,7 +148,7 @@ New Features Java Library: ---------------- - JNI native library dependencies - + The build for the hdf5_java native library used the wrong hdf5 target library for CMake builds. Correcting the hdf5_java library to build with the shared hdf5 library required testing @@ -209,6 +209,15 @@ Bug Fixes since HDF5-1.10.3 release Library ------- + - Allow H5detect and H5make_libsettings to take a file as an argument. + + Rather than only writing to stdout, add a command argument to name + the file that H5detect and H5make_libsettings will use for output. + Without an argument, stdout is still used, so backwards compatibility + is maintained. + + (ADB - 2018/09/05, HDFFV-9059) + - A bug was discovered in the parallel library where an application would hang if a collective read/write of a chunked dataset occurred when collective metadata reads were enabled and some of the ranks diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3c5526f..ee06f06 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -854,7 +854,7 @@ endif () # specific type checks inside #----------------------------------------------------------------------------- add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) -target_include_directories(H5detect PRIVATE "${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect @@ -865,12 +865,12 @@ target_link_libraries (H5detect add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c COMMAND $ - ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c + ARGS ${HDF5_BINARY_DIR}/H5Tinit.c DEPENDS H5detect ) add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -target_include_directories(H5make_libsettings PRIVATE "${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings @@ -881,7 +881,7 @@ target_link_libraries (H5make_libsettings add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c COMMAND $ - ARGS > ${HDF5_BINARY_DIR}/H5lib_settings.c + ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) @@ -925,14 +925,14 @@ if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5Tinit.c COMMAND $ - ARGS > ${HDF5_BINARY_DIR}/shared/H5Tinit.c + ARGS ${HDF5_BINARY_DIR}/shared/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_BINARY_DIR}/shared ) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c COMMAND $ - ARGS > ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) diff --git a/src/H5detect.c b/src/H5detect.c index 2d33a3d..c2d8ab0 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -45,8 +45,6 @@ static const char *FileHeader = "\n\ * running on a Vax or other machine with mixed * endianness. * - * Modifications: - * *------------------------------------------------------------------------- */ #undef NDEBUG @@ -117,6 +115,8 @@ typedef struct malign_t { unsigned int comp_align; /* alignment for structure */ } malign_t; +FILE *rawoutstream = NULL; + /* global variables types detection code */ H5_GCC_DIAG_OFF(larger-than=) static detected_t d_g[MAXDETECT]; @@ -143,9 +143,9 @@ static void detect_C99_integers32(void); static void detect_C99_integers64(void); static void detect_alignments(void); static unsigned int align_g[] = {1, 2, 4, 8, 16}; -static int align_status_g = 0; /* ALIGNMENT Signal Status */ +static int align_status_g = 0; /* ALIGNMENT Signal Status */ static int sigbus_handler_called_g = 0; /* how many times called */ -static int sigsegv_handler_called_g = 0;/* how many times called */ +static int sigsegv_handler_called_g = 0; /* how many times called */ static int sigill_handler_called_g = 0; /* how many times called */ static int signal_handler_tested_g = 0; /* how many times tested */ #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) @@ -157,16 +157,11 @@ static H5JMP_BUF jbuf_g; /*------------------------------------------------------------------------- - * Function: precision + * Function: precision * * Purpose: Determine the precision and offset. * - * Return: void - * - * Programmer: Robb Matzke - * Thursday, June 18, 1998 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -189,7 +184,8 @@ precision (detected_t *d) /*void*/; d->precision = 8 * (d->size - n); d->offset = 0; - } else if (d->perm[d->size - 1] < 0) { + } + else if (d->perm[d->size - 1] < 0) { /* * Higher addresses are padded. */ @@ -197,14 +193,16 @@ precision (detected_t *d) /*void*/; d->precision = 8 * (d->size - n); d->offset = 8 * n; - } else { + } + else { /* * No padding. */ d->precision = 8 * d->size; d->offset = 0; } - } else { + } + else { /* A floating point */ d->offset = MIN3(d->mpos, d->epos, d->sign); d->precision = d->msize + d->esize + 1; @@ -213,20 +211,16 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_I/DETECT_BYTE + * Function: DETECT_I/DETECT_BYTE * * Purpose: These macro takes a type like `int' and a base name like - * `nati' and detects the byte order. The VAR is used to - * construct the names of the C variables defined. + * `nati' and detects the byte order. The VAR is used to + * construct the names of the C variables defined. * - * DETECT_I is used for types that are larger than one byte, - * DETECT_BYTE is used for types that are exactly one byte. + * DETECT_I is used for types that are larger than one byte, + * DETECT_BYTE is used for types that are exactly one byte. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12 1996 + * Return: void * * Modifications: * @@ -244,7 +238,7 @@ precision (detected_t *d) * * Neil Fortner, 6 Sep 2013 * Split macro into DETECT_I and DETECT_BYTE macros, extracted - * common cod einto DETECT_I_BYTE_CORE. This was done to remove + * common code into DETECT_I_BYTE_CORE. This was done to remove * "will never be executed" warnings. * *------------------------------------------------------------------------- @@ -291,19 +285,15 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_F + * Function: DETECT_F * * Purpose: This macro takes a floating point type like `double' and - * a base name like `natd' and detects byte order, mantissa - * location, exponent location, sign bit location, presence or - * absence of implicit mantissa bit, and exponent bias and - * initializes a detected_t structure with those properties. + * a base name like `natd' and detects byte order, mantissa + * location, exponent location, sign bit location, presence or + * absence of implicit mantissa bit, and exponent bias and + * initializes a detected_t structure with those properties. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12 1996 + * Return: void * *------------------------------------------------------------------------- */ @@ -395,19 +385,13 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_M + * Function: DETECT_M * * Purpose: This macro takes only miscellaneous structures or pointer - * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It - * constructs the names and decides the alignment in structure. + * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It + * constructs the names and decides the alignment in structure. * - * Return: void - * - * Programmer: Raymond Lu - * slu@ncsa.uiuc.edu - * Dec 9, 2002 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -477,19 +461,14 @@ precision (detected_t *d) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigsegv_handler + * Function: sigsegv_handler * * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. - * - * Return: Returns via H5LONGJMP to jbuf_g. - * - * Programmer: Robb Matzke - * Thursday, March 18, 1999 + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Modifications: + * Return: Returns via H5LONGJMP to jbuf_g. * *------------------------------------------------------------------------- */ @@ -553,17 +532,14 @@ sigbus_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigill_handler + * Function: sigill_handler * * Purpose: Handler for SIGILL. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. - * - * Return: Returns via H5LONGJMP to jbuf_g. + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Programmer: Raymond Lu - * 28 October 2013 + * Return: Returns via H5LONGJMP to jbuf_g. * *------------------------------------------------------------------------- */ @@ -588,17 +564,11 @@ sigill_handler(int H5_ATTR_UNUSED signo) /*------------------------------------------------------------------------- - * Function: print_results + * Function: print_results * * Purpose: Prints information about the detected data types. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 14, 1996 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -609,7 +579,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) int i, j; /* Include files */ - printf("\ + fprintf(rawoutstream, "\ /****************/\n\ /* Module Setup */\n\ /****************/\n\ @@ -662,7 +632,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /*********************/\n\ \n\ \n"); - printf("\n\ + fprintf(rawoutstream, "\n\ /*******************/\n\ /* Local Variables */\n\ /*******************/\n\ @@ -670,7 +640,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /* The interface initialization function */ - printf("\n\ + fprintf(rawoutstream, "\n\ \n\ /*-------------------------------------------------------------------------\n\ * Function: H5T__init_native\n\ @@ -713,12 +683,12 @@ H5T__init_native(void)\n\ } /* Print a comment to describe this section of definitions. */ - printf("\n /*\n"); + fprintf(rawoutstream, "\n /*\n"); iprint(d+i); - printf(" */\n"); + fprintf(rawoutstream, " */\n"); /* The part common to fixed and floating types */ - printf("\ + fprintf(rawoutstream, "\ if(NULL == (dt = H5T__alloc()))\n\ HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, \"datatype allocation failed\")\n\ dt->shared->state = H5T_STATE_IMMUTABLE;\n\ @@ -728,16 +698,16 @@ H5T__init_native(void)\n\ d[i].size); /*size */ if(byte_order==-1) - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.order = H5T_ORDER_VAX;\n"); else if(byte_order==0) - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.order = H5T_ORDER_LE;\n"); else - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.order = H5T_ORDER_BE;\n"); - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.offset = %d;\n\ dt->shared->u.atomic.prec = %d;\n\ dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;\n\ @@ -748,12 +718,13 @@ H5T__init_native(void)\n\ if (0 == d[i].msize) { /* The part unique to fixed point types */ - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.u.i.sign = H5T_SGN_%s;\n", d[i].sign ? "2" : "NONE"); - } else { + } + else { /* The part unique to floating point types */ - printf("\ + fprintf(rawoutstream, "\ dt->shared->u.atomic.u.f.sign = %d;\n\ dt->shared->u.atomic.u.f.epos = %d;\n\ dt->shared->u.atomic.u.f.esize = %d;\n\ @@ -772,11 +743,11 @@ H5T__init_native(void)\n\ } /* Atomize the type */ - printf("\ + fprintf(rawoutstream, "\ if((H5T_NATIVE_%s_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)\n\ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \"can't register ID for built-in datatype\")\n", d[i].varname); - printf(" H5T_NATIVE_%s_ALIGN_g = %lu;\n", + fprintf(rawoutstream, " H5T_NATIVE_%s_ALIGN_g = %lu;\n", d[i].varname, (unsigned long)(d[i].align)); /* Variables for alignment of compound datatype */ @@ -784,28 +755,29 @@ H5T__init_native(void)\n\ !HDstrcmp(d[i].varname, "INT") || !HDstrcmp(d[i].varname, "LONG") || !HDstrcmp(d[i].varname, "LLONG") || !HDstrcmp(d[i].varname, "FLOAT") || !HDstrcmp(d[i].varname, "DOUBLE") || !HDstrcmp(d[i].varname, "LDOUBLE")) { - printf(" H5T_NATIVE_%s_COMP_ALIGN_g = %lu;\n", + fprintf(rawoutstream, " H5T_NATIVE_%s_COMP_ALIGN_g = %lu;\n", d[i].varname, (unsigned long)(d[i].comp_align)); } } /* Consider VAX a little-endian machine */ if(byte_order==0 || byte_order==-1) { - printf("\n\ + fprintf(rawoutstream, "\n\ /* Set the native order for this machine */\n\ H5T_native_order_g = H5T_ORDER_%s;\n", "LE"); - } else { - printf("\n\ + } + else { + fprintf(rawoutstream, "\n\ /* Set the native order for this machine */\n\ H5T_native_order_g = H5T_ORDER_%s;\n", "BE"); } /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */ - printf("\n /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */\n"); + fprintf(rawoutstream, "\n /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */\n"); for(j=0; jsize - 1); i >= pass * 4; --i) { - printf("%4d", d->perm[i]); - if (i > pass * 4) HDfputs(" ", stdout); - if (!i) break; + fprintf(rawoutstream, "%4d", d->perm[i]); + if (i > pass * 4) + HDfputs(" ", stdout); + if (!i) + break; } /* * Print the bit fields */ - printf("\n * "); + fprintf(rawoutstream, "\n * "); for (i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, 8 * d->size - 1); i >= pass * 4; --i) { unsigned int j; for (j = 8; j > 0; --j) { if (k == d->sign && d->msize) { - HDputchar('S'); - } else if (k >= d->epos && k < d->epos + d->esize) { - HDputchar('E'); - } else if (k >= d->mpos && k < d->mpos + d->msize) { - HDputchar('M'); - } else if (d->msize) { - HDputchar('?'); /*unknown floating point bit */ - } else if (d->sign) { - HDputchar('I'); - } else { - HDputchar('U'); + HDfputc('S', rawoutstream); + } + else if (k >= d->epos && k < d->epos + d->esize) { + HDfputc('E', rawoutstream); + } + else if (k >= d->mpos && k < d->mpos + d->msize) { + HDfputc('M', rawoutstream); + } + else if (d->msize) { + HDfputc('?', rawoutstream); /*unknown floating point bit */ + } + else if (d->sign) { + HDfputc('I', rawoutstream); + } + else { + HDfputc('U', rawoutstream); } --k; } - if (i > pass * 4) HDputchar(' '); + if (i > pass * 4) HDfputc(' ', rawoutstream); if (!i) break; } - HDputchar('\n'); + HDfputc('\n', rawoutstream); if (!pass) break; } @@ -939,40 +911,35 @@ iprint(detected_t *d) * Is there an implicit bit in the mantissa. */ if (d->msize) { - printf(" * Implicit bit? %s\n", d->imp ? "yes" : "no"); + fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no"); } /* * Alignment */ if (0 == d->align) { - printf(" * Alignment: NOT CALCULATED\n"); - } else if (1 == d->align) { - printf(" * Alignment: none\n"); - } else { - printf(" * Alignment: %lu\n", (unsigned long) (d->align)); + fprintf(rawoutstream, " * Alignment: NOT CALCULATED\n"); + } + else if (1 == d->align) { + fprintf(rawoutstream, " * Alignment: none\n"); + } + else { + fprintf(rawoutstream, " * Alignment: %lu\n", (unsigned long) (d->align)); } } /*------------------------------------------------------------------------- - * Function: byte_cmp + * Function: byte_cmp * * Purpose: Compares two chunks of memory A and B and returns the - * byte index into those arrays of the first byte that - * differs between A and B. Ignores differences where the - * corresponding bit in pad_mask is set to 0. + * byte index into those arrays of the first byte that + * differs between A and B. Ignores differences where the + * corresponding bit in pad_mask is set to 0. * - * Return: Success: Index of differing byte. - * - * Failure: -1 if all bytes are the same. - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12, 1996 - * - * Modifications: + * Return: Success: Index of differing byte. + * Failure: -1 if all bytes are the same. * *------------------------------------------------------------------------- */ @@ -992,15 +959,15 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) /*------------------------------------------------------------------------- - * Function: bit_cmp + * Function: bit_cmp * * Purpose: Compares two bit vectors and returns the index for the - * first bit that differs between the two vectors. The - * size of the vector is NBYTES. PERM is a mapping from - * actual order to little endian. Ignores differences where - * the corresponding bit in pad_mask is set to 0. + * first bit that differs between the two vectors. The + * size of the vector is NBYTES. PERM is a mapping from + * actual order to little endian. Ignores differences where + * the corresponding bit in pad_mask is set to 0. * - * Return: Index of first differing bit. + * Return: Index of first differing bit. * *------------------------------------------------------------------------- */ @@ -1033,99 +1000,97 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, /*------------------------------------------------------------------------- - * Function: fix_order + * Function: fix_order * * Purpose: Given an array PERM with elements FIRST through LAST - * initialized with zero origin byte numbers, this function - * creates a permutation vector that maps the actual order - * of a floating point number to little-endian. - * - * This function assumes that the mantissa byte ordering - * implies the total ordering. + * initialized with zero origin byte numbers, this function + * creates a permutation vector that maps the actual order + * of a floating point number to little-endian. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 + * This function assumes that the mantissa byte ordering + * implies the total ordering. * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ static void fix_order(int n, int last, int *perm, const char **mesg) { - int i; + int i; if (last > 1) { - /* - * We have at least three points to consider. - */ - if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { /* - * Little endian. + * We have at least three points to consider. */ - if (mesg) *mesg = "Little-endian"; - for (i = 0; i < n; i++) perm[i] = i; + if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { + /* + * Little endian. + */ + if (mesg) + *mesg = "Little-endian"; + for (i = 0; i < n; i++) + perm[i] = i; - } else if (perm[last] > perm[last-1] && perm[last-1] > perm[last-2]) { - /* - * Big endian. - */ - if (mesg) *mesg = "Big-endian"; - for (i = 0; i < n; i++) perm[i] = (n - 1) - i; + } + else if (perm[last] > perm[last - 1] + && perm[last - 1] > perm[last - 2]) { + /* + * Big endian. + */ + if (mesg) + *mesg = "Big-endian"; + for (i = 0; i < n; i++) + perm[i] = (n - 1) - i; - } else { - /* - * Bi-endian machines like VAX. - * (NOTE: This is not an actual determination of the VAX-endianness. - * It could have some other endianness and fall into this - * case - JKM & QAK) - */ - HDassert(0 == n % 2); - if (mesg) *mesg = "VAX"; - for (i = 0; i < n; i += 2) { - perm[i] = (n - 2) - i; - perm[i + 1] = (n - 1) - i; + } + else { + /* + * Bi-endian machines like VAX. + * (NOTE: This is not an actual determination of the VAX-endianness. + * It could have some other endianness and fall into this + * case - JKM & QAK) + */ + HDassert(0 == n % 2); + if (mesg) + *mesg = "VAX"; + for (i = 0; i < n; i += 2) { + perm[i] = (n - 2) - i; + perm[i + 1] = (n - 1) - i; + } } } - } else { - fprintf(stderr, - "Failed to detect byte order of %d-byte floating point.\n", n); - HDexit(1); + else { + fprintf(stderr, + "Failed to detect byte order of %d-byte floating point.\n", n); + HDexit(1); } } /*------------------------------------------------------------------------- - * Function: imp_bit + * Function: imp_bit * * Purpose: Looks for an implicit bit in the mantissa. The value - * of _A should be 1.0 and the value of _B should be 0.5. - * Some floating-point formats discard the most significant - * bit of the mantissa after normalizing since it will always - * be a one (except for 0.0). If this is true for the native - * floating point values stored in _A and _B then the function - * returns non-zero. + * of _A should be 1.0 and the value of _B should be 0.5. + * Some floating-point formats discard the most significant + * bit of the mantissa after normalizing since it will always + * be a one (except for 0.0). If this is true for the native + * floating point values stored in _A and _B then the function + * returns non-zero. * - * This function assumes that the exponent occupies higher - * order bits than the mantissa and that the most significant - * bit of the mantissa is next to the least significant bit - * of the exponent. + * This function assumes that the exponent occupies higher + * order bits than the mantissa and that the most significant + * bit of the mantissa is next to the least significant bit + * of the exponent. * * - * Return: Success: Non-zero if the most significant bit + * Return: Success: Non-zero if the most significant bit * of the mantissa is discarded (ie, the * mantissa has an implicit `one' as the * most significant bit). Otherwise, * returns zero. - * - * Failure: exit(1) - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 + * Failure: exit(1) * * Modifications: * @@ -1162,18 +1127,13 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ /*------------------------------------------------------------------------- - * Function: find_bias + * Function: find_bias * * Purpose: Determines the bias of the exponent. This function should - * be called with _A having a value of `1'. + * be called with _A having a value of `1'. * - * Return: Success: The exponent bias. - * - * Failure: - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 + * Return: Success: The exponent bias. + * Failure: * * Modifications: * @@ -1205,17 +1165,11 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) /*------------------------------------------------------------------------- - * Function: print_header + * Function: print_header * * Purpose: Prints the C file header for the generated file. * - * Return: void - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Mar 12 1997 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1224,15 +1178,15 @@ print_header(void) { time_t now = HDtime(NULL); - struct tm *tm = HDlocaltime(&now); - char real_name[30]; - char host_name[256]; - int i; - const char *s; + struct tm *tm = HDlocaltime(&now); + char real_name[30]; + char host_name[256]; + int i; + const char *s; #ifdef H5_HAVE_GETPWUID struct passwd *pwd = NULL; #else - int pwd = 1; + int pwd = 1; #endif static const char *month_name[] = { @@ -1281,20 +1235,22 @@ bit.\n"; */ #ifdef H5_HAVE_GETPWUID { - size_t n; - char *comma; - if ((pwd = HDgetpwuid(HDgetuid()))) { - if ((comma = HDstrchr(pwd->pw_gecos, ','))) { - n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); - HDstrncpy(real_name, pwd->pw_gecos, n); - real_name[n] = '\0'; - } else { - HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); - real_name[sizeof(real_name) - 1] = '\0'; + size_t n; + char *comma; + if ((pwd = HDgetpwuid(HDgetuid()))) { + if ((comma = HDstrchr(pwd->pw_gecos, ','))) { + n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); + HDstrncpy(real_name, pwd->pw_gecos, n); + real_name[n] = '\0'; + } + else { + HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); + real_name[sizeof(real_name) - 1] = '\0'; + } + } + else { + real_name[0] = '\0'; } - } else { - real_name[0] = '\0'; - } } #else real_name[0] = '\0'; @@ -1305,7 +1261,7 @@ bit.\n"; */ #ifdef H5_HAVE_GETHOSTNAME if (HDgethostname(host_name, sizeof(host_name)) < 0) { - host_name[0] = '\0'; + host_name[0] = '\0'; } #else host_name[0] = '\0'; @@ -1314,49 +1270,49 @@ bit.\n"; /* * The file header: warning, copyright notice, build information. */ - printf("/* Generated automatically by H5detect -- do not edit */\n\n\n"); - HDputs(FileHeader); /*the copyright notice--see top of this file */ + fprintf(rawoutstream, "/* Generated automatically by H5detect -- do not edit */\n\n\n"); + HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */ - printf(" *\n * Created:\t\t%s %2d, %4d\n", + fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); if (pwd || real_name[0] || host_name[0]) { - printf(" *\t\t\t"); - if (real_name[0]) printf("%s <", real_name); + fprintf(rawoutstream, " *\t\t\t"); + if (real_name[0]) + fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if (pwd) HDfputs(pwd->pw_name, stdout); + if (pwd) HDfputs(pwd->pw_name, rawoutstream); #endif - if (host_name[0]) printf("@%s", host_name); - if (real_name[0]) printf(">"); - HDputchar('\n'); + if (host_name[0]) + fprintf(rawoutstream, "@%s", host_name); + if (real_name[0]) + fprintf(rawoutstream, ">"); + HDfputc('\n', rawoutstream); } - printf(" *\n * Purpose:\t\t"); + fprintf(rawoutstream, " *\n * Purpose:\t\t"); for (s = purpose; *s; s++) { - HDputchar(*s); - if ('\n' == *s && s[1]) printf(" *\t\t\t"); + HDfputc(*s, rawoutstream); + if ('\n' == *s && s[1]) + fprintf(rawoutstream, " *\t\t\t"); } - printf(" *\n * Modifications:\n *\n"); - printf(" *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); - printf(" *\tIt was generated by code in `H5detect.c'.\n"); + fprintf(rawoutstream, " *\n * Modifications:\n *\n"); + fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); + fprintf(rawoutstream, " *\tIt was generated by code in `H5detect.c'.\n"); - printf(" *\n *"); - for (i = 0; i < 73; i++) HDputchar('-'); - printf("\n */\n\n"); + fprintf(rawoutstream, " *\n *"); + for (i = 0; i < 73; i++) + HDfputc('-', rawoutstream); + fprintf(rawoutstream, "\n */\n\n"); } /*------------------------------------------------------------------------- - * Function: detect_C89_integers + * Function: detect_C89_integers * * Purpose: Detect C89 integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1375,16 +1331,11 @@ detect_C89_integers(void) /*------------------------------------------------------------------------- - * Function: detect_C89_floats + * Function: detect_C89_floats * * Purpose: Detect C89 floating point types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1397,16 +1348,11 @@ detect_C89_floats(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers8 + * Function: detect_C99_integers8 * * Purpose: Detect C99 8 bit integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1459,16 +1405,11 @@ detect_C99_integers8(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers16 + * Function: detect_C99_integers16 * * Purpose: Detect C99 16 bit integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1497,16 +1438,11 @@ detect_C99_integers16(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers32 + * Function: detect_C99_integers32 * * Purpose: Detect C99 32 bit integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1535,16 +1471,11 @@ detect_C99_integers32(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers64 + * Function: detect_C99_integers64 * * Purpose: Detect C99 64 bit integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1586,16 +1517,11 @@ detect_C99_integers64(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers + * Function: detect_C99_integers * * Purpose: Detect C99 integer types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1612,16 +1538,11 @@ detect_C99_integers(void) /*------------------------------------------------------------------------- - * Function: detect_C99_floats + * Function: detect_C99_floats * * Purpose: Detect C99 floating point types * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1643,16 +1564,11 @@ detect_C99_floats(void) /*------------------------------------------------------------------------- - * Function: detect_alignments + * Function: detect_alignments * * Purpose: Detect structure alignments * - * Return: void - * - * Programmer: Albert Cheng - * 2004/05/20 - * - * Modifications: + * Return: void * *------------------------------------------------------------------------- */ @@ -1685,61 +1601,57 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) #endif void (*save_handler)(int) = HDsignal(signum, handler); volatile int i, val; - int ntries=5; - volatile int nfailures=0; - volatile int nsuccesses=0; - - for (i=0;i0 || nsuccesses != ntries){ - fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " - "Found %d failures and %d successes\n", - signum, ntries, nfailures, nsuccesses); - return(-1); - }else{ - /* all succeeded */ - return(0); + if (nfailures>0 || nsuccesses != ntries) { + fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " + "Found %d failures and %d successes\n", + signum, ntries, nfailures, nsuccesses); + return(-1); + } + else { + /* all succeeded */ + return(0); } } #endif /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Main entry point. + * Purpose: Main entry point. * * Return: Success: exit(0) * - * Failure: exit(1) - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 12, 1996 + * Failure: exit(1) * * Modifications: - * Albert Cheng, 2004/05/20 - * Some compilers, e.g., Intel C v7.0, took a long time to compile + * Some compilers, e.g., Intel C v7.0, took a long time to compile * with optimization when a module routine contains many code lines. * Divide up all those types detections macros into subroutines, both * to avoid the compiler optimization error and cleaner codes. @@ -1747,8 +1659,24 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) *------------------------------------------------------------------------- */ int HDF_NO_UBSAN -main(void) +main(int argc, char *argv[]) { + char *fname = NULL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawoutstream is changed only when succeeded */ + + if (argc > 1) { + fname = argv[1]; + } + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if ((f = HDfopen(fname, "w")) != NULL) { + rawoutstream = f; + } + } + if (!rawoutstream) + rawoutstream = stdout; #if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) #if defined(UAC_NOPRINT) && defined(UAC_SIGBUS) @@ -1760,7 +1688,7 @@ main(void) nvpairs[0] = SSIN_UACPROC; nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS; if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { - fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", + fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno)); } #endif @@ -1803,5 +1731,12 @@ main(void) print_results (nd_g, d_g, na_g, m_g); + if (rawoutstream && rawoutstream != stdout) { + if (HDfclose(rawoutstream)) + fprintf(stderr, "closing rawoutstream"); + else + rawoutstream = NULL; + } + return 0; } diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index 1892806..d803d07 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -27,12 +27,12 @@ static const char *FileHeader = "\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; /* * - * Created: H5make_libsettings.c - * 17 Mar 2010 - * Quincey Koziol + * Created: H5make_libsettings.c + * 17 Mar 2010 + * Quincey Koziol * - * Purpose: Generate the H5libsettings.c file from the - * libhdf5.settings file. + * Purpose: Generate the H5libsettings.c file from the + * libhdf5.settings file. * *------------------------------------------------------------------------- */ @@ -43,19 +43,18 @@ static const char *FileHeader = "\n\ #define LIBSETTINGSFNAME "libhdf5.settings" - +FILE *rawoutstream = NULL; + + /*------------------------------------------------------------------------- - * Function: insert_libhdf5_settings + * Function: insert_libhdf5_settings * - * Purpose: insert the contents of libhdf5.settings into a file - * represented by flibinfo. - * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not - * defined, i.e., not enabled. + * Purpose: insert the contents of libhdf5.settings into a file + * represented by flibinfo. + * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not + * defined, i.e., not enabled. * - * Return: void - * - * Programmer: Albert Cheng - * Apr 20, 2009 + * Return: void * *------------------------------------------------------------------------- */ @@ -63,9 +62,9 @@ static void insert_libhdf5_settings(FILE *flibinfo) { #ifdef H5_HAVE_EMBEDDED_LIBINFO - FILE *fsettings; /* for files libhdf5.settings */ + FILE *fsettings; /* for files libhdf5.settings */ int inchar; - int bol = 0; /* indicates the beginning of a new line */ + int bol = 0; /* indicates the beginning of a new line */ if(NULL == (fsettings = HDfopen(LIBSETTINGSFNAME, "r"))) { HDperror(LIBSETTINGSFNAME); @@ -77,33 +76,33 @@ insert_libhdf5_settings(FILE *flibinfo) fprintf(flibinfo, "char H5libhdf5_settings[]=\n"); bol++; while(EOF != (inchar = HDgetc(fsettings))) { - if(bol) { - /* Start a new line */ - fprintf(flibinfo, "\t\""); - bol = 0; - } /* end if */ - if(inchar == '\n') { - /* end of a line */ - fprintf(flibinfo, "\\n\"\n"); - bol++; + if(bol) { + /* Start a new line */ + fprintf(flibinfo, "\t\""); + bol = 0; + } /* end if */ + if(inchar == '\n') { + /* end of a line */ + fprintf(flibinfo, "\\n\"\n"); + bol++; } /* end if */ - else - HDputc(inchar, flibinfo); + else + HDputc(inchar, flibinfo); } /* end while */ if(HDfeof(fsettings)) { - /* wrap up */ - if(!bol) - /* EOF found without a new line */ - fprintf(flibinfo, "\\n\"\n"); - fprintf(flibinfo, ";\n\n"); + /* wrap up */ + if(!bol) + /* EOF found without a new line */ + fprintf(flibinfo, "\\n\"\n"); + fprintf(flibinfo, ";\n\n"); } /* end if */ else { - fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); - HDexit(1); + fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); + HDexit(1); } /* end else */ if(0 != HDfclose(fsettings)) { - HDperror(LIBSETTINGSFNAME); - HDexit(1); + HDperror(LIBSETTINGSFNAME); + HDexit(1); } /* end if */ #else /* print variable definition and an empty string */ @@ -112,18 +111,15 @@ insert_libhdf5_settings(FILE *flibinfo) #endif } /* insert_libhdf5_settings() */ - + /*------------------------------------------------------------------------- - * Function: make_libinfo - * - * Purpose: Create the embedded library information definition. - * This sets up for a potential extension that the declaration - * is printed to a file different from stdout. + * Function: make_libinfo * - * Return: void + * Purpose: Create the embedded library information definition. + * This sets up for a potential extension that the declaration + * is printed to a file different from stdout. * - * Programmer: Albert Cheng - * Sep 15, 2009 + * Return: void * *------------------------------------------------------------------------- */ @@ -131,42 +127,38 @@ static void make_libinfo(void) { /* print variable definition and then the string as a macro. */ - insert_libhdf5_settings(stdout); + insert_libhdf5_settings(rawoutstream); } - + /*------------------------------------------------------------------------- - * Function: print_header - * - * Purpose: Prints the header for the generated file. + * Function: print_header * - * Return: void + * Purpose: Prints the header for the generated file. * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Mar 12 1997 + * Return: void * *------------------------------------------------------------------------- */ static void print_header(void) { - time_t now = HDtime(NULL); - struct tm *tm = HDlocaltime(&now); - char real_name[30]; - char host_name[256]; - int i; - const char *s; + time_t now = HDtime(NULL); + struct tm *tm = HDlocaltime(&now); + char real_name[30]; + char host_name[256]; + int i; + const char *s; #ifdef H5_HAVE_GETPWUID - struct passwd *pwd = NULL; + struct passwd *pwd = NULL; #else - int pwd = 1; + int pwd = 1; #endif - static const char *month_name[] = + static const char *month_name[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - static const char *purpose = "\ + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + static const char *purpose = "\ This machine-generated source code contains\n\ information about the library build configuration\n"; @@ -175,22 +167,22 @@ information about the library build configuration\n"; */ #ifdef H5_HAVE_GETPWUID { - size_t n; - char *comma; + size_t n; + char *comma; - if((pwd = HDgetpwuid(HDgetuid()))) { - if((comma = HDstrchr(pwd->pw_gecos, ','))) { - n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos)); - HDstrncpy(real_name, pwd->pw_gecos, n); - real_name[n] = '\0'; - } /* end if */ + if((pwd = HDgetpwuid(HDgetuid()))) { + if((comma = HDstrchr(pwd->pw_gecos, ','))) { + n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos)); + HDstrncpy(real_name, pwd->pw_gecos, n); + real_name[n] = '\0'; + } /* end if */ else { - HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); - real_name[sizeof(real_name) - 1] = '\0'; - } /* end else */ - } /* end if */ + HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name)); + real_name[sizeof(real_name) - 1] = '\0'; + } /* end else */ + } /* end if */ else - real_name[0] = '\0'; + real_name[0] = '\0'; } #else real_name[0] = '\0'; @@ -201,7 +193,7 @@ information about the library build configuration\n"; */ #ifdef H5_HAVE_GETHOSTNAME if(HDgethostname(host_name, sizeof(host_name)) < 0) - host_name[0] = '\0'; + host_name[0] = '\0'; #else host_name[0] = '\0'; #endif @@ -209,53 +201,49 @@ information about the library build configuration\n"; /* * The file header: warning, copyright notice, build information. */ - printf("/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n"); - HDputs(FileHeader); /*the copyright notice--see top of this file */ + fprintf(rawoutstream, "/* Generated automatically by H5make_libsettings -- do not edit */\n\n\n"); + HDfputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */ - printf(" *\n * Created:\t\t%s %2d, %4d\n", - month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); + fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", + month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); if(pwd || real_name[0] || host_name[0]) { - printf(" *\t\t\t"); - if(real_name[0]) - printf("%s <", real_name); + fprintf(rawoutstream, " *\t\t\t"); + if(real_name[0]) + fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if(pwd) - HDfputs(pwd->pw_name, stdout); + if(pwd) + HDfputs(pwd->pw_name, rawoutstream); #endif - if(host_name[0]) - printf("@%s", host_name); - if(real_name[0]) - printf(">"); - HDputchar('\n'); + if(host_name[0]) + fprintf(rawoutstream, "@%s", host_name); + if(real_name[0]) + fprintf(rawoutstream, ">"); + HDfputc('\n', rawoutstream); } /* end if */ - printf(" *\n * Purpose:\t\t"); + fprintf(rawoutstream, " *\n * Purpose:\t\t"); for(s = purpose; *s; s++) { - HDputchar(*s); - if('\n' == *s && s[1]) - printf(" *\t\t\t"); + HDfputc(*s, rawoutstream); + if('\n' == *s && s[1]) + fprintf(rawoutstream, " *\t\t\t"); } /* end for */ - printf(" *\n * Modifications:\n *\n"); - printf(" *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); - printf(" *\tIt was generated by code in `H5make_libsettings.c'.\n"); + fprintf(rawoutstream, " *\n * Modifications:\n *\n"); + fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); + fprintf(rawoutstream, " *\tIt was generated by code in `H5make_libsettings.c'.\n"); - printf(" *\n *"); + fprintf(rawoutstream, " *\n *"); for(i = 0; i < 73; i++) - HDputchar('-'); - printf("\n */\n\n"); + HDfputc('-', rawoutstream); + fprintf(rawoutstream, "\n */\n\n"); } - + /*------------------------------------------------------------------------- - * Function: print_footer - * - * Purpose: Prints the file footer for the generated file. + * Function: print_footer * - * Return: void + * Purpose: Prints the file footer for the generated file. * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Mar 31 2010 + * Return: void * *------------------------------------------------------------------------- */ @@ -265,24 +253,37 @@ print_footer(void) /* nothing */ } - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Main entry point. + * Purpose: Main entry point. * - * Return: Success: exit(0) - * - * Failure: exit(1) - * - * Programmer: Albert Cheng - * 2010/4/1 + * Return: Success: exit(0) + * Failure: exit(1) * *------------------------------------------------------------------------- */ int -main(void) +main(int argc, char *argv[]) { + char *fname = NULL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawoutstream is changed only when succeeded */ + + if (argc > 1) { + fname = argv[1]; + } + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if ((f = HDfopen(fname, "w")) != NULL) { + rawoutstream = f; + } + } + if (!rawoutstream) + rawoutstream = stdout; + print_header(); /* Generate embedded library information variable definition */ @@ -290,5 +291,12 @@ main(void) print_footer(); + if (rawoutstream && rawoutstream != stdout) { + if (HDfclose(rawoutstream)) + fprintf(stderr, "closing rawoutstream"); + else + rawoutstream = NULL; + } + HDexit(0); } -- cgit v0.12 From 595b2d54ed34ee8b8502dbb162a2994f177b4a2c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 18 Sep 2018 12:35:17 -0500 Subject: HDFFV-9059 take file as argument --- src/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index a0defad..bc5c09e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -153,7 +153,7 @@ settings_DATA=libhdf5.settings H5Tinit.c: H5detect$(EXEEXT) LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5detect$(EXEEXT) > $@ || \ + $(RUNSERIAL) ./H5detect$(EXEEXT) $@ || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ ($(RM) $@ ; exit 1) @@ -165,7 +165,7 @@ H5Tinit.c: H5detect$(EXEEXT) H5lib_settings.c: H5make_libsettings$(EXEEXT) libhdf5.settings LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) > $@ || \ + $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) $@ || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ ($(RM) $@ ; exit 1) -- cgit v0.12 From 6c78869c19a88edfd7b6a2a99a8fb8f5febf0b7a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 18 Sep 2018 13:22:48 -0500 Subject: Fix whitespace and exit status --- src/H5detect.c | 443 ++++++++++++++++++++++------------------------- src/H5make_libsettings.c | 60 +++---- 2 files changed, 227 insertions(+), 276 deletions(-) diff --git a/src/H5detect.c b/src/H5detect.c index c2d8ab0..aac58de 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -26,11 +26,6 @@ static const char *FileHeader = "\n\ * help@hdfgroup.org. *\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; /* - * - * Created: H5detect.c - * 10 Aug 1997 - * Robb Matzke - * * Purpose: This code was borrowed heavily from the `detect.c' * program in the AIO distribution from Lawrence * Livermore National Laboratory. @@ -44,7 +39,6 @@ static const char *FileHeader = "\n\ * features which aren't available. We're not * running on a Vax or other machine with mixed * endianness. - * *------------------------------------------------------------------------- */ #undef NDEBUG @@ -157,12 +151,11 @@ static H5JMP_BUF jbuf_g; /*------------------------------------------------------------------------- - * Function: precision + * Function: precision * - * Purpose: Determine the precision and offset. - * - * Return: void + * Purpose: Determine the precision and offset. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -211,16 +204,16 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_I/DETECT_BYTE + * Function: DETECT_I/DETECT_BYTE * - * Purpose: These macro takes a type like `int' and a base name like - * `nati' and detects the byte order. The VAR is used to - * construct the names of the C variables defined. + * Purpose: These macro takes a type like `int' and a base name like + * `nati' and detects the byte order. The VAR is used to + * construct the names of the C variables defined. * - * DETECT_I is used for types that are larger than one byte, - * DETECT_BYTE is used for types that are exactly one byte. + * DETECT_I is used for types that are larger than one byte, + * DETECT_BYTE is used for types that are exactly one byte. * - * Return: void + * Return: void * * Modifications: * @@ -285,16 +278,13 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_F - * - * Purpose: This macro takes a floating point type like `double' and - * a base name like `natd' and detects byte order, mantissa - * location, exponent location, sign bit location, presence or - * absence of implicit mantissa bit, and exponent bias and - * initializes a detected_t structure with those properties. - * - * Return: void + * Function: DETECT_F * + * Purpose: This macro takes a floating point type like `double' and + * a base name like `natd' and detects byte order, mantissa + * location, exponent location, sign bit location, presence or + * absence of implicit mantissa bit, and exponent bias and + * initializes a detected_t structure with those properties. *------------------------------------------------------------------------- */ #define DETECT_F(TYPE,VAR,INFO) { \ @@ -385,14 +375,13 @@ precision (detected_t *d) /*------------------------------------------------------------------------- - * Function: DETECT_M - * - * Purpose: This macro takes only miscellaneous structures or pointer - * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It - * constructs the names and decides the alignment in structure. + * Function: DETECT_M * - * Return: void + * Purpose: This macro takes only miscellaneous structures or pointer + * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It + * constructs the names and decides the alignment in structure. * + * Return: void *------------------------------------------------------------------------- */ #define DETECT_M(TYPE,VAR,INFO) { \ @@ -422,29 +411,29 @@ precision (detected_t *d) _buf = (char*)HDmalloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \ if(H5SETJMP(jbuf_g)) _ano++; \ if(_ano < NELMTS(align_g)) { \ - *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \ - _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/\ - /* Cray Check: This section helps detect alignment on Cray's */ \ + *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \ + _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/\ + /* Cray Check: This section helps detect alignment on Cray's */ \ /* vector machines (like the SV1) which mask off */ \ - /* pointer values when pointing to non-word aligned */ \ - /* locations with pointers that are supposed to be */ \ - /* word aligned. -QAK */ \ - HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \ - /*How to handle VAX types?*/ \ - if(INFO.perm[0]) /* Big-Endian */ \ - HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \ - else /* Little-Endian */ \ - HDmemcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \ - _val2 = *((TYPE*)(_buf+align_g[_ano])); \ - H5_GCC_DIAG_OFF(float-equal) \ - if(_val!=_val2) \ - H5LONGJMP(jbuf_g, 1); \ - H5_GCC_DIAG_ON(float-equal) \ - /* End Cray Check */ \ - (INFO.align)=align_g[_ano]; \ + /* pointer values when pointing to non-word aligned */ \ + /* locations with pointers that are supposed to be */ \ + /* word aligned. -QAK */ \ + HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \ + /*How to handle VAX types?*/ \ + if(INFO.perm[0]) /* Big-Endian */ \ + HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \ + else /* Little-Endian */ \ + HDmemcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \ + _val2 = *((TYPE*)(_buf+align_g[_ano])); \ + H5_GCC_DIAG_OFF(float-equal) \ + if(_val!=_val2) \ + H5LONGJMP(jbuf_g, 1); \ + H5_GCC_DIAG_ON(float-equal) \ + /* End Cray Check */ \ + (INFO.align)=align_g[_ano]; \ } else { \ (INFO.align)=0; \ - fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \ + fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \ } \ HDfree(_buf); \ HDsignal(SIGBUS, _handler); /*restore original handler*/ \ @@ -461,15 +450,14 @@ precision (detected_t *d) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigsegv_handler - * - * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Function: sigsegv_handler * - * Return: Returns via H5LONGJMP to jbuf_g. + * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -494,20 +482,14 @@ sigsegv_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigbus_handler + * Function: sigbus_handler * - * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * * Return: Returns via H5LONGJMP to jbuf_g. - * - * Programmer: Robb Matzke - * Thursday, March 18, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -532,15 +514,14 @@ sigbus_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- - * Function: sigill_handler + * Function: sigill_handler * - * Purpose: Handler for SIGILL. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. - * - * Return: Returns via H5LONGJMP to jbuf_g. + * Purpose: Handler for SIGILL. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -564,12 +545,11 @@ sigill_handler(int H5_ATTR_UNUSED signo) /*------------------------------------------------------------------------- - * Function: print_results + * Function: print_results * - * Purpose: Prints information about the detected data types. - * - * Return: void + * Purpose: Prints information about the detected data types. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -844,12 +824,12 @@ done:\n\ /*------------------------------------------------------------------------- - * Function: iprint - * - * Purpose: Prints information about the fields of a floating point format. + * Function: iprint * - * Return: void + * Purpose: Prints information about the fields of a floating point format. * + * Return: void + *------------------------------------------------------------------------- */ static void @@ -931,16 +911,15 @@ iprint(detected_t *d) /*------------------------------------------------------------------------- - * Function: byte_cmp + * Function: byte_cmp * - * Purpose: Compares two chunks of memory A and B and returns the - * byte index into those arrays of the first byte that - * differs between A and B. Ignores differences where the - * corresponding bit in pad_mask is set to 0. - * - * Return: Success: Index of differing byte. - * Failure: -1 if all bytes are the same. + * Purpose: Compares two chunks of memory A and B and returns the + * byte index into those arrays of the first byte that + * differs between A and B. Ignores differences where the + * corresponding bit in pad_mask is set to 0. * + * Return: Success: Index of differing byte. + * Failure: -1 if all bytes are the same. *------------------------------------------------------------------------- */ static int @@ -959,15 +938,15 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) /*------------------------------------------------------------------------- - * Function: bit_cmp + * Function: bit_cmp * - * Purpose: Compares two bit vectors and returns the index for the - * first bit that differs between the two vectors. The - * size of the vector is NBYTES. PERM is a mapping from - * actual order to little endian. Ignores differences where - * the corresponding bit in pad_mask is set to 0. + * Purpose: Compares two bit vectors and returns the index for the + * first bit that differs between the two vectors. The + * size of the vector is NBYTES. PERM is a mapping from + * actual order to little endian. Ignores differences where + * the corresponding bit in pad_mask is set to 0. * - * Return: Index of first differing bit. + * Return: Index of first differing bit. * *------------------------------------------------------------------------- */ @@ -1000,33 +979,32 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, /*------------------------------------------------------------------------- - * Function: fix_order - * - * Purpose: Given an array PERM with elements FIRST through LAST - * initialized with zero origin byte numbers, this function - * creates a permutation vector that maps the actual order - * of a floating point number to little-endian. + * Function: fix_order * - * This function assumes that the mantissa byte ordering - * implies the total ordering. + * Purpose: Given an array PERM with elements FIRST through LAST + * initialized with zero origin byte numbers, this function + * creates a permutation vector that maps the actual order + * of a floating point number to little-endian. * - * Return: void + * This function assumes that the mantissa byte ordering + * implies the total ordering. * + * Return: void *------------------------------------------------------------------------- */ static void fix_order(int n, int last, int *perm, const char **mesg) { - int i; + int i; if (last > 1) { /* - * We have at least three points to consider. - */ + * We have at least three points to consider. + */ if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { /* - * Little endian. - */ + * Little endian. + */ if (mesg) *mesg = "Little-endian"; for (i = 0; i < n; i++) @@ -1036,8 +1014,8 @@ fix_order(int n, int last, int *perm, const char **mesg) else if (perm[last] > perm[last - 1] && perm[last - 1] > perm[last - 2]) { /* - * Big endian. - */ + * Big endian. + */ if (mesg) *mesg = "Big-endian"; for (i = 0; i < n; i++) @@ -1046,11 +1024,11 @@ fix_order(int n, int last, int *perm, const char **mesg) } else { /* - * Bi-endian machines like VAX. - * (NOTE: This is not an actual determination of the VAX-endianness. - * It could have some other endianness and fall into this - * case - JKM & QAK) - */ + * Bi-endian machines like VAX. + * (NOTE: This is not an actual determination of the VAX-endianness. + * It could have some other endianness and fall into this + * case - JKM & QAK) + */ HDassert(0 == n % 2); if (mesg) *mesg = "VAX"; @@ -1062,39 +1040,38 @@ fix_order(int n, int last, int *perm, const char **mesg) } else { fprintf(stderr, - "Failed to detect byte order of %d-byte floating point.\n", n); + "Failed to detect byte order of %d-byte floating point.\n", n); HDexit(1); } } /*------------------------------------------------------------------------- - * Function: imp_bit + * Function: imp_bit * - * Purpose: Looks for an implicit bit in the mantissa. The value - * of _A should be 1.0 and the value of _B should be 0.5. - * Some floating-point formats discard the most significant - * bit of the mantissa after normalizing since it will always - * be a one (except for 0.0). If this is true for the native - * floating point values stored in _A and _B then the function - * returns non-zero. + * Purpose: Looks for an implicit bit in the mantissa. The value + * of _A should be 1.0 and the value of _B should be 0.5. + * Some floating-point formats discard the most significant + * bit of the mantissa after normalizing since it will always + * be a one (except for 0.0). If this is true for the native + * floating point values stored in _A and _B then the function + * returns non-zero. * - * This function assumes that the exponent occupies higher - * order bits than the mantissa and that the most significant - * bit of the mantissa is next to the least significant bit - * of the exponent. + * This function assumes that the exponent occupies higher + * order bits than the mantissa and that the most significant + * bit of the mantissa is next to the least significant bit + * of the exponent. * * - * Return: Success: Non-zero if the most significant bit + * Return: Success: Non-zero if the most significant bit * of the mantissa is discarded (ie, the * mantissa has an implicit `one' as the * most significant bit). Otherwise, * returns zero. - * Failure: exit(1) * - * Modifications: + * Failure: 1 * - * Robb Matzke, 6 Nov 1996 + * Modifications: * Fixed a bug that occurs with non-implicit architectures. * *------------------------------------------------------------------------- @@ -1127,17 +1104,14 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ /*------------------------------------------------------------------------- - * Function: find_bias + * Function: find_bias * - * Purpose: Determines the bias of the exponent. This function should - * be called with _A having a value of `1'. + * Purpose: Determines the bias of the exponent. This function should + * be called with _A having a value of `1'. * - * Return: Success: The exponent bias. - * Failure: + * Return: The exponent bias. * * Modifications: - * - * Robb Matzke, 6 Nov 1996 * Fixed a bug with non-implicit architectures returning the * wrong exponent bias. * @@ -1165,28 +1139,27 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) /*------------------------------------------------------------------------- - * Function: print_header + * Function: print_header * - * Purpose: Prints the C file header for the generated file. - * - * Return: void + * Purpose: Prints the C file header for the generated file. * + * Return: void *------------------------------------------------------------------------- */ static void print_header(void) { - time_t now = HDtime(NULL); - struct tm *tm = HDlocaltime(&now); - char real_name[30]; - char host_name[256]; - int i; - const char *s; + time_t now = HDtime(NULL); + struct tm *tm = HDlocaltime(&now); + char real_name[30]; + char host_name[256]; + int i; + const char *s; #ifdef H5_HAVE_GETPWUID - struct passwd *pwd = NULL; + struct passwd *pwd = NULL; #else - int pwd = 1; + int pwd = 1; #endif static const char *month_name[] = { @@ -1280,7 +1253,7 @@ bit.\n"; if (real_name[0]) fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if (pwd) HDfputs(pwd->pw_name, rawoutstream); + if (pwd) HDfputs(pwd->pw_name, rawoutstream); #endif if (host_name[0]) fprintf(rawoutstream, "@%s", host_name); @@ -1308,35 +1281,33 @@ bit.\n"; /*------------------------------------------------------------------------- - * Function: detect_C89_integers - * - * Purpose: Detect C89 integer types + * Function: detect_C89_integers * - * Return: void + * Purpose: Detect C89 integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN detect_C89_integers(void) { - DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; - DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; - DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; - DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++; - DETECT_I(int, INT, d_g[nd_g]); nd_g++; - DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++; - DETECT_I(long, LONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; + DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; + DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; + DETECT_I(short, SHORT, d_g[nd_g]); nd_g++; + DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++; + DETECT_I(int, INT, d_g[nd_g]); nd_g++; + DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++; + DETECT_I(long, LONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; } /*------------------------------------------------------------------------- - * Function: detect_C89_floats + * Function: detect_C89_floats * - * Purpose: Detect C89 floating point types - * - * Return: void + * Purpose: Detect C89 floating point types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1348,12 +1319,11 @@ detect_C89_floats(void) /*------------------------------------------------------------------------- - * Function: detect_C99_integers8 - * - * Purpose: Detect C99 8 bit integer types + * Function: detect_C99_integers8 * - * Return: void + * Purpose: Detect C99 8 bit integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1361,56 +1331,55 @@ detect_C99_integers8(void) { #if H5_SIZEOF_INT8_T>0 #if H5_SIZEOF_INT8_T==1 - DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; + DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; #else - DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++; + DETECT_I(int8_t, INT8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT8_T>0 #if H5_SIZEOF_UINT8_T==1 - DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; #else - DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; + DETECT_I(uint8_t, UINT8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_INT_LEAST8_T>0 #if H5_SIZEOF_INT_LEAST8_T==1 - DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT_LEAST8_T>0 #if H5_SIZEOF_UINT_LEAST8_T==1 - DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; + DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_INT_FAST8_T>0 #if H5_SIZEOF_INT_FAST8_T==1 - DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; #else DETECT_I(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; #endif #endif #if H5_SIZEOF_UINT_FAST8_T>0 #if H5_SIZEOF_UINT_FAST8_T==1 - DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; #else - DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; #endif #endif } /*------------------------------------------------------------------------- - * Function: detect_C99_integers16 - * - * Purpose: Detect C99 16 bit integer types + * Function: detect_C99_integers16 * - * Return: void + * Purpose: Detect C99 16 bit integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1420,30 +1389,29 @@ detect_C99_integers16(void) DETECT_I(int16_t, INT16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT16_T>0 - DETECT_I(uint16_t, UINT16, d_g[nd_g]); nd_g++; + DETECT_I(uint16_t, UINT16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST16_T>0 - DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]); nd_g++; + DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST16_T>0 - DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]); nd_g++; + DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST16_T>0 - DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]); nd_g++; + DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST16_T>0 - DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++; #endif } /*------------------------------------------------------------------------- - * Function: detect_C99_integers32 + * Function: detect_C99_integers32 * - * Purpose: Detect C99 32 bit integer types - * - * Return: void + * Purpose: Detect C99 32 bit integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1453,29 +1421,29 @@ detect_C99_integers32(void) DETECT_I(int32_t, INT32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT32_T>0 - DETECT_I(uint32_t, UINT32, d_g[nd_g]); nd_g++; + DETECT_I(uint32_t, UINT32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST32_T>0 - DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]); nd_g++; + DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST32_T>0 - DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]); nd_g++; + DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST32_T>0 - DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]); nd_g++; + DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST32_T>0 - DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++; #endif } /*------------------------------------------------------------------------- - * Function: detect_C99_integers64 + * Function: detect_C99_integers64 * - * Purpose: Detect C99 64 bit integer types + * Purpose: Detect C99 64 bit integer types * - * Return: void + * Return: void * *------------------------------------------------------------------------- */ @@ -1486,24 +1454,24 @@ detect_C99_integers64(void) DETECT_I(int64_t, INT64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT64_T>0 - DETECT_I(uint64_t, UINT64, d_g[nd_g]); nd_g++; + DETECT_I(uint64_t, UINT64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_LEAST64_T>0 - DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]); nd_g++; + DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_LEAST64_T>0 - DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]); nd_g++; + DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_INT_FAST64_T>0 - DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]); nd_g++; + DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_UINT_FAST64_T>0 - DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]); nd_g++; + DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]); nd_g++; #endif #if H5_SIZEOF_LONG_LONG>0 DETECT_I(long long, LLONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++; #else /* * This architecture doesn't support an integer type larger than `long' @@ -1511,18 +1479,17 @@ detect_C99_integers64(void) * `long long' is probably equivalent to `long' here anyway. */ DETECT_I(long, LLONG, d_g[nd_g]); nd_g++; - DETECT_I(unsigned long, ULLONG, d_g[nd_g]); nd_g++; + DETECT_I(unsigned long, ULLONG, d_g[nd_g]); nd_g++; #endif } /*------------------------------------------------------------------------- - * Function: detect_C99_integers - * - * Purpose: Detect C99 integer types + * Function: detect_C99_integers * - * Return: void + * Purpose: Detect C99 integer types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1538,12 +1505,11 @@ detect_C99_integers(void) /*------------------------------------------------------------------------- - * Function: detect_C99_floats + * Function: detect_C99_floats * - * Purpose: Detect C99 floating point types - * - * Return: void + * Purpose: Detect C99 floating point types * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1564,12 +1530,11 @@ detect_C99_floats(void) /*------------------------------------------------------------------------- - * Function: detect_alignments - * - * Purpose: Detect structure alignments + * Function: detect_alignments * - * Return: void + * Purpose: Detect structure alignments * + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1615,11 +1580,11 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) nfailures++; } else { - if (val==signum){ + if (val==signum) { /* return from signum handler. Record a sucess. */ nsuccesses++; } - else{ + else { fprintf(stderr, "Unknown return value (%d) from H5SETJMP", val); nfailures++; } @@ -1629,13 +1594,13 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) HDsignal(signum, save_handler); if (nfailures>0 || nsuccesses != ntries) { fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " - "Found %d failures and %d successes\n", - signum, ntries, nfailures, nsuccesses); - return(-1); + "Found %d failures and %d successes\n", + signum, ntries, nfailures, nsuccesses); + return -1; } else { /* all succeeded */ - return(0); + return 0; } } #endif @@ -1646,12 +1611,10 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) * * Purpose: Main entry point. * - * Return: Success: exit(0) - * - * Failure: exit(1) + * Return: Success: 0 * * Modifications: - * Some compilers, e.g., Intel C v7.0, took a long time to compile + * Some compilers, e.g., Intel C v7.0, took a long time to compile * with optimization when a module routine contains many code lines. * Divide up all those types detections macros into subroutines, both * to avoid the compiler optimization error and cleaner codes. @@ -1738,5 +1701,5 @@ main(int argc, char *argv[]) rawoutstream = NULL; } - return 0; + return EXIT_SUCCESS; } diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index d803d07..d4caabb 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -26,11 +26,6 @@ static const char *FileHeader = "\n\ * help@hdfgroup.org. *\n\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; /* - * - * Created: H5make_libsettings.c - * 17 Mar 2010 - * Quincey Koziol - * * Purpose: Generate the H5libsettings.c file from the * libhdf5.settings file. * @@ -45,17 +40,15 @@ static const char *FileHeader = "\n\ FILE *rawoutstream = NULL; - /*------------------------------------------------------------------------- - * Function: insert_libhdf5_settings - * - * Purpose: insert the contents of libhdf5.settings into a file - * represented by flibinfo. - * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not - * defined, i.e., not enabled. + * Function: insert_libhdf5_settings * - * Return: void + * Purpose: insert the contents of libhdf5.settings into a file + * represented by flibinfo. + * Make it an empty string if H5_HAVE_EMBEDDED_LIBINFO is not + * defined, i.e., not enabled. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -68,7 +61,7 @@ insert_libhdf5_settings(FILE *flibinfo) if(NULL == (fsettings = HDfopen(LIBSETTINGSFNAME, "r"))) { HDperror(LIBSETTINGSFNAME); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* print variable definition and the string */ @@ -98,11 +91,11 @@ insert_libhdf5_settings(FILE *flibinfo) } /* end if */ else { fprintf(stderr, "Read errors encountered with %s\n", LIBSETTINGSFNAME); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end else */ if(0 != HDfclose(fsettings)) { HDperror(LIBSETTINGSFNAME); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ #else /* print variable definition and an empty string */ @@ -113,14 +106,13 @@ insert_libhdf5_settings(FILE *flibinfo) /*------------------------------------------------------------------------- - * Function: make_libinfo + * Function: make_libinfo * - * Purpose: Create the embedded library information definition. - * This sets up for a potential extension that the declaration - * is printed to a file different from stdout. - * - * Return: void + * Purpose: Create the embedded library information definition. + * This sets up for a potential extension that the declaration + * is printed to a file different from stdout. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -132,12 +124,11 @@ make_libinfo(void) /*------------------------------------------------------------------------- - * Function: print_header - * - * Purpose: Prints the header for the generated file. + * Function: print_header * - * Return: void + * Purpose: Prints the header for the generated file. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -239,12 +230,11 @@ information about the library build configuration\n"; /*------------------------------------------------------------------------- - * Function: print_footer + * Function: print_footer * - * Purpose: Prints the file footer for the generated file. - * - * Return: void + * Purpose: Prints the file footer for the generated file. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -255,13 +245,11 @@ print_footer(void) /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Main entry point. + * Function: main * - * Return: Success: exit(0) - * Failure: exit(1) + * Purpose: Main entry point. * + * Return: Success: 0 *------------------------------------------------------------------------- */ int @@ -298,5 +286,5 @@ main(int argc, char *argv[]) rawoutstream = NULL; } - HDexit(0); + HDexit(EXIT_SUCCESS); } -- cgit v0.12 From 680cf4d946fd10d50e0f7acdc5bc93f91037fb4f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 18 Sep 2018 14:10:14 -0700 Subject: Removed 'VOL' versions of FUNC_ENTER macros as well as empty functions orginally intended to support the full SWMR feature. --- java/test/testfiles/JUnit-TestH5Edefault.txt | 14 +- src/H5A.c | 6 +- src/H5Adeprec.c | 2 +- src/H5Aint.c | 259 +++---------------- src/H5Apkg.h | 7 - src/H5D.c | 8 +- src/H5Dchunk.c | 8 +- src/H5Dint.c | 153 ++--------- src/H5Dio.c | 4 +- src/H5Dpkg.h | 3 - src/H5F.c | 27 +- src/H5Fefc.c | 4 +- src/H5Fint.c | 236 ++--------------- src/H5Fmount.c | 10 +- src/H5Fpkg.h | 7 +- src/H5G.c | 23 +- src/H5Gdeprec.c | 369 +++++---------------------- src/H5Gint.c | 213 +--------------- src/H5Gpkg.h | 5 - src/H5I.c | 40 +-- src/H5L.c | 369 +++------------------------ src/H5O.c | 26 +- src/H5Ocopy.c | 7 +- src/H5Odeprec.c | 13 +- src/H5Oflush.c | 54 +--- src/H5Oint.c | 282 +------------------- src/H5Opkg.h | 11 - src/H5Rint.c | 20 +- src/H5T.c | 4 +- src/H5Tcommit.c | 94 +------ src/H5Z.c | 6 +- src/H5private.h | 50 ---- tools/test/h5dump/errfiles/tall-1.err | 19 +- tools/test/h5dump/errfiles/tall-2A.err | 19 +- tools/test/h5dump/errfiles/tall-2A0.err | 19 +- tools/test/h5dump/errfiles/tall-2B.err | 19 +- tools/test/h5dump/errfiles/tdset-2.err | 11 +- tools/test/h5dump/errfiles/textlink.err | 38 ++- tools/test/h5dump/errfiles/textlinkfar.err | 33 ++- tools/test/h5dump/errfiles/textlinksrc.err | 33 ++- tools/test/h5dump/errfiles/torderlinks1.err | 19 +- tools/test/h5dump/errfiles/torderlinks2.err | 19 +- tools/test/h5dump/errfiles/tperror.err | 11 +- 43 files changed, 418 insertions(+), 2156 deletions(-) diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index 62497f9..b39dbef 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -36,25 +36,19 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file major: File accessibilty minor: Unable to open file - #001: (file name) line (number) in H5F__open(): unable to open file - major: File accessibilty - minor: Unable to open file - #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class + #001: (file name) line (number) in H5F_open(): unable to retrieve VFL class major: File accessibilty minor: Can't get value - #003: (file name) line (number) in H5FD_get_class(): can't find object for ID + #002: (file name) line (number) in H5FD_get_class(): can't find object for ID major: Object atom minor: Unable to find atom information (already closed?) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file major: File accessibilty minor: Unable to open file - #001: (file name) line (number) in H5F__open(): unable to open file - major: File accessibilty - minor: Unable to open file - #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class + #001: (file name) line (number) in H5F_open(): unable to retrieve VFL class major: File accessibilty minor: Can't get value - #003: (file name) line (number) in H5FD_get_class(): can't find object for ID + #002: (file name) line (number) in H5FD_get_class(): can't find object for ID major: Object atom minor: Unable to find atom information (already closed?) diff --git a/src/H5A.c b/src/H5A.c index 8e64eda..a0408c3 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -1133,7 +1133,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Call private attribute rename routine */ - if(H5A__rename(&loc, old_name, new_name) < 0) + if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1379,7 +1379,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Delete the attribute from the location */ - if(H5A__delete(&loc, name) < 0) + if(H5O__attr_remove(loc.oloc, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1563,7 +1563,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Check if the attribute exists */ - if((ret_value = H5A__exists(&loc, attr_name)) < 0) + if((ret_value = H5O__attr_exists(loc.oloc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 9b592b0..99c1c0c 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -340,7 +340,7 @@ H5Aget_num_attrs(hid_t loc_id) } /*lint !e788 All appropriate cases are covered */ /* Look up the # of attributes for the object */ - if((ret_value = H5A__get_num_attrs(loc)) < 0) + if((ret_value = H5O__attr_count(loc)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") done: diff --git a/src/H5Aint.c b/src/H5Aint.c index 55560c7..807c67e 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -87,8 +87,6 @@ typedef struct { /* Local Prototypes */ /********************/ -static H5A_t *H5A__create_common(const H5G_loc_t *loc, const char *name, - const H5T_t *type, const H5S_t *space, hid_t acpl_id); static herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr); static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/); @@ -127,7 +125,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); /*------------------------------------------------------------------------- - * Function: H5A__create_common + * Function: H5A__create * * Purpose: This is the guts of creating an attribute. * @@ -138,8 +136,8 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); * *------------------------------------------------------------------------- */ -static H5A_t * -H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, +H5A_t * +H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -148,7 +146,7 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, htri_t exists; /* Whether attribute exists */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_STATIC_TAG(loc->oloc->addr) + FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr) /* Check args */ HDassert(loc); @@ -285,45 +283,6 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* H5A__create_common() */ - - -/*------------------------------------------------------------------------- - * Function: H5A__create - * - * Purpose: Entry point for creating attribute on an object - * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Attribute structure on success, NULL on Failure. - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -H5A_t * -H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, - const H5S_t *space, hid_t acpl_id) -{ - H5A_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check args */ - HDassert(loc); - HDassert(name); - HDassert(type); - HDassert(space); - - /* Go do the real work for attaching the attribute to the object */ - if(NULL == (ret_value = H5A__create_common(loc, name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, NULL, "unable to create attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* H5A__create() */ @@ -350,7 +309,7 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -368,8 +327,8 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr loc_found = TRUE; /* Go do the real work for attaching the attribute to the object */ - if(NULL == (attr = H5A__create_common(&obj_loc, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + if(NULL == (attr = H5A__create(&obj_loc, attr_name, type, space, acpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") /* Set return value */ ret_value = attr; @@ -384,7 +343,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__create_by_name() */ @@ -450,10 +409,6 @@ done: * * Purpose: Open an attribute in an object header * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol @@ -467,7 +422,7 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name) H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -490,7 +445,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open() */ @@ -517,7 +472,7 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -554,7 +509,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_idx() */ @@ -580,7 +535,7 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -618,7 +573,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_name() */ @@ -652,7 +607,7 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) HDassert(attr); HDassert(mem_type); @@ -721,7 +676,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__read() */ @@ -756,7 +711,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) HDassert(attr); HDassert(mem_type); @@ -835,7 +790,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__write() */ @@ -939,7 +894,7 @@ H5A__get_type(H5A_t *attr) H5T_t *dt = NULL; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(attr); @@ -970,7 +925,7 @@ done: if(H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0)) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_type() */ @@ -1192,7 +1147,7 @@ H5A__close_cb(H5A_t *attr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(attr); @@ -1203,7 +1158,7 @@ H5A__close_cb(H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__close_cb() */ @@ -1355,39 +1310,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__exists - * - * Purpose: Private version of H5Aexists - * - * Note: This routine is needed so that there's a non-API routine for - * detecting attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: TRUE/FALSE - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -htri_t -H5A__exists(const H5G_loc_t *loc, const char *name) -{ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check if the attribute exists */ - if((ret_value = H5O__attr_exists(loc->oloc, name)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__exists() */ - - -/*------------------------------------------------------------------------- * Function: H5A__exists_by_name * * Purpose: Private version of H5Aexists_by_name @@ -1409,7 +1331,7 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name) hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1430,7 +1352,7 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__exists_by_name() */ @@ -2599,39 +2521,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__rename - * - * Purpose: Private version of H5Arename - * - * Note: This routine is needed so that there's a non-API routine for - * renaming attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__rename(const H5G_loc_t *loc, const char *old_name, const char *new_name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Call object header attribute rename routine */ - if(H5O__attr_rename(loc->oloc, old_name, new_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__rename() */ - - -/*------------------------------------------------------------------------- * Function: H5A__rename_by_name * * Purpose: Private version of H5Arename_by_name @@ -2654,7 +2543,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2675,44 +2564,9 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__rename_by_name() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5A__get_num_attrs - * - * Purpose: Private version of deprecated H5Aget_num_attrs - * - * Note: This routine is needed so that there's a non-API routine for - * querying the attribute count that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -int -H5A__get_num_attrs(const H5O_loc_t *loc) -{ - int ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Look up the # of attributes for the object */ - if((ret_value = H5O__attr_count(loc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__get_num_attrs() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - /*------------------------------------------------------------------------- * Function: H5A__iterate_common @@ -2755,10 +2609,6 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, * * Purpose: Private version of H5Aiterate2 * - * Note: This routine is needed so that there's a non-API routine for - * iterating over attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2774,7 +2624,7 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, H5A_attr_iter_op_t attr_op; /* Attribute operator */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP2; @@ -2785,7 +2635,7 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -2811,7 +2661,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, hsize_t idx; /* Index of attribute to start iterating at */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP; @@ -2829,7 +2679,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, *attr_num = (unsigned)idx; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_old() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -2839,10 +2689,6 @@ done: * * Purpose: Private version of H5Aiterate_by_name * - * Note: This routine is needed so that there's a non-API routine for - * iterating over attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2863,7 +2709,7 @@ H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ H5A_attr_iter_op_t attr_op; /* Attribute operator */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2896,44 +2742,11 @@ done: else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_by_name() */ /*------------------------------------------------------------------------- - * Function: H5A__delete - * - * Purpose: Private version of H5Adelete - * - * Note: This routine is needed so that there's a non-API routine for - * deleting attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__delete(const H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Call object header attribute delete attribute routine */ - if(H5O__attr_remove(loc->oloc, name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__delete() */ - - -/*------------------------------------------------------------------------- * Function: H5A__delete_by_name * * Purpose: Private version of H5Adelete_by_name @@ -2955,7 +2768,7 @@ H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2976,7 +2789,7 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_name() */ @@ -3003,7 +2816,7 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -3024,6 +2837,6 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_idx() */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index af16b55..0bb6d8f 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -200,13 +200,8 @@ H5_DLL herr_t H5A__close(H5A_t *attr); H5_DLL herr_t H5A__close_cb(H5A_t *attr); H5_DLL htri_t H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo); H5_DLL herr_t H5A__set_version(const H5F_t *f, H5A_t *attr); -H5_DLL herr_t H5A__rename(const H5G_loc_t *loc, const char *old_name, - const char *new_name); H5_DLL herr_t H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name, const char *new_attr_name); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL int H5A__get_num_attrs(const H5O_loc_t *loc); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ H5_DLL herr_t H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data); H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, @@ -216,12 +211,10 @@ H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_DLL herr_t H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -H5_DLL herr_t H5A__delete(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name); H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); -H5_DLL htri_t H5A__exists(const H5G_loc_t *loc, const char *name); H5_DLL htri_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name); H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf); H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf); diff --git a/src/H5D.c b/src/H5D.c index 61ccb5a..0ea7e4a 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -220,8 +220,8 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* build and open the new dataset */ - if(NULL == (dset = H5D__create_anon(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) @@ -481,8 +481,8 @@ H5Dget_create_plist(hid_t dset_id) if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") - if((ret_value = H5D__get_create_plist(dataset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist") + if((ret_value = H5D_get_create_plist(dataset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4906f3c..16d7530 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -495,7 +495,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); @@ -565,7 +565,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, *filters = udata.filter_mask; done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__chunk_direct_read() */ @@ -590,7 +590,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage H5D_chunk_ud_t udata; /* User data for querying chunk info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); @@ -663,7 +663,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage *storage_size = dset->shared->layout.u.chunk.size; done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5D__get_chunk_storage_size */ diff --git a/src/H5Dint.c b/src/H5Dint.c index e8874a2..2d4985e 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -58,7 +58,6 @@ static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); -static herr_t H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); static herr_t H5D__close_cb(H5D_t *dataset); @@ -299,7 +298,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, H5D_obj_create_t dcrt_info; /* Information for dataset creation */ H5D_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -330,52 +329,11 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, ret_value = (H5D_t *)ocrt_info.new_obj; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__create_named() */ /*------------------------------------------------------------------------- - * Function: H5D__create_anon - * - * Purpose: Internal routine to create a new anonymous dataset. - * - * Note: This routine is needed so that there's a non-API routine for - * creating datasets that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new dataset object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 9, 2017 - * - *------------------------------------------------------------------------- - */ -H5D_t * -H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, - hid_t dapl_id) -{ - H5D_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(file); - HDassert(type_id != H5P_DEFAULT); - HDassert(space); - HDassert(dcpl_id != H5P_DEFAULT); - HDassert(dapl_id != H5P_DEFAULT); - - /* Build and open the dataset */ - if(NULL == (ret_value = H5D__create(file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__create_anon() */ - - -/*------------------------------------------------------------------------- * Function: H5D__get_space_status * * Purpose: Returns the status of dataspace allocation. @@ -390,7 +348,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) { herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(dset); @@ -423,7 +381,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */ - if(H5D__get_storage_size_real(dset, &space_allocated) < 0) + if(H5D__get_storage_size(dset, &space_allocated) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") /* Decide on how much of the space is allocated */ @@ -444,7 +402,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) } /* end else */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__get_space_status() */ @@ -1189,7 +1147,7 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id) hbool_t loc_found = FALSE; /* Location at 'name' found */ H5D_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(loc); @@ -1223,7 +1181,7 @@ done: if(loc_found && H5G_loc_free(&dset_loc) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__open_name() */ @@ -1617,7 +1575,7 @@ H5D__close_cb(H5D_t *dataset) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* check args */ HDassert(dataset && dataset->oloc.file && dataset->shared); @@ -1628,7 +1586,7 @@ H5D__close_cb(H5D_t *dataset) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset"); done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__close_cb() */ @@ -2262,7 +2220,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_storage_size_real + * Function: H5D__get_storage_size * * Purpose: Determines how much space has been reserved to store the raw * data of a dataset. @@ -2270,8 +2228,8 @@ done: * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ -static herr_t -H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size) +herr_t +H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2313,35 +2271,6 @@ H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size) done: FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5D__get_storage_size_real() */ - - -/*------------------------------------------------------------------------- - * Function: H5D__get_storage_size - * - * Purpose: Determines how much space has been reserved to store the raw - * data of a dataset. - * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Non-negative on success, negative on failure - *------------------------------------------------------------------------- - */ -herr_t -H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */ - if(H5D__get_storage_size_real(dset, storage_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* end H5D__get_storage_size() */ @@ -2586,7 +2515,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) unsigned dim_idx; /* Dimension index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset); @@ -2747,7 +2676,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__set_extent() */ @@ -2833,7 +2762,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(dset); @@ -2848,7 +2777,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset and object flush callback") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__flush() */ @@ -2873,7 +2802,7 @@ H5D__format_convert(H5D_t *dataset) hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* Check args */ HDassert(dataset); @@ -2999,7 +2928,7 @@ done: if(newlayout != NULL) newlayout = (H5O_layout_t *)H5MM_xfree(newlayout); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__format_convert() */ @@ -3126,44 +3055,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_create_plist - * - * Purpose: Internal routine to retrieve a dataset's creation property list. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: ID for a copy of the dataset creation property - * list. The property list ID should be released - * by calling H5Pclose(). - * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5D__get_create_plist(const H5D_t *dset) -{ - hid_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(dset); - - /* Retrieve the DCPL */ - if((ret_value = H5D_get_create_plist(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset's creation property list") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__get_create_plist() */ - - -/*------------------------------------------------------------------------- * Function: H5D_get_create_plist * * Purpose: Private function for H5Dget_create_plist @@ -3422,7 +3313,7 @@ H5D__get_space(const H5D_t *dset) H5S_t *space = NULL; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* If the layout is virtual, update the extent */ if(dset->shared->layout.type == H5D_VIRTUAL) @@ -3443,7 +3334,7 @@ done: if(H5S_close(space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__get_space() */ @@ -3508,7 +3399,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset) hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dset); @@ -3536,6 +3427,6 @@ done: if(H5D__virtual_release_source_dset_files(head) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__refresh() */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 5fea91f..ed384ca 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -449,7 +449,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, char fake_char; /* Temporary variable for NULL buffer pointers */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* check args */ HDassert(dataset && dataset->oloc.file); @@ -616,7 +616,7 @@ done: if(H5S_close(projected_mem_space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down projected memory dataspace") - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__read() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index b887b87..1217c48 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -555,8 +555,6 @@ H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id); -H5_DLL H5D_t *H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, - hid_t dcpl_id, hid_t dapl_id); H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id); H5_DLL hid_t H5D__get_space(const H5D_t *dset); H5_DLL hid_t H5D__get_type(const H5D_t *dset); @@ -575,7 +573,6 @@ H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset); H5_DLL herr_t H5D__flush_real(H5D_t *dataset); H5_DLL herr_t H5D__flush(H5D_t *dset, hid_t dset_id); -H5_DLL hid_t H5D__get_create_plist(const H5D_t *dset); H5_DLL herr_t H5D__mark(const H5D_t *dataset, unsigned flags); H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset); diff --git a/src/H5F.c b/src/H5F.c index 01fd7db..65fbc9e 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -440,7 +440,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* Create a new file or truncate an existing file. */ - if (NULL == (new_file = H5F__create(filename, flags, fcpl_id, fapl_id))) + if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ @@ -505,7 +505,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the file */ - if(NULL == (new_file = H5F__open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) + if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") /* Get an atom for the file */ @@ -621,15 +621,22 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) * to be flushed. */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { - hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */ + hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */ /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, object_id, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Flush the file */ - if(H5F__flush(f, scope) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + /* Flush other files, depending on scope */ + if(H5F_SCOPE_GLOBAL == scope) { + /* Call the flush routine for mounted file hierarchies */ + if(H5F_flush_mounts(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") + } /* end if */ + else + /* Call the flush routine, for this file */ + if(H5F__flush(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") } /* end if */ done: @@ -796,9 +803,9 @@ H5Fget_freespace(hid_t file_id) if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Get the free space in the file */ - if(H5F__get_freespace(file, &tot_space) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + /* Go get the actual amount of free space in the file */ + if(H5MF_get_freespace(file, &tot_space, NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space for file") ret_value = (hssize_t)tot_space; @@ -1273,7 +1280,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") /* Get the free-space section information in the file */ - if((ret_value = H5F__get_free_sections(file, type, nsects, sect_info)) < 0) + if((ret_value = H5MF_get_free_sections(file, type, nsects, sect_info)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") done: diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 07bb644..a394071 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -481,7 +481,7 @@ H5F__efc_release(H5F_efc_t *efc) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(efc); @@ -491,7 +491,7 @@ H5F__efc_release(H5F_efc_t *efc) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't remove entry from external file cache") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_efc_release() */ diff --git a/src/H5Fint.c b/src/H5Fint.c index abc638a..432cd8e 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -795,7 +795,7 @@ H5F__is_hdf5(const char *name) haddr_t sig_addr; /* Addess of hdf5 file signature */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Open the file at the virtual file layer */ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) @@ -812,7 +812,7 @@ done: if(H5FD_close(file) < 0 && ret_value >= 0) HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__is_hdf5() */ @@ -1333,78 +1333,6 @@ H5F__dest(H5F_t *f, hbool_t flush) /*------------------------------------------------------------------------- - * Function: H5F__create - * - * Purpose: Internal routine to create a file. - * - * Note: This routine is needed so that there's a non-API routine for - * creating files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new file object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -H5F_t * -H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) -{ - H5F_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(filename); - - /* Create a new file or truncate an existing file. */ - if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5F__create() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__open - * - * Purpose: Internal routine to open a file. - * - * Note: This routine is needed so that there's a non-API routine for - * opening files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new file object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -H5F_t * -H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) -{ - H5F_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(filename); - - /* Open the file */ - if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5F__open() */ - - -/*------------------------------------------------------------------------- * Function: H5F_open * * Purpose: Opens (or creates) a file. This function understands the @@ -1926,7 +1854,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) /*------------------------------------------------------------------------- - * Function: H5F__flush_real + * Function: H5F__flush * * Purpose: Flushes cached data. * @@ -1934,7 +1862,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) *------------------------------------------------------------------------- */ herr_t -H5F__flush_real(H5F_t *f) +H5F__flush(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1954,49 +1882,6 @@ H5F__flush_real(H5F_t *f) HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush file data") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__flush_real() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__flush - * - * Purpose: Internal routine to flush a file. - * - * Note: This routine is needed so that there's a non-API routine for - * flushing files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5F__flush(H5F_t *f, H5F_scope_t scope) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Flush other files, depending on scope */ - if(H5F_SCOPE_GLOBAL == scope) { - /* Call the flush routine for mounted file hierarchies */ - if(H5F_flush_mounts(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") - } /* end if */ - else - /* Call the flush routine, for this file */ - if(H5F__flush_real(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* end H5F__flush() */ @@ -2005,10 +1890,6 @@ done: * * Purpose: Internal routine to close a file. * - * Note: This routine is needed so that there's a non-API routine for - * closing files that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol @@ -2022,7 +1903,7 @@ H5F__close(hid_t file_id) H5F_t *f; /* File pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Flush file if this is the last reference to this id and we have write * intent, unless it will be flushed by the "shared" file being closed. @@ -2037,7 +1918,7 @@ H5F__close(hid_t file_id) if((nref = H5I_get_ref(file_id, FALSE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get ID ref count") if(nref == 1) - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache") } /* end if */ @@ -2047,7 +1928,7 @@ H5F__close(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "decrementing file ID failed") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__close() */ @@ -2073,7 +1954,7 @@ H5F__close_cb(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -2105,7 +1986,7 @@ H5F__close_cb(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__close_cb() */ @@ -2780,7 +2661,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(f); @@ -2808,7 +2689,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) * * QAK - April, 2018 */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Set the new bounds */ @@ -2822,45 +2703,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__get_freespace - * - * Purpose: Private version of H5Fget_freespace - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: SUCCEED - * Failure: FAIL - *------------------------------------------------------------------------- - */ -herr_t -H5F__get_freespace(H5F_t *f, hsize_t *tot_space) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Go get the actual amount of free space in the file */ - if(H5MF_get_freespace(f, tot_space, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5F__get_freespace() */ - - -/*------------------------------------------------------------------------- * Function: H5F__get_file_image * * Purpose: Private version of H5Fget_file_image * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Bytes copied / number of bytes needed. * Failure: negative value *------------------------------------------------------------------------- @@ -2872,7 +2718,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) haddr_t eoa; /* End of file address */ ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ if(!file || !file->shared || !file->shared->lf) @@ -2959,7 +2805,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__get_file_image() */ @@ -2968,9 +2814,6 @@ done: * * Purpose: Private version of H5Fget_info * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -2980,7 +2823,7 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3009,7 +2852,7 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo) finfo->free.version = HDF5_FREESPACE_VERSION; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__get_info() */ @@ -3098,39 +2941,6 @@ H5F_set_retries(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F__get_free_sections - * - * Purpose: Private version of H5Fget_free_sections - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: non-negative, the total # of free space sections - * Failure: negative - *------------------------------------------------------------------------- - */ -ssize_t -H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, - H5F_sect_info_t *sect_info) -{ - ssize_t ret_value = -1; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Go get the actual amount of free space in the file */ - if((ret_value = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space sections for file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5F__get_free_sections() */ - - -/*------------------------------------------------------------------------- * Function: H5F_object_flush_cb * * Purpose: To invoke the callback function for object flush that is set @@ -3426,9 +3236,6 @@ done: * set up flush dependency/proxy even for file opened without * SWMR to resolve issues with opened objects. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -3448,7 +3255,7 @@ H5F__start_swmr_write(H5F_t *f) hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3481,7 +3288,7 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension") /* Flush data buffers */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush f's cached information") /* Get the # of opened named datatypes and attributes */ @@ -3617,7 +3424,7 @@ done: if(obj_paths) H5MM_xfree(obj_paths); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__start_swmr_write() */ @@ -3626,9 +3433,6 @@ done: * * Purpose: Private version of H5Fformat_convert * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -3639,7 +3443,7 @@ H5F__format_convert(H5F_t *f) hbool_t mark_dirty = FALSE; /* Whether to mark the file's superblock dirty */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3682,6 +3486,6 @@ H5F__format_convert(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__format_convert() */ diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 4cd1edf..b04bd3a 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -112,7 +112,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED H5G_loc_t root_loc; /* Group location of root of file to mount */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(loc); HDassert(name && *name); @@ -240,7 +240,7 @@ done: } } - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__mount() */ @@ -277,7 +277,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name) int child_idx; /* Index of child in parent's mtab */ herr_t ret_value = SUCCEED; /*return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(loc); HDassert(name && *name); @@ -390,7 +390,7 @@ done: if(mp_loc_setup) H5G_loc_free(&mp_loc); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__unmount() */ @@ -651,7 +651,7 @@ H5F_flush_mounts_recurse(H5F_t *f) nerrors++; /* Call the "real" flush routine, for this file */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Check flush errors for children - errors are already on the stack */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2ab41de..2e8a793 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -396,16 +396,11 @@ H5FL_EXTERN(H5F_file_t); /* General routines */ H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); -H5_DLL H5F_t *H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); -H5_DLL H5F_t *H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); -H5_DLL herr_t H5F__flush(H5F_t *f, H5F_scope_t scope); -H5_DLL herr_t H5F__flush_real(H5F_t *f); +H5_DLL herr_t H5F__flush(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name); H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); -H5_DLL herr_t H5F__get_freespace(H5F_t *f, hsize_t *tot_space); H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); -H5_DLL ssize_t H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info); H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); diff --git a/src/H5G.c b/src/H5G.c index fa065fa..cbf3a8e 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -400,10 +400,10 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_anon(loc.oloc->file, &gcrt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: /* Release the group's object header, if it was created */ @@ -509,10 +509,11 @@ H5Gget_create_plist(hid_t group_id) /* Check args */ if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") - if((ret_value = H5G__get_create_plist(group)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") + /* Retrieve the GCPL */ + if((ret_value = H5G_get_create_plist(group)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") done: FUNC_LEAVE_API(ret_value) @@ -554,7 +555,7 @@ H5Gget_info(hid_t grp_id, H5G_info_t *grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the group's information */ - if(H5G__get_info(&loc, grp_info/*out*/) < 0) + if(H5G__obj_info(loc.oloc, grp_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -722,9 +723,9 @@ H5Gflush(hid_t group_id) if(H5CX_set_loc(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Flush group's metadata to file */ - if(H5G__flush(grp, group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") + /* Flush metadata to file */ + if(H5O_flush_common(&grp->oloc, group_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback") done: FUNC_LEAVE_API(ret_value) @@ -761,7 +762,7 @@ H5Grefresh(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call private function to refresh group object */ - if((H5G__refresh(grp, group_id)) < 0) + if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index f6c6d8f..57bbcd9 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -76,24 +76,11 @@ static herr_t H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name, hid_t lcpl_id); static herr_t H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id); -static herr_t H5G__unlink(H5G_loc_t *loc, const char *name); -static herr_t H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size, - char *buf/*out*/); -static herr_t H5G__set_comment(const H5G_loc_t *loc, const char *name, - const char *comment); -static int H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf, - size_t bufsize); -static herr_t H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk, - const H5G_link_iterate_t *lnk_op, void *op_data); -static herr_t H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info); static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); static herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/); -static ssize_t H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, char *name, size_t size); static H5G_obj_t H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -197,9 +184,9 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") /* Check if we need to create a non-standard GCPL */ if(size_hint > 0) { @@ -238,7 +225,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") done: if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) @@ -321,9 +308,9 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Check arguments */ if(!cur_name || !*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") if(!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(cur_loc_id) < 0) @@ -357,9 +344,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Check arguments */ if(!cur_name || !*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") if(!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(cur_loc_id) < 0) @@ -393,7 +380,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, H5G_loc_t new_loc; /* Information about new link's group */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Create the appropriate kind of link */ if(type == H5L_TYPE_HARD) { @@ -441,7 +428,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "Not a valid link type") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__link() */ @@ -531,7 +518,7 @@ H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5G_loc_t dst_loc, *dst_loc_p; /* Group info for destination location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) @@ -553,10 +540,10 @@ H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") + HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__move() */ @@ -578,16 +565,16 @@ H5Gunlink(hid_t loc_id, const char *name) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if(H5G__unlink(&loc, name) < 0) + /* Call H5L routine... */ + if(H5L_delete(&loc, name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: @@ -596,37 +583,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__unlink - * - * Purpose: Internal version of H5Gunlink. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__unlink(H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call H5L routine... */ - if(H5L_delete(loc, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__unlink() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_linkval * * Purpose: Retrieve's a soft link's data. The new API is @@ -645,53 +601,21 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if(H5G__get_linkval(&loc, name, size, buf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_linkval() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__get_linkval - * - * Purpose: Internal version of H5Gget_linkval. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size, - char *buf/*out*/) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - /* Call the link routine which provides this capability */ - if(H5L_get_val(loc, name, buf, size) < 0) + if(H5L_get_val(&loc, name, buf, size) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_linkval() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_linkval() */ /*------------------------------------------------------------------------- @@ -721,17 +645,17 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) H5TRACE3("e", "i*s*s", loc_id, name, comment); if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if(H5G__set_comment(&loc, name, comment) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") + /* Call the common routine which provides this capability */ + if(H5G_loc_set_comment(&loc, name, comment) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: FUNC_LEAVE_API(ret_value) @@ -739,37 +663,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__set_comment - * - * Purpose: Internal version of H5Gset_comment. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__set_comment(const H5G_loc_t *loc, const char *name, const char *comment) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the common routine which provides this capability */ - if(H5G_loc_set_comment(loc, name, comment) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__set_comment() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_comment * * Purpose: Return at most BUFSIZE characters of the comment for the @@ -802,19 +695,19 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf); if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(bufsize > 0 && !buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if((ret_value = H5G__get_comment(&loc, name, buf, bufsize)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") + /* Call the common routine which provides this capability */ + if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") done: FUNC_LEAVE_API(ret_value) @@ -822,38 +715,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_comment - * - * Purpose: Internal version of H5Gget_comment. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static int -H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf, - size_t bufsize) -{ - int ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the common routine which provides this capability */ - if((ret_value = (int)H5G_loc_get_comment(loc, name, buf, bufsize)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_comment() */ - - -/*------------------------------------------------------------------------- * Function: H5Giterate * * Purpose: Iterates over the entries of a group. The LOC_ID and NAME @@ -905,8 +766,8 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; - /* Call private function. */ - if((ret_value = H5G__iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) + /* Call the common routine which provides this capability */ + if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ @@ -919,39 +780,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__iterate - * - * Purpose: Internal version of H5Giterate. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk, - const H5G_link_iterate_t *lnk_op, void *op_data) -{ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the common routine which provides this capability */ - if((ret_value = H5G_iterate(loc_id, name, idx_type, order, idx, last_lnk, lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__iterate() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_num_objs * * Purpose: Returns the number of objects in the group. It iterates @@ -970,22 +798,27 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5G_loc_t loc; /* Location of object */ - H5G_info_t grp_info; /* Group information */ - herr_t ret_value = SUCCEED; + H5G_loc_t loc; /* Location of object */ + H5G_info_t grp_info; /* Group information */ + H5O_type_t obj_type; /* Type of object at location */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", loc_id, num_objs); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + if(H5O_obj_type(loc.oloc, &obj_type) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + if(obj_type != H5O_TYPE_GROUP) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") if(!num_objs) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects") - /* Call the internal routine */ - if(H5G__get_num_objs(loc.oloc, &grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine") + /* Retrieve information about the group */ + if(H5G__obj_info(loc.oloc, &grp_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects") /* Set the number of objects [sic: links] in the group */ *num_objs = grp_info.nlinks; @@ -996,44 +829,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_num_objs - * - * Purpose: Internal version of H5Gget_num_objs. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info) -{ - H5O_type_t obj_type; /* Type of object at location */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") - - /* Retrieve information about the group */ - if(H5G__obj_info(oloc, grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_num_objs() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_objinfo * * Purpose: Returns information about an object. If FOLLOW_LINK is @@ -1062,13 +857,13 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") /* Get info */ if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") done: FUNC_LEAVE_API(ret_value) @@ -1177,7 +972,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_trav_goi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(loc); @@ -1220,7 +1015,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_objinfo() */ @@ -1250,62 +1045,28 @@ done: ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) { - H5G_loc_t loc; /* Object location */ - ssize_t ret_value; + H5G_loc_t loc; /* Object location */ + H5O_type_t obj_type; /* Type of object at location */ + ssize_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") - - /* Call internal function */ - if((ret_value = H5G__get_objname_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_objname_by_idx() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__get_objname_by_idx - * - * Purpose: Internal version of H5Gget_objname_by_idx. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, char *name, size_t size) -{ - H5O_type_t obj_type; /* Type of object at location */ - ssize_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + if(H5O_obj_type(loc.oloc, &obj_type) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") /* Call common routine */ - if((ret_value = H5G_obj_get_name_by_idx(oloc, idx_type, order, idx, name, size)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") + if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_objname_by_idx() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_objname_by_idx() */ /*------------------------------------------------------------------------- @@ -1334,11 +1095,11 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") /* Call internal function*/ if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") done: FUNC_LEAVE_API(ret_value) @@ -1368,7 +1129,7 @@ H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) H5O_type_t obj_type; /* Type of object at location */ H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - FUNC_ENTER_STATIC_VOL_TAG(oloc->addr) + FUNC_ENTER_STATIC_TAG(oloc->addr) /* Sanity check */ HDassert(oloc); @@ -1401,7 +1162,7 @@ H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) } /* end else */ done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5G__obj_get_type_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 3b5de44..8fd7514 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -134,7 +134,7 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, H5G_obj_create_t gcrt_info; /* Information for group creation */ H5G_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -161,48 +161,11 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, ret_value = (H5G_t *)ocrt_info.new_obj; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__create_named() */ /*------------------------------------------------------------------------- - * Function: H5G__create_anon - * - * Purpose: Internal routine to create a new anonymous group. - * - * Note: This routine is needed so that there's a non-API routine for - * creating groups that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new group object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 17, 2017 - * - *------------------------------------------------------------------------- - */ -H5G_t * -H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info) -{ - H5G_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(file); - HDassert(gcrt_info); - - /* Create the new group & get its ID */ - if(NULL == (ret_value = H5G__create(file, gcrt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, NULL, "unable to create group") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__create_anon() */ - - -/*------------------------------------------------------------------------- * Function: H5G__create * * Purpose: Creates a new empty group with the specified name. The name @@ -302,7 +265,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name) H5O_type_t obj_type; /* Type of object at location */ H5G_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(loc); @@ -336,7 +299,7 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__open_name() */ @@ -502,7 +465,7 @@ H5G__close_cb(H5G_t *grp) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(grp && grp->shared); @@ -513,7 +476,7 @@ H5G__close_cb(H5G_t *grp) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "problem closing group") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__close_cb() */ @@ -1239,44 +1202,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_create_plist - * - * Purpose: Internal routine to retrieve a group's creation property list. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: ID for a copy of the group creation property - * list. The property list ID should be released - * by calling H5Pclose(). - * - * Failure: H5I_INVALID_HID - * - * Programmer: Quincey Koziol - * December 17, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5G__get_create_plist(const H5G_t *grp) -{ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(grp); - - /* Retrieve the GCPL */ - if((ret_value = H5G_get_create_plist(grp)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_create_plist() */ - - -/*------------------------------------------------------------------------- * Function: H5G_get_create_plist * * Purpose: Private function for H5Gget_create_plist @@ -1372,51 +1297,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_info - * - * Purpose: Internal routine to retrieve the info for a group. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(grp_info); - - /* Retrieve the group's information */ - if(H5G__obj_info(loc->oloc, grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_info() */ - - -/*------------------------------------------------------------------------- * Function: H5G__get_info_by_name * * Purpose: Internal routine to retrieve the info for a group, by name. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 18, 2017 @@ -1432,7 +1317,7 @@ H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_in hbool_t loc_found = FALSE; /* Location at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -1457,7 +1342,7 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_name() */ @@ -1466,11 +1351,7 @@ done: * * Purpose: Internal routine to retrieve the info for a group, by index. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 18, 2017 @@ -1487,7 +1368,7 @@ H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, hbool_t loc_found = FALSE; /* Location at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -1512,76 +1393,6 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_idx() */ - -/*------------------------------------------------------------------------- - * Function: H5G__flush - * - * Purpose: Internal routine to flushes a group to disk. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__flush(H5G_t *grp, hid_t group_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(grp); - - /* Flush metadata to file */ - if(H5O_flush_common(&grp->oloc, group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5G__flush */ - - -/*------------------------------------------------------------------------- - * Function: H5G__refresh - * - * Purpose: Internal routine to refresh a group. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__refresh(H5G_t *grp, hid_t group_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(grp); - - /* Call private function to refresh group object */ - if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5G__refresh */ - diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index f0a9aea..b89777d 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -331,16 +331,11 @@ H5FL_EXTERN(H5G_shared_t); H5_DLL H5G_t *H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info); H5_DLL H5G_t *H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t gcpl_id); -H5_DLL H5G_t *H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info); H5_DLL H5G_t *H5G__open_name(const H5G_loc_t *loc, const char *name); -H5_DLL hid_t H5G__get_create_plist(const H5G_t *grp); -H5_DLL herr_t H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info); H5_DLL herr_t H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_info); H5_DLL herr_t H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info); -H5_DLL herr_t H5G__flush(H5G_t *grp, hid_t group_id); -H5_DLL herr_t H5G__refresh(H5G_t *grp, hid_t group_id); H5_DLL herr_t H5G__close_cb(H5G_t *grp); /* diff --git a/src/H5I.c b/src/H5I.c index 4df7b7e..3cf592d 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -128,7 +128,6 @@ static int H5I__inc_type_ref(H5I_type_t type); static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); -static ssize_t H5I__get_name(const H5G_loc_t *loc, char *name, size_t size); #ifdef H5I_DEBUG_OUTPUT static int H5I__debug_cb(void *_item, void *_key, void *_udata); static herr_t H5I__debug(H5I_type_t type); @@ -2021,8 +2020,8 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") - /* Call internal routine to retrieve object's name */ - if((ret_value = H5I__get_name(&loc, name, size)) < 0) + /* Retrieve object's name */ + if((ret_value = H5G_get_name(&loc, name, size, NULL)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: @@ -2031,41 +2030,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__get_name - * - * Purpose: Internal routine to retrieve the name for an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: The length of the name - * Failure: -1 - * - * Programmer: Quincey Koziol - * January 9, 2018 - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5I__get_name(const H5G_loc_t *loc, char *name, size_t size) -{ - ssize_t ret_value = -1; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - - /* Retrieve object's name */ - if((ret_value = H5G_get_name(loc, name, size, NULL)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5I__get_name() */ - - -/*------------------------------------------------------------------------- * Function: H5Iget_file_id * * Purpose: The public version of H5I_get_file_id(), obtains the file diff --git a/src/H5L.c b/src/H5L.c index b26a8c4..6967812 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -102,16 +102,10 @@ static herr_t H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id); -static herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id); -static herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, - const char *link_name, hid_t lcpl_id); static herr_t H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size); static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_val(const H5G_loc_t *loc, const char *name, - void *buf/*out*/, size_t size); static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -121,7 +115,6 @@ static herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, static herr_t H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__delete(const H5G_loc_t *loc, const char *name); static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -133,8 +126,6 @@ static herr_t H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name, - H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id); static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -145,8 +136,6 @@ static htri_t H5L__exists(const H5G_loc_t *loc, const char *name); static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_info(const H5G_loc_t *loc, const char *name, - H5L_info_t *linfo/*out*/); static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -162,10 +151,6 @@ static ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name static herr_t H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data); -static herr_t H5L__visit(hid_t grp_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, - void *op_data); - /*********************/ /* Package Variables */ @@ -338,8 +323,8 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, dst_loc_p = src_loc_p; /* Move the link */ - if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) @@ -400,8 +385,8 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, dst_loc_p = src_loc_p; /* Copy the link */ - if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) @@ -451,8 +436,8 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Create the link */ - if(H5L__create_soft(link_target, &link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -516,8 +501,8 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") /* Create the link */ - if(H5L__create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -617,8 +602,8 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Unlink */ - if(H5L__delete(&loc, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + if(H5L_delete(&loc, name) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -670,7 +655,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Delete the link */ if(H5L__delete_by_idx(&loc, group_name, idx_type, order, n) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -717,8 +702,8 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link value */ - if(H5L__get_val(&loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) + if(H5L_get_val(&loc, name, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: FUNC_LEAVE_API(ret_value) @@ -854,8 +839,8 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link information */ - if(H5L__get_info(&loc, name, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + if(H5L_get_info(&loc, name, linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -904,7 +889,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Get the link information */ if(H5L__get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -1087,7 +1072,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, /* Get the link information */ if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") done: FUNC_LEAVE_API(ret_value) @@ -1135,7 +1120,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, /* Iterate over the links */ if((ret_value = H5L__iterate(grp_id, ".", idx_type, order, idx_p, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -1191,7 +1176,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, /* Iterate over the links */ if((ret_value = H5L__iterate(loc_id, group_name, idx_type, order, idx_p, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -1248,8 +1233,8 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Call internal routine */ - if((ret_value = H5L__visit(grp_id, ".", idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) @@ -1309,8 +1294,8 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal routine */ - if((ret_value = H5L__visit(loc_id, group_name, idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) @@ -1895,45 +1880,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__create_hard - * - * Purpose: Internal routine to create a hard link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(cur_loc); - HDassert(cur_name); - HDassert(link_loc); - HDassert(link_name); - - /* Create the link */ - if(H5L_create_hard(cur_loc, cur_name, link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__create_hard() */ - - -/*------------------------------------------------------------------------- * Function: H5L_create_soft * * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. @@ -1982,44 +1928,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__create_soft - * - * Purpose: Internal routine to create a soft link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, - const char *link_name, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(target_path); - HDassert(link_loc); - HDassert(link_name); - - /* Create the link */ - if(H5L_create_soft(target_path, link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__create_soft() */ - - -/*------------------------------------------------------------------------- * Function: H5L__create_ud * * Purpose: Creates a user-defined link. See H5Lcreate_ud for @@ -2039,7 +1947,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX); @@ -2073,7 +1981,7 @@ done: /* Free the link's udata buffer if it's been allocated */ H5MM_xfree(lnk.u.ud.udata); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__create_ud() */ @@ -2216,42 +2124,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_val - * - * Purpose: Internal routine to query a link value - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Get the link value */ - if(H5L_get_val(loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_val() */ - - -/*------------------------------------------------------------------------- * Function: H5L__get_val_by_idx_cb * * Purpose: Callback for retrieving a link's value according to an @@ -2308,9 +2180,6 @@ done: * Purpose: Internal routine to query a link value according to the * index within a group * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2326,7 +2195,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5L_trav_gvbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -2344,7 +2213,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n) done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__get_val_by_idx() */ @@ -2439,42 +2308,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__delete - * - * Purpose: Internal routine to delete a link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__delete(const H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Delete the link */ - if(H5L_delete(loc, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link: %s", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__delete() */ - - -/*------------------------------------------------------------------------- * Function: H5L__delete_by_idx_cb * * Purpose: Callback for removing a link according to an index's order. @@ -2519,9 +2352,6 @@ done: * Purpose: Internal routine to delete a link according to its index * within a group. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2537,7 +2367,7 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5L_trav_rmbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -2553,8 +2383,8 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__delete_by_idx() */ /*------------------------------------------------------------------------- @@ -2864,45 +2694,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__move - * - * Purpose: Internal routine to move / copy a link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__move(const H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc, - const char *dst_name, hbool_t copy_flag, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(src_loc); - HDassert(src_name); - HDassert(dst_loc); - HDassert(dst_name); - - /* Move the link */ - if(H5L_move(src_loc, src_name, dst_loc, dst_name, copy_flag, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__move() */ - - -/*------------------------------------------------------------------------- * Function: H5L__exists_final_cb * * Purpose: Callback for checking whether a link exists, as the final @@ -3083,7 +2874,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name) H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* A path of "/" will always exist in a file */ if(0 == HDstrcmp(name, "/")) @@ -3098,7 +2889,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name) ret_value = (htri_t)udata.exists; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5L__exists() */ @@ -3173,42 +2964,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_info - * - * Purpose: Internal routine to retrieve link info - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linfo/*out*/) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Get the link information */ - if(H5L_get_info(loc, name, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info for: '%s'", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_info() */ - - -/*------------------------------------------------------------------------- * Function: H5L__get_info_by_idx_cb * * Purpose: Callback for retrieving a link's metadata according to an @@ -3265,9 +3020,6 @@ done: * Purpose: Internal routine to retrieve link info according to an * index's order. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -3283,7 +3035,7 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -3298,10 +3050,10 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type /* Traverse the group hierarchy to locate the object to get info about */ if(H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__get_info_by_idx() */ @@ -3351,9 +3103,6 @@ done: * Purpose: Internal routine to retrieve link name according to an * index's order. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -3370,7 +3119,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5L_trav_gnbi_t udata; /* User data for callback */ ssize_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -3392,7 +3141,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, ret_value = udata.name_len; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__get_name_by_idx() */ @@ -3401,9 +3150,6 @@ done: * * Purpose: Internal routine to iterate over links * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -3421,7 +3167,7 @@ H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, hsize_t idx; /* Internal location to hold index */ herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(group_name); @@ -3444,48 +3190,11 @@ H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, *idx_p = last_lnk; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__iterate() */ /*------------------------------------------------------------------------- - * Function: H5L__visit - * - * Purpose: Internal routine to visit links - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__visit(hid_t grp_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, H5L_iterate_t op, void *op_data) -{ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(group_name); - HDassert(op); - - /* Call internal group visitation routine */ - if((ret_value = H5G_visit(grp_id, group_name, idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__visit() */ - - -/*------------------------------------------------------------------------- * Function: H5L__link_copy_file * * Purpose: Copy a link and the object it points to from one file to diff --git a/src/H5O.c b/src/H5O.c index 9b832f1..25c3d83 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -116,7 +116,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the object */ - if((ret_value = H5O__open_name(&loc, name)) < 0) + if((ret_value = H5O_open_name(&loc, name, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -292,9 +292,9 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Create a link to the object */ - if(H5O__create_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") + /* Link to the object */ + if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -339,7 +339,7 @@ H5Oincr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's refcount */ - if(H5O__link(oloc, 1) < 0) + if(H5O_link(oloc, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -385,7 +385,7 @@ H5Odecr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's refcount */ - if(H5O__link(oloc, -1) < 0) + if(H5O_link(oloc, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -426,7 +426,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") /* Check if the object exists */ - if((ret_value = H5O__exists_by_name(&loc, name)) < 0) + if((ret_value = H5G_loc_exists(&loc, name)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -467,7 +467,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, fields) < 0) + if(H5G_loc_info(&loc, ".", oinfo/*out*/, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -515,7 +515,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, fields) < 0) + if(H5G_loc_info(&loc, name, oinfo/*out*/, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -612,7 +612,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* (Re)set the object's comment */ - if(H5O__set_comment_by_name(&loc, ".", comment) < 0) + if(H5G_loc_set_comment(&loc, ".", comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: @@ -658,7 +658,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* (Re)set the object's comment */ - if(H5O__set_comment_by_name(&loc, name, comment) < 0) + if(H5G_loc_set_comment(&loc, name, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: @@ -696,7 +696,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the object's comment */ - if((ret_value = H5O__get_comment_by_name(&loc, ".", comment/*out*/, bufsize)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") done: @@ -741,7 +741,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's comment */ - if((ret_value = H5O__get_comment_by_name(&loc, name, comment/*out*/, bufsize)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name) done: diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 2e628f4..b57eaf6 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -242,9 +242,6 @@ done: * * Purpose: Internal routine to copy an object * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -265,7 +262,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, hbool_t obj_open = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -322,7 +319,7 @@ done: if(obj_open && H5O_close(&src_oloc, NULL) < 0) HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__copy() */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 876579d..c73529e 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -31,9 +31,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Opkg.h" /* Object headers */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Opkg.h" /* Object headers */ /****************/ @@ -100,8 +101,8 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: FUNC_LEAVE_API(ret_value) @@ -140,7 +141,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) + if(H5G_loc_info(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: diff --git a/src/H5Oflush.c b/src/H5Oflush.c index e8e077e..d8c9530 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -49,7 +49,6 @@ static herr_t H5O__flush(hid_t obj_id); static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag); static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc); -static herr_t H5O__refresh(hid_t obj_id); /*************/ @@ -133,9 +132,6 @@ done: * * Purpose: Internal routine to flush an object * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -152,7 +148,7 @@ H5O__flush(hid_t obj_id) const H5O_obj_class_t *obj_class; /* Class of object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check args */ if(NULL == (oloc = H5O_get_loc(obj_id))) @@ -175,7 +171,7 @@ H5O__flush(hid_t obj_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__flush() */ @@ -235,17 +231,22 @@ done: herr_t H5Orefresh(hid_t oid) { - herr_t ret_value = SUCCEED; /* Return value */ + H5O_loc_t *oloc; /* object location */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", oid); + /* Check args */ + if(NULL == (oloc = H5O_get_loc(oid))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") + /* Set up collective metadata if appropriate */ if(H5CX_set_loc(oid) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal routine */ - if(H5O__refresh(oid) < 0) + if(H5O_refresh_metadata(oid, *oloc) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: @@ -460,40 +461,3 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5O_refresh_metadata_reopen() */ - -/*------------------------------------------------------------------------- - * Function: H5O__refresh - * - * Purpose: Internal routine to refresh an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 29, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5O__refresh(hid_t obj_id) -{ - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(NULL == (oloc = H5O_get_loc(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") - - /* Private function */ - if(H5O_refresh_metadata(obj_id, *oloc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__refresh() */ - diff --git a/src/H5Oint.c b/src/H5Oint.c index 2752a25..49d7835 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -565,49 +565,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__open_name - * - * Purpose: Internal routine to open an object by name - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5O__open_name(const H5G_loc_t *loc, const char *name) -{ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name); - - /* Open the object */ - if((ret_value = H5O_open_name(loc, name, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__open_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O__open_by_idx * * Purpose: Internal routine to open an object by index within group * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -626,7 +587,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -651,7 +612,7 @@ done: if(H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__open_by_idx() */ @@ -660,9 +621,6 @@ done: * * Purpose: Internal routine to open an object by its address * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -679,7 +637,7 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) H5O_loc_t obj_oloc; /* Opened object object location */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -697,7 +655,7 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__open_by_addr() */ @@ -739,44 +697,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__create_link - * - * Purpose: Internal routine to create a link from a group to an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__create_link(const H5G_loc_t *new_loc, const char *new_name, - H5G_loc_t *obj_loc, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(new_loc); - HDassert(new_name && *new_name); - HDassert(obj_loc); - - /* Link to the object */ - if(H5L_link(new_loc, new_name, obj_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__create_link() */ - - -/*------------------------------------------------------------------------- * Function: H5O_close * * Purpose: Closes an object header that was previously open. @@ -1004,41 +924,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__link - * - * Purpose: Internal routine to change the refcount for an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__link(const H5O_loc_t *oloc, int adjust) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(oloc); - - /* Change the object's refcount */ - if(H5O_link(oloc, adjust) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__link() */ - - -/*------------------------------------------------------------------------- * Function: H5O_protect * * Purpose: Wrapper around H5AC_protect for use during a H5O_protect-> @@ -2051,42 +1936,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__exists_by_name - * - * Purpose: Internal routine to check if an object exists - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -htri_t -H5O__exists_by_name(const H5G_loc_t *loc, const char *name) -{ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Check if the object exists */ - if((ret_value = H5G_loc_exists(loc, name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__exists_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O_get_hdr_info * * Purpose: Retrieve the object header information for an object @@ -2342,52 +2191,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__get_info_by_name - * - * Purpose: Internal routine to retrieve an object's info - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Note: Add a parameter "fields" to indicate selection of object info. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo, unsigned fields) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - HDassert(oinfo); - - /* Retrieve the object's information */ - if(H5G_loc_info(loc, name, oinfo/*out*/, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__get_info_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O__get_info_by_idx * * Purpose: Internal routine to retrieve an object's info according to * an index within a group. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). * * Note: Add a parameter "fields" to indicate selection of object info. * @@ -2409,7 +2217,7 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id hbool_t loc_found = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -2435,85 +2243,11 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__get_info_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5O__set_comment_by_name - * - * Purpose: Internal routine to set an object's "comment" - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name, - const char *comment) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* (Re)set the object's comment */ - if(H5G_loc_set_comment(loc, name, comment) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__set_comment_by_name() */ - - -/*------------------------------------------------------------------------- - * Function: H5O__get_comment_by_name - * - * Purpose: Internal routine to retrieve an object's "comment" - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -ssize_t -H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name, - char *comment, size_t bufsize) -{ - ssize_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(loc, name, comment/*out*/, bufsize)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__get_comment_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O_get_create_plist * * Purpose: Retrieve the object creation properties for an object @@ -2893,7 +2627,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, hid_t obj_id = (-1); /* ID of object */ herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Portably initialize user data struct to zeros */ HDmemset(&udata, 0, sizeof(udata)); @@ -2981,7 +2715,7 @@ done: if(udata.visited) H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__visit() */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 616f96b..19d90c5 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -555,25 +555,14 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1]; H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; /* Package-local function prototypes */ -H5_DLL hid_t H5O__open_name(const H5G_loc_t *loc, const char *name); H5_DLL hid_t H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); H5_DLL hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr); H5_DLL hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref); -H5_DLL herr_t H5O__create_link(const H5G_loc_t *new_loc, const char *new_name, - H5G_loc_t *obj_loc, hid_t lcpl_id); H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc); H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted); -H5_DLL herr_t H5O__link(const H5O_loc_t *loc, int adjust); -H5_DLL htri_t H5O__exists_by_name(const H5G_loc_t *loc, const char *name); -H5_DLL herr_t H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, - H5O_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields); -H5_DLL herr_t H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name, - const char *comment); -H5_DLL ssize_t H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name, - char *comment, size_t bufsize); H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields); H5_DLL herr_t H5O__inc_rc(H5O_t *oh); diff --git a/src/H5Rint.c b/src/H5Rint.c index acf6b56..d2f315b 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -230,7 +230,7 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, hbool_t obj_found = FALSE; /* Object location found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(loc); @@ -335,7 +335,7 @@ done: if (obj_found) H5G_loc_free(&obj_loc); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__create() */ @@ -381,7 +381,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, H5O_type_t obj_type; /* Type of object */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); @@ -504,7 +504,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, } /* end switch */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__dereference() */ @@ -538,7 +538,7 @@ H5R__get_region(H5F_t *file, const void *_ref) uint8_t *buf = NULL; /* Buffer to store serialized selection in */ H5S_t *ret_value; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(file); @@ -573,7 +573,7 @@ done: if(buf) H5MM_xfree(buf); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_region() */ @@ -607,7 +607,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, unsigned rc; /* Reference count of object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(file); HDassert(_ref); @@ -662,7 +662,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_obj_type() */ @@ -701,7 +701,7 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, H5O_loc_t oloc; /* Object location describing object for reference */ ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(f); @@ -763,6 +763,6 @@ done: if (file_id > 0 && H5I_dec_ref(file_id) < 0) HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_name() */ diff --git a/src/H5T.c b/src/H5T.c index fa97506..76b0663 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -3714,7 +3714,7 @@ H5T__close_cb(H5T_t *dt) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* check args */ HDassert(dt && dt->shared); @@ -3724,7 +3724,7 @@ H5T__close_cb(H5T_t *dt) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype"); done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__close_cb() */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 1719f8f..649bd2e 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -59,8 +59,6 @@ static herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); static hid_t H5T__get_create_plist(const H5T_t *type); static H5T_t *H5T__open_oid(const H5G_loc_t *loc); -static herr_t H5T__flush(H5T_t *dt, hid_t type_id); -static herr_t H5T__refresh(H5T_t *dt, hid_t type_id); /*********************/ @@ -165,7 +163,7 @@ H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, H5T_state_t old_state; /* The state of the datatype before H5T__commit. */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(loc); @@ -219,7 +217,7 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__commit_named() */ @@ -296,7 +294,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) H5O_loc_t *oloc; /* Object location for datatype */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(file); @@ -318,7 +316,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5T__commit_anon() */ @@ -667,8 +665,8 @@ H5Tflush(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Flush metadata for named datatype */ - if(H5T__flush(dt, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") + if(H5O_flush_common(&dt->oloc, type_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback") done: FUNC_LEAVE_API(ret_value) @@ -707,7 +705,7 @@ H5Trefresh(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Call private function to refresh datatype object */ - if((H5T__refresh(dt, type_id)) < 0) + if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") done: @@ -742,7 +740,7 @@ H5T__get_create_plist(const H5T_t *type) hid_t new_tcpl_id = FAIL; /* New datatype creation property list */ hid_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Sanity check */ HDassert(type); @@ -770,7 +768,7 @@ done: if(H5I_dec_app_ref(new_tcpl_id) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to close temporary object") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_create_plist() */ @@ -798,7 +796,7 @@ H5T__open_name(const H5G_loc_t *loc, const char *name) hbool_t obj_found = FALSE; /* Object at 'name' found */ H5T_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -836,7 +834,7 @@ done: if(H5G_loc_free(&type_loc) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__open_name() */ @@ -1040,73 +1038,3 @@ H5T_update_shared(H5T_t *dt) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5T_update_shared() */ - -/*------------------------------------------------------------------------- - * Function: H5T__flush - * - * Purpose: Internal routine to flushes a named datatype to disk. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T__flush(H5T_t *dt, hid_t type_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Sanity check */ - HDassert(dt); - - /* To flush metadata and invoke flush callback if there is */ - if(H5O_flush_common(&dt->oloc, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5T__flush */ - - -/*------------------------------------------------------------------------- - * Function: H5T__refresh - * - * Purpose: Internal routine to refresh a named datatype. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T__refresh(H5T_t *dt, hid_t type_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Sanity check */ - HDassert(dt); - - /* Call private function to refresh datatype object */ - if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5T__refresh */ - diff --git a/src/H5Z.c b/src/H5Z.c index f68fbce..14b0400 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -387,9 +387,9 @@ H5Z__unregister(H5Z_filter_t filter_id) H5Z_object_t object; /* Object to pass to callbacks */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE - HDassert(filter_id>=0 && filter_id<=H5Z_FILTER_MAX); + HDassert(filter_id >= 0 && filter_id <= H5Z_FILTER_MAX); /* Is the filter already registered? */ for (filter_index = 0; filter_index < H5Z_table_used_g; filter_index++) @@ -434,7 +434,7 @@ H5Z__unregister(H5Z_filter_t filter_id) H5Z_table_used_g--; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__unregister() */ diff --git a/src/H5private.h b/src/H5private.h index 8974e46..196d001 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2199,12 +2199,6 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use this macro for all package-level functions that are VOL entry-points */ -#define FUNC_ENTER_PACKAGE_VOL { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for package-level functions which propgate errors, but don't issue them */ #define FUNC_ENTER_PACKAGE_NOERR { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ @@ -2221,29 +2215,12 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use the following macro as replacement for the FUNC_ENTER_PACKAGE - * macro when the function needs to set up a metadata tag and is also a - * VOL entry-point. */ -#define FUNC_ENTER_PACKAGE_VOL_TAG(tag) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for all "normal" staticly-scoped functions */ #define FUNC_ENTER_STATIC { \ FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use this macro for all "normal" staticly-scoped functions that are VOL entry-points */ -#define FUNC_ENTER_STATIC_VOL { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */ #define FUNC_ENTER_STATIC_NOERR { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ @@ -2266,17 +2243,6 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use the following macro as replacement for the FUNC_ENTER_STATIC - * macro when the function needs to set up a metadata tag and is a VOL - * entry-point. */ -#define FUNC_ENTER_STATIC_VOL_TAG(tag) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /*------------------------------------------------------------------------- * Purpose: Register function exit for code profiling. This should be @@ -2331,13 +2297,6 @@ H5_DLL herr_t H5CX_pop(void); return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ -#define FUNC_LEAVE_NOAPI_VOL(ret_value) \ - ; \ - } /*end scope from end of FUNC_ENTER*/ \ - H5_POP_FUNC \ - return(ret_value); \ -} /*end scope from beginning of FUNC_ENTER*/ - #define FUNC_LEAVE_NOAPI_VOID \ ; \ } /*end scope from end of FUNC_ENTER*/ \ @@ -2365,15 +2324,6 @@ H5_DLL herr_t H5CX_pop(void); return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ -/* Use this macro when exiting a VOL entry-point function that set up a metadata tag */ -#define FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) \ - ; \ - } /*end scope from end of FUNC_ENTER*/ \ - H5AC_tag(prev_tag, NULL); \ - H5_POP_FUNC \ - return(ret_value); \ -} /*end scope from beginning of FUNC_ENTER*/ - /****************************************/ /* Revisions to FUNC_ENTER/LEAVE Macros */ diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err index d00a92b..e61966f 100644 --- a/tools/test/h5dump/errfiles/tdset-2.err +++ b/tools/test/h5dump/errfiles/tdset-2.err @@ -21,19 +21,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5L__get_info(): unable to get link info for: 'dset3' - major: Links - minor: Can't get value - #002: (file name) line (number) in H5L_get_info(): name doesn't exist + #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #004: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "dset3" diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index 99e8530..4a5f545 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -2,61 +2,55 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' major: File accessibilty minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err index a888ba9..1f9241a 100644 --- a/tools/test/h5dump/errfiles/textlinkfar.err +++ b/tools/test/h5dump/errfiles/textlinkfar.err @@ -2,52 +2,49 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open object + #007: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #009: (file name) line (number) in H5O_open_name(): object not found + #008: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #010: (file name) line (number) in H5G_loc_find(): can't find object + #009: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #011: (file name) line (number) in H5G_traverse(): internal path traversal failed + #010: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #011: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #013: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #013: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #015: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #014: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #016: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #015: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err index a888ba9..1f9241a 100644 --- a/tools/test/h5dump/errfiles/textlinksrc.err +++ b/tools/test/h5dump/errfiles/textlinksrc.err @@ -2,52 +2,49 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open object + #007: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #009: (file name) line (number) in H5O_open_name(): object not found + #008: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #010: (file name) line (number) in H5G_loc_find(): can't find object + #009: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #011: (file name) line (number) in H5G_traverse(): internal path traversal failed + #010: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #011: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #013: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #013: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #015: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #014: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #016: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #015: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index 22b4318..648906b 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index 22b4318..648906b 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err index 55aeb4a..733b652 100644 --- a/tools/test/h5dump/errfiles/tperror.err +++ b/tools/test/h5dump/errfiles/tperror.err @@ -21,19 +21,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5L__get_info(): unable to get link info for: 'bogus' - major: Links - minor: Can't get value - #002: (file name) line (number) in H5L_get_info(): name doesn't exist + #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #004: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "bogus" -- cgit v0.12 From deaa1db8521f155ab990a79cc52675ee82a76608 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 18 Sep 2018 17:31:40 -0500 Subject: HDFFV-10332 Use pre-generated files --- release_docs/RELEASE.txt | 7 ++- src/CMakeLists.txt | 109 ++++++++++++++++++++++++++++------------------- 2 files changed, 70 insertions(+), 46 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c8c7d5c..6aa7a70 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -84,7 +84,12 @@ New Features Library: -------- - - + - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used. + + Rather than always running H5detect and generating H5Tinit.c and + H5make_libsettings.c, supply a location for those files. + + (ADB - 2018/09/18, HDFFV-10332) Parallel Library: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee06f06..1cd0a10 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -853,38 +853,50 @@ endif () # Setup the H5detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- -add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) -target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) -TARGET_C_PROPERTIES (H5detect STATIC) -target_link_libraries (H5detect - PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> - INTERFACE $<$:"-O0"> -) +option (HDF5_USE_PREGEN "Use pre-generated Files" OFF) +if (HDF5_USE_PREGEN) + set (HDF5_GENERATED_SOURCE_DIR ${HDF5_USE_PREGEN_DIR}) +else () + set (HDF5_GENERATED_SOURCE_DIR ${HDF5_BINARY_DIR}) +endif () -add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c - COMMAND $ - ARGS ${HDF5_BINARY_DIR}/H5Tinit.c - DEPENDS H5detect -) +if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) + add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) + target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) + TARGET_C_PROPERTIES (H5detect STATIC) + target_link_libraries (H5detect + PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> + INTERFACE $<$:"-O0"> + ) -add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) -TARGET_C_PROPERTIES (H5make_libsettings STATIC) -target_link_libraries (H5make_libsettings - PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> - INTERFACE $<$:"-O0"> -) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) +endif () -add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_BINARY_DIR} -) +if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) + add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) + target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) + TARGET_C_PROPERTIES (H5make_libsettings STATIC) + target_link_libraries (H5make_libsettings + PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> + INTERFACE $<$:"-O0"> + ) + + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) +endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" #all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" @@ -893,7 +905,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- -set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) +set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIB_TARGET} @@ -922,21 +934,28 @@ set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/shared/H5Tinit.c - COMMAND $ - ARGS ${HDF5_BINARY_DIR}/shared/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_BINARY_DIR}/shared - ) - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_BINARY_DIR} - ) - set (shared_gen_SRCS ${HDF5_BINARY_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared + ) + endif () + + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + endif () + + set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) + add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -- cgit v0.12 From eb78fd88325d58a95c026129f1e2b4c7c50f621a Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 18 Sep 2018 22:57:37 -0700 Subject: Develop normalization with vol_integration. Mostly peripheral things like the tools and wrappers, with just enough core library code to support that. --- MANIFEST | 2 +- bin/make_err | 8 +- c++/src/Makefile.am | 10 +- c++/test/tattr.cpp | 8 +- fortran/test/tH5F.F90 | 2 - hl/tools/h5watch/swmr_check_compat_vfd.c | 2 +- src/H5.c | 20 +- src/H5E.c | 543 +++++++++++++------------- src/H5Edeprec.c | 138 +++---- src/H5Eint.c | 348 ++++++++--------- src/H5Epkg.h | 20 +- src/H5FDpkg.h | 2 +- src/H5FDtest.c | 6 +- src/H5private.h | 3 +- src/H5system.c | 10 +- test/accum.c | 39 +- test/accum_swmr_reader.c | 10 +- test/dsets.c | 101 +++-- test/flush1.c | 2 +- test/flush2.c | 2 +- test/flushrefresh.c | 107 ++--- test/links.c | 16 +- test/swmr.c | 162 ++++---- test/swmr_check_compat_vfd.c | 2 +- tools/src/h5format_convert/h5format_convert.c | 164 ++++---- tools/src/h5jam/h5jam.c | 30 +- tools/src/misc/h5debug.c | 2 +- tools/test/h5diff/h5diffgentest.c | 164 ++++---- tools/test/h5jam/tellub.c | 182 ++++----- tools/test/h5repack/h5repack.sh.in | 1 + tools/test/h5stat/testh5stat.sh.in | 1 - 31 files changed, 1033 insertions(+), 1074 deletions(-) diff --git a/MANIFEST b/MANIFEST index f011e94..117c531 100644 --- a/MANIFEST +++ b/MANIFEST @@ -526,8 +526,8 @@ ./src/H5CS.c ./src/H5CSprivate.h ./src/H5CX.c -./src/H5CXprivate.h ./src/H5CXmodule.h +./src/H5CXprivate.h ./src/H5D.c ./src/H5Dbtree.c ./src/H5Dbtree2.c diff --git a/bin/make_err b/bin/make_err index bfe8861..623c1b6 100755 --- a/bin/make_err +++ b/bin/make_err @@ -244,8 +244,8 @@ sub create_init ($) { print HEADER "/* Major error codes */\n"; print HEADER "/*********************/\n\n"; foreach $name (keys %major) { - print HEADER " "x(0*$indent),"assert(${name}_g==(-1));\n"; - print HEADER " "x(0*$indent),"if((msg = H5E_create_msg(cls, H5E_MAJOR, \"${major{$name}}\"))==NULL)\n"; + print HEADER " "x(0*$indent),"HDassert(${name}_g==(-1));\n"; + print HEADER " "x(0*$indent),"if((msg = H5E__create_msg(cls, H5E_MAJOR, \"${major{$name}}\"))==NULL)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\")\n"; print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, \"can't register error message\")\n"; @@ -260,8 +260,8 @@ sub create_init ($) { # Iterate over all the minor errors in each section for $name ( @{$section_list{$sect_name}}) { - print HEADER " "x(0*$indent),"assert(${name}_g==(-1));\n"; - print HEADER " "x(0*$indent),"if((msg = H5E_create_msg(cls, H5E_MINOR, \"${minor{$name}}\"))==NULL)\n"; + print HEADER " "x(0*$indent),"HDassert(${name}_g==(-1));\n"; + print HEADER " "x(0*$indent),"if((msg = H5E__create_msg(cls, H5E_MINOR, \"${minor{$name}}\"))==NULL)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\")\n"; print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, \"can't register error message\")\n"; diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index 949325a..eb50209 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -32,15 +32,15 @@ bin_SCRIPTS=h5c++ # Source files for the library libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp \ - H5DataSpace.cpp H5PropList.cpp H5Library.cpp \ - H5FaccProp.cpp H5FcreatProp.cpp H5LcreatProp.cpp \ - H5LaccProp.cpp H5DaccProp.cpp H5DxferProp.cpp \ + H5DataSpace.cpp H5PropList.cpp H5Library.cpp \ + H5FaccProp.cpp H5FcreatProp.cpp H5LcreatProp.cpp \ + H5LaccProp.cpp H5DaccProp.cpp H5DxferProp.cpp \ H5DcreatProp.cpp H5Location.cpp H5AbstractDs.cpp \ H5Attribute.cpp H5Object.cpp H5OcreatProp.cpp \ - H5DataType.cpp H5AtomType.cpp H5PredType.cpp \ + H5DataType.cpp H5AtomType.cpp H5PredType.cpp \ H5EnumType.cpp H5IntType.cpp H5FloatType.cpp \ H5StrType.cpp H5ArrayType.cpp H5VarLenType.cpp \ - H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp \ + H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp \ H5File.cpp # HDF5 C++ library depends on HDF5 Library. diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index bdf6d80..4734755 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1712,7 +1712,7 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, // Close property list dcpl.close(); - // H5O_is_attr_dense_test - un-usable + // H5O__is_attr_dense_test - un-usable // Add attributes, until just before converting to dense storage char attr_name[NAME_BUF_SIZE]; @@ -1727,7 +1727,7 @@ static void test_attr_dense_create(FileCreatPropList& fcpl, attr.write(PredType::NATIVE_UINT, &attr_num); } // end for - // H5O_is_attr_dense_test - un-usable + // H5O__is_attr_dense_test - un-usable { // Add one more attribute, to push into "dense" storage @@ -1815,8 +1815,8 @@ static void test_attr_corder_create_basic(FileCreatPropList& fcpl, ds_space.close(); // Check on dataset's attribute storage status. - // NOTE: Wrappers not available yet (H5O_is_attr_empty_test - // and H5O_is_attr_dense_test) + // NOTE: Wrappers not available yet (H5O__is_attr_empty_test + // and H5O__is_attr_dense_test) // Close dataset dataset.close(); diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index 72920f2..ee386dd 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -30,8 +30,6 @@ ! access the dataset from the second file as a member of a group ! in the first file. - - MODULE TH5F CONTAINS diff --git a/hl/tools/h5watch/swmr_check_compat_vfd.c b/hl/tools/h5watch/swmr_check_compat_vfd.c index 7d11a73..26f76cb 100644 --- a/hl/tools/h5watch/swmr_check_compat_vfd.c +++ b/hl/tools/h5watch/swmr_check_compat_vfd.c @@ -48,7 +48,7 @@ main(void) driver = HDgetenv("HDF5_DRIVER"); - if(H5FD_supports_swmr_test(driver)) + if(H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; else return EXIT_FAILURE; diff --git a/src/H5.c b/src/H5.c index 1b13fea..32af55b 100644 --- a/src/H5.c +++ b/src/H5.c @@ -262,7 +262,7 @@ H5_term_library(void) /* Don't do anything if the library is already closed */ if(!(H5_INIT_GLOBAL)) - goto done; + goto done; /* Indicate that the library is being shut down */ H5_TERM_GLOBAL = TRUE; @@ -379,18 +379,18 @@ H5_term_library(void) * down if any of the below code involves using the instrumentation code. */ if(H5_MPEinit_g) { - int mpi_initialized; - int mpi_finalized; - int mpe_code; + int mpi_initialized; + int mpi_finalized; + int mpe_code; - MPI_Initialized(&mpi_initialized); - MPI_Finalized(&mpi_finalized); + MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); if (mpi_initialized && !mpi_finalized) { - mpe_code = MPE_Finish_log("h5log"); - HDassert(mpe_code >=0); - } /* end if */ - H5_MPEinit_g = FALSE; /* turn it off no matter what */ + mpe_code = MPE_Finish_log("h5log"); + HDassert(mpe_code >=0); + } /* end if */ + H5_MPEinit_g = FALSE; /* turn it off no matter what */ } /* end if */ #endif diff --git a/src/H5E.c b/src/H5E.c index eecf6e7..170133e 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -49,11 +49,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Epkg.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Epkg.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /****************/ /* Local Macros */ @@ -78,18 +79,17 @@ /* Local Prototypes */ /********************/ /* Static function declarations */ -static herr_t H5E_set_default_auto(H5E_t *stk); -static H5E_cls_t *H5E_register_class(const char *cls_name, const char *lib_name, - const char *version); -static herr_t H5E_unregister_class(H5E_cls_t *cls); -static ssize_t H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size); -static int H5E_close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata); -static herr_t H5E_close_msg(H5E_msg_t *err); -static H5E_msg_t *H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg); -static H5E_t *H5E_get_current_stack(void); -static herr_t H5E_set_current_stack(H5E_t *estack); -static herr_t H5E_close_stack(H5E_t *err_stack); -static ssize_t H5E_get_num(const H5E_t *err_stack); +static herr_t H5E__set_default_auto(H5E_t *stk); +static H5E_cls_t *H5E__register_class(const char *cls_name, const char *lib_name, const char *version); +static herr_t H5E__unregister_class(H5E_cls_t *cls); +static ssize_t H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size); +static int H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata); +static herr_t H5E__close_msg(H5E_msg_t *err); +static H5E_msg_t *H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg); +static H5E_t *H5E__get_current_stack(void); +static herr_t H5E__set_current_stack(H5E_t *estack); +static herr_t H5E__close_stack(H5E_t *err_stack); +static ssize_t H5E__get_num(const H5E_t *err_stack); /*********************/ @@ -123,7 +123,7 @@ static const H5I_class_t H5I_ERRCLS_CLS[1] = {{ H5I_ERROR_CLASS, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E_unregister_class /* Callback routine for closing objects of this class */ + (H5I_free_t)H5E__unregister_class /* Callback routine for closing objects of this class */ }}; /* Error message ID class */ @@ -131,7 +131,7 @@ static const H5I_class_t H5I_ERRMSG_CLS[1] = {{ H5I_ERROR_MSG, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E_close_msg /* Callback routine for closing objects of this class */ + (H5I_free_t)H5E__close_msg /* Callback routine for closing objects of this class */ }}; /* Error stack ID class */ @@ -139,19 +139,17 @@ static const H5I_class_t H5I_ERRSTK_CLS[1] = {{ H5I_ERROR_STACK, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5E_close_stack /* Callback routine for closing objects of this class */ + (H5I_free_t)H5E__close_stack /* Callback routine for closing objects of this class */ }}; /*------------------------------------------------------------------------- - * Function: H5E_init + * Function: H5E_init * - * Purpose: Initialize the interface from some other layer. + * Purpose: Initialize the interface from some other layer. * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, June 29, 2004 @@ -176,7 +174,7 @@ done: * * Purpose: Initialize interface-specific information * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -207,13 +205,13 @@ H5E__init_package(void) #ifndef H5_HAVE_THREADSAFE H5E_stack_g[0].nused = 0; - H5E_set_default_auto(H5E_stack_g); + H5E__set_default_auto(H5E_stack_g); #endif /* H5_HAVE_THREADSAFE */ /* Allocate the HDF5 error class */ HDassert(H5E_ERR_CLS_g == (-1)); HDsnprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, (HDstrlen(H5_VERS_SUBRELEASE) > 0 ? "-"H5_VERS_SUBRELEASE : "")); - if(NULL == (cls = H5E_register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers))) + if(NULL == (cls = H5E__register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers))) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "class initialization failed") if((H5E_ERR_CLS_g = H5I_register(H5I_ERROR_CLASS, cls, FALSE)) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class") @@ -227,14 +225,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_term_package + * Function: H5E_term_package * - * Purpose: Terminates the H5E interface + * Purpose: Terminates the H5E interface * - * Return: Success: Positive if anything is done that might - * affect other interfaces; zero otherwise. + * Return: Success: Positive if anything is done that might + * affect other interfaces; zero otherwise. * - * Failure: Negative. + * Failure: Negative * * Programmer: Raymond Lu * Tuesday, July 22, 2003 @@ -262,8 +260,8 @@ H5E_term_package(void) (void)H5I_clear_type(H5I_ERROR_STACK, FALSE, FALSE); /* Clear all the error classes */ - if(ncls > 0) { - (void)H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE); + if(ncls > 0) { + (void)H5I_clear_type(H5I_ERROR_CLASS, FALSE, FALSE); /* Reset the HDF5 error class, if its been closed */ if(H5I_nmembers(H5I_ERROR_CLASS) == 0) @@ -271,8 +269,8 @@ H5E_term_package(void) } /* end if */ /* Clear all the error messages */ - if(nmsg > 0) { - (void)H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE); + if(nmsg > 0) { + (void)H5I_clear_type(H5I_ERROR_MSG, FALSE, FALSE); /* Reset the HDF5 error messages, if they've been closed */ if(H5I_nmembers(H5I_ERROR_MSG) == 0) { @@ -282,17 +280,17 @@ H5E_term_package(void) } /* end if */ n++; /*H5I*/ - } /* end if */ + } /* end if */ else { - /* Destroy the error class, message, and stack id groups */ - n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); - n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); - n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); + /* Destroy the error class, message, and stack id groups */ + n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); - /* Mark closed */ + /* Mark closed */ if(0 == n) H5_PKG_INIT_VAR = FALSE; - } /* end else */ + } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) @@ -300,12 +298,12 @@ H5E_term_package(void) /*-------------------------------------------------------------------------- - * Function: H5E_set_default_auto + * Function: H5E__set_default_auto * * Purpose: Initialize "automatic" error stack reporting info to library * default * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, November 1, 2007 @@ -313,9 +311,9 @@ H5E_term_package(void) *-------------------------------------------------------------------------- */ static herr_t -H5E_set_default_auto(H5E_t *stk) +H5E__set_default_auto(H5E_t *stk) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #ifndef H5_NO_DEPRECATED_SYMBOLS #ifdef H5_USE_16_API_DEFAULT @@ -334,19 +332,19 @@ H5E_set_default_auto(H5E_t *stk) stk->auto_data = NULL; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_set_default_auto() */ +} /* end H5E__set_default_auto() */ #ifdef H5_HAVE_THREADSAFE /*------------------------------------------------------------------------- - * Function: H5E_get_stack + * Function: H5E__get_stack * - * Purpose: Support function for H5E_get_my_stack() to initialize and + * Purpose: Support function for H5E__get_my_stack() to initialize and * acquire per-thread error stack. * - * Return: Success: error stack (H5E_t *) + * Return: Success: Pointer to an error stack struct (H5E_t *) * - * Failure: NULL + * Failure: NULL * * Programmer: Chee Wai LEE * April 24, 2000 @@ -354,11 +352,11 @@ H5E_set_default_auto(H5E_t *stk) *------------------------------------------------------------------------- */ H5E_t * -H5E_get_stack(void) +H5E__get_stack(void) { H5E_t *estack = NULL; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR estack = (H5E_t *)H5TS_get_thread_local_value(H5TS_errstk_key_g); @@ -377,7 +375,7 @@ H5E_get_stack(void) /* Set the thread-specific info */ estack->nused = 0; - H5E_set_default_auto(estack); + H5E__set_default_auto(estack); /* (It's not necessary to release this in this API, it is * released by the "key destructor" set up in the H5TS @@ -388,16 +386,16 @@ H5E_get_stack(void) /* Set return value */ FUNC_LEAVE_NOAPI(estack) -} /* end H5E_get_stack() */ +} /* end H5E__get_stack() */ #endif /* H5_HAVE_THREADSAFE */ /*------------------------------------------------------------------------- - * Function: H5E_free_class + * Function: H5E_free_class * - * Purpose: Private function to free an error class. + * Purpose: Private function to free an error class. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, January 22, 2009 @@ -423,11 +421,12 @@ H5E_free_class(H5E_cls_t *cls) /*------------------------------------------------------------------------- - * Function: H5Eregister_class + * Function: H5Eregister_class * - * Purpose: Registers an error class. + * Purpose: Registers an error class. * - * Return: Non-negative value as class ID on success/Negative on failure + * Return: Success: An ID for the error class + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -438,22 +437,22 @@ hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version) { H5E_cls_t *cls; /* Pointer to error class */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*s*s*s", cls_name, lib_name, version); /* Check arguments */ if(cls_name == NULL || lib_name == NULL || version == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid string") /* Create the new error class object */ - if(NULL == (cls = H5E_register_class(cls_name, lib_name, version))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, FAIL, "can't create error class") + if(NULL == (cls = H5E__register_class(cls_name, lib_name, version))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error class") /* Register the new error class to get an ID for it */ if((ret_value = H5I_register(H5I_ERROR_CLASS, cls, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error class") done: FUNC_LEAVE_API(ret_value) @@ -461,11 +460,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_register_class + * Function: H5E__register_class * - * Purpose: Private function to register an error class. + * Purpose: Private function to register an error class. * - * Return: Non-negative value as class ID on success/Negative on failure + * Return: Success: Pointer to an error class struct + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -473,12 +473,12 @@ done: *------------------------------------------------------------------------- */ static H5E_cls_t * -H5E_register_class(const char *cls_name, const char *lib_name, const char *version) +H5E__register_class(const char *cls_name, const char *lib_name, const char *version) { H5E_cls_t *cls = NULL; /* Pointer to error class */ H5E_cls_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(cls_name); @@ -506,15 +506,15 @@ done: HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_register_class() */ +} /* end H5E__register_class() */ /*------------------------------------------------------------------------- - * Function: H5Eunregister_class + * Function: H5Eunregister_class * - * Purpose: Closes an error class. + * Purpose: Closes an error class. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -546,11 +546,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_unregister_class + * Function: H5E__unregister_class * - * Purpose: Private function to close an error class. + * Purpose: Private function to close an error class. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -558,17 +558,17 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_unregister_class(H5E_cls_t *cls) +H5E__unregister_class(H5E_cls_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(cls); /* Iterate over all the messages and delete those in this error class */ - if(H5I_iterate(H5I_ERROR_MSG, H5E_close_msg_cb, cls, FALSE) < 0) + if(H5I_iterate(H5I_ERROR_MSG, H5E__close_msg_cb, cls, FALSE) < 0) HGOTO_ERROR(H5E_ERROR, H5E_BADITER, FAIL, "unable to free all messages in this error class") /* Free error class structure */ @@ -577,16 +577,16 @@ H5E_unregister_class(H5E_cls_t *cls) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_unregister_class() */ +} /* end H5E__unregister_class() */ /*------------------------------------------------------------------------- - * Function: H5Eget_class_name + * Function: H5Eget_class_name * - * Purpose: Retrieves error class name. + * Purpose: Retrieves error class name. * - * Return: Non-negative for name length if succeeds(zero means no name); - * otherwise returns negative value. + * Return: Success: Name length (zero means no name) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -597,18 +597,18 @@ ssize_t H5Eget_class_name(hid_t class_id, char *name, size_t size) { H5E_cls_t *cls; /* Pointer to error class */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*sz", class_id, name, size); /* Get the error class */ if(NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error class ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error class ID") /* Retrieve the class name */ - if((ret_value = H5E_get_class_name(cls, name, size)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get error class name") + if((ret_value = H5E__get_class_name(cls, name, size)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error class name") done: FUNC_LEAVE_API(ret_value) @@ -616,12 +616,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_get_class_name + * Function: H5E__get_class_name * - * Purpose: Private function to retrieve error class name. + * Purpose: Private function to retrieve error class name. * - * Return: Non-negative for name length if succeeds(zero means no name); - * otherwise returns negative value. + * Return: Success: Name length (zero means no name) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -629,11 +629,11 @@ done: *------------------------------------------------------------------------- */ static ssize_t -H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) +H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size) { - ssize_t len = 0; /* Length of error class's name */ + ssize_t len = -1; /* Length of error class's name */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(cls); @@ -650,16 +650,17 @@ H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) /* Return the full length */ FUNC_LEAVE_NOAPI(len) -} /* end H5E_get_class_name() */ +} /* end H5E__get_class_name() */ /*------------------------------------------------------------------------- - * Function: H5E_close_msg_cb + * Function: H5E__close_msg_cb * * Purpose: H5I_iterate callback function to close error messages in the * error class. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: H5_ITER_CONT (0) + * Failure: H5_ITER_ERROR (-1) * * Programmer: Raymond Lu * July 14, 2003 @@ -667,36 +668,36 @@ H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) *------------------------------------------------------------------------- */ static int -H5E_close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata) +H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata) { H5E_msg_t *err_msg = (H5E_msg_t*)obj_ptr; H5E_cls_t *cls = (H5E_cls_t*)udata; - herr_t ret_value = SUCCEED; /* Return value */ + int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(err_msg); /* Close the message if it is in the class being closed */ if(err_msg->cls == cls) { - if(H5E_close_msg(err_msg) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, FAIL, "unable to close error message") + if(H5E__close_msg(err_msg) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "unable to close error message") if(NULL == H5I_remove(obj_id)) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, FAIL, "unable to remove error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove error message") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_close_msg_cb() */ +} /* end H5E__close_msg_cb() */ /*------------------------------------------------------------------------- - * Function: H5Eclose_msg + * Function: H5Eclose_msg * - * Purpose: Closes a major or minor error. + * Purpose: Closes a major or minor error. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -725,11 +726,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_close_msg + * Function: H5E__close_msg * - * Purpose: Private function to close an error messge. + * Purpose: Private function to close an error messge. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -737,9 +738,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_close_msg(H5E_msg_t *err) +H5E__close_msg(H5E_msg_t *err) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(err); @@ -750,15 +751,16 @@ H5E_close_msg(H5E_msg_t *err) err = H5FL_FREE(H5E_msg_t, err); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_close_msg() */ +} /* end H5E__close_msg() */ /*------------------------------------------------------------------------- - * Function: H5Ecreate_msg + * Function: H5Ecreate_msg * - * Purpose: Creates a major or minor error, returns an ID. + * Purpose: Creates a major or minor error, returns an ID. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: An error ID + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -770,39 +772,40 @@ H5Ecreate_msg(hid_t class_id, H5E_type_t msg_type, const char *msg_str) { H5E_cls_t *cls; /* Pointer to error class */ H5E_msg_t *msg; /* Pointer to new error message */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iEt*s", class_id, msg_type, msg_str); /* Check arguments */ if(msg_type != H5E_MAJOR && msg_type != H5E_MINOR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid message type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "not a valid message type") if(msg_str == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "message is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "message is NULL") /* Get the error class */ if(NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error class ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an error class ID") /* Create the new error message object */ - if(NULL == (msg = H5E_create_msg(cls, msg_type, msg_str))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, FAIL, "can't create error message") + if(NULL == (msg = H5E__create_msg(cls, msg_type, msg_str))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error message") /* Register the new error class to get an ID for it */ if((ret_value = H5I_register(H5I_ERROR_MSG, msg, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error message") done: FUNC_LEAVE_API(ret_value) } /* end H5Ecreate_msg() */ /*------------------------------------------------------------------------- - * Function: H5E_create_msg + * Function: H5E__create_msg * - * Purpose: Private function to create a major or minor error. + * Purpose: Private function to create a major or minor error. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: Pointer to a message struct + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -810,12 +813,12 @@ done: *------------------------------------------------------------------------- */ static H5E_msg_t * -H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) +H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) { H5E_msg_t *msg = NULL; /* Pointer to new error message */ H5E_msg_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(cls); @@ -837,20 +840,20 @@ H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) done: if(!ret_value) - if(msg && H5E_close_msg(msg) < 0) + if(msg && H5E__close_msg(msg) < 0) HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_create_msg() */ +} /* end H5E__create_msg() */ /*------------------------------------------------------------------------- - * Function: H5Eget_msg + * Function: H5Eget_msg * - * Purpose: Retrieves an error message. + * Purpose: Retrieves an error message. * - * Return: Non-negative for message length if succeeds(zero means no message); - * otherwise returns negative value. + * Return: Success: Message length (zero means no message) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -861,18 +864,18 @@ ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg_str, size_t size) { H5E_msg_t *msg; /* Pointer to error message */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "i*Et*sz", msg_id, type, msg_str, size); /* Get the message object */ if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error message ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error message ID") /* Get the message's text */ - if((ret_value = H5E_get_msg(msg, type, msg_str, size)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get error message text") + if((ret_value = H5E__get_msg(msg, type, msg_str, size)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error message text") done: FUNC_LEAVE_API(ret_value) @@ -880,11 +883,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ecreate_stack + * Function: H5Ecreate_stack * - * Purpose: Creates a new, empty, error stack. + * Purpose: Creates a new, empty, error stack. * - * Return: Non-negative value as stack ID on success/Negative on failure + * Return: Success: An error stack ID + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Thursday, November 1, 2007 @@ -895,21 +899,21 @@ hid_t H5Ecreate_stack(void) { H5E_t *stk; /* Error stack */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE0("i",""); /* Allocate a new error stack */ if(NULL == (stk = H5FL_CALLOC(H5E_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Set the "automatic" error reporting info to the library default */ - H5E_set_default_auto(stk); + H5E__set_default_auto(stk); /* Register the stack */ if((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't create error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack") done: FUNC_LEAVE_API(ret_value) @@ -917,12 +921,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_current_stack + * Function: H5Eget_current_stack * - * Purpose: Registers current error stack, returns object handle for it, + * Purpose: Registers current error stack, returns object handle for it, * clears it. * - * Return: Non-negative value as stack ID on success/Negative on failure + * Return: Success: An error stack ID + * Failure: H5I_INVALID_HID * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -933,19 +938,19 @@ hid_t H5Eget_current_stack(void) { H5E_t *stk; /* Error stack */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(FAIL) + FUNC_ENTER_API_NOCLEAR(H5I_INVALID_HID) H5TRACE0("i",""); /* Get the current stack */ - if(NULL == (stk = H5E_get_current_stack())) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, FAIL, "can't create error stack") + if(NULL == (stk = H5E__get_current_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error stack") /* Register the stack */ if((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't create error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack") done: FUNC_LEAVE_API(ret_value) @@ -953,11 +958,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_get_current_stack + * Function: H5E__get_current_stack * - * Purpose: Private function to register an error stack. + * Purpose: Private function to register an error stack. * - * Return: Non-negative value as class ID on success/Negative on failure + * Return: Success: Pointer to an error class struct + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 11, 2003 @@ -965,17 +971,17 @@ done: *------------------------------------------------------------------------- */ static H5E_t * -H5E_get_current_stack(void) +H5E__get_current_stack(void) { H5E_t *current_stack; /* Pointer to the current error stack */ H5E_t *estack_copy = NULL; /* Pointer to new error stack to return */ unsigned u; /* Local index variable */ H5E_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get a pointer to the current error stack */ - if(NULL == (current_stack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (current_stack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack") /* Allocate a new error stack */ @@ -1026,24 +1032,19 @@ done: estack_copy = H5FL_FREE(H5E_t, estack_copy); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_get_current_stack() */ +} /* end H5E__get_current_stack() */ /*------------------------------------------------------------------------- - * Function: H5Eset_current_stack + * Function: H5Eset_current_stack * - * Purpose: Replaces current stack with specified stack. This closes the - * stack ID also. + * Purpose: Replaces current stack with specified stack. This closes the + * stack ID also. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 15, 2003 - * - * Modification: - * Raymond Lu - * 7 September 2010 - * Also closes the stack to avoid potential problem (bug 1799) * *------------------------------------------------------------------------- */ @@ -1061,7 +1062,7 @@ H5Eset_current_stack(hid_t err_stack) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Set the current error stack */ - if(H5E_set_current_stack(estack) < 0) + if(H5E__set_current_stack(estack) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "unable to set error stack") /* @@ -1078,11 +1079,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_set_current_stack + * Function: H5E__set_current_stack * - * Purpose: Private function to replace an error stack. + * Purpose: Private function to replace an error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 15, 2003 @@ -1090,19 +1091,19 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_set_current_stack(H5E_t *estack) +H5E__set_current_stack(H5E_t *estack) { H5E_t *current_stack; /* Default error stack */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(estack); /* Get a pointer to the current error stack */ - if(NULL == (current_stack = H5E_get_my_stack ())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (current_stack = H5E__get_my_stack ())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Empty current error stack */ @@ -1138,15 +1139,15 @@ H5E_set_current_stack(H5E_t *estack) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_set_current_stack() */ +} /* end H5E__set_current_stack() */ /*------------------------------------------------------------------------- - * Function: H5Eclose_stack + * Function: H5Eclose_stack * - * Purpose: Closes an error stack. + * Purpose: Closes an error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -1180,11 +1181,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_close_stack + * Function: H5E__close_stack * - * Purpose: Private function to close an error stack. + * Purpose: Private function to close an error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -1192,9 +1193,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_close_stack(H5E_t *estack) +H5E__close_stack(H5E_t *estack) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(estack); @@ -1206,15 +1207,16 @@ H5E_close_stack(H5E_t *estack) estack = H5FL_FREE(H5E_t, estack); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_close_stack() */ +} /* end H5E__close_stack() */ /*------------------------------------------------------------------------- - * Function: H5Eget_num + * Function: H5Eget_num * - * Purpose: Retrieves the number of error message. + * Purpose: Retrieves the number of error messages. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: The number of errors + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 15, 2003 @@ -1228,13 +1230,13 @@ H5Eget_num(hid_t error_stack_id) ssize_t ret_value; /* Return value */ /* Don't clear the error stack! :-) */ - FUNC_ENTER_API_NOCLEAR(FAIL) + FUNC_ENTER_API_NOCLEAR((-1)) H5TRACE1("Zs", "i", error_stack_id); /* Need to check for errors */ if(error_stack_id == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get current error stack") } /* end if */ else { /* Only clear the error stack if it's not the default stack */ @@ -1242,12 +1244,12 @@ H5Eget_num(hid_t error_stack_id) /* Get the error stack to operate on */ if(NULL == (estack = (H5E_t *)H5I_object_verify(error_stack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an error stack ID") } /* end else */ /* Get the number of errors on stack */ - if((ret_value = H5E_get_num(estack)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get number of errors") + if((ret_value = H5E__get_num(estack)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get number of errors") done: FUNC_LEAVE_API(ret_value) @@ -1255,11 +1257,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_get_num + * Function: H5E__get_num * - * Purpose: Private function to retrieve number of errors in error stack. + * Purpose: Private function to retrieve number of errors in error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: Success: The number of errors + * Failure: -1 (can't fail at this time) * * Programmer: Raymond Lu * Friday, July 15, 2003 @@ -1267,22 +1270,22 @@ done: *------------------------------------------------------------------------- */ static ssize_t -H5E_get_num(const H5E_t *estack) +H5E__get_num(const H5E_t *estack) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(estack); FUNC_LEAVE_NOAPI((ssize_t)estack->nused) -} /* end H5E_get_num() */ +} /* end H5E__get_num() */ /*------------------------------------------------------------------------- - * Function: H5Epop + * Function: H5Epop * - * Purpose: Deletes some error messages from the top of error stack. + * Purpose: Deletes some error messages from the top of error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 16, 2003 @@ -1301,7 +1304,7 @@ H5Epop(hid_t err_stack, size_t count) /* Need to check for errors */ if(err_stack == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else { @@ -1318,7 +1321,7 @@ H5Epop(hid_t err_stack, size_t count) count = estack->nused; /* Pop the errors off the stack */ - if(H5E_pop(estack, count) < 0) + if(H5E__pop(estack, count) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't pop errors from stack") done: @@ -1327,22 +1330,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5Epush2 + * Function: H5Epush2 * - * Purpose: Pushes a new error record onto error stack for the current - * thread. The error has major and minor IDs MAJ_ID and - * MIN_ID, the name of a function where the error was detected, - * the name of the file where the error was detected, the - * line within that file, and an error description string. The - * function name, file name, and error description strings must - * be statically allocated. + * Purpose: Pushes a new error record onto error stack for the current + * thread. The error has major and minor IDs MAJ_ID and + * MIN_ID, the name of a function where the error was detected, + * the name of the file where the error was detected, the + * line within that file, and an error description string. The + * function name, file name, and error description strings must + * be statically allocated. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, October 18, 1999 * - * Notes: Basically a new public API wrapper around the H5E__push_stack + * Notes: Basically a new public API wrapper around the H5E__push_stack * function. * *------------------------------------------------------------------------- @@ -1435,11 +1438,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eclear2 + * Function: H5Eclear2 * - * Purpose: Clears the error stack for the specified error stack. + * Purpose: Clears the error stack for the specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -1477,14 +1480,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eprint2 + * Function: H5Eprint2 * - * Purpose: Prints the error stack in some default way. This is just a - * convenience function for H5Ewalk() with a function that - * prints error messages. Users are encouraged to write there - * own more specific error handlers. + * Purpose: Prints the error stack in some default way. This is just a + * convenience function for H5Ewalk() with a function that + * prints error messages. Users are encouraged to write there + * own more specific error handlers. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -1503,7 +1506,7 @@ H5Eprint2(hid_t err_stack, FILE *stream) /* Need to check for errors */ if(err_stack == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else { @@ -1515,7 +1518,7 @@ H5Eprint2(hid_t err_stack, FILE *stream) } /* end else */ /* Print error stack */ - if(H5E_print(estack, stream, FALSE) < 0) + if(H5E__print(estack, stream, FALSE) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: @@ -1524,12 +1527,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ewalk2 + * Function: H5Ewalk2 * - * Purpose: Walks the error stack for the current thread and calls some - * function for each error along the way. + * Purpose: Walks the error stack for the current thread and calls some + * function for each error along the way. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -1549,7 +1552,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi /* Need to check for errors */ if(err_stack == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else { @@ -1563,7 +1566,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi /* Walk the error stack */ op.vers = 2; op.u.func2 = stack_func; - if(H5E_walk(estack, direction, &op, client_data) < 0) + if(H5E__walk(estack, direction, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: @@ -1572,23 +1575,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_auto2 + * Function: H5Eget_auto2 * - * Purpose: Returns the current settings for the automatic error stack - * traversal function and its data for specific error stack. - * Either (or both) arguments may be null in which case the - * value is not returned. + * Purpose: Returns the current settings for the automatic error stack + * traversal function and its data for specific error stack. + * Either (or both) arguments may be null in which case the + * value is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Saturday, February 28, 1998 * - * Modification:Raymond Lu - * 4 October 2010 - * If the printing function isn't the default H5Eprint1 or 2, - * and H5Eset_auto1 has been called to set the old style - * printing function, a call to H5Eget_auto2 should fail. *------------------------------------------------------------------------- */ herr_t @@ -1602,7 +1600,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) H5TRACE3("e", "i*x**x", estack_id, func, client_data); if(estack_id == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else @@ -1610,7 +1608,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &op, client_data) < 0) + if(H5E__get_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -1628,28 +1626,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eset_auto2 + * Function: H5Eset_auto2 * - * Purpose: Turns on or off automatic printing of errors for certain + * Purpose: Turns on or off automatic printing of errors for certain * error stack. When turned on (non-null FUNC pointer) any * API function which returns an error indication will first * call FUNC passing it CLIENT_DATA as an argument. * - * The default values before this function is called are - * H5Eprint2() with client data being the standard error stream, - * stderr. + * The default values before this function is called are + * H5Eprint2() with client data being the standard error stream, + * stderr. * - * Automatic stack traversal is always in the H5E_WALK_DOWNWARD - * direction. + * Automatic stack traversal is always in the H5E_WALK_DOWNWARD + * direction. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 * - * Modification:Raymond Lu - * 4 October 2010 - * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on. *------------------------------------------------------------------------- */ herr_t @@ -1664,7 +1659,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) H5TRACE3("e", "ix*x", estack_id, func, client_data); if(estack_id == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else @@ -1673,7 +1668,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) #ifndef H5_NO_DEPRECATED_SYMBOLS /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &op, NULL) < 0) + if(H5E__get_auto(estack, &op, NULL) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") /* Set the automatic error reporting information */ @@ -1688,7 +1683,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) /* Set the automatic error reporting function */ op.func2 = func; - if(H5E_set_auto(estack, &op, client_data) < 0) + if(H5E__set_auto(estack, &op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") done: @@ -1697,14 +1692,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eauto_is_v2 + * Function: H5Eauto_is_v2 * - * Purpose: Determines if the error auto reporting function for an + * Purpose: Determines if the error auto reporting function for an * error stack conforms to the H5E_auto_stack_t typedef * or the H5E_auto_t typedef. The IS_STACK parameter is set * to 1 for the first case and 0 for the latter case. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, September 8, 2004 @@ -1721,7 +1716,7 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) H5TRACE2("e", "i*Iu", estack_id, is_stack); if(estack_id == H5E_DEFAULT) { - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") } /* end if */ else diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index fc3eb9c..603d448 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -35,11 +35,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Epkg.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Epkg.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -80,12 +80,12 @@ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5Eget_major + * Function: H5Eget_major * - * Purpose: Retrieves a major error message. + * Purpose: Retrieves a major error message. * - * Return: Returns message if succeeds. - * otherwise returns NULL. + * Return: Success: Pointer to the message + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -106,21 +106,21 @@ H5Eget_major(H5E_major_t maj) /* Get the message object */ if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(maj, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") /* Get the size & type of the message's text */ - if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + if((size = H5E__get_msg(msg, &type, NULL, (size_t)0)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") if(type != H5E_MAJOR) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one") /* Application will free this */ size++; msg_str = (char *)H5MM_malloc((size_t)size); /* Get the text for the message */ - if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + if(H5E__get_msg(msg, NULL, msg_str, (size_t)size) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") ret_value = msg_str; @@ -133,12 +133,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_minor + * Function: H5Eget_minor * - * Purpose: Retrieves a minor error message. + * Purpose: Retrieves a minor error message. * - * Return: Returns message if succeeds. - * otherwise returns NULL. + * Return: Success: Pointer to the message + * Failure: NULL * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -159,21 +159,21 @@ H5Eget_minor(H5E_minor_t min) /* Get the message object */ if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(min, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") /* Get the size & type of the message's text */ - if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + if((size = H5E__get_msg(msg, &type, NULL, (size_t)0)) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") if(type != H5E_MINOR) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one") /* Application will free this */ size++; msg_str = (char *)H5MM_malloc((size_t)size); /* Get the text for the message */ - if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + if(H5E__get_msg(msg, NULL, msg_str, (size_t)size) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") ret_value = msg_str; @@ -186,19 +186,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Epush1 + * Function: H5Epush1 * - * Purpose: This function definition is for backward compatibility only. + * Purpose: This function definition is for backward compatibility only. * It doesn't have error stack and error class as parameters. * The old definition of major and minor is casted as HID_T * in H5Epublic.h * - * Notes: Basically a public API wrapper around the H5E_push2 + * Notes: Basically a public API wrapper around the H5E_push2 * function. For backward compatibility, it maintains the * same parameter as the old function, in contrary to * H5Epush2. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Tuesday, Sep 16, 2003 @@ -225,12 +225,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eclear1 + * Function: H5Eclear1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Clears the error stack for the specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -256,15 +256,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eprint1 + * Function: H5Eprint1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Prints the error stack in some default way. This is just a - * convenience function for H5Ewalk() with a function that - * prints error messages. Users are encouraged to write there - * own more specific error handlers. + * convenience function for H5Ewalk() with a function that + * prints error messages. Users are encouraged to write there + * own more specific error handlers. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 @@ -281,11 +281,11 @@ H5Eprint1(FILE *stream) FUNC_ENTER_API_NOCLEAR(FAIL) /*NO TRACE*/ - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Print error stack */ - if(H5E_print(estack, stream, TRUE) < 0) + if(H5E__print(estack, stream, TRUE) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: @@ -294,13 +294,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ewalk1 + * Function: H5Ewalk1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Walks the error stack for the current thread and calls some - * function for each error along the way. + * function for each error along the way. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 @@ -318,13 +318,13 @@ H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data) FUNC_ENTER_API_NOCLEAR(FAIL) /*NO TRACE*/ - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Walk the error stack */ walk_op.vers = 1; walk_op.u.func1 = func; - if(H5E_walk(estack, direction, &walk_op, client_data) < 0) + if(H5E__walk(estack, direction, &walk_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") done: @@ -333,24 +333,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eget_auto1 + * Function: H5Eget_auto1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Returns the current settings for the automatic error stack - * traversal function and its data for specific error stack. - * Either (or both) arguments may be null in which case the - * value is not returned. + * traversal function and its data for specific error stack. + * Either (or both) arguments may be null in which case the + * value is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 * - * Modification:Raymond Lu - * 4 October 2010 - * If the printing function isn't the default H5Eprint1 or 2, - * and H5Eset_auto2 has been called to set the new style - * printing function, a call to H5Eget_auto1 should fail. *------------------------------------------------------------------------- */ herr_t @@ -364,11 +359,11 @@ H5Eget_auto1(H5E_auto1_t *func, void **client_data) H5TRACE2("e", "*x**x", func, client_data); /* Retrieve default error stack */ - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &auto_op, client_data) < 0) + if(H5E__get_auto(estack, &auto_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") /* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto2 */ @@ -384,29 +379,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5Eset_auto1 + * Function: H5Eset_auto1 * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatbility. * Turns on or off automatic printing of errors for certain * error stack. When turned on (non-null FUNC pointer) any * API function which returns an error indication will first * call FUNC passing it CLIENT_DATA as an argument. * - * The default values before this function is called are - * H5Eprint1() with client data being the standard error stream, - * stderr. + * The default values before this function is called are + * H5Eprint1() with client data being the standard error stream, + * stderr. * - * Automatic stack traversal is always in the H5E_WALK_DOWNWARD - * direction. + * Automatic stack traversal is always in the H5E_WALK_DOWNWARD + * direction. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Sep 16, 2003 * - * Modification:Raymond Lu - * 4 October 2010 - * If the FUNC is H5Eprint2, put the IS_DEFAULT flag on. *------------------------------------------------------------------------- */ herr_t @@ -420,11 +412,11 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) FUNC_ENTER_API_NOCLEAR(FAIL) H5TRACE2("e", "x*x", func, client_data); - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Get the automatic error reporting information */ - if(H5E_get_auto(estack, &auto_op, NULL) < 0) + if(H5E__get_auto(estack, &auto_op, NULL) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") /* Set the automatic error reporting information */ @@ -435,7 +427,7 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) auto_op.is_default = TRUE; auto_op.func1 = func; - if(H5E_set_auto(estack, &auto_op, client_data) < 0) + if(H5E__set_auto(estack, &auto_op, client_data) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") done: diff --git a/src/H5Eint.c b/src/H5Eint.c index 15953af..540c9b1 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -32,11 +32,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Epkg.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Epkg.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -64,12 +64,12 @@ typedef struct H5E_print_t { /* Local Prototypes */ /********************/ #ifndef H5_NO_DEPRECATED_SYMBOLS -static herr_t H5E_walk1_cb(int n, H5E_error1_t *err_desc, +static herr_t H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -static herr_t H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, +static herr_t H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data); -static herr_t H5E_clear_entries(H5E_t *estack, size_t nentries); +static herr_t H5E__clear_entries(H5E_t *estack, size_t nentries); /*********************/ @@ -108,18 +108,18 @@ hid_t H5E_ERR_CLS_g = FAIL; * variables used for MPI error reporting */ char H5E_mpi_error_str[MPI_MAX_ERROR_STRING]; -int H5E_mpi_error_str_len; +int H5E_mpi_error_str_len; #endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- - * Function: H5E_get_msg + * Function: H5E__get_msg * - * Purpose: Private function to retrieve an error message. + * Purpose: Private function to retrieve an error message. * - * Return: Non-negative for name length if succeeds(zero means no name); - * otherwise returns negative value. + * Return: Success: Message length (zero means no message) + * Failure: -1 * * Programmer: Raymond Lu * Friday, July 14, 2003 @@ -127,11 +127,11 @@ int H5E_mpi_error_str_len; *------------------------------------------------------------------------- */ ssize_t -H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) +H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) { ssize_t len = -1; /* Length of error message */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(msg); @@ -152,37 +152,37 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) /* Set the return value to the full length of the message */ FUNC_LEAVE_NOAPI(len) -} /* end H5E_get_msg() */ +} /* end H5E__get_msg() */ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5E_walk1_cb + * Function: H5E__walk1_cb * - * Purpose: This function is for backward compatibility. + * Purpose: This function is for backward compatibility. * This is a default error stack traversal callback function - * that prints error messages to the specified output stream. - * This function is for backward compatibility with v1.6. - * It is not meant to be called directly but rather as an - * argument to the H5Ewalk() function. This function is called - * also by H5Eprint(). Application writers are encouraged to - * use this function as a model for their own error stack - * walking functions. + * that prints error messages to the specified output stream. + * This function is for backward compatibility with v1.6. + * It is not meant to be called directly but rather as an + * argument to the H5Ewalk() function. This function is called + * also by H5Eprint(). Application writers are encouraged to + * use this function as a model for their own error stack + * walking functions. * - * N is a counter for how many times this function has been - * called for this particular traversal of the stack. It always - * begins at zero for the first error on the stack (either the - * top or bottom error, or even both, depending on the traversal - * direction and the size of the stack). + * N is a counter for how many times this function has been + * called for this particular traversal of the stack. It always + * begins at zero for the first error on the stack (either the + * top or bottom error, or even both, depending on the traversal + * direction and the size of the stack). * - * ERR_DESC is an error description. It contains all the - * information about a particular error. + * ERR_DESC is an error description. It contains all the + * information about a particular error. * - * CLIENT_DATA is the same pointer that was passed as the - * CLIENT_DATA argument of H5Ewalk(). It is expected to be a - * file pointer (or stderr if null). + * CLIENT_DATA is the same pointer that was passed as the + * CLIENT_DATA argument of H5Ewalk(). It is expected to be a + * file pointer (or stderr if null). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Thursday, May 11, 2006 @@ -190,7 +190,7 @@ H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) *------------------------------------------------------------------------- */ static herr_t -H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) +H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) { H5E_print_t *eprint = (H5E_print_t *)client_data; FILE *stream; /* I/O stream to print output to */ @@ -202,7 +202,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(err_desc); @@ -239,7 +239,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) if(cls_ptr->lib_vers) eprint->cls.lib_vers = cls_ptr->lib_vers; - fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", + HDfprintf(stream, "%s-DIAG: Error detected in %s (%s) ", (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"), (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"), (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)")); @@ -249,22 +249,22 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) { int mpi_rank, mpi_initialized, mpi_finalized; - MPI_Initialized(&mpi_initialized); + MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); if(mpi_initialized && !mpi_finalized) { - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - fprintf(stream, "MPI-process %d", mpi_rank); - } /* end if */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + HDfprintf(stream, "MPI-process %d", mpi_rank); + } /* end if */ else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); } /* end block */ #elif defined(H5_HAVE_THREADSAFE) - fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); + HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); #else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); #endif - fprintf(stream, ":\n"); + HDfprintf(stream, ":\n"); } /* end if */ /* Check for "real" error description - used to format output more nicely */ @@ -272,44 +272,44 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) have_desc=0; /* Print error message */ - fprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n", + HDfprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, err_desc->line, err_desc->func_name, (have_desc ? ": " : ""), (have_desc ? err_desc->desc : "")); - fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); - fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); + HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); + HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_walk1_cb() */ +} /* end H5E__walk1_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- - * Function: H5E_walk2_cb + * Function: H5E__walk2_cb * - * Purpose: This is a default error stack traversal callback function - * that prints error messages to the specified output stream. - * It is not meant to be called directly but rather as an - * argument to the H5Ewalk2() function. This function is - * called also by H5Eprint2(). Application writers are - * encouraged to use this function as a model for their own - * error stack walking functions. + * Purpose: This is a default error stack traversal callback function + * that prints error messages to the specified output stream. + * It is not meant to be called directly but rather as an + * argument to the H5Ewalk2() function. This function is + * called also by H5Eprint2(). Application writers are + * encouraged to use this function as a model for their own + * error stack walking functions. * - * N is a counter for how many times this function has been - * called for this particular traversal of the stack. It always - * begins at zero for the first error on the stack (either the - * top or bottom error, or even both, depending on the traversal - * direction and the size of the stack). + * N is a counter for how many times this function has been + * called for this particular traversal of the stack. It always + * begins at zero for the first error on the stack (either the + * top or bottom error, or even both, depending on the traversal + * direction and the size of the stack). * - * ERR_DESC is an error description. It contains all the - * information about a particular error. + * ERR_DESC is an error description. It contains all the + * information about a particular error. * - * CLIENT_DATA is the same pointer that was passed as the - * CLIENT_DATA argument of H5Ewalk(). It is expected to be a - * file pointer (or stderr if null). + * CLIENT_DATA is the same pointer that was passed as the + * CLIENT_DATA argument of H5Ewalk(). It is expected to be a + * file pointer (or stderr if null). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, December 12, 1997 @@ -317,7 +317,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) +H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) { H5E_print_t *eprint = (H5E_print_t *)client_data; FILE *stream; /* I/O stream to print output to */ @@ -329,7 +329,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(err_desc); @@ -371,7 +371,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) if(cls_ptr->lib_vers) eprint->cls.lib_vers = cls_ptr->lib_vers; - fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", + HDfprintf(stream, "%s-DIAG: Error detected in %s (%s) ", (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"), (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"), (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)")); @@ -381,22 +381,22 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) { int mpi_rank, mpi_initialized, mpi_finalized; - MPI_Initialized(&mpi_initialized); + MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); if(mpi_initialized && !mpi_finalized) { - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - fprintf(stream, "MPI-process %d", mpi_rank); - } /* end if */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + HDfprintf(stream, "MPI-process %d", mpi_rank); + } /* end if */ else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); } /* end block */ #elif defined(H5_HAVE_THREADSAFE) - fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); + HDfprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); #else - fprintf(stream, "thread 0"); + HDfprintf(stream, "thread 0"); #endif - fprintf(stream, ":\n"); + HDfprintf(stream, ":\n"); } /* end if */ /* Check for "real" error description - used to format output more nicely */ @@ -404,28 +404,28 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) have_desc = 0; /* Print error message */ - fprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n", + HDfprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, err_desc->line, err_desc->func_name, (have_desc ? ": " : ""), (have_desc ? err_desc->desc : "")); - fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); - fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); + HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); + HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_walk2_cb() */ +} /* end H5E__walk2_cb() */ /*------------------------------------------------------------------------- - * Function: H5E_print + * Function: H5E__print * - * Purpose: Private function to print the error stack in some default + * Purpose: Private function to print the error stack in some default * way. This is just a convenience function for H5Ewalk() and * H5Ewalk2() with a function that prints error messages. * Users are encouraged to write there own more specific error * handlers. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -433,13 +433,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) +H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) { H5E_print_t eprint; /* Callback information to pass to H5E_walk() */ H5E_walk_op_t walk_op; /* Error stack walking callback */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(estack); @@ -457,8 +457,8 @@ H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) if(bk_compatible) { #ifndef H5_NO_DEPRECATED_SYMBOLS walk_op.vers = 1; - walk_op.u.func1 = H5E_walk1_cb; - if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) + walk_op.u.func1 = H5E__walk1_cb; + if(H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") #else /* H5_NO_DEPRECATED_SYMBOLS */ HDassert(0 && "version 1 error stack print without deprecated symbols!"); @@ -466,40 +466,40 @@ H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) } /* end if */ else { walk_op.vers = 2; - walk_op.u.func2 = H5E_walk2_cb; - if(H5E_walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) + walk_op.u.func2 = H5E__walk2_cb; + if(H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void*)&eprint) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_print() */ +} /* end H5E__print() */ /*------------------------------------------------------------------------- - * Function: H5E_walk + * Function: H5E__walk * - * Purpose: Private function for H5Ewalk. + * Purpose: Private function for H5Ewalk. * Walks the error stack, calling the specified function for - * each error on the stack. The DIRECTION argument determines - * whether the stack is walked from the inside out or the - * outside in. The value H5E_WALK_UPWARD means begin with the - * most specific error and end at the API; H5E_WALK_DOWNWARD - * means to start at the API and end at the inner-most function - * where the error was first detected. - * - * The function pointed to by STACK_FUNC will be called for - * each error record in the error stack. It's arguments will - * include an index number (beginning at zero regardless of - * stack traversal direction), an error stack entry, and the - * CLIENT_DATA pointer passed to H5E_print. - * - * The function FUNC is also provided for backward compatibility. - * When BK_COMPATIBLE is set to be TRUE, FUNC is used to be - * compatible with older library. If BK_COMPATIBLE is FALSE, - * STACK_FUNC is used. - * - * Return: Non-negative on success/Negative on failure + * each error on the stack. The DIRECTION argument determines + * whether the stack is walked from the inside out or the + * outside in. The value H5E_WALK_UPWARD means begin with the + * most specific error and end at the API; H5E_WALK_DOWNWARD + * means to start at the API and end at the inner-most function + * where the error was first detected. + * + * The function pointed to by STACK_FUNC will be called for + * each error record in the error stack. It's arguments will + * include an index number (beginning at zero regardless of + * stack traversal direction), an error stack entry, and the + * CLIENT_DATA pointer passed to H5E_print. + * + * The function FUNC is also provided for backward compatibility. + * When BK_COMPATIBLE is set to be TRUE, FUNC is used to be + * compatible with older library. If BK_COMPATIBLE is FALSE, + * STACK_FUNC is used. + * + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, December 12, 1997 @@ -507,14 +507,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, +H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, void *client_data) { int i; /* Local index variable */ herr_t status; /* Status from callback function */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(estack); @@ -587,18 +587,18 @@ H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_walk() */ +} /* end H5E__walk() */ /*------------------------------------------------------------------------- - * Function: H5E_get_auto + * Function: H5E__get_auto * - * Purpose: Private function to return the current settings for the + * Purpose: Private function to return the current settings for the * automatic error stack traversal function and its data * for specific error stack. Either (or both) arguments may * be null in which case the value is not returned. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * July 18, 2003 @@ -606,9 +606,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) +H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(estack); @@ -619,26 +619,26 @@ H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) *client_data = estack->auto_data; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_get_auto2() */ +} /* end H5E__get_auto() */ /*------------------------------------------------------------------------- - * Function: H5E_set_auto + * Function: H5E__set_auto * - * Purpose: Private function to turn on or off automatic printing of + * Purpose: Private function to turn on or off automatic printing of * errors for certain error stack. When turned on (non-null * FUNC pointer) any API function which returns an error * indication will first call FUNC passing it CLIENT_DATA * as an argument. * - * The default values before this function is called are - * H5Eprint2() with client data being the standard error stream, - * stderr. + * The default values before this function is called are + * H5Eprint2() with client data being the standard error stream, + * stderr. * - * Automatic stack traversal is always in the H5E_WALK_DOWNWARD - * direction. + * Automatic stack traversal is always in the H5E_WALK_DOWNWARD + * direction. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -646,9 +646,9 @@ H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) *------------------------------------------------------------------------- */ herr_t -H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) +H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(estack); @@ -657,15 +657,15 @@ H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) estack->auto_data = client_data; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_set_auto() */ +} /* end H5E__set_auto() */ /*------------------------------------------------------------------------- - * Function: H5E_printf_stack + * Function: H5E_printf_stack * - * Purpose: Printf-like wrapper around H5E__push_stack. + * Purpose: Printf-like wrapper around H5E__push_stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, August 12, 2008 @@ -758,19 +758,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5E__push_stack + * Function: H5E__push_stack * - * Purpose: Pushes a new error record onto error stack for the current - * thread. The error has major and minor IDs MAJ_ID and - * MIN_ID, the name of a function where the error was detected, - * the name of the file where the error was detected, the - * line within that file, and an error description string. The - * function name, file name, and error description strings must - * be statically allocated (the FUNC_ENTER() macro takes care of - * the function name and file name automatically, but the - * programmer is responsible for the description string). + * Purpose: Pushes a new error record onto error stack for the current + * thread. The error has major and minor IDs MAJ_ID and + * MIN_ID, the name of a function where the error was detected, + * the name of the file where the error was detected, the + * line within that file, and an error description string. The + * function name, file name, and error description strings must + * be statically allocated (the FUNC_ENTER() macro takes care of + * the function name and file name automatically, but the + * programmer is responsible for the description string). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Friday, December 12, 1997 @@ -799,7 +799,7 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line /* Check for 'default' error stack */ if(estack == NULL) - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_DONE(FAIL) /* @@ -845,12 +845,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_clear_entries + * Function: H5E__clear_entries * - * Purpose: Private function to clear the error stack entries for the + * Purpose: Private function to clear the error stack entries for the * specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, August 6, 2003 @@ -858,13 +858,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5E_clear_entries(H5E_t *estack, size_t nentries) +H5E__clear_entries(H5E_t *estack, size_t nentries) { H5E_error2_t *error; /* Pointer to error stack entry to clear */ unsigned u; /* Local index variable */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(estack); @@ -897,16 +897,16 @@ H5E_clear_entries(H5E_t *estack, size_t nentries) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_clear_entries() */ +} /* end H5E__clear_entries() */ /*------------------------------------------------------------------------- - * Function: H5E_clear_stack + * Function: H5E_clear_stack * - * Purpose: Private function to clear the error stack for the + * Purpose: Private function to clear the error stack for the * specified error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -922,13 +922,13 @@ H5E_clear_stack(H5E_t *estack) /* Check for 'default' error stack */ if(estack == NULL) - if(NULL == (estack = H5E_get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ + if(NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") /* Empty the error stack */ HDassert(estack); if(estack->nused) - if(H5E_clear_entries(estack, estack->nused) < 0) + if(H5E__clear_entries(estack, estack->nused) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack") done: @@ -937,12 +937,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5E_pop + * Function: H5E__pop * - * Purpose: Private function to delete some error messages from the top + * Purpose: Private function to delete some error messages from the top * of error stack. * - * Return: Non-negative value on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Friday, July 16, 2003 @@ -950,33 +950,33 @@ done: *------------------------------------------------------------------------- */ herr_t -H5E_pop(H5E_t *estack, size_t count) +H5E__pop(H5E_t *estack, size_t count) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(estack); HDassert(estack->nused >= count); /* Remove the entries from the error stack */ - if(H5E_clear_entries(estack, count) < 0) + if(H5E__clear_entries(estack, count) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't remove errors from stack") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_pop() */ +} /* end H5E__pop() */ /*------------------------------------------------------------------------- - * Function: H5E_dump_api_stack + * Function: H5E_dump_api_stack * - * Purpose: Private function to dump the error stack during an error in + * Purpose: Private function to dump the error stack during an error in * an API function if a callback function is defined for the * current error stack. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, August 6, 2003 @@ -992,7 +992,7 @@ H5E_dump_api_stack(hbool_t is_api) /* Only dump the error stack during an API call */ if(is_api) { - H5E_t *estack = H5E_get_my_stack(); + H5E_t *estack = H5E__get_my_stack(); HDassert(estack); diff --git a/src/H5Epkg.h b/src/H5Epkg.h index fcde1ca..ac98496 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -49,15 +49,15 @@ * each thread individually. The association of stacks to threads will * be handled by the pthread library. * - * In order for this macro to work, H5E_get_my_stack() must be preceeded + * In order for this macro to work, H5E__get_my_stack() must be preceeded * by "H5E_t *estack =". */ -#define H5E_get_my_stack() H5E_get_stack() +#define H5E__get_my_stack() H5E__get_stack() #else /* H5_HAVE_THREADSAFE */ /* * The current error stack. */ -#define H5E_get_my_stack() (H5E_stack_g + 0) +#define H5E__get_my_stack() (H5E_stack_g + 0) #endif /* H5_HAVE_THREADSAFE */ @@ -132,20 +132,20 @@ H5_DLLVAR H5E_t H5E_stack_g[1]; /******************************/ H5_DLL herr_t H5E__term_deprec_interface(void); #ifdef H5_HAVE_THREADSAFE -H5_DLL H5E_t *H5E_get_stack(void); +H5_DLL H5E_t *H5E__get_stack(void); #endif /* H5_HAVE_THREADSAFE */ H5_DLL herr_t H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc); -H5_DLL ssize_t H5E_get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type, +H5_DLL ssize_t H5E__get_msg(const H5E_msg_t *msg_ptr, H5E_type_t *type, char *msg, size_t size); -H5_DLL herr_t H5E_print(const H5E_t *estack, FILE *stream, hbool_t bk_compat); -H5_DLL herr_t H5E_walk(const H5E_t *estack, H5E_direction_t direction, +H5_DLL herr_t H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compat); +H5_DLL herr_t H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op, void *client_data); -H5_DLL herr_t H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, +H5_DLL herr_t H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data); -H5_DLL herr_t H5E_set_auto(H5E_t *estack, const H5E_auto_op_t *op, +H5_DLL herr_t H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data); -H5_DLL herr_t H5E_pop(H5E_t *err_stack, size_t count); +H5_DLL herr_t H5E__pop(H5E_t *err_stack, size_t count); #endif /* _H5Epkg_H */ diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h index 6f47efb..e51050e 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -57,7 +57,7 @@ H5_DLL herr_t H5FD_free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, /* Testing functions */ #ifdef H5FD_TESTING -H5_DLL hbool_t H5FD_supports_swmr_test(const char *vfd_name); +H5_DLL hbool_t H5FD__supports_swmr_test(const char *vfd_name); #endif /* H5FD_TESTING */ #endif /* _H5FDpkg_H */ diff --git a/src/H5FDtest.c b/src/H5FDtest.c index f528dfb..080223c 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -71,7 +71,7 @@ /*------------------------------------------------------------------------- - * Function: H5FD_supports_swmr_test() + * Function: H5FD__supports_swmr_test() * * Purpose: Determines if a VFD supports SWMR. * @@ -98,7 +98,7 @@ *------------------------------------------------------------------------- */ hbool_t -H5FD_supports_swmr_test(const char *vfd_name) +H5FD__supports_swmr_test(const char *vfd_name) { hbool_t ret_value = FALSE; @@ -112,5 +112,5 @@ H5FD_supports_swmr_test(const char *vfd_name) FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_supports_swmr_test() */ +} /* end H5FD__supports_swmr_test() */ diff --git a/src/H5private.h b/src/H5private.h index 196d001..2dff0f0 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1992,7 +1992,6 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ H5_DLL herr_t H5CX_push(void); H5_DLL herr_t H5CX_pop(void); - #ifndef NDEBUG #define FUNC_ENTER_CHECK_NAME(asrt) \ { \ @@ -2031,7 +2030,7 @@ H5_DLL herr_t H5CX_pop(void); /* Local variables for API routines */ #define FUNC_ENTER_API_VARS \ MPE_LOG_VARS \ - H5TRACE_DECL \ + H5TRACE_DECL #define FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_VARS \ diff --git a/src/H5system.c b/src/H5system.c index 186d8fa..2d29650 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -294,13 +294,13 @@ HDfprintf(FILE *stream, const char *fmt, ...) unsigned short x = (unsigned short)va_arg(ap, unsigned int); n = fprintf(stream, format_templ, x); } else if(!*modifier) { - unsigned int x = va_arg(ap, unsigned int); /*lint !e732 Loss of sign not really occurring */ + unsigned int x = va_arg(ap, unsigned int); n = fprintf(stream, format_templ, x); } else if(!HDstrcmp(modifier, "l")) { - unsigned long x = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occurring */ + unsigned long x = va_arg(ap, unsigned long); n = fprintf(stream, format_templ, x); } else { - uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occurring */ + uint64_t x = va_arg(ap, uint64_t); n = fprintf(stream, format_templ, x); } break; @@ -333,7 +333,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'a': { - haddr_t x = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occurring */ + haddr_t x = va_arg(ap, haddr_t); if(H5F_addr_defined(x)) { len = 0; @@ -387,7 +387,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 's': case 'p': { - char *x = va_arg(ap, char*); /*lint !e64 Type mismatch not really occurring */ + char *x = va_arg(ap, char*); n = fprintf(stream, format_templ, x); } break; diff --git a/test/accum.c b/test/accum.c index 19006b6..91786a9 100644 --- a/test/accum.c +++ b/test/accum.c @@ -1846,11 +1846,11 @@ test_swmr_write_big(hbool_t newest_format) * by the environment variable. */ driver = HDgetenv("HDF5_DRIVER"); - if (!H5FD_supports_swmr_test(driver)) { + if(!H5FD__supports_swmr_test(driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } /* File access property list */ if((fapl = h5_fileaccess()) < 0) @@ -1863,7 +1863,8 @@ test_swmr_write_big(hbool_t newest_format) if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - } else { /* non-latest-format */ + } + else { /* non-latest-format */ if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } /* end if */ @@ -1951,10 +1952,11 @@ test_swmr_write_big(hbool_t newest_format) if((pid = HDfork()) < 0) { HDperror("fork"); FAIL_STACK_ERROR; - } else if(0 == pid) { /* Child process */ + } + else if(0 == pid) { /* Child process */ /* Run the reader */ status = HDexecv(SWMR_READER, new_argv); - printf("errno from execv = %s\n", strerror(errno)); + HDprintf("errno from execv = %s\n", strerror(errno)); FAIL_STACK_ERROR; } /* end if */ @@ -2030,18 +2032,19 @@ accum_printf(const H5F_t *f) { H5F_meta_accum_t * accum = &f->shared->accum; - printf("\n"); - printf("Current contents of accumulator:\n"); - if (accum->alloc_size == 0) { - printf("=====================================================\n"); - printf(" No accumulator allocated.\n"); - printf("=====================================================\n"); - } else { - printf("=====================================================\n"); - printf(" accumulator allocated size == %zu\n", accum->alloc_size); - printf(" accumulated data size == %zu\n", accum->size); + HDprintf("\n"); + HDprintf("Current contents of accumulator:\n"); + if(accum->alloc_size == 0) { + HDprintf("=====================================================\n"); + HDprintf(" No accumulator allocated.\n"); + HDprintf("=====================================================\n"); + } + else { + HDprintf("=====================================================\n"); + HDprintf(" accumulator allocated size == %zu\n", accum->alloc_size); + HDprintf(" accumulated data size == %zu\n", accum->size); HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty); - printf("=====================================================\n"); + HDprintf("=====================================================\n"); HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc); if(accum->dirty) { HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off)); @@ -2049,8 +2052,8 @@ accum_printf(const H5F_t *f) } /* end if */ HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size)); HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", (haddr_t)(accum->loc + accum->alloc_size)); - printf("=====================================================\n"); + HDprintf("=====================================================\n"); } - printf("\n\n"); + HDprintf("\n\n"); } /* accum_printf() */ diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 5bda46a..cf2616e 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -56,9 +56,8 @@ main(void) * by the environment variable. */ driver = HDgetenv("HDF5_DRIVER"); - if(!H5FD_supports_swmr_test(driver)) { + if(!H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; - } /* Initialize buffers */ for(u = 0; u < 1024; u++) { @@ -101,8 +100,11 @@ main(void) return EXIT_SUCCESS; -error: - H5Fclose(fid); +error: + H5E_BEGIN_TRY { + H5Pclose(fapl); + H5Fclose(fid); + } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); diff --git a/test/dsets.c b/test/dsets.c index d23f438..faf2ad7 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -27,7 +27,6 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" #include "H5Pprivate.h" @@ -2517,8 +2516,7 @@ error: * * Purpose: Tests library behavior when filter is missing * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -2543,7 +2541,7 @@ test_missing_filter(hid_t file) /* Verify deflate filter is registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) { H5_FAILED(); - printf(" Line %d: Deflate filter not available\n",__LINE__); + HDprintf(" Line %d: Deflate filter not available\n",__LINE__); goto error; } /* end if */ @@ -2555,31 +2553,31 @@ test_missing_filter(hid_t file) /* (Use private routine, to avoid range checking on filter ID) */ if(H5Z__unregister(H5Z_FILTER_DEFLATE) < 0) { H5_FAILED(); - printf(" Line %d: Can't unregister deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__); goto error; } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ /* Verify deflate filter is not registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) { H5_FAILED(); - printf(" Line %d: Deflate filter available\n",__LINE__); + HDprintf(" Line %d: Deflate filter available\n",__LINE__); goto error; } /* end if */ /* Create dcpl with deflate filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Pset_deflate(dcpl, 9) < 0) { H5_FAILED(); - printf(" Line %d: Can't set deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't set deflate filter\n",__LINE__); goto error; } /* end if */ @@ -2587,47 +2585,47 @@ test_missing_filter(hid_t file) ret=H5Pall_filters_avail(dcpl); if(ret<0) { H5_FAILED(); - printf(" Line %d: Can't check filter availability\n",__LINE__); + HDprintf(" Line %d: Can't check filter availability\n",__LINE__); goto error; } /* end if */ if(ret!=FALSE) { H5_FAILED(); - printf(" Line %d: Filter shouldn't be available\n",__LINE__); + HDprintf(" Line %d: Filter shouldn't be available\n",__LINE__); goto error; } /* end if */ /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_MISSING_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if(0 == (dset_size = H5Dget_storage_size(dsid))) { H5_FAILED(); - printf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ @@ -2635,14 +2633,14 @@ test_missing_filter(hid_t file) /* (i.e. the deflation filter we asked for was silently ignored) */ if((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -2652,10 +2650,10 @@ test_missing_filter(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -2664,21 +2662,21 @@ test_missing_filter(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -2688,14 +2686,14 @@ test_missing_filter(hid_t file) /* Open existing file */ if((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open existing deflated file\n", __LINE__); + HDprintf(" Line %d: Can't open existing deflated file\n", __LINE__); goto error; } /* end if */ /* Open dataset */ if((dsid = H5Dopen2(fid, "Dataset1", H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n", __LINE__); + HDprintf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ @@ -2705,21 +2703,21 @@ test_missing_filter(hid_t file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Should not be able to read dataset data\n", __LINE__); + HDprintf(" Line %d: Should not be able to read dataset data\n", __LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n", __LINE__); + HDprintf(" Line %d: Can't close dataset\n", __LINE__); goto error; } /* end if */ /* Close existing file */ if(H5Fclose(fid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n", __LINE__); + HDprintf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ @@ -2727,21 +2725,21 @@ test_missing_filter(hid_t file) /* Verify deflate filter is not registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) { H5_FAILED(); - printf(" Line %d: Deflate filter available\n",__LINE__); + HDprintf(" Line %d: Deflate filter available\n",__LINE__); goto error; } /* end if */ #ifdef H5_HAVE_FILTER_DEFLATE /* Register deflate filter (use internal function to avoid range checks) */ if(H5Z_register(H5Z_DEFLATE) < 0) { H5_FAILED(); - printf(" Line %d: Can't unregister deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__); goto error; } /* end if */ /* Verify deflate filter is registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) { H5_FAILED(); - printf(" Line %d: Deflate filter not available\n",__LINE__); + HDprintf(" Line %d: Deflate filter not available\n",__LINE__); goto error; } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ @@ -2751,13 +2749,13 @@ test_missing_filter(hid_t file) api_ctx_pushed = FALSE; PASSED(); - return 0; + return SUCCEED; error: if(api_ctx_pushed) H5CX_pop(); - return -1; -} + return FAIL; +} /* end test_missing_filter() */ /*------------------------------------------------------------------------- @@ -8301,25 +8299,25 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Loop over using SWMR access to write */ for(swmr = 0; swmr <= 1; swmr++) { - int compress; /* Whether chunks should be compressed */ + int compress; /* Whether chunks should be compressed */ /* SWMR is now supported with/without latest format: */ - /* (1) write+latest-format (2) SWMR-write+non-latest-format */ + /* (1) write+latest-format (2) SWMR-write+non-latest-format */ /* Skip this iteration if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(swmr && !H5FD_supports_swmr_test(env_h5_driver)) + if(swmr && !H5FD__supports_swmr_test(env_h5_driver)) continue; #ifdef H5_HAVE_FILTER_DEFLATE /* Loop over compressing chunks */ for(compress = 0; compress <= 1; compress++) #else - /* Loop over without compression */ + /* Loop over without compression */ for(compress = 0; compress <= 0; compress++) #endif /* H5_HAVE_FILTER_DEFLATE */ - { + { H5D_alloc_time_t alloc_time; /* Storage allocation time */ /* Loop over storage allocation time */ @@ -10412,11 +10410,11 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } /* Check if we are using the latest version of the format */ if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) @@ -10428,7 +10426,8 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) /* Create file with write+latest-format */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - } else { + } + else { /* Create file with SWMR-write+non-latest-format */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -10661,11 +10660,11 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10781,11 +10780,11 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10901,11 +10900,11 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if(!H5FD_supports_swmr_test(env_h5_driver)) { + if(!H5FD__supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); return 0; - } /* end if */ + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -12904,7 +12903,7 @@ error: #define SRC_DSET "src_dset" #define V_DSET "v_dset" static herr_t -test_versionbounds() +test_versionbounds(void) { hid_t fapl = -1; hid_t srcfile = -1; /* Files with source dsets */ diff --git a/test/flush1.c b/test/flush1.c index bdbd731..fefa8d0 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -209,7 +209,7 @@ main(void) /* Check if the current VFD supports SWMR */ driver = HDgetenv("HDF5_DRIVER"); - vfd_supports_swmr = H5FD_supports_swmr_test(driver); + vfd_supports_swmr = H5FD__supports_swmr_test(driver); /*************************************************/ /* NOTE: Not closing the file ID is intentional! */ diff --git a/test/flush2.c b/test/flush2.c index 9fdf6c1..6e8aee7 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -258,7 +258,7 @@ main(void) /* Check if the current VFD supports SWMR */ driver = HDgetenv("HDF5_DRIVER"); - vfd_supports_swmr = H5FD_supports_swmr_test(driver); + vfd_supports_swmr = H5FD__supports_swmr_test(driver); /* TEST 1 */ /* Check the case where the file was flushed */ diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 4196d85..42b5e43 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -130,7 +130,7 @@ herr_t end_verification(void); * it will time out waiting for a signal from the test script * which will never come. * - * Return: 0 on Success, 1 on Failure + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Mike McGreevy * July 1, 2010 @@ -155,7 +155,7 @@ int main(int argc, const char *argv[]) /* Determine driver being used */ envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL || H5FD_supports_swmr_test(envval)) { + if(envval == NULL || H5FD__supports_swmr_test(envval)) { if(test_flush() != SUCCEED) TEST_ERROR; if(test_refresh() != SUCCEED) TEST_ERROR; } /* end if */ @@ -166,23 +166,26 @@ int main(int argc, const char *argv[]) if(end_verification() < 0) TEST_ERROR; if(end_verification() < 0) TEST_ERROR; } /* end else */ - } else if(argc == 3) { + } + else if(argc == 3) { /* Two arguments supplied. Pass them to flush verification routine. */ if(flush_verification(argv[1], argv[2]) != 0) PROCESS_ERROR; - } else if(argc == 2) { + } + else if(argc == 2) { /* One argument supplied. Pass it to refresh verification routine. */ if(refresh_verification(argv[1]) != 0) PROCESS_ERROR; - } else { + } + else { /* Illegal number of arguments supplied. Error. */ HDfprintf(stderr, "Error. %d is an Invalid number of arguments to main().\n", argc); PROCESS_ERROR } /* end if */ - return SUCCEED; + return EXIT_SUCCESS; error: /* Return */ - return FAIL; + return EXIT_FAILURE; } /* main */ @@ -1027,55 +1030,57 @@ herr_t refresh_verification(const char * obj_pathname) * test cases is easy). */ do { - if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) { - if(H5Drefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) { - if(H5Grefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) { - if(H5Trefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) || + if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) { + if(H5Drefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) { + if(H5Grefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) { + if(H5Trefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) || (HDstrcmp(obj_pathname, T3) == 0)) { - if(H5Orefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else { - HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname); - PROCESS_ERROR; - } /* end else */ - - /* Get object info. This should now accurately reflect the refreshed object on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; - - /* Confirm following (first 4) attributes are the same: */ - /* Confirm following (last 4) attributes are different */ - if( (flushed_oinfo.addr == refreshed_oinfo.addr) && - (flushed_oinfo.type == refreshed_oinfo.type) && - (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && - (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && - (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && - (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && - (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && - (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { - ok = TRUE; - break; - } - if(tries == sleep_tries) - HDsleep(1); + if(H5Orefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else { + HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname); + PROCESS_ERROR; + } /* end else */ + + /* Get object info. This should now accurately reflect the refreshed object on disk. */ + if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) + PROCESS_ERROR; + + /* Confirm following (first 4) attributes are the same: */ + /* Confirm following (last 4) attributes are different */ + if( (flushed_oinfo.addr == refreshed_oinfo.addr) && + (flushed_oinfo.type == refreshed_oinfo.type) && + (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && + (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && + (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && + (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && + (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && + (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { + ok = TRUE; + break; + } + + if(tries == sleep_tries) + HDsleep(1); } while(--tries); - + if(!ok) { - printf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, - (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); - printf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, - (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); - PROCESS_ERROR; + HDprintf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", + (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, + (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); + HDprintf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", + (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, + (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); + PROCESS_ERROR; } - + /* Close objects */ if(H5Oclose(oid) < 0) PROCESS_ERROR; if(H5Fclose(fid) < 0) PROCESS_ERROR; diff --git a/test/links.c b/test/links.c index fb2c75a..786aa8f 100644 --- a/test/links.c +++ b/test/links.c @@ -4052,7 +4052,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo if(H5Fclose(file1) < 0) TEST_ERROR /* Only run this part with VFDs that support SWMR */ - if(H5FD_supports_swmr_test(env_h5_drvr)) { + if(H5FD__supports_swmr_test(env_h5_drvr)) { /* Reopen file1, with read-write and SWMR-write access */ /* Only supported under the latest file format */ @@ -8354,9 +8354,9 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != 16) TEST_ERROR if (UD_CB_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; } /* Fill the query buffer */ @@ -9004,9 +9004,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) gid = H5Oopen(fid, "soft5", plist); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through lesser soft link */ @@ -15003,7 +15003,7 @@ main(void) nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; } /* end for */ /* These tests assume that external links are a form of UD links, diff --git a/test/swmr.c b/test/swmr.c index 0b352e2..b7e54e7 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -6484,106 +6484,106 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) if(childpid == 0) { /* Child process */ hid_t child_fid1 = -1; /* File ID */ hid_t child_fid2 = -1; /* File ID */ - hid_t child_did1 = -1, child_did2 = -1; - hid_t child_sid = -1; - hsize_t tdims[1]; - int rbuf[2] = {0, 0}; - int child_notify = 0; + hid_t child_did1 = -1, child_did2 = -1; + hid_t child_sid = -1; + hsize_t tdims[1]; + int rbuf[2] = {0, 0}; + int child_notify = 0; - /* Close unused write end for out_pdf */ - if(HDclose(out_pdf[1]) < 0) - HDexit(EXIT_FAILURE); + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) + HDexit(EXIT_FAILURE); - /* close unused read end for in_pdf */ - if(HDclose(in_pdf[0]) < 0) - HDexit(EXIT_FAILURE); + /* close unused read end for in_pdf */ + if(HDclose(in_pdf[0]) < 0) + HDexit(EXIT_FAILURE); - /* Wait for notification from parent process */ - while(child_notify != 1) { - if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); - } + /* Wait for notification from parent process */ + while(child_notify != 1) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } - /* Open the file 2 times */ - if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) - HDexit(EXIT_FAILURE); + /* Open the file 2 times */ + if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); - if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) - HDexit(EXIT_FAILURE); + if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); - /* Open the dataset 2 times */ - if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0) - HDexit(EXIT_FAILURE); - if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0) - HDexit(EXIT_FAILURE); + /* Open the dataset 2 times */ + if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); + if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); - /* Get the dataset's dataspace via did1 */ - if((child_sid = H5Dget_space(child_did1)) < 0) - HDexit(EXIT_FAILURE); - if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) - HDexit(EXIT_FAILURE); - if(tdims[0] != 1) - HDexit(EXIT_FAILURE); + /* Get the dataset's dataspace via did1 */ + if((child_sid = H5Dget_space(child_did1)) < 0) + HDexit(EXIT_FAILURE); + if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) + HDexit(EXIT_FAILURE); + if(tdims[0] != 1) + HDexit(EXIT_FAILURE); - /* Read from the dataset via did2 */ - if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - HDexit(EXIT_FAILURE); + /* Read from the dataset via did2 */ + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + HDexit(EXIT_FAILURE); - /* Verify the data is correct */ - if(rbuf[0] != 99) - HDexit(EXIT_FAILURE); + /* Verify the data is correct */ + if(rbuf[0] != 99) + HDexit(EXIT_FAILURE); - /* Notify parent process */ - child_notify = 2; - if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); + /* Notify parent process */ + child_notify = 2; + if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); - /* Wait for notification from parent process */ - while(child_notify != 3) { - if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); - } + /* Wait for notification from parent process */ + while(child_notify != 3) { + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); + } - /* Refresh dataset via did1 */ - if(H5Drefresh(child_did1) < 0) - HDexit(EXIT_FAILURE); + /* Refresh dataset via did1 */ + if(H5Drefresh(child_did1) < 0) + HDexit(EXIT_FAILURE); - /* Get the dataset's dataspace and verify */ - if((child_sid = H5Dget_space(child_did1)) < 0) - HDexit(EXIT_FAILURE); - if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) - HDexit(EXIT_FAILURE); + /* Get the dataset's dataspace and verify */ + if((child_sid = H5Dget_space(child_did1)) < 0) + HDexit(EXIT_FAILURE); + if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) + HDexit(EXIT_FAILURE); - if(tdims[0] != 2) - HDexit(EXIT_FAILURE); + if(tdims[0] != 2) + HDexit(EXIT_FAILURE); - /* Read from the dataset */ - if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - HDexit(EXIT_FAILURE); + /* Read from the dataset */ + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + HDexit(EXIT_FAILURE); - /* Verify the data is correct */ - if(rbuf[0] != 100 || rbuf[1] != 100) - HDexit(EXIT_FAILURE); + /* Verify the data is correct */ + if(rbuf[0] != 100 || rbuf[1] != 100) + HDexit(EXIT_FAILURE); - /* Close the 2 datasets */ - if(H5Dclose(child_did1) < 0) - HDexit(EXIT_FAILURE); - if(H5Dclose(child_did2) < 0) - HDexit(EXIT_FAILURE); + /* Close the 2 datasets */ + if(H5Dclose(child_did1) < 0) + HDexit(EXIT_FAILURE); + if(H5Dclose(child_did2) < 0) + HDexit(EXIT_FAILURE); - /* Close the 2 files */ - if(H5Fclose(child_fid1) < 0) - HDexit(EXIT_FAILURE); - if(H5Fclose(child_fid2) < 0) - HDexit(EXIT_FAILURE); + /* Close the 2 files */ + if(H5Fclose(child_fid1) < 0) + HDexit(EXIT_FAILURE); + if(H5Fclose(child_fid2) < 0) + HDexit(EXIT_FAILURE); - /* Close the pipes */ - if(HDclose(out_pdf[0]) < 0) - HDexit(EXIT_FAILURE); - if(HDclose(in_pdf[1]) < 0) - HDexit(EXIT_FAILURE); + /* Close the pipes */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + if(HDclose(in_pdf[1]) < 0) + HDexit(EXIT_FAILURE); - HDexit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); } /* Close unused read end for out_pdf */ @@ -7042,7 +7042,7 @@ main(void) * by the environment variable. */ driver = HDgetenv("HDF5_DRIVER"); - if(!H5FD_supports_swmr_test(driver)) { + if(!H5FD__supports_swmr_test(driver)) { printf("This VFD does not support SWMR I/O\n"); return EXIT_SUCCESS; } /* end if */ diff --git a/test/swmr_check_compat_vfd.c b/test/swmr_check_compat_vfd.c index 1589f6e..e249e09 100644 --- a/test/swmr_check_compat_vfd.c +++ b/test/swmr_check_compat_vfd.c @@ -46,7 +46,7 @@ main(void) driver = HDgetenv("HDF5_DRIVER"); - if(H5FD_supports_swmr_test(driver)) + if(H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; else return EXIT_FAILURE; diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index 0fc0289..b9ed9ce 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -226,81 +226,84 @@ convert(hid_t fid, const char *dname) /* Open the dataset */ if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) { - error_msg("unable to open dataset \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; - - } else if(verbose_g) - HDfprintf(stdout, "Open the dataset\n"); + error_msg("unable to open dataset \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Open the dataset\n"); /* Get the dataset's creation property list */ if((dcpl = H5Dget_create_plist(did)) < 0) { - error_msg("unable to get the dataset creation property list\n"); - h5tools_setstatus(EXIT_FAILURE); - goto error; + error_msg("unable to get the dataset creation property list\n"); + h5tools_setstatus(EXIT_FAILURE); + goto error; } /* Get the dataset's layout */ if((layout_type = H5Pget_layout(dcpl)) < 0) { - error_msg("unable to get the dataset layout type\n"); - h5tools_setstatus(EXIT_FAILURE); - goto error; - - } else if(verbose_g) - HDfprintf(stdout, "Retrieve the dataset's layout\n"); + error_msg("unable to get the dataset layout type\n"); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Retrieve the dataset's layout\n"); switch(layout_type) { - case H5D_CHUNKED: - if(verbose_g) - HDfprintf(stdout, "Dataset is a chunked dataset\n"); - - /* Get the dataset's chunk indexing type */ - if(H5Dget_chunk_index_type(did, &idx_type) < 0) { - error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); + case H5D_CHUNKED: + if(verbose_g) + HDfprintf(stdout, "Dataset is a chunked dataset\n"); + + /* Get the dataset's chunk indexing type */ + if(H5Dget_chunk_index_type(did, &idx_type) < 0) { + error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); + + if(idx_type == H5D_CHUNK_IDX_BTREE) { + if(verbose_g) + HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n"); + h5tools_setstatus(EXIT_SUCCESS); + goto done; + } + else if (verbose_g) + HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); - if(idx_type == H5D_CHUNK_IDX_BTREE) { - if(verbose_g) - HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; - } else if (verbose_g) - HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); break; - case H5D_CONTIGUOUS: - if(verbose_g) - HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n"); - break; + case H5D_CONTIGUOUS: + if(verbose_g) + HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n"); + break; - case H5D_COMPACT: - if(verbose_g) - HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n"); - break; + case H5D_COMPACT: + if(verbose_g) + HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n"); + break; - case H5D_VIRTUAL: - if(verbose_g) - HDfprintf(stdout, "No further action for virtual dataset\n"); - goto done; + case H5D_VIRTUAL: + if(verbose_g) + HDfprintf(stdout, "No further action for virtual dataset\n"); + goto done; - case H5D_NLAYOUTS: - case H5D_LAYOUT_ERROR: - default: - error_msg("unknown layout type for \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; + case H5D_NLAYOUTS: + case H5D_LAYOUT_ERROR: + default: + error_msg("unknown layout type for \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; } /* end switch */ /* No further action if it is a noop */ if(noop_g) { - if(verbose_g) - HDfprintf(stdout, "Not converting the dataset\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; + if(verbose_g) + HDfprintf(stdout, "Not converting the dataset\n"); + h5tools_setstatus(EXIT_SUCCESS); + goto done; } if(verbose_g) @@ -308,51 +311,54 @@ convert(hid_t fid, const char *dname) /* Downgrade the dataset */ if(H5Dformat_convert(did) < 0) { - error_msg("unable to downgrade dataset \"%s\"\n", dname); - h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - HDfprintf(stdout, "Done\n"); + error_msg("unable to downgrade dataset \"%s\"\n", dname); + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Done\n"); done: /* Close the dataset */ if(H5Dclose(did) < 0) { error_msg("unable to close dataset \"%s\"\n", dname); h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - HDfprintf(stdout, "Close the dataset\n"); + goto error; + } + else if(verbose_g) + HDfprintf(stdout, "Close the dataset\n"); /* Close the dataset creation property list */ if(H5Pclose(dcpl) < 0) { error_msg("unable to close dataset creation property list\n"); h5tools_setstatus(EXIT_FAILURE); - goto error; - } else if(verbose_g) - printf("Close the dataset creation property list\n"); + goto error; + } + else if(verbose_g) + HDprintf("Close the dataset creation property list\n"); - return(0); + return 0; error: if(verbose_g) - HDfprintf(stdout, "Error encountered\n"); + HDfprintf(stdout, "Error encountered\n"); H5E_BEGIN_TRY { H5Pclose(dcpl); H5Dclose(did); } H5E_END_TRY; - return(-1); + return -1; } /* convert() */ /*------------------------------------------------------------------------- - * Function: convert_dsets_cb() + * Function: convert_dsets_cb() * - * Purpose: The callback routine from the traversal to convert the - * chunk indexing type of the dataset object. + * Purpose: The callback routine from the traversal to convert the + * chunk indexing type of the dataset object. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static int @@ -363,11 +369,11 @@ convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_vis /* If the object has already been seen then just return */ if(NULL == already_visited) { if(oi->type == H5O_TYPE_DATASET) { - if(verbose_g) - HDfprintf(stdout, "Going to process dataset:%s...\n", path); - if(convert(fid, path) < 0) - goto error; - } /* end if */ + if(verbose_g) + HDfprintf(stdout, "Going to process dataset:%s...\n", path); + if(convert(fid, path) < 0) + goto error; + } /* end if */ } /* end if */ return 0; diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 01ba4af..4f3e7a4 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -221,7 +221,7 @@ main (int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); - parse_command_line (argc, argv); + parse_command_line(argc, argv); if (ub_file == NULL) { /* no user block */ @@ -252,21 +252,21 @@ main (int argc, const char *argv[]) leave (EXIT_FAILURE); } - ifile = H5Fopen (input_file, H5F_ACC_RDONLY, H5P_DEFAULT); + ifile = H5Fopen(input_file, H5F_ACC_RDONLY, H5P_DEFAULT); if (ifile < 0) { error_msg("Can't open input HDF5 file \"%s\"\n", input_file); leave (EXIT_FAILURE); } - plist = H5Fget_create_plist (ifile); + plist = H5Fget_create_plist(ifile); if (plist < 0) { error_msg("Can't get file creation plist for file \"%s\"\n", input_file); H5Fclose(ifile); leave (EXIT_FAILURE); } - status = H5Pget_userblock (plist, &usize); + status = H5Pget_userblock(plist, &usize); if (status < 0) { error_msg("Can't get user block for file \"%s\"\n", input_file); H5Pclose(plist); @@ -330,7 +330,7 @@ main (int argc, const char *argv[]) } } - newubsize = compute_user_block_size ((hsize_t) fsize); + newubsize = compute_user_block_size((hsize_t) fsize); startub = usize; @@ -345,22 +345,22 @@ main (int argc, const char *argv[]) else { /* add new ub to current ublock, pad to new offset */ newubsize += usize; - newubsize = compute_user_block_size ((hsize_t) newubsize); + newubsize = compute_user_block_size((hsize_t) newubsize); } } /* copy the HDF5 from starting at usize to starting at newubsize: * makes room at 'from' for new ub */ /* if no current ub, usize is 0 */ - copy_some_to_file (h5fid, ofid, usize, newubsize, (ssize_t) (h5fsize - usize)); + copy_some_to_file(h5fid, ofid, usize, newubsize, (ssize_t) (h5fsize - usize)); /* copy the old ub to the beginning of the new file */ if (!do_clobber) { - where = copy_some_to_file (h5fid, ofid, (hsize_t) 0, (hsize_t) 0, (ssize_t) usize); + where = copy_some_to_file(h5fid, ofid, (hsize_t) 0, (hsize_t) 0, (ssize_t) usize); } /* copy the new ub to the end of the ub */ - where = copy_some_to_file (ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1); + where = copy_some_to_file(ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1); /* pad the ub */ if(write_pad(ofid, where, &where) < 0) { @@ -372,18 +372,18 @@ main (int argc, const char *argv[]) } /* end if */ if(ub_file) - HDfree (ub_file); + HDfree(ub_file); if(input_file) - HDfree (input_file); + HDfree(input_file); if(output_file) - HDfree (output_file); + HDfree(output_file); if(ufid >= 0) - HDclose (ufid); + HDclose(ufid); if(h5fid >= 0) - HDclose (h5fid); + HDclose(h5fid); if(ofid >= 0) - HDclose (ofid); + HDclose(ofid); return h5tools_getstatus(); } diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index b66e7ce..088e6e9 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -346,7 +346,7 @@ main(int argc, char *argv[]) /* * Debug a global heap collection. */ - status = H5HG_debug (f, addr, stdout, 0, VCOL); + status = H5HG_debug(f, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 7321c66..4f92cae 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include "hdf5.h" #include "H5private.h" @@ -110,6 +108,10 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define SPACE1_DIM1 0 #define SPACE1_DIM2 0 +/* Error macros */ +#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); +#define PROGRAM_ERROR {AT(); goto error;} + /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group, @@ -178,7 +180,7 @@ static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int ma static void gen_datareg(hid_t fid, int make_diffs); /* utilities */ static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); -static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); +static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); static int gen_dataset_idx(const char *file, int format); /*------------------------------------------------------------------------- @@ -286,7 +288,7 @@ int main(void) /* string dataset and attribute. HDFFV-10028 */ test_objs_strings(DIFF_STRINGS1, DIFF_STRINGS2); - return 0; + return EXIT_SUCCESS; } /*------------------------------------------------------------------------- @@ -4908,9 +4910,9 @@ out: * types. * h5diff should show non-comparable output from these common objects. *-------------------------------------------------------------------------*/ -static void test_objs_nocomparables(const char *fname1, const char *fname2) +static void +test_objs_nocomparables(const char *fname1, const char *fname2) { - herr_t status = SUCCEED; hid_t fid1 = -1; hid_t fid2 = -1; hid_t topgid1 = -1; @@ -4927,110 +4929,90 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) * Open file(s) to add objects *------------------------------------------------------------------------*/ /* file1 */ - fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); - status = FAIL; - goto out; - } + if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* file2 */ - fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname2); - status = FAIL; - goto out; - } + if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /*----------------------------------------------------------------------- * in file1 : add member objects *------------------------------------------------------------------------*/ /* parent group */ - topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); - status = FAIL; - goto out; - } + if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* dataset */ - status = write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1); - if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); - goto out; - } + if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0) + PROGRAM_ERROR /* group */ - gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); - status = FAIL; - goto out; - } + if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* committed type */ - tid1 = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); - goto out; - } + if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR + if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR /*----------------------------------------------------------------------- * in file2 : add member objects *------------------------------------------------------------------------*/ /* parent group */ - topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); - status = FAIL; - goto out; - } + if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* group */ - gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); - status = FAIL; - goto out; - } + if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* committed type */ - tid2 = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); - goto out; - } + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR + if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR /* dataset */ - status = write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2); - if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); - goto out; - } + if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0) + PROGRAM_ERROR -out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if (fid1) + if(H5Fclose(fid1) < 0) + PROGRAM_ERROR + if(H5Fclose(fid2) < 0) + PROGRAM_ERROR + if(H5Gclose(topgid1) < 0) + PROGRAM_ERROR + if(H5Gclose(topgid2) < 0) + PROGRAM_ERROR + if(H5Gclose(gid1) < 0) + PROGRAM_ERROR + if(H5Gclose(gid2) < 0) + PROGRAM_ERROR + if(H5Tclose(tid1) < 0) + PROGRAM_ERROR + if(H5Tclose(tid2) < 0) + PROGRAM_ERROR + + return; + +error: + H5E_BEGIN_TRY { H5Fclose(fid1); - if (fid2) H5Fclose(fid2); - if (topgid1) H5Gclose(topgid1); - if (topgid2) H5Gclose(topgid2); - if (gid1) H5Gclose(gid1); - if (gid2) H5Gclose(gid2); - if (tid1) H5Tclose(tid1); - if (tid2) H5Tclose(tid2); + } H5E_END_TRY; + return; } static hid_t mkstr(int size, H5T_str_t pad) @@ -8085,36 +8067,40 @@ out: * *------------------------------------------------------------------------- */ -static -int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) +static herr_t +write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { hid_t did = -1; hid_t sid = -1; /* create a space */ - if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) - goto out; + if((sid = H5Screate_simple(rank, dims, NULL)) < 0) + PROGRAM_ERROR /* create the dataset */ - if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* write */ - if (buf) { - if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto out; - } + if(buf) + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + PROGRAM_ERROR /* close */ - H5Dclose(did); - H5Sclose(sid); + if(H5Dclose(did) < 0) + PROGRAM_ERROR + if(H5Sclose(sid) < 0) + PROGRAM_ERROR return SUCCEED; -out: +error: + + H5E_BEGIN_TRY { + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; - H5Dclose(did); - H5Sclose(sid); return FAIL; -} +} /* end write_dset() */ diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c index 8e4b3ac..667f2d9 100644 --- a/tools/test/h5jam/tellub.c +++ b/tools/test/h5jam/tellub.c @@ -26,9 +26,9 @@ */ static const char *s_opts = "h"; static struct long_options l_opts[] = { - {"help", no_arg, 'h'}, - {"hel", no_arg, 'h'}, - {NULL, 0, '\0'} + {"help", no_arg, 'h'}, + {"hel", no_arg, 'h'}, + {NULL, 0, '\0'} }; /*------------------------------------------------------------------------- @@ -37,152 +37,126 @@ static struct long_options l_opts[] = { * Purpose: Print the usage message * * Return: void - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ static void usage (const char *prog) { - fflush (stdout); - fprintf (stdout, "usage: %s h5_file\n", prog); - fprintf (stdout, - " Check that h5_fil is HDF5 file and print size of user block \n"); - fprintf (stdout, " %s -h\n", prog); - fprintf (stdout, " Print a usage message and exit\n"); -} + HDfflush(stdout); + HDfprintf(stdout, "usage: %s h5_file\n", prog); + HDfprintf(stdout, + " Check that h5_fil is HDF5 file and print size of user block \n"); + HDfprintf(stdout, " %s -h\n", prog); + HDfprintf(stdout, " Print a usage message and exit\n"); +} /* end usage() */ /*------------------------------------------------------------------------- * Function: parse_command_line * * Purpose: Parse the command line for the h5dumper. * - * Return: Success: - * + * Return: Success: void * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ static void parse_command_line (int argc, const char *argv[]) { - int opt; - - /* parse command line options */ - while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) - { - switch ((char) opt) - { - case 'h': - usage (h5tools_getprogname()); - exit (EXIT_SUCCESS); - case '?': - default: - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); - } + int opt; + + /* parse command line options */ + while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) { + switch ((char) opt) { + case 'h': + usage (h5tools_getprogname()); + HDexit(EXIT_SUCCESS); + case '?': + default: + usage (h5tools_getprogname()); + HDexit(EXIT_FAILURE); + } } - /* check for file name to be processed */ - if (argc <= opt_ind) - { - error_msg("missing file name\n"); - usage (h5tools_getprogname()); - exit (EXIT_FAILURE); + /* check for file name to be processed */ + if (argc <= opt_ind) { + error_msg("missing file name\n"); + usage (h5tools_getprogname()); + HDexit(EXIT_FAILURE); } -} +} /* end parse_command_line() */ /*------------------------------------------------------------------------- * Function: main * * Purpose: HDF5 user block unjammer * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: - * - * Modifications: - * + * Return: EXIT_SUCCESS/EXIT_FAILURE *------------------------------------------------------------------------- */ int main (int argc, const char *argv[]) { - char *ifname; - void *edata; - H5E_auto2_t func; - hid_t ifile; - hsize_t usize; - htri_t testval; - herr_t status; - hid_t plist; - - h5tools_setprogname(PROGRAMNAME); - h5tools_setstatus(EXIT_SUCCESS); - - /* Initialize h5tools lib */ - h5tools_init(); - - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - parse_command_line (argc, argv); - - if (argc <= (opt_ind)) - { - error_msg("missing file name\n"); - usage (h5tools_getprogname()); - return (EXIT_FAILURE); + char *ifname; + void *edata; + H5E_auto2_t func; + hid_t ifile; + hsize_t usize; + htri_t testval; + herr_t status; + hid_t plist = -1; + + h5tools_setprogname(PROGRAMNAME); + h5tools_setstatus(EXIT_SUCCESS); + + /* Initialize h5tools lib */ + h5tools_init(); + + /* Disable error reporting */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + + parse_command_line(argc, argv); + + if(argc <= (opt_ind)) { + error_msg("missing file name\n"); + usage (h5tools_getprogname()); + return EXIT_FAILURE; } - ifname = HDstrdup (argv[opt_ind]); + ifname = HDstrdup(argv[opt_ind]); - testval = H5Fis_hdf5 (ifname); + testval = H5Fis_hdf5(ifname); - if (testval <= 0) - { - error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname); - return (EXIT_FAILURE); + if(testval <= 0) { + error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname); + return EXIT_FAILURE; } - ifile = H5Fopen (ifname, H5F_ACC_RDONLY, H5P_DEFAULT); + ifile = H5Fopen(ifname, H5F_ACC_RDONLY, H5P_DEFAULT); - if (ifile < 0) - { - error_msg("Can't open input HDF5 file \"%s\"\n", ifname); - return (EXIT_FAILURE); + if(ifile < 0) { + error_msg("Can't open input HDF5 file \"%s\"\n", ifname); + return EXIT_FAILURE; } - plist = H5Fget_create_plist (ifile); - if (plist < 0) - { - error_msg("Can't get file creation plist for file \"%s\"\n", - ifname); - return (EXIT_FAILURE); + plist = H5Fget_create_plist(ifile); + if(plist < 0) { + error_msg("Can't get file creation plist for file \"%s\"\n", ifname); + return EXIT_FAILURE; } - status = H5Pget_userblock (plist, &usize); - if (status < 0) - { - error_msg("Can't get user block for file \"%s\"\n", ifname); - return (EXIT_FAILURE); + status = H5Pget_userblock(plist, &usize); + if(status < 0) { + error_msg("Can't get user block for file \"%s\"\n", ifname); + return EXIT_FAILURE; } - printf ("%ld\n", (long) usize); + HDprintf("%ld\n", (long) usize); - H5Pclose (plist); - H5Fclose (ifile); + H5Pclose (plist); + H5Fclose (ifile); - return (EXIT_SUCCESS); -} + return EXIT_SUCCESS; +} /* end main() */ diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index b0a2f99..a36eb08 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -997,6 +997,7 @@ fi ############################################################################## ### T H E T E S T S ############################################################################## + # prepare for test COPY_TESTFILES_TO_TESTDIR diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in index 5082daf..0a5127f 100644 --- a/tools/test/h5stat/testh5stat.sh.in +++ b/tools/test/h5stat/testh5stat.sh.in @@ -249,7 +249,6 @@ TOOLTEST h5stat_help2.ddl --help TOOLTEST h5stat_notexist.ddl notexist.h5 TOOLTEST h5stat_nofile.ddl '' - # Test file with groups, compressed datasets, user-applied fileters, etc. # h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4 TOOLTEST h5stat_filters.ddl h5stat_filters.h5 -- cgit v0.12 From fe418f6c2389122bbab2404046513fac9d6dab7e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Sep 2018 08:06:05 -0500 Subject: Use constants for test comparisons --- java/test/TestH5E.java | 6 +++--- java/test/TestH5Edefault.java | 44 +++++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 656069a..7810c74 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -168,7 +168,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Epop #:" + num_msg, num_msg == 3); try { H5.H5Epop(current_stackid, 1); @@ -186,7 +186,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop", num_msg == 3); + assertTrue("H5.H5Epop", num_msg == 2); } @Test @@ -314,7 +314,7 @@ public class TestH5E { err.printStackTrace(); fail("testH5Ewalk:H5Eget_num " + err); } - assertTrue("testH5Ewalk #:" + num_msg, num_msg == 4); + assertTrue("testH5Ewalk #:" + num_msg, num_msg == 3); try { H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 5324d3a..e6ac7fa 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -27,6 +27,10 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Edefault { + public static final int ERRSTACK_CNT = 3; + public static final int ERRSTACK_MTY_CNT = 0; + public static final int ERRSTACK_POP_CNT = 2; + @Rule public TestName testname = new TestName(); @Before @@ -91,7 +95,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); //Save a copy of the current stack and clears the current stack try { @@ -122,7 +126,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); try { H5.H5Eclose_stack(stack_id); @@ -153,7 +157,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); //Save a copy of the current stack and clears the current stack try { @@ -174,7 +178,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_MTY_CNT); //Verify the copy has the correct number of messages try { @@ -184,7 +188,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); //Generate errors on default stack try { @@ -202,7 +206,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); //Remove one message from the current stack try { @@ -213,7 +217,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == 3); + assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_POP_CNT); //Verify the copy still has the correct number of messages try { @@ -223,7 +227,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); } @Test(expected = IllegalArgumentException.class) @@ -293,7 +297,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); //Save a copy of the current stack try { @@ -314,7 +318,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); //Generate errors on default stack try { @@ -332,7 +336,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); //Remove one message from the current stack try { @@ -343,7 +347,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == 3); + assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_POP_CNT); //Verify the copy still has the correct number of messages try { @@ -353,7 +357,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); try { H5.H5Eset_current_stack(stack_id); @@ -363,7 +367,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); } @Test(expected = IllegalArgumentException.class) @@ -386,7 +390,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop before #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Epop before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -395,7 +399,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop after #:" + num_msg, num_msg == 3); + assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_POP_CNT); } @Test(expected = IllegalArgumentException.class) @@ -471,7 +475,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eclear2_with_msg: " + err); } - assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); try { H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -480,7 +484,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eclear2_with_msg: " + err); } - assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0); + assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT); } @Test(expected = IllegalArgumentException.class) @@ -516,7 +520,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_num: " + err); } - assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == 0); + assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT); } @Test @@ -534,7 +538,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_num_with_msg: " + err); } - assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0); + assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > TestH5Edefault.ERRSTACK_MTY_CNT); } } -- cgit v0.12 From d2806d4875074efd03431385922480e27e32a060 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Sep 2018 08:52:13 -0500 Subject: HDFFV-10332 Adjust checks and generation of files --- src/CMakeLists.txt | 73 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1cd0a10..e90e580 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -860,6 +860,10 @@ else () set (HDF5_GENERATED_SOURCE_DIR ${HDF5_BINARY_DIR}) endif () +if (BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") +endif () + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") @@ -877,6 +881,30 @@ if (NOT EXISTS ${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 $ + 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 () +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 + 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 + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () endif () if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) @@ -896,6 +924,30 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) + if (BUILD_SHARED_LIBS) + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) + endif () + endif () +else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) + if (BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c" + DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) + endif () endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" @@ -933,27 +985,6 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - COMMAND $ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared - ) - endif () - - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - endif () - set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) -- cgit v0.12 From cd290ddecb084a4496f57d60ca8db10d8abdf5ee Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Sep 2018 08:58:08 -0500 Subject: Add Constants to all ERR STK checks --- java/test/TestH5E.java | 16 ++++++++++------ java/test/TestH5Edefault.java | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 7810c74..a1ca42c 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -37,6 +37,10 @@ import org.junit.rules.TestName; public class TestH5E { @Rule public TestName testname = new TestName(); + + public static final int ERRSTACK_CNT = 3; + public static final int ERRSTACK_MTY_CNT = 0; + long hdf_java_classid = -1; long current_stackid = -1; @@ -158,7 +162,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == 0); + assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT); try { num_msg = H5.H5Eget_num(current_stackid); @@ -168,7 +172,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == 3); + assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT); try { H5.H5Epop(current_stackid, 1); @@ -186,7 +190,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop", num_msg == 2); + assertTrue("H5.H5Epop", num_msg == TestH5E.ERRSTACK_CNT - 1); } @Test @@ -227,7 +231,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == 0); + assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT); } catch (Throwable err) { err.printStackTrace(); @@ -238,7 +242,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == 1); + assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT + 1); } catch (Throwable err) { err.printStackTrace(); @@ -314,7 +318,7 @@ public class TestH5E { err.printStackTrace(); fail("testH5Ewalk:H5Eget_num " + err); } - assertTrue("testH5Ewalk #:" + num_msg, num_msg == 3); + assertTrue("testH5Ewalk #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT); try { H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index e6ac7fa..8365027 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -27,12 +27,12 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Edefault { + @Rule public TestName testname = new TestName(); + public static final int ERRSTACK_CNT = 3; public static final int ERRSTACK_MTY_CNT = 0; public static final int ERRSTACK_POP_CNT = 2; - @Rule public TestName testname = new TestName(); - @Before public void H5Eset_default_stack() { assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); -- cgit v0.12 From bd1be52990553fa700c0aad09a3adcd28012af2f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Sep 2018 08:59:03 -0500 Subject: Fix typo --- java/test/TestH5E.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index a1ca42c..f6db1ed 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -242,7 +242,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT + 1); + assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT + 1); } catch (Throwable err) { err.printStackTrace(); -- cgit v0.12 From 59f36c5cdef1899742feb1c06ee09886e2d0a220 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 19 Sep 2018 10:52:43 -0500 Subject: Remove extra constant --- java/test/TestH5Edefault.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 8365027..b510936 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -31,7 +31,6 @@ public class TestH5Edefault { public static final int ERRSTACK_CNT = 3; public static final int ERRSTACK_MTY_CNT = 0; - public static final int ERRSTACK_POP_CNT = 2; @Before public void H5Eset_default_stack() { @@ -217,7 +216,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_POP_CNT); + assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT - 1); //Verify the copy still has the correct number of messages try { @@ -347,7 +346,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_POP_CNT); + assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1); //Verify the copy still has the correct number of messages try { @@ -399,7 +398,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_POP_CNT); + assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1); } @Test(expected = IllegalArgumentException.class) -- cgit v0.12 From b3ad9e1c0e3d70233518ee84bd68935f5adb3b89 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 20 Sep 2018 09:01:57 -0500 Subject: Fix missed replacement --- java/test/TestH5E.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index f6db1ed..1f4e658 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -328,7 +328,7 @@ public class TestH5E { fail("testH5Ewalk:H5Ewalk2 " + err); } assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty()); - assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==4); + assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==TestH5E.ERRSTACK_CNT); } } -- cgit v0.12 From 2862c93a2bd863a44ffe4e9664905090bc58f9ed Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 20 Sep 2018 10:15:12 -0500 Subject: Correct $withval usage in configure --- configure.ac | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index cedfcfd..469c53d 100644 --- a/configure.ac +++ b/configure.ac @@ -1261,8 +1261,8 @@ AC_ARG_WITH([dmalloc], [Use dmalloc memory debugging aid [default=no]])],, [withval=no]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_DMALLOC="yes" AC_CHECK_HEADERS([dmalloc.h],, [unset HAVE_DMALLOC]) if test "x$HAVE_DMALLOC" = "xyes"; then @@ -1272,7 +1272,7 @@ case $withval in AC_MSG_ERROR([couldn't find dmalloc library]) fi ;; - no) + X-|X-no|X-none) HAVE_DMALLOC="no" AC_MSG_CHECKING([for dmalloc library]) AC_MSG_RESULT([suppressed]) @@ -1340,8 +1340,8 @@ AC_ARG_WITH([zlib], filter [default=yes]])],, [withval=yes]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_ZLIB="yes" AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB]) if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then @@ -1355,7 +1355,7 @@ case $withval in AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) fi ;; - no) + X-|X-no|X-none) HAVE_ZLIB="no" AC_MSG_CHECKING([for zlib]) AC_MSG_RESULT([suppressed]) @@ -1434,8 +1434,8 @@ AC_ARG_WITH([szlib], filter [default=no]])],, [withval=no]) -case $withval in - yes) +case "X-$withval" in + X-yes) HAVE_SZLIB="yes" AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZLIB]) if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then @@ -1445,7 +1445,7 @@ case $withval in AC_MSG_ERROR([couldn't find szlib library]) fi ;; - no) + X-|X-no|X-none) HAVE_SZLIB="no" AC_MSG_CHECKING([for szlib]) AC_MSG_RESULT([suppressed]) -- cgit v0.12 From 67a126c7ba8825ffb193c930c7b8cae939b3446d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 20 Sep 2018 10:40:51 -0700 Subject: Normalization with vol_integration (test code and H5Xtest.c) --- src/H5ACprivate.h | 2 +- src/H5Atest.c | 34 +- src/H5Ctest.c | 2 +- src/H5Dtest.c | 8 +- src/H5EApkg.h | 4 +- src/H5EAtest.c | 16 +- src/H5Edeprec.c | 10 +- src/H5FApkg.h | 4 +- src/H5FAtest.c | 25 +- src/H5FDspace.c | 1 + src/H5FSpkg.h | 4 +- src/H5FStest.c | 20 +- src/H5Fpkg.h | 10 +- src/H5Ftest.c | 105 ++-- src/H5Gpkg.h | 3 +- src/H5Gtest.c | 80 ++- src/H5HLdbg.c | 46 +- src/H5Ipublic.h | 2 +- src/H5MF.c | 3 + src/H5MFprivate.h | 3 +- src/H5Opkg.h | 19 +- src/H5Otest.c | 130 ++--- src/H5PBprivate.h | 6 +- src/H5Ppkg.h | 4 +- src/H5Ptest.c | 40 +- src/H5SMtest.c | 2 +- src/H5TS.c | 6 +- src/H5TSprivate.h | 1 + test/cache_common.c | 107 ++-- test/cache_logging.c | 9 +- test/cache_tagging.c | 25 +- test/dangle.c | 3 +- test/earray.c | 10 +- test/efc.c | 13 +- test/err_compat.c | 2 +- test/evict_on_close.c | 48 +- test/farray.c | 328 ++++++------ test/fheap.c | 2 +- test/fillval.c | 57 ++- test/freespace.c | 22 +- test/gheap.c | 344 ++++++------- test/h5test.c | 10 +- test/istore.c | 2 +- test/lheap.c | 12 +- test/mf.c | 74 +-- test/objcopy.c | 1 - test/ohdr.c | 30 +- test/page_buffer.c | 10 +- test/swmr.c | 4 +- test/swmr_generator.c | 4 +- test/tarray.c | 40 +- test/tattr.c | 1154 +++++++++++++++++++++---------------------- test/testfiles/err_compat_1 | 2 +- test/testframe.c | 8 +- test/testhdf5.c | 4 +- test/tfile.c | 37 +- test/tgenprop.c | 12 +- test/th5s.c | 1 - test/tmisc.c | 30 +- test/tsohm.c | 24 +- test/tunicode.c | 2 +- test/tvltypes.c | 4 +- test/unregister.c | 239 +++++---- test/vfd.c | 21 +- 64 files changed, 1627 insertions(+), 1658 deletions(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 99cc0e9..0e8620d 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -435,7 +435,7 @@ H5_DLL herr_t H5AC_get_mdc_image_info(H5AC_t *cache_ptr, haddr_t *image_addr, /* Tag & Ring routines */ H5_DLL void H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag); H5_DLL herr_t H5AC_flush_tagged_metadata(H5F_t *f, haddr_t metadata_tag); -H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t * f, haddr_t metadata_tag, hbool_t match_global); +H5_DLL herr_t H5AC_evict_tagged_metadata(H5F_t *f, haddr_t metadata_tag, hbool_t match_global); H5_DLL herr_t H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag); H5_DLL herr_t H5AC_ignore_tags(const H5F_t *f); H5_DLL herr_t H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked); diff --git a/src/H5Atest.c b/src/H5Atest.c index 31fbe8e..36c3d35 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Atest.c - * Dec 18 2006 - * Quincey Koziol + * Created: H5Atest.c * - * Purpose: Attribute testing routines. + * Purpose: Attribute testing routines. * *------------------------------------------------------------------------- */ @@ -27,19 +25,19 @@ /****************/ #include "H5Amodule.h" /* This source code file is part of the H5A module */ -#define H5A_TESTING /*suppress warning about H5A testing funcs*/ +#define H5A_TESTING /* Suppress warning about H5A testing funcs */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5SMprivate.h" /* Shared object header messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMprivate.h" /* Shared object header messages */ /****************/ @@ -78,12 +76,11 @@ /*------------------------------------------------------------------------- - * Function: H5A__is_shared_test + * Function: H5A__is_shared_test * * Purpose: Check if an attribute is shared * - * Return: Success: Non-negative - * Failure: Negative + * Return: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol * Dec 19, 2006 @@ -111,12 +108,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__get_shared_rc_test + * Function: H5A__get_shared_rc_test * * Purpose: Retrieve the refcount for a shared attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 19, 2006 @@ -127,7 +123,7 @@ herr_t H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count) { H5A_t *attr; /* Attribute object for ID */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Ctest.c b/src/H5Ctest.c index 2cd0a5d..9da6350 100644 --- a/src/H5Ctest.c +++ b/src/H5Ctest.c @@ -143,7 +143,7 @@ H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status) /* Get file pointer */ if(NULL == (f = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Get cache pointer */ cache = f->shared->cache; diff --git a/src/H5Dtest.c b/src/H5Dtest.c index c2b6199..ac1d05a 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -28,10 +28,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ /****************/ diff --git a/src/H5EApkg.h b/src/H5EApkg.h index fb9afc0..0adcde2 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -469,8 +469,8 @@ H5_DLL herr_t H5EA__dblock_debug(H5F_t *f, haddr_t addr, /* Testing routines */ #ifdef H5EA_TESTING -H5_DLL herr_t H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam); -H5_DLL int H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2); +H5_DLL herr_t H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam); +H5_DLL int H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2); #endif /* H5EA_TESTING */ #endif /* _H5EApkg_H */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 3da7996..7c02e16 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -401,7 +401,7 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */ /*------------------------------------------------------------------------- - * Function: H5EA_get_cparam_test + * Function: H5EA__get_cparam_test * * Purpose: Retrieve the parameters used to create the extensible array * @@ -413,9 +413,9 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, +BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, -H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) +H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) /* Check arguments. */ HDassert(ea); @@ -429,11 +429,11 @@ H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) cparam->data_blk_min_elmts = ea->hdr->cparam.data_blk_min_elmts; cparam->max_dblk_page_nelmts_bits = ea->hdr->cparam.max_dblk_page_nelmts_bits; -END_FUNC(PRIV) /* end H5EA_get_cparam_test() */ +END_FUNC(PKG) /* end H5EA__get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5EA_cmp_cparam_test + * Function: H5EA__cmp_cparam_test * * Purpose: Compare the parameters used to create the extensible array * @@ -445,9 +445,9 @@ END_FUNC(PRIV) /* end H5EA_get_cparam_test() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERRCATCH, +BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, -H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)) +H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)) /* Check arguments. */ HDassert(cparam1); @@ -481,5 +481,5 @@ H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2) CATCH -END_FUNC(PRIV) /* end H5EA_cmp_cparam_test() */ +END_FUNC(PKG) /* end H5EA__cmp_cparam_test() */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 603d448..4462303 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -227,7 +227,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eclear1 * - * Purpose: This function is for backward compatbility. + * Purpose: This function is for backward compatibility. * Clears the error stack for the specified error stack. * * Return: SUCCEED/FAIL @@ -258,7 +258,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eprint1 * - * Purpose: This function is for backward compatbility. + * Purpose: This function is for backward compatibility. * Prints the error stack in some default way. This is just a * convenience function for H5Ewalk() with a function that * prints error messages. Users are encouraged to write there @@ -296,7 +296,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Ewalk1 * - * Purpose: This function is for backward compatbility. + * Purpose: This function is for backward compatibility. * Walks the error stack for the current thread and calls some * function for each error along the way. * @@ -335,7 +335,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eget_auto1 * - * Purpose: This function is for backward compatbility. + * Purpose: This function is for backward compatibility. * Returns the current settings for the automatic error stack * traversal function and its data for specific error stack. * Either (or both) arguments may be null in which case the @@ -381,7 +381,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Eset_auto1 * - * Purpose: This function is for backward compatbility. + * Purpose: This function is for backward compatibility. * Turns on or off automatic printing of errors for certain * error stack. When turned on (non-null FUNC pointer) any * API function which returns an error indication will first diff --git a/src/H5FApkg.h b/src/H5FApkg.h index 720c046..6ce899e 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -307,8 +307,8 @@ H5_DLL herr_t H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, /* Testing routines */ #ifdef H5FA_TESTING -H5_DLL herr_t H5FA_get_cparam_test(const H5FA_t *ea, H5FA_create_t *cparam); -H5_DLL int H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2); +H5_DLL herr_t H5FA__get_cparam_test(const H5FA_t *ea, H5FA_create_t *cparam); +H5_DLL int H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2); #endif /* H5FA_TESTING */ #endif /* _H5FApkg_H */ diff --git a/src/H5FAtest.c b/src/H5FAtest.c index 4b03036..27cd8b7 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -70,12 +70,9 @@ typedef struct H5FA__test_ctx_t { static void *H5FA__test_crt_context(void *udata); static herr_t H5FA__test_dst_context(void *ctx); static herr_t H5FA__test_fill(void *nat_blk, size_t nelmts); -static herr_t H5FA__test_encode(void *raw, const void *elmt, size_t nelmts, - void *ctx); -static herr_t H5FA__test_decode(const void *raw, void *elmt, size_t nelmts, - void *ctx); -static herr_t H5FA__test_debug(FILE *stream, int indent, int fwidth, - hsize_t idx, const void *elmt); +static herr_t H5FA__test_encode(void *raw, const void *elmt, size_t nelmts, void *ctx); +static herr_t H5FA__test_decode(const void *raw, void *elmt, size_t nelmts, void *ctx); +static herr_t H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt); static void *H5FA__test_crt_dbg_context(H5F_t *f, haddr_t obj_addr); @@ -361,7 +358,7 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ /*------------------------------------------------------------------------- - * Function: H5FA_get_cparam_test + * Function: H5FA__get_cparam_test * * Purpose: Retrieve the parameters used to create the fixed array * @@ -372,9 +369,9 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, NOERR, +BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, -H5FA_get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) +H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) /* Check arguments. */ HDassert(fa); @@ -384,11 +381,11 @@ H5FA_get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) cparam->raw_elmt_size = fa->hdr->cparam.raw_elmt_size; cparam->nelmts = fa->hdr->cparam.nelmts; -END_FUNC(PRIV) /* end H5FA_get_cparam_test() */ +END_FUNC(PKG) /* end H5FA__get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5FA_cmp_cparam_test + * Function: H5FA__cmp_cparam_test * * Purpose: Compare the parameters used to create the fixed array * @@ -399,9 +396,9 @@ END_FUNC(PRIV) /* end H5FA_get_cparam_test() */ * *------------------------------------------------------------------------- */ -BEGIN_FUNC(PRIV, ERRCATCH, +BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, -H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)) +H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)) /* Check arguments. */ HDassert(cparam1); @@ -415,5 +412,5 @@ H5FA_cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2) CATCH -END_FUNC(PRIV) /* end H5FA_cmp_cparam_test() */ +END_FUNC(PKG) /* end H5FA__cmp_cparam_test() */ diff --git a/src/H5FDspace.c b/src/H5FDspace.c index e158a44..69fcb96 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -38,6 +38,7 @@ #include "H5Fprivate.h" /* File access */ #include "H5FDpkg.h" /* File Drivers */ #include "H5FDmulti.h" /* Usage-partitioned file family */ +#include "H5FLprivate.h" /* Free lists */ /****************/ diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index a5896ee..f160055 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -242,8 +242,8 @@ H5_DLL void H5FS__sect_assert(const H5FS_t *fspace); /* Testing routines */ #ifdef H5FS_TESTING -H5_DLL herr_t H5FS_get_cparam_test(const H5FS_t *fh, H5FS_create_t *cparam); -H5_DLL int H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2); +H5_DLL herr_t H5FS__get_cparam_test(const H5FS_t *fh, H5FS_create_t *cparam); +H5_DLL int H5FS__cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2); #endif /* H5FS_TESTING */ #endif /* _H5FSpkg_H */ diff --git a/src/H5FStest.c b/src/H5FStest.c index 5ab0219..120a9a8 100644 --- a/src/H5FStest.c +++ b/src/H5FStest.c @@ -69,7 +69,7 @@ /*------------------------------------------------------------------------- - * Function: H5FS_get_cparam_test + * Function: H5FS__get_cparam_test * * Purpose: Retrieve the parameters used to create the free-space manager * similar to H5HF_get_cparam_test() @@ -82,9 +82,9 @@ *------------------------------------------------------------------------- */ herr_t -H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) +H5FS__get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(frsp); @@ -97,16 +97,16 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) cparam->max_sect_size = frsp->max_sect_size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_get_cparam_test() */ +} /* H5FS__get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5FS_cmp_cparam_test + * Function: H5FS__cmp_cparam_test * * Purpose: Compare the parameters used to create the free space manager * similar to H5HF_cmp_cparam_test() * - * Return: SUCCEED/FAIL + * Return: A value like strcmp() * * Programmer: Vailin Choi * August 25th, 2008 @@ -114,11 +114,11 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) *------------------------------------------------------------------------- */ int -H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2) +H5FS__cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2) { - int ret_value = SUCCEED; /* Return value */ + int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(cparam1); @@ -151,5 +151,5 @@ H5FS_cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_cmp_cparam_test */ +} /* H5FS__cmp_cparam_test */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2e8a793..3716c66 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -30,7 +30,7 @@ #include "H5Fprivate.h" /* Other public headers needed by this file */ -#include "H5Bpublic.h" /* B-tree header, for H5B_NUM_BTREE_ID */ +#include "H5Bpublic.h" /* B-tree header (for H5B_NUM_BTREE_ID) */ /* Other private headers needed by this file */ #include "H5private.h" /* Generic Functions */ @@ -462,10 +462,10 @@ H5_DLL herr_t H5F__evict_cache_entries(H5F_t *f); /* Testing functions */ #ifdef H5F_TESTING -H5_DLL herr_t H5F_get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count); -H5_DLL herr_t H5F_check_cached_stab_test(hid_t file_id); -H5_DLL herr_t H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); -H5_DLL herr_t H5F_get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); +H5_DLL herr_t H5F__get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t *mesg_count); +H5_DLL herr_t H5F__check_cached_stab_test(hid_t file_id); +H5_DLL herr_t H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); +H5_DLL herr_t H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); #endif /* H5F_TESTING */ #endif /* _H5Fpkg_H */ diff --git a/src/H5Ftest.c b/src/H5Ftest.c index bdecad2..df9c933 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -26,24 +26,24 @@ /* Module Setup */ /****************/ -#include "H5Fmodule.h" /* This source code file is part of the H5F module */ -#define H5F_TESTING /*suppress warning about H5F testing funcs*/ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ -#define H5G_TESTING /*suppress warning about H5G testing funcs*/ -#define H5SM_FRIEND /*suppress error about including H5SMpkg */ -#define H5SM_TESTING /*suppress warning about H5SM testing funcs*/ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ +#define H5F_TESTING /* Suppress warning about H5F testing funcs */ +#define H5G_FRIEND /* Suppress error about including H5Gpkg.h */ +#define H5G_TESTING /* Suppress warning about H5G testing funcs */ +#define H5SM_FRIEND /* Suppress error about including H5SMpkg.h */ +#define H5SM_TESTING /* Suppress warning about H5SM testing funcs */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5SMpkg.h" /* Shared object header messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMpkg.h" /* Shared object header messages */ /****************/ @@ -82,31 +82,29 @@ /*------------------------------------------------------------------------- - * Function: H5F_get_sohm_mesg_count_test + * Function: H5F__get_sohm_mesg_count_test * * Purpose: Retrieve the number of shared messages of a given type in a file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jan 3, 2007 + * Programmer: Quincey Koziol + * Jan 3, 2007 * *------------------------------------------------------------------------- */ herr_t -H5F_get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, - size_t *mesg_count) +H5F__get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_count) { - H5F_t *file; /* File info */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Push API context */ if(H5CX_push() < 0) @@ -122,19 +120,18 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_sohm_mesg_count_test() */ +} /* end H5F__get_sohm_mesg_count_test() */ /*------------------------------------------------------------------------- - * Function: H5F_check_cached_stab_test + * Function: H5F__check_cached_stab_test * * Purpose: Check that a file's superblock contains a cached symbol * table entry, that the entry matches that in the root * group's object header, and check that the addresses are * valid. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Mar 31, 2009 @@ -142,17 +139,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_check_cached_stab_test(hid_t file_id) +H5F__check_cached_stab_test(hid_t file_id) { - H5F_t *file; /* File info */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Push API context */ if(H5CX_push() < 0) @@ -168,16 +165,15 @@ done: HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_check_cached_stab_test() */ +} /* end H5F__check_cached_stab_test() */ /*------------------------------------------------------------------------- - * Function: H5F_get_maxaddr_test + * Function: H5F__get_maxaddr_test * * Purpose: Retrieve the maximum address for a file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Jun 10, 2009 @@ -185,33 +181,32 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_get_maxaddr_test(hid_t file_id, haddr_t *maxaddr) +H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Retrieve maxaddr for file */ *maxaddr = file->shared->maxaddr; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_maxaddr_test() */ +} /* end H5F__get_maxaddr_test() */ /*------------------------------------------------------------------------- - * Function: H5F_get_sbe_addr_test + * Function: H5F__get_sbe_addr_test * * Purpose: Retrieve the address of a superblock extension's object header - * for a file + * for a file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Jul 10, 2016 @@ -219,21 +214,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr) +H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Retrieve maxaddr for file */ *sbe_addr = file->shared->sblock->ext_addr; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_sbe_addr_test() */ +} /* end H5F__get_sbe_addr_test() */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index b89777d..ae697ad 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -429,8 +429,7 @@ H5_DLL herr_t H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type H5_DLL herr_t H5G__link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, hsize_t *last_lnk, const H5G_lib_iterate_t op, void *op_data); H5_DLL herr_t H5G__link_release_table(H5G_link_table_t *ltable); -H5_DLL herr_t H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, - const H5O_link_t *lnk); +H5_DLL herr_t H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, const H5O_link_t *lnk); /* Functions that understand "compact" link storage */ H5_DLL herr_t H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk); diff --git a/src/H5Gtest.c b/src/H5Gtest.c index f2f3e3a..1899606 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -28,13 +28,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5Iprivate.h" /* IDs */ /****************/ /* Local Macros */ @@ -80,7 +80,7 @@ htri_t H5G__is_empty_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has no link messages and no symbol table message and no "dense" link storage @@ -114,7 +114,7 @@ H5G__is_empty_test(hid_t gid) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { /* Sanity check that new group format shouldn't have old messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) @@ -127,7 +127,7 @@ H5G__is_empty_test(hid_t gid) /* Check for a link info message */ if((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(linfo_exists > 0) { H5O_linfo_t linfo; /* Link info message */ @@ -158,7 +158,7 @@ H5G__is_empty_test(hid_t gid) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { H5O_stab_t stab; /* Info about local heap & B-tree */ hsize_t nlinks; /* Number of links in the group */ @@ -202,7 +202,7 @@ done: hid_t gid; IN: group to check unsigned *nmsgs; OUT: # of link messages in header RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has link messages and how many. GLOBAL VARIABLES @@ -232,15 +232,15 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists == 0) HGOTO_DONE(FALSE) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") /* Check if we should retrieve the number of link messages */ if(nmsgs) { @@ -269,7 +269,7 @@ done: htri_t H5G__has_stab_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has a symbol table message. GLOBAL VARIABLES @@ -299,15 +299,15 @@ H5G__has_stab_test(hid_t gid) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists == 0) HGOTO_DONE(FALSE) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") done: if(api_ctx_pushed && H5CX_pop() < 0) @@ -326,7 +326,7 @@ done: htri_t H5G__is_new_dense_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group is in the "new" format for groups (link messages/ fractal heap+v2 B-tree) and if it is in "dense" storage form (ie. it has @@ -358,19 +358,19 @@ H5G__is_new_dense_test(hid_t gid) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_DONE(FALSE) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_DONE(FALSE) /* Check if the group has link info message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { H5O_linfo_t linfo; /* Link info message */ @@ -404,7 +404,7 @@ done: hsize_t *name_count; OUT: Number of links in name index hsize_t *corder_count; OUT: Number of links in creation order index RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Currently, just retrieves the number of links in each index and returns them. @@ -495,7 +495,7 @@ done: hid_t gid; IN: group to check size_t *lheap_size; OUT: Size of local heap RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Checks the size of the local heap for a group GLOBAL VARIABLES @@ -525,11 +525,11 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) /* Make certain the group has a symbol table message */ if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message") /* Check the size of the local heap for the group */ if(H5HL_get_size(grp->oloc.file, stab.heap_addr, lheap_size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size") + HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size") done: if(api_ctx_pushed && H5CX_pop() < 0) @@ -551,7 +551,7 @@ done: size_t *user_path_len; OUT: Size of user path unsigned *obj_hidden; OUT: Whether object is hidden RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Retrieves the user path for an ID. A zero for the length is returned in the case of no user path. @@ -648,15 +648,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__verify_cached_stab_test + * Function: H5G__verify_cached_stab_test * * Purpose: Check that a that the provided group entry contains a * cached symbol table entry, that the entry matches that in * the provided group's object header, and check that the * addresses are valid. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Mar 31, 2009 @@ -666,9 +665,9 @@ done: herr_t H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) { - H5O_stab_t stab; /* Symbol table */ - H5HL_t *heap = NULL; /* Pointer to local heap */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_stab_t stab; /* Symbol table */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(grp_oloc->addr) @@ -681,7 +680,8 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message") /* Verify that the cached symbol table info matches the symbol table message - * in the object header */ + * in the object header. + */ if((ent->cache.stab.btree_addr != stab.btree_addr) || (ent->cache.stab.heap_addr != stab.heap_addr)) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header") @@ -711,7 +711,7 @@ done: * group with a symbol table, and that that information is * correct. * - * Return: Non-negative on success/Negative on failure + * Return: H5_ITER_STOP/H5_ITER_CONT/H5_ITER_ERROR * * Programmer: Neil Fortner * Apr 8, 2011 @@ -732,9 +732,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, FUNC_ENTER_STATIC - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); @@ -749,7 +747,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, targ_oloc.holding_file = FALSE; /* Iterate over entries */ - for(i=0; insyms; i++) { + for(i = 0; i < sn->nsyms; i++) { /* Update oloc address */ targ_oloc.addr = sn->entry[i].header; @@ -773,7 +771,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, if((sn->entry[i].cache.stab.btree_addr != stab.btree_addr) || (sn->entry[i].cache.stab.heap_addr != stab.heap_addr)) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "cached symbol table information is incorrect") - } /* end if */ + } else if(sn->entry[i].type == H5G_CACHED_STAB) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "nonexistent STAB message is cached") diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index e4e6fa8..edb0261 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -76,10 +76,10 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth)) "Data bytes allocated for heap:", h->dblk_size); - /* - * Traverse the free list and check that all free blocks fall within + /* Traverse the free list and check that all free blocks fall within * the heap and that no two free blocks point to the same region of - * the heap. */ + * the heap. + */ if(NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); @@ -88,35 +88,30 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth)) char temp_str[32]; HDsnprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block); - HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9), - temp_str, - freelist->offset, freelist->size); - if((freelist->offset + freelist->size) > h->dblk_size) - HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); - else { + HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9), temp_str, freelist->offset, freelist->size); + if((freelist->offset + freelist->size) > h->dblk_size) + HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); + else { int overlap = 0; size_t i; - for(i = 0; i < freelist->size; i++) { - if(marker[freelist->offset + i]) - overlap++; - marker[freelist->offset + i] = 1; - } /* end for */ - if(overlap) - HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); - else - amount_free += freelist->size; - } /* end for */ + for(i = 0; i < freelist->size; i++) { + if(marker[freelist->offset + i]) + overlap++; + marker[freelist->offset + i] = 1; + } /* end for */ + if(overlap) + HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); + else + amount_free += freelist->size; + } /* end else */ } /* end for */ if(h->dblk_size) - HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, - "Percent of heap used:", - ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); + HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", + ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); - /* - * Print the data in a VMS-style octal dump. - */ + /* Print the data in a VMS-style octal dump */ H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); CATCH @@ -127,3 +122,4 @@ CATCH H5E_THROW(H5E_CANTFREE, "can't free marker buffer"); END_FUNC(PRIV) /* end H5HL_debug() */ + diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index c737bbe..c471e5a 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -66,7 +66,7 @@ typedef int64_t hid_t; * can be removed from the ID type. If the function returns negative * (failure) then the object will remain in the ID type. */ -typedef herr_t (*H5I_free_t)(void*); +typedef herr_t (*H5I_free_t)(void *); /* Type of the function to compare objects & keys */ typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key); diff --git a/src/H5MF.c b/src/H5MF.c index 65b27db..0d368d4 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -2291,6 +2291,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2320,6 +2321,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, &curr_ring); curr_ring = needed_ring; @@ -2435,6 +2437,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, &curr_ring); curr_ring = needed_ring; diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 58e5054..bd57f05 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -60,8 +60,7 @@ H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); H5_DLL herr_t H5MF_try_extend(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t extra_requested); -H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, - hsize_t size); +H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size); H5_DLL ssize_t H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info); diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 19d90c5..059b46a 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -648,16 +648,15 @@ H5_DLLVAR const unsigned H5O_pline_ver_bounds[H5F_LIBVER_NBOUNDS]; /* Testing functions */ #ifdef H5O_TESTING -H5_DLL htri_t H5O_is_attr_empty_test(hid_t oid); -H5_DLL htri_t H5O_is_attr_dense_test(hid_t oid); -H5_DLL herr_t H5O_num_attrs_test(hid_t oid, hsize_t *nattrs); -H5_DLL herr_t H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count); -H5_DLL herr_t H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val); -H5_DLL herr_t H5O_expunge_chunks_test(const H5O_loc_t *oloc); -H5_DLL herr_t H5O_get_rc(const H5O_loc_t *oloc, unsigned *rc); -H5_DLL herr_t H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, - unsigned *chunk_num); -H5_DLL herr_t H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type); +H5_DLL htri_t H5O__is_attr_empty_test(hid_t oid); +H5_DLL htri_t H5O__is_attr_dense_test(hid_t oid); +H5_DLL herr_t H5O__num_attrs_test(hid_t oid, hsize_t *nattrs); +H5_DLL herr_t H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count); +H5_DLL herr_t H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val); +H5_DLL herr_t H5O__expunge_chunks_test(const H5O_loc_t *oloc); +H5_DLL herr_t H5O__get_rc_test(const H5O_loc_t *oloc, unsigned *rc); +H5_DLL herr_t H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num); +H5_DLL herr_t H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type); #endif /* H5O_TESTING */ /* Object header debugging routines */ diff --git a/src/H5Otest.c b/src/H5Otest.c index 32b31f2..7cb7b3d 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -75,11 +75,11 @@ /*-------------------------------------------------------------------------- NAME - H5O_is_attr_dense_test + H5O__is_attr_dense_test PURPOSE Determine whether attributes for an object are stored "densely" USAGE - htri_t H5O_is_attr_dense_test(oid) + htri_t H5O__is_attr_dense_test(oid) hid_t oid; IN: object to check RETURNS Non-negative TRUE/FALSE on success, negative on failure @@ -93,7 +93,7 @@ REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5O_is_attr_dense_test(hid_t oid) +H5O__is_attr_dense_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ @@ -101,7 +101,7 @@ H5O_is_attr_dense_test(hid_t oid) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -114,7 +114,7 @@ H5O_is_attr_dense_test(hid_t oid) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -136,21 +136,21 @@ H5O_is_attr_dense_test(hid_t oid) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_is_attr_dense_test() */ +} /* H5O__is_attr_dense_test() */ /*-------------------------------------------------------------------------- NAME - H5O_is_attr_empty_test + H5O__is_attr_empty_test PURPOSE Determine whether there are any attributes for an object USAGE - htri_t H5O_is_attr_empty_test(oid) + htri_t H5O__is_attr_empty_test(oid) hid_t oid; IN: object to check RETURNS Non-negative TRUE/FALSE on success, negative on failure @@ -163,7 +163,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5O_is_attr_empty_test(hid_t oid) +H5O__is_attr_empty_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ @@ -174,7 +174,7 @@ H5O_is_attr_empty_test(hid_t oid) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -187,7 +187,7 @@ H5O_is_attr_empty_test(hid_t oid) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ if(oh->version > H5O_VERSION_1) { @@ -237,21 +237,21 @@ done: if(bt2_name && H5B2_close(bt2_name) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_is_attr_empty_test() */ +} /* H5O__is_attr_empty_test() */ /*-------------------------------------------------------------------------- NAME - H5O_num_attrs_test + H5O__num_attrs_test PURPOSE Determine whether there are any attributes for an object USAGE - herr_t H5O_num_attrs_test(oid, nattrs) + herr_t H5O__num_attrs_test(oid, nattrs) hid_t oid; IN: object to check hsize_t *nattrs; OUT: Number of attributes on object RETURNS @@ -265,7 +265,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) +H5O__num_attrs_test(hid_t oid, hsize_t *nattrs) { H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ @@ -275,7 +275,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -288,7 +288,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -335,21 +335,21 @@ done: if(bt2_name && H5B2_close(bt2_name) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_num_attrs_test() */ +} /* H5O__num_attrs_test() */ /*-------------------------------------------------------------------------- NAME - H5O_attr_dense_info_test + H5O__attr_dense_info_test PURPOSE Retrieve information about the state of the "dense" storage for attributes USAGE - herr_t H5O_attr_dense_info_test(oid, name_count, corder_count) + herr_t H5O__attr_dense_info_test(oid, name_count, corder_count) hid_t oid; IN: Object to check hsize_t *name_count; OUT: Number of attributes in name index hsize_t *corder_count; OUT: Number of attributes in creation order index @@ -365,7 +365,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) +H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) { H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ @@ -375,7 +375,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -391,7 +391,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -438,22 +438,22 @@ done: if(bt2_corder && H5B2_close(bt2_corder) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_attr_dense_info_test() */ +} /* H5O__attr_dense_info_test() */ /*-------------------------------------------------------------------------- NAME - H5O_check_msg_marked_test + H5O__check_msg_marked_test PURPOSE Check if an unknown message with the "mark if unknown" flag actually gets marked. USAGE - herr_t H5O_check_msg_marked_test(oid, flag_val) + herr_t H5O__check_msg_marked_test(oid, flag_val) hid_t oid; IN: Object to check hbool_t flag_val; IN: Desired flag value RETURNS @@ -468,7 +468,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) +H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val) { H5O_t *oh = NULL; /* Object header */ H5O_loc_t *loc; /* Pointer to object's location */ @@ -476,7 +476,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) unsigned idx; /* Index of message */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -484,11 +484,11 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Locate "unknown" message */ for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(idx_msg->type->id == H5O_UNKNOWN_ID) { + if(idx_msg->type->id == H5O_UNKNOWN_ID) { /* Check for "unknown" message having the correct flags */ if(((idx_msg->flags & H5O_MSG_FLAG_WAS_UNKNOWN) > 0) != flag_val) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "'unknown' message has incorrect 'was unknown' flag value") @@ -503,15 +503,15 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_check_msg_marked_test() */ +} /* H5O__check_msg_marked_test() */ /*-------------------------------------------------------------------------- NAME - H5O_expunge_chunks_test + H5O__expunge_chunks_test PURPOSE Expunge all the chunks for an object header from the cache. USAGE @@ -529,7 +529,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_expunge_chunks_test(const H5O_loc_t *loc) +H5O__expunge_chunks_test(const H5O_loc_t *loc) { H5O_t *oh = NULL; /* Object header */ haddr_t chk_addr[16]; /* Array of chunk addresses */ @@ -537,11 +537,11 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc) size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Safety check */ nchunks = oh->nchunks; @@ -553,7 +553,7 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc) /* Release the object header */ if(H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") /* Iterate over all the saved chunk addresses, evicting them from the cache */ /* (in reverse order, so that chunk #0 is unpinned) */ @@ -563,16 +563,16 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_expunge_chunks_test() */ +} /* H5O__expunge_chunks_test() */ /*-------------------------------------------------------------------------- NAME - H5O_get_rc + H5O__get_rc_test PURPOSE Retrieve the refcount for the object header USAGE - herr_t H5O_expunge_chunks_test(loc, rc) + herr_t H5O__get_rc_test(loc, rc) const H5O_loc_t *loc; IN: Object location for object header to query unsigned *rc; OUT: Pointer to refcount for object header RETURNS @@ -587,12 +587,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_get_rc(const H5O_loc_t *loc, unsigned *rc) +H5O__get_rc_test(const H5O_loc_t *loc, unsigned *rc) { H5O_t *oh = NULL; /* Object header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -600,7 +600,7 @@ H5O_get_rc(const H5O_loc_t *loc, unsigned *rc) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Save the refcount for the object header */ *rc = oh->nlink; @@ -608,19 +608,19 @@ H5O_get_rc(const H5O_loc_t *loc, unsigned *rc) done: /* Release the object header */ if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_expunge_chunks_test() */ +} /* H5O__get_rc_test() */ /*-------------------------------------------------------------------------- NAME - H5O_msg_get_chunkno_test + H5O__msg_get_chunkno_test PURPOSE Retrieve the chunk number for an object header message of a given type. USAGE - herr_t H5O_check_msg_marked_test(oid, chunk_num) + herr_t H5O__msg_get_chunkno_test(oid, msg_type, chunk_num) hid_t oid; IN: Object to check unsigned msg_type; IN: Object header message type to check unsigned *chunk_num; OUT: Object header chunk that the message is in @@ -636,7 +636,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) +H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) { H5O_t *oh = NULL; /* Object header */ H5O_loc_t *loc; /* Pointer to object's location */ @@ -645,7 +645,7 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -658,11 +658,11 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Locate first message of given type */ for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(idx_msg->type->id == msg_type) { + if(idx_msg->type->id == msg_type) { /* Set the chunk number for the message */ *chunk_num = idx_msg->chunkno; @@ -676,21 +676,21 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_msg_get_chunkno_test() */ +} /* H5O__msg_get_chunkno_test() */ /*-------------------------------------------------------------------------- NAME - H5O_msg_move_to_new_chunk_test + H5O__msg_move_to_new_chunk_test PURPOSE Move a message into a new chunk USAGE - herr_t H5O_msg_move_to_new_chunk_test(oid, msg_type) + herr_t H5O__msg_move_to_new_chunk_test(oid, msg_type) hid_t oid; IN: Object to check unsigned msg_type; IN: Object header message type to check RETURNS @@ -704,7 +704,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) +H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) { H5O_t *oh = NULL; /* Object header */ H5O_loc_t *loc; /* Pointer to object's location */ @@ -713,7 +713,7 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location for object */ if(NULL == (loc = H5O_get_loc(oid))) @@ -726,11 +726,11 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Locate first message of given type */ for(idx = 0, curr_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, curr_msg++) - if(curr_msg->type->id == msg_type) { + if(curr_msg->type->id == msg_type) { H5O_msg_alloc_info_t found_msg; /* Information about message to move */ unsigned msg_chunkno = curr_msg->chunkno; /* Chunk that the message is in */ uint8_t *end_chunk_data = (oh->chunk[msg_chunkno].image + oh->chunk[msg_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[msg_chunkno].gap); /* End of message data in chunk */ @@ -784,10 +784,10 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_msg_get_chunkno_test() */ +} /* H5O__msg_get_chunkno_test() */ diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index aef87e1..b94b845 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -91,10 +91,8 @@ H5_DLL herr_t H5PB_dest(H5F_t *f); H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr); H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr); -H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - void *buf/*out*/); -H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - const void *buf); +H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Statistics routines */ H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf); diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 60b2363..19ff7f9 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -200,8 +200,8 @@ H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter, /* Testing functions */ #ifdef H5P_TESTING -H5_DLL char *H5P_get_class_path_test(hid_t pclass_id); -H5_DLL hid_t H5P_open_class_path_test(const char *path); +H5_DLL char *H5P__get_class_path_test(hid_t pclass_id); +H5_DLL hid_t H5P__open_class_path_test(const char *path); #endif /* H5P_TESTING */ #endif /* _H5Ppkg_H */ diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 475a164..075040d 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -35,11 +35,11 @@ /*-------------------------------------------------------------------------- NAME - H5P_get_class_path_test + H5P__get_class_path_test PURPOSE Routine to query the full path of a generic property list class USAGE - char *H5P_get_class_name_test(pclass_id) + char *H5P__get_class_name_test(pclass_id) hid_t pclass_id; IN: Property class to query RETURNS Success: Pointer to a malloc'ed string containing the full path of class @@ -51,17 +51,17 @@ GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_get_class_path() + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P__get_class_path() EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ char * -H5P_get_class_path_test(hid_t pclass_id) +H5P__get_class_path_test(hid_t pclass_id) { H5P_genclass_t *pclass; /* Property class to query */ char *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_PACKAGE /* Check arguments. */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) @@ -73,53 +73,53 @@ H5P_get_class_path_test(hid_t pclass_id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_class_path_test() */ +} /* H5P__get_class_path_test() */ /*-------------------------------------------------------------------------- NAME - H5P_open_class_path_test + H5P__open_class_path_test PURPOSE Routine to open a [copy of] a class with its full path name USAGE - hid_t H5P_open_class_name_test(path) + hid_t H5P__open_class_name_test(path) const char *path; IN: Full path name of class to open [copy of] RETURNS Success: ID of generic property class - Failure: NULL + Failure: H5I_INVALID_HID DESCRIPTION This routine opens [a copy] of the class indicated by the full path. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_open_class_path() + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P__open_class_path() EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ hid_t -H5P_open_class_path_test(const char *path) +H5P__open_class_path_test(const char *path) { H5P_genclass_t *pclass = NULL; /* Property class to query */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments. */ - if (NULL == path || *path=='\0') - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid class path"); + if(NULL == path || *path=='\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid class path"); /* Open the property list class */ - if ((pclass=H5P_open_class_path(path))==NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to find class with full path"); + if(NULL == (pclass = H5P_open_class_path(path))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to find class with full path"); /* Get an atom for the class */ - if ((ret_value=H5I_register(H5I_GENPROP_CLS, pclass, TRUE))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); done: - if(ret_value<0 && pclass) + if(H5I_INVALID_HID == ret_value && pclass) H5P_close_class(pclass); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_open_class_path_test() */ +} /* H5P__open_class_path_test() */ diff --git a/src/H5SMtest.c b/src/H5SMtest.c index 490265c..0a6149d 100644 --- a/src/H5SMtest.c +++ b/src/H5SMtest.c @@ -113,7 +113,7 @@ H5SM__get_mesg_count_test(H5F_t *f, unsigned type_id, size_t *mesg_count) done: /* Release resources */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM__get_mesg_count_test() */ diff --git a/src/H5TS.c b/src/H5TS.c index d239e09..10e14d5 100644 --- a/src/H5TS.c +++ b/src/H5TS.c @@ -359,7 +359,6 @@ H5TS_win32_process_enter(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex) ret_value = FALSE; #endif /* H5_HAVE_CODESTACK */ - /* Set up thread local storage */ if(TLS_OUT_OF_INDEXES == (H5TS_apictx_key_g = TlsAlloc())) ret_value = FALSE; @@ -428,12 +427,9 @@ H5TS_win32_process_exit(void) /* Clean up per-process thread local storage */ TlsFree(H5TS_errstk_key_g); - #ifdef H5_HAVE_CODESTACK TlsFree(H5TS_funcstk_key_g); #endif /* H5_HAVE_CODESTACK */ - - /* Clean up per-process thread local storage */ TlsFree(H5TS_apictx_key_g); return; @@ -479,7 +475,6 @@ H5TS_win32_thread_exit(void) LocalFree((HLOCAL)lpvData); #endif /* H5_HAVE_CODESTACK */ - /* Clean up per-thread thread local storage */ lpvData = TlsGetValue(H5TS_apictx_key_g); if(lpvData) LocalFree((HLOCAL)lpvData); @@ -534,3 +529,4 @@ H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata) } /* H5TS_create_thread */ #endif /* H5_HAVE_THREADSAFE */ + diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h index 8d74676..9e093a6 100644 --- a/src/H5TSprivate.h +++ b/src/H5TSprivate.h @@ -128,3 +128,4 @@ H5_DLL H5TS_thread_t H5TS_create_thread(void *(*func)(void *), H5TS_attr_t * att #endif /* c_plusplus || __cplusplus */ #endif /* H5TSprivate_H_ */ + diff --git a/test/cache_common.c b/test/cache_common.c index 2cc188e..b078964 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -20,6 +20,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5MFprivate.h" #include "H5MMprivate.h" + #include "cache_common.h" @@ -3276,23 +3277,24 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - HDassert(fid >= 0); - saved_fid = fid; + HDassert(fid >= 0); + saved_fid = fid; if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { pass = FALSE; failure_mssg = "H5Fflush() failed."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } else { + } + else { file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); - if(file_ptr == NULL) { + if(file_ptr == NULL) { pass = FALSE; failure_mssg = "Can't get file_ptr."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } + } } } @@ -3303,36 +3305,36 @@ setup_cache(size_t max_cache_size, if(pass) { /* A bit of fancy footwork here: - * - * The call to H5Fcreate() allocates an instance of H5C_t, - * initializes it, and stores its address in f->shared->cache. - * - * We don't want to use this cache, as it has a bunch of extra - * initialization that may change over time, and in any case - * it will not in general be configured the way we want it. - * - * We used to deal with this problem by storing the file pointer - * in another instance of H5C_t, and then ignoring the original - * version. However, this strategy doesn't work any more, as - * we can't store the file pointer in the instance of H5C_t, - * and we have modified many cache routines to use a file - * pointer to look up the target cache. - * - * Thus we now make note of the address of the instance of - * H5C_t created by the call to H5Fcreate(), set - * file_ptr->shared->cache to NULL, call H5C_create() - * to allocate a new instance of H5C_t for test purposes, - * and store than new instance's address in - * file_ptr->shared->cache. - * - * On shut down, we call H5C_dest on our instance of H5C_t, - * set file_ptr->shared->cache to point to the original - * instance, and then close the file normally. - */ + * + * The call to H5Fcreate() allocates an instance of H5C_t, + * initializes it, and stores its address in f->shared->cache. + * + * We don't want to use this cache, as it has a bunch of extra + * initialization that may change over time, and in any case + * it will not in general be configured the way we want it. + * + * We used to deal with this problem by storing the file pointer + * in another instance of H5C_t, and then ignoring the original + * version. However, this strategy doesn't work any more, as + * we can't store the file pointer in the instance of H5C_t, + * and we have modified many cache routines to use a file + * pointer to look up the target cache. + * + * Thus we now make note of the address of the instance of + * H5C_t created by the call to H5Fcreate(), set + * file_ptr->shared->cache to NULL, call H5C_create() + * to allocate a new instance of H5C_t for test purposes, + * and store than new instance's address in + * file_ptr->shared->cache. + * + * On shut down, we call H5C_dest on our instance of H5C_t, + * set file_ptr->shared->cache to point to the original + * instance, and then close the file normally. + */ HDassert(saved_cache == NULL); - saved_cache = file_ptr->shared->cache; - file_ptr->shared->cache = NULL; + saved_cache = file_ptr->shared->cache; + file_ptr->shared->cache = NULL; cache_ptr = H5C_create(max_cache_size, min_clean_size, @@ -3351,19 +3353,20 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - if(cache_ptr == NULL) { + if(cache_ptr == NULL) { pass = FALSE; failure_mssg = "H5C_create() failed."; if(verbose) HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC); - } else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { + } + else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { pass = FALSE; - failure_mssg = "Bad cache_ptr magic."; + failure_mssg = "Bad cache_ptr magic."; if(verbose) HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC); - } + } } if(show_progress) /* 7 */ @@ -3446,7 +3449,7 @@ takedown_cache(H5F_t * file_ptr, H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } - if ( H5C_prep_for_file_close(file_ptr) < 0 ) { + if ( H5C_prep_for_file_close(file_ptr) < 0 ) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; @@ -3456,23 +3459,23 @@ takedown_cache(H5F_t * file_ptr, H5C_dest(file_ptr); - if ( saved_cache != NULL ) { + if ( saved_cache != NULL ) { - file_ptr->shared->cache = saved_cache; - saved_cache = NULL; - } + file_ptr->shared->cache = saved_cache; + saved_cache = NULL; + } } if ( saved_fapl_id != H5P_DEFAULT ) { H5Pclose(saved_fapl_id); - saved_fapl_id = H5P_DEFAULT; + saved_fapl_id = H5P_DEFAULT; } if ( saved_fcpl_id != H5P_DEFAULT ) { H5Pclose(saved_fcpl_id); - saved_fcpl_id = H5P_DEFAULT; + saved_fcpl_id = H5P_DEFAULT; } if ( saved_fid != -1 ) { @@ -3489,21 +3492,21 @@ takedown_cache(H5F_t * file_ptr, saved_actual_base_addr = HADDR_UNDEF; } - if ( H5Fclose(saved_fid) < 0 ) { + if ( H5Fclose(saved_fid) < 0 ) { pass = FALSE; - failure_mssg = "couldn't close test file."; + failure_mssg = "couldn't close test file."; - } else { + } else { - saved_fid = -1; + saved_fid = -1; } /* Pop API context */ H5CX_pop(); - if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { + if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { @@ -3515,10 +3518,10 @@ takedown_cache(H5F_t * file_ptr, if ( HDremove(filename) < 0 ) { pass = FALSE; - failure_mssg = "couldn't delete test file."; + failure_mssg = "couldn't delete test file."; - } - } + } + } } return; diff --git a/test/cache_logging.c b/test/cache_logging.c index 1eb9d41..6fd48d8 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -40,8 +40,8 @@ test_logging_api(void) char *location = NULL; size_t size; - hid_t fid; - hid_t gid; + hid_t fid = -1; + hid_t gid = -1; hbool_t is_currently_logging; char group_name[8]; char filename[1024]; @@ -166,10 +166,11 @@ main(void) if(nerrors) { HDprintf("***** %d Metadata cache logging TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return 1; + HDexit(EXIT_FAILURE); } HDprintf("All Metadata Cache Logging tests passed.\n"); - return 0; + + HDexit(EXIT_SUCCESS); } diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 119ba62..0160607 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -394,7 +394,7 @@ error: * Function: get_sbe_tag() * * Purpose: This function retrieves the tag associated with the superblock - * extension (the object header address stored in the superblock) + * extension (the object header address stored in the superblock) * * Return: 0 on Success; 1 on Failure * @@ -407,7 +407,7 @@ static int get_sbe_tag(hid_t fid, haddr_t *tag) { /* Retrieve the superblock extension's object header address for the file */ - if(H5F_get_sbe_addr_test(fid, tag) < 0) + if(H5F__get_sbe_addr_test(fid, tag) < 0) TEST_ERROR; return 0; @@ -3599,7 +3599,7 @@ check_external_link_open_tags(void) /* =========================== */ /* Close open objects and file */ /* =========================== */ - if ( (H5Gclose(xid)) < 0 ) TEST_ERROR; + if ( H5Gclose(xid) < 0 ) TEST_ERROR; if ( H5Fclose(fid) < 0 ) TEST_ERROR; if ( H5Fclose(fid2) < 0 ) TEST_ERROR; @@ -3672,7 +3672,7 @@ check_invalid_tag_application(void) /* This should fail as no tag is set up during the protect call */ if (( lheap = H5HL_protect(f, addr, H5AC__NO_FLAGS_SET)) != NULL ) TEST_ERROR; - /* Again, set up a valid tag in the DXPL */ + /* Again, set up a valid tag in the API context */ H5AC_tag((haddr_t)25, NULL); /* Call H5HL_protect again to protect the local heap. This should succeed. */ @@ -3711,9 +3711,7 @@ error: * * Purpose: Run tests on library's ability to tag metadata entries. * - * Return: Success: - * - * Failure: + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Mike McGreevy * January 15, 2009 @@ -3755,12 +3753,12 @@ main(void) /* Run tests on each fcpl set up above. */ if (test_type == TEST_DEFAULT) { - if (!nerrs) printf("Testing standard tag application cases w/ default fcpl:\n"); + if (!nerrs) HDprintf("Testing standard tag application cases w/ default fcpl:\n"); fcpl = fcpl_default; } else if (test_type == TEST_SHMESG) { - if (!nerrs) printf("Testing standard tag application cases w/ shared messages:\n"); + if (!nerrs) HDprintf("Testing standard tag application cases w/ shared messages:\n"); fcpl = fcpl_shmesg_all; } else { @@ -3780,7 +3778,7 @@ main(void) if (!nerrs) nerrs += check_link_removal_tags(fcpl, test_type); } /* end for */ - if (!nerrs) printf("Testing other specific tag application cases:\n"); + if (!nerrs) HDprintf("Testing other specific tag application cases:\n"); if (!nerrs) nerrs += check_group_creation_tags(); if (!nerrs) nerrs += check_multi_group_creation_tags(); if (!nerrs) nerrs += check_group_open_tags(); @@ -3804,10 +3802,13 @@ main(void) HDremove(FILENAME2); /* Return Errors */ - return nerrs > 0; + if (nerrs > 0) + return EXIT_FAILURE; + else + return EXIT_SUCCESS; error: /* Return with Error */ - return 1; + return EXIT_FAILURE; } /* main */ diff --git a/test/dangle.c b/test/dangle.c index 75e9c84..9f30f10 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -602,7 +602,8 @@ test_dangle_force(void) TEST_ERROR; /* Allocate the array of object IDs */ - objs = (hid_t*)HDmalloc(sizeof(hid_t) * (size_t)count); + if(NULL == (objs = (hid_t *)HDcalloc((size_t)count, sizeof(hid_t)))) + TEST_ERROR; /* Get the list of open IDs */ if(H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)count, objs) < 0) diff --git a/test/earray.c b/test/earray.c index d72b3f5..02e4d85 100644 --- a/test/earray.c +++ b/test/earray.c @@ -521,18 +521,18 @@ verify_cparam(const H5EA_t *ea, const H5EA_create_t *cparam) /* Retrieve creation parameters */ HDmemset(&test_cparam, 0, sizeof(H5EA_create_t)); - if(H5EA_get_cparam_test(ea, &test_cparam) < 0) + if(H5EA__get_cparam_test(ea, &test_cparam) < 0) FAIL_STACK_ERROR /* Verify creation parameters */ - if(H5EA_cmp_cparam_test(cparam, &test_cparam)) + if(H5EA__cmp_cparam_test(cparam, &test_cparam)) TEST_ERROR /* Success */ - return(0); + return 0; error: - return(-1); + return -1; } /* verify_cparam() */ @@ -2398,7 +2398,7 @@ error: H5E_BEGIN_TRY { if(ea) H5EA_close(ea); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; diff --git a/test/efc.c b/test/efc.c index 5a946bb..d63ef34 100644 --- a/test/efc.c +++ b/test/efc.c @@ -2885,8 +2885,7 @@ error: * * Purpose: Test the external file cache code * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Neil Fortner * December 16, 2010 @@ -2900,7 +2899,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Test Setup */ - puts("Testing the external file cache"); + HDputs("Testing the external file cache"); /* Create property lists */ fcpl_id = H5Pcreate(H5P_FILE_CREATE); @@ -2937,14 +2936,14 @@ main(void) if(nerrors) goto error; - puts("All external file cache tests passed."); + HDputs("All external file cache tests passed."); h5_clean_files(FILENAME, fapl_id); - return 0; + return EXIT_SUCCESS; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl_id); @@ -2952,6 +2951,6 @@ error: if(api_ctx_pushed) H5CX_pop(); - return 1; + return EXIT_FAILURE; } /* end main() */ diff --git a/test/err_compat.c b/test/err_compat.c index eee150b..4860a3c 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -469,7 +469,7 @@ main(void) char filename[1024]; const char *FUNC_main="main"; - fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There're supposed to be some error messages\n"); + fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 6536837..9d23f2f 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Dana Robinson - * Spring 2016 - * - * Purpose: Tests the basic operation of the evict-on-close cache +/* Purpose: Tests the basic operation of the evict-on-close cache * behavior. Tests that ensure the tagging is handled correctly * are located in cache.c. */ @@ -91,9 +87,6 @@ static herr_t check_group_layout(hid_t fid, const char *group_name); * * Return: TRUE/FALSE * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static hbool_t @@ -114,8 +107,8 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag) return TRUE; else entry_ptr = entry_ptr->ht_next; - } /* end while */ - } /* end for */ + } + } return FALSE; } /* end verify_tag_not_in_cache() */ @@ -129,9 +122,6 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag) * Return: Success: The file ID of the created file * Failure: -1 * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static hid_t @@ -207,7 +197,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; if(H5Gclose(gid2) < 0) TEST_ERROR; - } /* end for */ + } if(H5Gclose(gid1) < 0) TEST_ERROR; @@ -303,7 +293,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; if(H5Gclose(gid2) < 0) TEST_ERROR; - } /* end for */ + } if(H5Gclose(gid1) < 0) TEST_ERROR; @@ -593,9 +583,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -710,9 +697,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -815,9 +799,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -873,7 +854,7 @@ check_evict_on_close_api(void) /* ensure an invalid plist fails */ H5E_BEGIN_TRY { - status = H5Pget_evict_on_close((hid_t)-1, &evict_on_close); + status = H5Pget_evict_on_close(H5I_INVALID_HID, &evict_on_close); } H5E_END_TRY; if(status >= 0) FAIL_PUTS_ERROR("H5Pget_evict_on_close() accepted invalid hid_t."); @@ -897,9 +878,6 @@ error: * * Return: EXIT_FAILURE/EXIT_SUCCESS * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ int @@ -979,7 +957,7 @@ main(void) HDprintf("All evict-on-close tests passed.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: @@ -992,7 +970,7 @@ error: H5Pclose(fapl_id); } H5E_END_TRY; - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* end main() */ @@ -1007,9 +985,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2017 - * *------------------------------------------------------------------------- */ static herr_t @@ -1052,9 +1027,6 @@ error: * * Return: EXIT_FAILURE/EXIT_SUCCESS * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ int @@ -1076,14 +1048,14 @@ main(void) HDprintf("All evict-on-close tests passed.\n"); HDprintf("Note that EoC is not supported under parallel so most tests are skipped.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: HDprintf("***** %u evict-on-close test%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* main() - parallel */ diff --git a/test/farray.c b/test/farray.c index 383cb32..21d3186 100644 --- a/test/farray.c +++ b/test/farray.c @@ -25,9 +25,9 @@ #include "H5FApkg.h" /* Fixed Arrays */ /* Other private headers that this test requires */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" /* IDs */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Local macros */ @@ -113,74 +113,71 @@ h5_stat_size_t empty_size_g; /*------------------------------------------------------------------------- - * Function: init_cparam + * Function: init_cparam * - * Purpose: Initialize array creation parameter structure + * Purpose: Initialize array creation parameter structure * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t init_cparam(H5FA_create_t *cparam, farray_test_param_t *tparam) { /* Wipe out background */ HDmemset(cparam, 0, sizeof(*cparam)); - cparam->cls = H5FA_CLS_TEST; - cparam->raw_elmt_size = ELMT_SIZE; - cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS; - cparam->nelmts = tparam->nelmts; + cparam->cls = H5FA_CLS_TEST; + cparam->raw_elmt_size = ELMT_SIZE; + cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS; + cparam->nelmts = tparam->nelmts; - return(0); + return SUCCEED; } /* init_cparam() */ /*------------------------------------------------------------------------- - * Function: create_file + * Function: create_file * - * Purpose: Create file and retrieve pointer to internal file object - * - * Return: Success: 0 - * Failure: -1 + * Purpose: Create file and retrieve pointer to internal file object * + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ -static int -create_file(hid_t fapl, hid_t *file, H5F_t **f) +static herr_t +create_file(hid_t fapl_id, hid_t *fid, H5F_t **f) { /* Create the file to work on */ - if((*file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((*fid = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) - FAIL_STACK_ERROR + if(NULL == (*f = (H5F_t *)H5I_object(*fid))) + FAIL_STACK_ERROR; /* Ignore metadata tags in the file's cache */ if(H5AC_ignore_tags(*f) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR; /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* create_file() */ /*------------------------------------------------------------------------- - * Function: check_stats + * Function: check_stats * - * Purpose: Verify stats for a fixed array + * Purpose: Verify stats for a fixed array * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t check_stats(const H5FA_t *fa, const farray_state_t *state) { H5FA_stat_t farray_stats; /* Statistics about the array */ @@ -194,40 +191,38 @@ check_stats(const H5FA_t *fa, const farray_state_t *state) HDfprintf(stdout, "farray_stats.hdr_size = %Hu, state->hdr_size = %Hu\n", farray_stats.hdr_size, state->hdr_size); TEST_ERROR - } /* end if */ + } if(farray_stats.dblk_size != state->dblk_size) { HDfprintf(stdout, "farray_stats.dblk_size = %Hu, state->dblk_size = %Hu\n", farray_stats.dblk_size, state->dblk_size); TEST_ERROR - } /* end if */ + } if(farray_stats.nelmts != state->nelmts) { HDfprintf(stdout, "farray_stats.nelmts = %Hu, state->nelmts = %Hu\n", farray_stats.nelmts, state->nelmts); TEST_ERROR - } /* end if */ + } - /* All tests passed */ - return(0); + /* Success */ + return SUCCEED; error: - return(-1); + return FAIL; } /* check_stats() */ /*------------------------------------------------------------------------- - * Function: set_fa_state + * Function: set_fa_state * - * Purpose: Set the state of the Fixed Array + * Purpose: Set the state of the Fixed Array * - * Return: does not fail - * - * Programmer: Vailin Choi; 5th August, 2009 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) { size_t dblk_page_nelmts; /* # of elements per page */ @@ -242,57 +237,58 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits; if(state->nelmts > dblk_page_nelmts) { - size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); - size_t dblk_page_init_size = (npages + 7) / 8; - hsize_t checksum_size = npages * 4; + size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); + size_t dblk_page_init_size = (npages + 7) / 8; + hsize_t checksum_size = npages * 4; - state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size + + state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size + state->nelmts * cparam->raw_elmt_size; - } else - state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size; + } + else + state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size; - return(0); + return SUCCEED; } /* end set_fa_state() */ /*------------------------------------------------------------------------- - * Function: reopen_file + * Function: reopen_file * - * Purpose: Perform common "re-open" operations on file & array for testing + * Purpose: Perform common "re-open" operations on file & array for testing * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static int -reopen_file(hid_t *file, H5F_t **f, hid_t fapl, +reopen_file(hid_t *fid, H5F_t **f, hid_t fapl_id, H5FA_t **fa, haddr_t fa_addr, const farray_test_param_t *tparam) { /* Check for closing & re-opening the array */ /* (actually will close & re-open the file as well) */ if(tparam->reopen_array) { + /* Close array, if given */ if(fa && *fa) { if(H5FA_close(*fa) < 0) FAIL_STACK_ERROR *fa = NULL; - } /* end if */ + } /* Close file */ - if(*file) { - if(H5Fclose(*file) < 0) + if(*fid) { + if(H5Fclose(*fid) < 0) FAIL_STACK_ERROR - *file = (-1); + *fid = H5I_INVALID_HID; *f = NULL; - } /* end if */ + } /* Re-open the file */ - if((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if((*fid = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5I_object(*fid))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -303,27 +299,26 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, if(fa) if(NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) FAIL_STACK_ERROR - } /* end if */ + } /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* reopen_file() */ /*------------------------------------------------------------------------- - * Function: create_array + * Function: create_array * - * Purpose: Create a fixed array and perform initial checks + * Purpose: Create a fixed array and perform initial checks * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t create_array(H5F_t *f, const H5FA_create_t *cparam, H5FA_t **fa, haddr_t *fa_addr) { @@ -338,65 +333,65 @@ create_array(H5F_t *f, const H5FA_create_t *cparam, FAIL_STACK_ERROR if(!H5F_addr_defined(*fa_addr)) TEST_ERROR + + /* Check array stats */ HDmemset(&state, 0, sizeof(state)); - state.hdr_size = FA_HDR_SIZE; - state.nelmts = cparam->nelmts; + state.hdr_size = FA_HDR_SIZE; + state.nelmts = cparam->nelmts; if(check_stats(*fa, &state)) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* create_array() */ /*------------------------------------------------------------------------- - * Function: verify_cparam + * Function: verify_cparam * - * Purpose: Verify creation parameters are correct + * Purpose: Verify creation parameters are correct * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t verify_cparam(const H5FA_t *fa, const H5FA_create_t *cparam) { H5FA_create_t test_cparam; /* Creation parameters for array */ /* Retrieve creation parameters */ HDmemset(&test_cparam, 0, sizeof(H5FA_create_t)); - if(H5FA_get_cparam_test(fa, &test_cparam) < 0) + if(H5FA__get_cparam_test(fa, &test_cparam) < 0) FAIL_STACK_ERROR /* Verify creation parameters */ - if(H5FA_cmp_cparam_test(cparam, &test_cparam)) + if(H5FA__cmp_cparam_test(cparam, &test_cparam)) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* verify_cparam() */ /*------------------------------------------------------------------------- - * Function: finish + * Function: finish * - * Purpose: Close array, delete array, close file and verify that file + * Purpose: Close array, delete array, close file and verify that file * is empty size * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int -finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) +static herr_t +finish(hid_t fid, hid_t fapl_id, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) { h5_stat_size_t file_size; /* File size, after deleting array */ @@ -409,11 +404,11 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(file) < 0) + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size = h5_get_file_size(filename_g, fapl)) < 0) + if((file_size = h5_get_file_size(filename_g, fapl_id)) < 0) TEST_ERROR /* Verify the file is correct size */ @@ -421,10 +416,10 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* finish() */ @@ -627,23 +622,21 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +test_open_twice(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ - H5FA_t *fa = NULL; /* Fixed array wrapper */ - H5FA_t *fa2 = NULL; /* Fixed array wrapper */ - haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl, &file, &f) < 0) + if(create_file(fapl_id, &fid, &f) < 0) TEST_ERROR - /* - * Display testing message - */ + /* Display testing message */ TESTING("open fixed array twice"); /* Create array */ @@ -666,15 +659,15 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) fa2 = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) + if(reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Re-open the file */ - if((file2 = H5Freopen(file)) < 0) + if((fid2 = H5Freopen(fid)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5I_object(fid2))) FAIL_STACK_ERROR /* Open the fixed array through the second file handle */ @@ -694,11 +687,11 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(file) < 0) + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + if(finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -712,8 +705,8 @@ error: H5FA_close(fa); if(fa2) H5FA_close(fa2); - H5Fclose(file); - H5Fclose(file2); + H5Fclose(fid); + H5Fclose(fid2); } H5E_END_TRY; return 1; @@ -736,26 +729,24 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { - char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - hid_t file0 = -1; /* File ID */ - hid_t file00 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ - H5FA_t *fa = NULL; /* Fixed array wrapper */ - H5FA_t *fa2 = NULL; /* Fixed array wrapper */ - haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ - - /* - * Display testing message - */ + char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fid0 = H5I_INVALID_HID; /* File ID */ + hid_t fid00 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + + /* Display testing message */ TESTING("open fixed array twice, through different file handles"); /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl, &file, &f) < 0) + if(create_file(fapl_id, &fid, &f) < 0) TEST_ERROR /* Create array */ @@ -781,11 +772,11 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa /* (So that there is something holding the file open when the extensible * array is closed) */ - if((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if((fid0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) + if(reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Close the first fixed array wrapper */ @@ -797,26 +788,25 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(file) < 0) + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - file = -1; + fid = H5I_INVALID_HID; /* Open a different file */ /* (This re-allocates the 'top' file pointer and assigns it a different * 'shared' file pointer, making the file pointer in the fixed array's * header stale) */ - h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp)); - if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + h5_fixname(FILENAME[1], fapl_id, filename_tmp, sizeof(filename_tmp)); + if((fid00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR - /* Re-open the file with the fixed array */ - if((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if((fid2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5I_object(fid2))) FAIL_STACK_ERROR /* Open the fixed array through the second file handle */ @@ -828,13 +818,13 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa TEST_ERROR /* Close the extra file handles */ - if(H5Fclose(file0) < 0) + if(H5Fclose(fid0) < 0) FAIL_STACK_ERROR - if(H5Fclose(file00) < 0) + if(H5Fclose(fid00) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + if(finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -848,10 +838,10 @@ error: H5FA_close(fa); if(fa2) H5FA_close(fa2); - H5Fclose(file); - H5Fclose(file2); - H5Fclose(file0); - H5Fclose(file00); + H5Fclose(fid); + H5Fclose(fid2); + H5Fclose(fid0); + H5Fclose(fid00); } H5E_END_TRY; return 1; @@ -966,7 +956,7 @@ error: H5FA_close(fa); if(fa2) H5FA_close(fa2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; @@ -1666,7 +1656,7 @@ main(void) fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); if(ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); @@ -1706,12 +1696,12 @@ main(void) switch(curr_test) { /* "Normal" testing parameters */ case FARRAY_TEST_NORMAL: - puts("Testing with NORMAL PARAMETERS"); + HDputs("Testing with NORMAL PARAMETERS"); break; /* "Re-open array" testing parameters */ case FARRAY_TEST_REOPEN: - puts("Testing with reopen array flag set"); + HDputs("Testing with reopen array flag set"); tparam.reopen_array = FARRAY_TEST_REOPEN; break; @@ -1738,25 +1728,25 @@ main(void) switch(curr_iter) { /* "Forward" testing parameters */ case FARRAY_ITER_FW: - puts("Testing with forward iteration"); + HDputs("Testing with forward iteration"); tparam.fiter = &fa_iter_fw; break; /* "Reverse" testing parameters */ case FARRAY_ITER_RV: - puts("Testing with reverse iteration"); + HDputs("Testing with reverse iteration"); tparam.fiter = &fa_iter_rv; break; /* "Random" testing parameters */ case FARRAY_ITER_RND: - puts("Testing with random iteration"); + HDputs("Testing with random iteration"); tparam.fiter = &fa_iter_rnd; break; /* "Cyclic" testing parameters */ case FARRAY_ITER_CYC: - puts("Testing with cyclic iteration"); + HDputs("Testing with cyclic iteration"); tparam.fiter = &fa_iter_cyc; break; @@ -1772,22 +1762,26 @@ main(void) nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)tparam.nelmts, "setting all the array elements"); } /* end for */ - /* Check skipping elements */ + /* Check skipping elements */ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)1, TRUE, "skipping to first element"); nerrors += test_skip_elmts(fapl, &cparam, &tparam, ((hsize_t)1 << cparam.max_dblk_page_nelmts_bits), TRUE, "skipping to first element in data block page"); nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), TRUE, "skipping to last element"); - /* Create Fixed Array of MAX_NELMTS elements */ - /* - * MAX_NELMTS succeeds on jam and smirom. - * The value was adjusted for linew due to the following: - Linew failed with "H5FD_sec2_truncate(): unable to extend file properly" - Linew failed with "H5FD_sec2_truncate(): File too large" - */ + /* Create Fixed Array */ + /* MAX_NELMTS succeeds on some platforms buy may fail on others: + * + * "H5FD_sec2_truncate(): unable to extend file properly" + * + * and + * + * "H5FD_sec2_truncate(): File too large" + * + * have both been seen. + */ tparam.nelmts = MAX_NELMTS/17; - init_cparam(&cparam, &tparam); + init_cparam(&cparam, &tparam); - /* Set the last element in the Fixed Array */ + /* Set the last element in the Fixed Array */ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), FALSE, "skipping to last element"); } /* end for */ @@ -1800,22 +1794,22 @@ main(void) if(nerrors) goto error; - puts("All fixed array tests passed."); + HDputs("All fixed array tests passed."); /* Clean up file used */ h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { - H5Pclose(fapl); + H5Pclose(fapl); } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); - return 1; + HDexit(EXIT_FAILURE); } /* end main() */ diff --git a/test/fheap.c b/test/fheap.c index e38d263..1af56a6 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -3037,7 +3037,7 @@ error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_size() */ diff --git a/test/fillval.c b/test/fillval.c index 8c8e902..5b95de9 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -762,15 +762,17 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, comp_datatype *buf_c=NULL; H5D_space_status_t allocation; - if(datatype==H5T_INTEGER) + if(datatype == H5T_INTEGER) { fillval = *(int*)_fillval; - else if(datatype==H5T_COMPOUND) { - fill_c.a=((comp_datatype*)_fillval)->a; + } + else if(datatype == H5T_COMPOUND) { + fill_c.a=((comp_datatype*)_fillval)->a; fill_c.x=((comp_datatype*)_fillval)->x; fill_c.y=((comp_datatype*)_fillval)->y; fill_c.z=((comp_datatype*)_fillval)->z; - } else { - puts("Invalid type for test"); + } + else { + HDputs("Invalid type for test"); goto error; } @@ -806,7 +808,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, goto error; } /* case for compound datatype */ - } else if(datatype==H5T_COMPOUND) { + } + else if(datatype==H5T_COMPOUND) { if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0) goto error; if(fill_time != H5D_FILL_TIME_NEVER && (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) || @@ -828,10 +831,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, /* Select all odd data locations in the file dataset */ for (i=0, nelmts=1; i<5; i++) { - hs_size[i] = cur_size[i]/2; - hs_offset[i] = 0; - hs_stride[i] = 2; - nelmts *= hs_size[i]; + hs_size[i] = cur_size[i]/2; + hs_offset[i] = 0; + hs_stride[i] = 2; + nelmts *= hs_size[i]; } if((mspace=H5Screate_simple(5, hs_size, hs_size)) < 0) goto error; if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, @@ -1089,17 +1092,23 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) } h5_fixname(base_name, fapl, filename, sizeof filename); - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5D_CHUNKED==layout) { - if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; - } else if(H5D_COMPACT==layout) { - if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if(H5D_CHUNKED == layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) + goto error; + } + else if(H5D_COMPACT == layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) + goto error; } - if((ctype_id=create_compound_type()) < 0) goto error; + if((ctype_id = create_compound_type()) < 0) + goto error; /* I. Test H5D_ALLOC_TIME_LATE space allocation cases */ if(H5D_COMPACT != layout) { @@ -2359,8 +2368,6 @@ test_partalloc(hid_t fapl, const char *base_name) * Programmer: Robb Matzke * Thursday, October 1, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -2380,8 +2387,8 @@ main(int argc, char *argv[]) else if(!strcmp(argv[argno], "compact")) test_compact =1; else { - fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); - exit(EXIT_FAILURE); + HDfprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); + HDexit(EXIT_FAILURE); } } /* end for */ } /* end if */ @@ -2444,15 +2451,15 @@ main(int argc, char *argv[]) if(nerrors) goto error; - puts("All fill value tests passed."); + HDputs("All fill value tests passed."); if(h5_cleanup(FILENAME, fapl)) HDremove(FILE_NAME_RAW); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("***** FILL VALUE TESTS FAILED *****"); - return 1; + HDputs("***** FILL VALUE TESTS FAILED *****"); + HDexit(EXIT_FAILURE); } diff --git a/test/freespace.c b/test/freespace.c index 33a6f89..f397377 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -24,7 +24,7 @@ #define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" -#include "H5CXprivate.h" /* API Contexts */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" #include "H5VMprivate.h" @@ -496,7 +496,7 @@ test_fs_create(hid_t fapl) if(!H5F_addr_defined(fs_addr)) TEST_ERROR - if (frsp->nclasses != nclasses) + if(frsp->nclasses != nclasses) TEST_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -504,9 +504,9 @@ test_fs_create(hid_t fapl) TEST_ERROR HDmemset(&test_cparam, 0, sizeof(H5FS_create_t)); - if(H5FS_get_cparam_test(frsp, &test_cparam) < 0) + if(H5FS__get_cparam_test(frsp, &test_cparam) < 0) FAIL_STACK_ERROR - if (H5FS_cmp_cparam_test(&cparam, &test_cparam)) + if(H5FS__cmp_cparam_test(&cparam, &test_cparam)) FAIL_STACK_ERROR /* Close the free space manager */ @@ -1857,14 +1857,14 @@ test_fs_sect_shrink(hid_t fapl) * Re-add section A that allow shrinking and its section class type defines "can_shrink" */ if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); can_shrink = FALSE; if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* should have nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1875,18 +1875,18 @@ test_fs_sect_shrink(hid_t fapl) /* section A should not be there in free-space */ if((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if (node_found) TEST_ERROR /* Close the free space manager */ if(H5FS_close(f, frsp) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ if(H5FS_delete(f, fs_addr) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; /* Close the file */ @@ -2082,7 +2082,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2357,7 +2357,7 @@ test_fs_sect_change_class(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR diff --git a/test/gheap.c b/test/gheap.c index bf0f18a..4dc3fb0 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -15,9 +15,9 @@ * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Purpose: Tests the global heap. The global heap is the set of all - * collections but the collections are not related to one - * another by anything that appears in the file format. + * Purpose: Tests the global heap. The global heap is the set of all + * collections but the collections are not related to one + * another by anything that appears in the file format. */ #include "h5test.h" #include "H5ACprivate.h" @@ -56,37 +56,35 @@ const char *FILENAME[] = { NULL }; - + /*------------------------------------------------------------------------- * Function: test_1 * - * Purpose: Writes a sequence of objects to the global heap where each - * object is larger than the one before. + * Purpose: Writes a sequence of objects to the global heap where each + * object is larger than the one before. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_1 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - uint8_t in[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + uint8_t in[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("monotonically increasing lengths"); @@ -97,10 +95,10 @@ test_1 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -116,11 +114,12 @@ test_1 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if(status < 0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; - } else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) { + } + else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) { H5_FAILED(); - puts(" Collection addresses are not monotonically increasing"); + HDputs(" Collection addresses are not monotonically increasing"); nerrors++; } } @@ -134,11 +133,12 @@ test_1 (hid_t fapl) H5Eclear2(H5E_DEFAULT); if(NULL == H5HG_read(f, obj + u, in, NULL)) { H5_FAILED(); - puts(" Unable to read object"); + HDputs(" Unable to read object"); nerrors++; - } else if(HDmemcmp(in, out, size)) { + } + else if(HDmemcmp(in, out, size)) { H5_FAILED(); - puts(" Value read doesn't match value written"); + HDputs(" Value read doesn't match value written"); nerrors++; } } @@ -147,51 +147,51 @@ test_1 (hid_t fapl) HDfree(obj); obj = NULL; - if(H5Fclose(file) < 0) goto error; - if(nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_2 * - * Purpose: Writes a sequence of objects to the global heap where each - * object is smaller than the one before. + * Purpose: Writes a sequence of objects to the global heap where each + * object is smaller than the one before. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_2 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - uint8_t in[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + uint8_t in[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + int nerrors = 0; + char filename[1024]; TESTING("monotonically decreasing lengths"); @@ -202,10 +202,10 @@ test_2 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -216,9 +216,9 @@ test_2 (hid_t fapl) size = GHEAP_TEST_NOBJS - u; HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - if (H5HG_insert (f, size, out, obj + u) < 0) { + if(H5HG_insert(f, size, out, obj + u) < 0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } } @@ -232,11 +232,12 @@ test_2 (hid_t fapl) H5Eclear2(H5E_DEFAULT); if(NULL == H5HG_read(f, obj + u, in, NULL)) { H5_FAILED(); - puts(" Unable to read object"); + HDputs(" Unable to read object"); nerrors++; - } else if (memcmp (in, out, size)) { + } + else if (memcmp (in, out, size)) { H5_FAILED(); - puts(" Value read doesn't match value written"); + HDputs(" Value read doesn't match value written"); nerrors++; } } @@ -245,51 +246,51 @@ test_2 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_3 * - * Purpose: Creates a few global heap objects and then removes them all. - * The collection should also be removed. + * Purpose: Creates a few global heap objects and then removes them all. + * The collection should also be removed. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_3 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("complete object removal"); @@ -300,11 +301,11 @@ test_3 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { - H5_FAILED(); - puts(" Unable to create file"); - goto error; + H5_FAILED(); + HDputs(" Unable to create file"); + goto error; } /* Create some stuff */ @@ -315,7 +316,7 @@ test_3 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } } @@ -325,7 +326,7 @@ test_3 (hid_t fapl) status = H5HG_remove(f, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to remove object"); + HDputs(" Unable to remove object"); nerrors++; } } @@ -334,52 +335,52 @@ test_3 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_4 * - * Purpose: Tests the H5HG_remove() feature by writing lots of objects - * and occassionally removing some. When we're done they're all - * removed. + * Purpose: Tests the H5HG_remove() feature by writing lots of objects + * and occassionally removing some. When we're done they're all + * removed. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_4 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("partial object removal"); @@ -390,10 +391,10 @@ test_4 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[3], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -405,21 +406,20 @@ test_4 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } - /* - * Remove every third one beginning with the second, but after the - * next one has already been inserted. That is, insert A, B, C; - * remove B, insert D, E, F; remove E; etc. - */ + /* Remove every third one beginning with the second, but after the + * next one has already been inserted. That is, insert A, B, C; + * remove B, insert D, E, F; remove E; etc. + */ if(1 == (u % 3)) { H5Eclear2(H5E_DEFAULT); status = H5HG_remove(f, obj + u - 1); if (status<0) { H5_FAILED(); - puts(" Unable to remove object"); + HDputs(" Unable to remove object"); nerrors++; } HDmemset(obj + u - 1, 0, sizeof *obj); @@ -430,51 +430,51 @@ test_4 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_ooo_indices * - * Purpose: Tests that indices can be stored out of order. This can + * Purpose: Tests that indices can be stored out of order. This can * happen when the indices "wrap around" due to many * insertions and deletions (for example, from rewriting a * VL dataset). * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Monday, October 26, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_ooo_indices(hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; unsigned i, j; - H5HG_t *obj = NULL; - herr_t status; - int nerrors=0; - char filename[1024]; + H5HG_t *obj = NULL; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("out of order indices"); @@ -487,16 +487,18 @@ test_ooo_indices(hid_t fapl) goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; - } /* end if */ + } /* Alternately insert 1000 entries and remove the previous group of 1000 - * entries, until the indices wrap around */ - for(i=0; i<66; i++) { + * entries, until the indices wrap around. + */ + for(i = 0; i < 66; i++) { /* Insert 1000 entries. The index into the obj array will alternate up * and down by 1000 so the previous set of insertions is preserved and - * can be deleted. */ + * can be deleted. + */ for(j=1000*((~i&1)); j<1000*((~i&1)+1); j++) { H5Eclear2(H5E_DEFAULT); status = H5HG_insert(f, sizeof(j), &j, &obj[j]); @@ -506,7 +508,7 @@ test_ooo_indices(hid_t fapl) /* Check that the index is as expected */ if(obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1u << 16) - 1) + 1) GHEAP_REPEATED_ERR(" Unexpected global heap index"); - } /* end for */ + } /* Remove the previous 1000 entries */ if(i>0) @@ -515,20 +517,21 @@ test_ooo_indices(hid_t fapl) status = H5HG_remove(f, &obj[j]); if (status<0) GHEAP_REPEATED_ERR(" Unable to remove object from global heap"); - } /* end for */ - } /* end for */ + } + } /* The indices should have "wrapped around" on the last iteration */ HDassert(obj[534].idx == 65535); HDassert(obj[535].idx == 1); /* Reopen the file */ - if (H5Fclose(file)<0) goto error; + if (H5Fclose(file) < 0) + goto error; if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to open file"); + HDputs(" Unable to open file"); goto error; } /* end if */ @@ -538,14 +541,15 @@ test_ooo_indices(hid_t fapl) goto error; if(i != j) { H5_FAILED(); - puts(" Incorrect read value"); + HDputs(" Incorrect read value"); goto error; - } /* end if */ - } /* end for */ - - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + } + } + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; HDfree(obj); obj = NULL; @@ -554,69 +558,67 @@ test_ooo_indices(hid_t fapl) error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); return MAX(1, nerrors); } /* end test_ooo_indices */ - + /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Tests global heap. + * Function: main * - * Return: Success: zero - * - * Failure: non-zero - * - * Programmer: Robb Matzke - * Tuesday, March 31, 1998 + * Purpose: Tests global heap. * - * Modifications: + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ int main (void) { - int nerrors=0; - hid_t fapl; + int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_reset(); - fapl = h5_fileaccess(); + if ((fapl_id = h5_fileaccess()) < 0) + goto error; /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; - nerrors += test_1(fapl); - nerrors += test_2(fapl); - nerrors += test_3(fapl); - nerrors += test_4(fapl); - nerrors += test_ooo_indices(fapl); + nerrors += test_1(fapl_id); + nerrors += test_2(fapl_id); + nerrors += test_3(fapl_id); + nerrors += test_4(fapl_id); + nerrors += test_ooo_indices(fapl_id); /* Verify symbol table messages are cached */ - nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); if (nerrors) goto error; - puts("All global heap tests passed."); + + HDputs("All global heap tests passed."); /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - h5_cleanup(FILENAME, fapl); - return 0; + h5_cleanup(FILENAME, fapl_id); + HDexit(EXIT_SUCCESS); error: - puts("*** TESTS FAILED ***"); + H5E_BEGIN_TRY { + H5Pclose(fapl_id); + } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); - return 1; -} + HDputs("*** TESTS FAILED ***"); + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/h5test.c b/test/h5test.c index 687f594..fb5b83d 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1633,15 +1633,11 @@ error: * * Purpose: Callback function for h5_verify_cached_stabs. * - * Return: Success: 0 - * - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Tuesday, April 12, 2011 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1649,9 +1645,9 @@ h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, const H5O_info_t *oinfo, void H5_ATTR_UNUSED *udata) { if(oinfo->type == H5O_TYPE_GROUP) - return(H5G__verify_cached_stabs_test(oid)); + return H5G__verify_cached_stabs_test(oid); else - return(0); + return SUCCEED; } /* end h5_verify_cached_stabs_cb() */ diff --git a/test/istore.c b/test/istore.c index b5bac2c..1d57a2a 100644 --- a/test/istore.c +++ b/test/istore.c @@ -216,7 +216,7 @@ test_create(hid_t f, const char *prefix) /* Create chunked dataset of this dimensionality */ HDsnprintf(name, sizeof name, "%s_%02u", prefix, u); - if ((dataset=new_object(f, name, (int)u, dims, my_chunk_dims)) < 0) + if((dataset = new_object(f, name, (int)u, dims, my_chunk_dims)) < 0) return FAIL; /* Close dataset created */ diff --git a/test/lheap.c b/test/lheap.c index 4f09b6e..d309fb0 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -41,9 +41,7 @@ const char *FILENAME[] = { * heap, close the file, open the file, read data out of the * local heap, close the file. * - * Return: Success: zero - * - * Failure: non-zero + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Tuesday, November 24, 1998 @@ -95,7 +93,7 @@ main(void) H5Eprint2(H5E_DEFAULT, stdout); goto error; } - if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) { + if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -147,7 +145,7 @@ main(void) if(j > 4) buf[j] = '\0'; - if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) { + if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -211,7 +209,7 @@ main(void) HDputs("All local heap tests passed."); h5_cleanup(FILENAME, fapl); - return 0; + return EXIT_SUCCESS; error: HDputs("*** TESTS FAILED ***"); @@ -221,6 +219,6 @@ main(void) if(api_ctx_pushed) H5CX_pop(); - return 1; + return EXIT_FAILURE; } diff --git a/test/mf.c b/test/mf.c index 04b7c0b..eefd2a1 100644 --- a/test/mf.c +++ b/test/mf.c @@ -903,7 +903,7 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Retrieve the file's maxaddr */ - if(H5F_get_maxaddr_test(file, &maxaddr) < 0) + if(H5F__get_maxaddr_test(file, &maxaddr) < 0) FAIL_STACK_ERROR /* Allocate some temporary address space */ @@ -3702,7 +3702,7 @@ error: * Alignment = 1024 or 4096 * * Test 1: - * Turn off using meta data aggregator + * Turn off using metadata aggregator * Allocate a block of 30 which should be from file allocation * Result: * The return address should be aligned @@ -3715,13 +3715,13 @@ error: * A fragment [1054, 994] or [4126, 4066] is freed to free-space * EOA is 2098 or 8242 * Test 2: - * Turn off using meta data aggregator + * Turn off using metadata aggregator * Allocate a block which should be from file allocation * The return address should be aligned * H5MF_try_shrink() the block with aligned address should succeed * * Test 3: - * Turn off using meta data aggregator + * Turn off using metadata aggregator * Allocate a block which should be from file allocation * The return address should be aligned * H5MF_try_extend() the block with aligned address should succeed @@ -5917,17 +5917,17 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ - return(0); + return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_mf_align_alloc6() */ /* @@ -7027,7 +7027,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) * assertion failures on the first file space alloc / dealloc. */ if(f->shared->first_alloc_dealloc){ - if(SUCCEED!=H5MF_tidy_self_referential_fsm_hack(f)) + if(SUCCEED != H5MF_tidy_self_referential_fsm_hack(f)) FAIL_STACK_ERROR ran_H5MF_tidy_self_referential_fsm_hack = TRUE; } @@ -7614,7 +7614,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) hid_t fcpl = -1; /* File creation property list */ hid_t fapl_new = -1; /* File access property list ID */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr2, addr3; /* Addresses for small meta data blocks */ + haddr_t addr2, addr3; /* Addresses for small metadata blocks */ haddr_t saddr1; /* Addresses for small raw data blocks */ haddr_t gaddr1; /* Addresses for large data blocks */ hbool_t split = FALSE, multi = FALSE; @@ -7661,7 +7661,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) TEST_ERROR - /* Allocate 3 small meta data blocks: addr1, addr2, addr3 */ + /* Allocate 3 small metadata blocks: addr1, addr2, addr3 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034); addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); @@ -7673,7 +7673,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); - /* Verify that the freed block with addr2 is found from the small meta data manager */ + /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type], &found_addr) < 0) TEST_ERROR if(found_addr != addr2) @@ -7735,7 +7735,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR - /* Verify that the small meta data manager is there */ + /* Verify that the small metadata manager is there */ H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR @@ -7746,16 +7746,16 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) * assertion failures on the first file space alloc / dealloc. */ if(f->shared->first_alloc_dealloc){ - if(SUCCEED!=H5MF_tidy_self_referential_fsm_hack(f)) + if(SUCCEED != H5MF_tidy_self_referential_fsm_hack(f)) FAIL_STACK_ERROR } - /* Set up to use the small meta data manager */ + /* Set up to use the small metadata manager */ if(!(f->shared->fs_man[fs_type])) if(H5MF__open_fstype(f, fs_type) < 0) TEST_ERROR - /* Verify that the freed block with addr2 is found from the small meta data manager */ + /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)(f->shared->fs_page_size-(addr3+TBLOCK_SIZE50)), f->shared->fs_man[fs_type], &found_addr) < 0) TEST_ERROR @@ -7838,7 +7838,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) hid_t fid = -1; /* File ID */ hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1; /* Address for small meta data block */ + haddr_t addr1; /* Address for small metadata block */ haddr_t saddr1; /* Address for small raw data block */ haddr_t gaddr1; /* Address for large data block */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -7872,14 +7872,14 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR - /* Allocate a small meta data block with addr1 */ + /* Allocate a small metadata block with addr1 */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); /* Try to shrink the block with addr1 */ if((status = H5MF_try_shrink(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE50)) < 0) FAIL_STACK_ERROR - /* Couldn't shrink due to the section (remaining space in the page) is in the small meta data free-space manager */ + /* Couldn't shrink due to the section (remaining space in the page) is in the small metadata free-space manager */ if(status == TRUE) TEST_ERROR /* Allocate a small raw data block with saddr1 */ @@ -7961,7 +7961,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) hid_t fid = -1; /* File ID */ hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1, addr2, addr3; /* Addresses for small meta data blocks */ + haddr_t addr1, addr2, addr3; /* Addresses for small metadata blocks */ haddr_t saddr1; /* Address for small raw data block */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ htri_t was_extended; /* Whether the block can be extended or not */ @@ -7993,7 +7993,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR - /* Allocate a small meta data block with addr1 */ + /* Allocate a small metadata block with addr1 */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE98); /* Try extending the block with addr1 at EOF not crossing page boundary */ @@ -8001,7 +8001,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) /* Should succeed */ if(was_extended != TRUE) TEST_ERROR - /* Allocate 2 small meta data blocks with addr2 and addr3--will be on another meta data page */ + /* Allocate 2 small metadata blocks with addr2 and addr3--will be on another metadata page */ addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE100); addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE150); @@ -8028,7 +8028,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) /* Free the block with addr1 */ H5MF_xfree(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE3248); - /* Allocate a new meta data block with addr1 */ + /* Allocate a new metadata block with addr1 */ /* There is a page end threshold of size H5F_FILE_SPACE_PGEND_META_THRES at the end of the block */ /* The block is right next to the threshold */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3286); @@ -8409,7 +8409,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ haddr_t addr2, addr3, addr4, addr5; /* Addresses for blocks */ - haddr_t addr9, addr10, addr11; /* Address for small meta data blocks */ + haddr_t addr9, addr10, addr11; /* Address for small metadata blocks */ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */ H5FS_stat_t fs_stat; /* Information for free-space manager */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -8445,7 +8445,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR - /* Allocate 2 small meta data blocks: addr1, addr2 */ + /* Allocate 2 small metadata blocks: addr1, addr2 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); @@ -8464,13 +8464,13 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(saddr2 != (saddr1 + TBLOCK_SIZE30)) TEST_ERROR - /* Allocate a small meta data block with addr3--there is no free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr3--there is no free-space section big enough to fulfill the request */ addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE4020); /* Should be on the third page and page aligned */ if(addr3 % TBLOCK_SIZE4096) TEST_ERROR - /* Allocate a small meta data block with addr4--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr4--there is a free-space section big enough to fulfill the request */ addr4 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); /* Should not be page aligned */ if(!(addr4 % TBLOCK_SIZE4096)) @@ -8479,7 +8479,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(addr4 != (addr2 + TBLOCK_SIZE50)) TEST_ERROR - /* Allocate a small meta data block with addr5--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr5--there is a free-space section big enough to fulfill the request */ addr5 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE40); /* Should not be page aligned */ if(!(addr5 % TBLOCK_SIZE4096)) @@ -8489,16 +8489,16 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(addr5 != (addr3 + TBLOCK_SIZE4020)) TEST_ERROR - /* Allocate a small meta data block with addr6--taking up the remaining space in the first page */ + /* Allocate a small metadata block with addr6--taking up the remaining space in the first page */ if(family) H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3080); else H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3088); - /* Allocate a small meta data block with addr7--taking up the remaining space in the third page */ + /* Allocate a small metadata block with addr7--taking up the remaining space in the third page */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE36); - /* Allocate 2 small meta data blocks: addr8, addr9--there is no free-space to fulfill the request */ + /* Allocate 2 small metadata blocks: addr8, addr9--there is no free-space to fulfill the request */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); addr9 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); @@ -8514,13 +8514,13 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(fs_stat.tot_space != TBLOCK_SIZE4096) TEST_ERROR - /* Allocate a small meta data block with addr10--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr10--there is a free-space section big enough to fulfill the request */ addr10 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3900); /* The block should be next to the block with addr9 */ if(addr10 != (addr9 + TBLOCK_SIZE80)) TEST_ERROR - /* Allocate a small meta data block with addr11 */ + /* Allocate a small metadata block with addr11 */ /* The current free-space section is unable to fulfill the request; obtain a page from the large manager */ addr11 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); /* The address of the block should be the same the freed block with saddr1 */ @@ -8575,7 +8575,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) hid_t fcpl2 = -1; /* File creation property list ID */ hid_t fapl_new = -1; /* File access property list ID */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1, addr2; /* Addresses for small meta data blocks */ + haddr_t addr1, addr2; /* Addresses for small metadata blocks */ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */ haddr_t gaddr1, gaddr2; /* Addresses for blocks */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -8729,7 +8729,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) /* Disable small data block mechanism */ if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0) TEST_ERROR - /* Disable meta data block mechanism */ + /* Disable metadata block mechanism */ if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0) TEST_ERROR @@ -8741,7 +8741,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) TEST_ERROR - /* Allocate 2 small meta data blocks */ + /* Allocate 2 small metadata blocks */ addr1 = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE50); diff --git a/test/objcopy.c b/test/objcopy.c index 18de027..9aa2265 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -21,7 +21,6 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" diff --git a/test/ohdr.c b/test/ohdr.c index 669b1e0..ffede25 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -15,24 +15,24 @@ * Tuesday, November 24, 1998 */ #include "h5test.h" -#include "H5Iprivate.h" + +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" /* Identifiers */ /* * This file needs to access private datatypes from the H5O package. * This file also needs to access the object header testing code. */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /* suppress error about including H5Opkg */ #define H5O_TESTING #include "H5Opkg.h" /* * This file needs to access private datatypes from the H5G package. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /* suppress error about including H5Gpkg */ #include "H5Gpkg.h" -#include "H5CXprivate.h" /* API Contexts */ - const char *FILENAME[] = { "ohdr", NULL @@ -119,7 +119,7 @@ test_cont(char *filename, hid_t fapl) FAIL_STACK_ERROR if(H5AC_flush(f) < 0) FAIL_STACK_ERROR - if(H5O_expunge_chunks_test(&oh_locA) < 0) + if(H5O__expunge_chunks_test(&oh_locA) < 0) FAIL_STACK_ERROR if(H5O_get_hdr_info(&oh_locA, &hdr_info) < 0) @@ -220,7 +220,7 @@ test_ohdr_cache(char *filename, hid_t fapl) /* Query object header information */ rc = 0; - if(H5O_get_rc(&oh_loc, &rc) < 0) + if(H5O__get_rc_test(&oh_loc, &rc) < 0) FAIL_STACK_ERROR if(0 != rc) TEST_ERROR @@ -261,7 +261,7 @@ test_ohdr_cache(char *filename, hid_t fapl) * a non-invasive way -QAK) */ rc = 0; - if(H5O_get_rc(&oh_loc, &rc) < 0) + if(H5O__get_rc_test(&oh_loc, &rc) < 0) FAIL_STACK_ERROR if(0 != rc) TEST_ERROR @@ -567,7 +567,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) FAIL_STACK_ERROR /* Check that the "unknown" message was _NOT_ marked */ - if(H5O_check_msg_marked_test(did, FALSE) < 0) + if(H5O__check_msg_marked_test(did, FALSE) < 0) FAIL_STACK_ERROR /* Close the dataset */ @@ -647,7 +647,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) FAIL_STACK_ERROR /* Check that the "unknown" message was marked */ - if(H5O_check_msg_marked_test(did, TRUE) < 0) + if(H5O__check_msg_marked_test(did, TRUE) < 0) FAIL_STACK_ERROR /* Close the dataset */ @@ -769,9 +769,9 @@ version_string(H5F_libver_t libver) /* Return the formed version bound string */ return str; -} /* end of version_string */ - +} /* end version_string() */ + /*------------------------------------------------------------------------- * Function: main * @@ -780,13 +780,9 @@ version_string(H5F_libver_t libver) * Return: Success: 0 * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 * - * Modification: - * - Added loop of combinations of low/high library format bounds - * (BMR, Feb 2018) - * *------------------------------------------------------------------------- */ int diff --git a/test/page_buffer.c b/test/page_buffer.c index 3c61ab0..79f110c 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -21,6 +21,10 @@ #include "h5test.h" +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" +#include "H5PBprivate.h" + /* * This file needs to access private information from the H5F package. */ @@ -31,12 +35,8 @@ #define H5F_TESTING #include "H5Fpkg.h" -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" -#include "H5PBprivate.h" - -#define FILENAME_LEN 1024 +#define FILENAME_LEN 1024 #define NUM_DSETS 5 #define NX 100 #define NY 50 diff --git a/test/swmr.c b/test/swmr.c index b7e54e7..8f50123 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -3015,7 +3015,7 @@ test_start_swmr_write_stress_ohdr(hid_t in_fapl) /* Retrieve the chunk # for the dataspace message */ chunk_num = UINT_MAX; - if(H5O_msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) + if(H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) FAIL_STACK_ERROR; /* Should be in chunk #0 for now */ if(0 != chunk_num) @@ -3072,7 +3072,7 @@ test_start_swmr_write_stress_ohdr(hid_t in_fapl) /* Retrieve the chunk # for the dataspace message */ chunk_num = UINT_MAX; - if(H5O_msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) + if(H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0) FAIL_STACK_ERROR; /* Should be in chunk #0 for now */ if(1 != chunk_num) diff --git a/test/swmr_generator.c b/test/swmr_generator.c index 1c2ec04..23620fb 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -230,12 +230,12 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write, unsigned chunk_num; /* Object header chunk # for dataspace message */ /* Move the dataspace message to a new object header chunk */ - if(H5O_msg_move_to_new_chunk_test(dsid, H5O_SDSPACE_ID) < 0) + if(H5O__msg_move_to_new_chunk_test(dsid, H5O_SDSPACE_ID) < 0) return -1; /* Retrieve the chunk # for the dataspace message */ chunk_num = UINT_MAX; - if(H5O_msg_get_chunkno_test(dsid, H5O_SDSPACE_ID, &chunk_num) < 0) + if(H5O__msg_get_chunkno_test(dsid, H5O_SDSPACE_ID, &chunk_num) < 0) return -1; /* Should not be in chunk #0 for now */ if(0 == chunk_num) diff --git a/test/tarray.c b/test/tarray.c index 99f7bf8..d8ededf 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -26,8 +26,8 @@ #define TESTFILE "tarrold.h5" /* 1-D array datatype */ -#define ARRAY1_RANK 1 -#define ARRAY1_DIM1 4 +#define ARRAY1_RANK 1 +#define ARRAY1_DIM1 4 /* 3-D array datatype */ #define ARRAY2_RANK 3 @@ -65,7 +65,7 @@ typedef struct void *test_array_alloc_custom(size_t size, void *info); void test_array_free_custom(void *mem, void *info); - + /*------------------------------------------------------------------------- * Function: test_array_atomic_1d * @@ -189,7 +189,7 @@ test_array_atomic_1d(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_atomic_1d() */ - + /*------------------------------------------------------------------------- * Function: test_array_funcs * @@ -252,7 +252,7 @@ test_array_funcs(void) CHECK(ret, FAIL, "H5Tclose"); } /* end test_array_funcs() */ - + /*------------------------------------------------------------------------- * Function: test_array_atomic_3d * @@ -381,7 +381,7 @@ test_array_atomic_3d(void) } /* end test_array_atomic_3d() */ - + /*------------------------------------------------------------------------- * Function: test_array_array_atomic * @@ -540,7 +540,7 @@ test_array_array_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_array_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_atomic * @@ -747,7 +747,7 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_compound_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_array * @@ -1006,7 +1006,7 @@ test_array_compound_array(void) ** allocated. ** ****************************************************************/ - + /*------------------------------------------------------------------------- * Function: test_array_alloc_custom * @@ -1045,7 +1045,7 @@ test_array_alloc_custom(size_t size, void *info) return ret_value; } /* end test_array_alloc_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_free_custom * @@ -1081,7 +1081,7 @@ test_array_free_custom(void *_mem, void *info) return; } /* end test_array_free_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_atomic * @@ -1296,7 +1296,7 @@ test_array_vlen_atomic(void) } /* end test_array_vlen_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_array * @@ -1341,7 +1341,7 @@ test_array_vlen_array(void) for(k=0; k<(i+j+1); k++) for(l=0; l= min_dense; u--) { @@ -5108,18 +5106,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, u, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, u, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Delete another attribute, to push attribute storage into compact form */ @@ -5128,13 +5126,13 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (min_dense - 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (min_dense - 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Re-add attributes to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { @@ -5153,18 +5151,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Close Datasets */ @@ -5212,18 +5210,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); /* Delete several attributes from object, until attribute storage resumes compact form */ for(u = max_compact; u >= min_dense; u--) { @@ -5232,18 +5230,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, u, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, u, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Delete another attribute, to push attribute storage into compact form */ @@ -5252,13 +5250,13 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (min_dense - 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (min_dense - 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Re-add attributes to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { @@ -5277,18 +5275,18 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact + 1), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact + 1), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); /* Delete all attributes */ for(u = max_compact; u > 0; u--) { @@ -5318,7 +5316,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_transition() */ - + /**************************************************************** ** ** test_attr_corder_delete(): Test basic H5A (attribute) code. @@ -5425,10 +5423,10 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create attributes, until attribute storage is in dense form */ for(u = 0; u < max_compact * 2; u++) { @@ -5447,18 +5445,18 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); } /* end for */ /* Close Datasets */ @@ -5519,7 +5517,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_delete() */ - + /*------------------------------------------------------------------------- * Function: attr_info_by_idx_check * @@ -5666,7 +5664,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, return(-1); } /* end attr_info_by_idx_check() */ - + /**************************************************************** ** ** test_attr_info_by_idx(): Test basic H5A (attribute) code. @@ -5755,10 +5753,10 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for query on non-existant attribute */ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo, H5P_DEFAULT); @@ -5787,13 +5785,13 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound offset queries */ ret = H5Aget_info_by_idx(my_dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &ainfo, H5P_DEFAULT); @@ -5819,8 +5817,8 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Verify state of object */ - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); /* Verify information for new attribute */ ret = attr_info_by_idx_check(my_dataset, attrname, (hsize_t)u, use_index); @@ -5828,21 +5826,21 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound offset queries */ @@ -5876,7 +5874,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_info_by_idx() */ - + /**************************************************************** ** ** test_attr_delete_by_idx(): Test basic H5A (attribute) code. @@ -5995,10 +5993,10 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for deleting non-existant attribute */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -6025,13 +6023,13 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound deletions */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); @@ -6091,8 +6089,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify state of attribute storage (empty) */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); } /* end for */ /* Work on all the datasets */ @@ -6131,8 +6129,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -6141,21 +6139,21 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound deletion */ @@ -6216,8 +6214,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify state of attribute storage (empty) */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); /* Check for deletion on empty attribute storage again */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -6264,8 +6262,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -6376,8 +6374,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Adelete_by_idx"); /* Verify state of attribute storage (empty) */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); /* Check for deletion on empty attribute storage again */ ret = H5Adelete_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -6408,7 +6406,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_delete_by_idx() */ - + /**************************************************************** ** ** attr_iterate2_cb(): Revised attribute operator @@ -6482,7 +6480,7 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); } /* end attr_iterate2_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /**************************************************************** ** ** attr_iterate1_cb(): Attribute operator @@ -6495,7 +6493,7 @@ attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data) } /* end attr_iterate1_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: attr_iterate2_fail_cb * @@ -6517,7 +6515,7 @@ attr_iterate2_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED * return(H5_ITER_ERROR); } /* end attr_iterate2_fail_cb() */ - + /*------------------------------------------------------------------------- * Function: attr_iterate_check * @@ -6817,7 +6815,7 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, return(-1); } /* end attr_iterate_check() */ - + /**************************************************************** ** ** test_attr_iterate2(): Test basic H5A (attribute) code. @@ -6947,10 +6945,10 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for iterating over object with no attributes (should be OK) */ ret = H5Aiterate2(my_dataset, idx_type, order, NULL, attr_iterate2_cb, NULL); @@ -6983,13 +6981,13 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound iteration */ idx = u; @@ -7049,8 +7047,8 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7059,21 +7057,21 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound iteration */ @@ -7121,7 +7119,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) HDfree(visited); } /* test_attr_iterate2() */ - + /*------------------------------------------------------------------------- * Function: attr_open_by_idx_check * @@ -7181,7 +7179,7 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, return(-1); } /* end attr_open_by_idx_check() */ - + /**************************************************************** ** ** test_attr_open_by_idx(): Test basic H5A (attribute) code. @@ -7299,10 +7297,10 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening an attribute on an object with no attributes */ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -7329,13 +7327,13 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for out of bound opening an attribute on an object */ ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); @@ -7383,8 +7381,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7393,21 +7391,21 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for out of bound opening an attribute on an object */ @@ -7443,7 +7441,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: attr_open_check * @@ -7529,7 +7527,7 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, return(-1); } /* end attr_open_check() */ - + /**************************************************************** ** ** test_attr_open_by_name(): Test basic H5A (attribute) code. @@ -7621,10 +7619,10 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening a non-existant attribute on an object with no attributes */ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); @@ -7657,13 +7655,13 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Check for opening a non-existant attribute on an object with compact attribute storage */ ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); @@ -7720,8 +7718,8 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7730,21 +7728,21 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Check for opening a non-existant attribute on an object with dense attribute storage */ @@ -7784,7 +7782,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_open_by_name() */ - + /**************************************************************** ** ** test_attr_create_by_name(): Test basic H5A (attribute) code. @@ -7875,10 +7873,10 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end switch */ /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -7901,13 +7899,13 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, max_compact, "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, max_compact, "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Test opening attributes stored compactly */ ret = attr_open_check(fid, dsetname, my_dataset, u); @@ -7954,8 +7952,8 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Verify state of object */ if(u >= max_compact) { - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); } /* end if */ /* Verify information for new attribute */ @@ -7964,21 +7962,21 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end for */ /* Verify state of object */ - ret = H5O_num_attrs_test(my_dataset, &nattrs); - CHECK(ret, FAIL, "H5O_num_attrs_test"); - VERIFY(nattrs, (max_compact * 2), "H5O_num_attrs_test"); - is_empty = H5O_is_attr_empty_test(my_dataset); - VERIFY(is_empty, FALSE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(my_dataset); - VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O_is_attr_dense_test"); + ret = H5O__num_attrs_test(my_dataset, &nattrs); + CHECK(ret, FAIL, "H5O__num_attrs_test"); + VERIFY(nattrs, (max_compact * 2), "H5O__num_attrs_test"); + is_empty = H5O__is_attr_empty_test(my_dataset); + VERIFY(is_empty, FALSE, "H5O__is_attr_empty_test"); + is_dense = H5O__is_attr_dense_test(my_dataset); + VERIFY(is_dense, (new_format ? TRUE : FALSE), "H5O__is_attr_dense_test"); if(new_format) { /* Retrieve & verify # of records in the name & creation order indices */ - ret = H5O_attr_dense_info_test(my_dataset, &name_count, &corder_count); - CHECK(ret, FAIL, "H5O_attr_dense_info_test"); + ret = H5O__attr_dense_info_test(my_dataset, &name_count, &corder_count); + CHECK(ret, FAIL, "H5O__attr_dense_info_test"); if(use_index) - VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); - VERIFY(name_count, (max_compact * 2), "H5O_attr_dense_info_test"); + VERIFY(name_count, corder_count, "H5O__attr_dense_info_test"); + VERIFY(name_count, (max_compact * 2), "H5O__attr_dense_info_test"); } /* end if */ /* Test opening attributes stored compactly */ @@ -8132,14 +8130,14 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -8151,10 +8149,10 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -8206,11 +8204,11 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -8258,11 +8256,11 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ /* Close attribute's datatype */ @@ -8279,15 +8277,15 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) if(test_shared != 0) { if(test_shared == 1) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Unlink datasets with attributes */ @@ -8303,20 +8301,20 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -8463,14 +8461,14 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -8482,10 +8480,10 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -8537,11 +8535,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -8589,11 +8587,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Create new attribute name */ @@ -8726,15 +8724,15 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) if(test_shared != 0) { if(test_shared == 1) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Unlink datasets with attributes */ @@ -8750,20 +8748,20 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -8909,14 +8907,14 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -8928,10 +8926,10 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -8983,11 +8981,11 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -9027,7 +9025,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Check refcount for attribute */ ret = H5A__get_shared_rc_test(attr, &shared_refcount); CHECK(ret, FAIL, "H5A__get_shared_rc_test"); - VERIFY(shared_refcount, 2, "H5A_get_shared_rc_test"); + VERIFY(shared_refcount, 2, "H5A__get_shared_rc_test"); } /* end else */ /* Close attribute */ @@ -9035,11 +9033,11 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ @@ -9095,15 +9093,15 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) if(test_shared != 0) { if(test_shared == 1) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 2, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 2, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Unlink datasets with attributes */ @@ -9119,20 +9117,20 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -9278,14 +9276,14 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Check on dataset's message storage status */ if(test_shared != 0) { /* Datasets' datatypes can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Datasets' dataspace can be shared */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 1, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Retrieve limits for compact/dense attribute storage */ @@ -9297,10 +9295,10 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pclose"); /* Check on datasets' attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - is_dense = H5O_is_attr_dense_test(dataset2); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset2); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { @@ -9352,11 +9350,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); + is_dense = H5O__is_attr_dense_test(dataset); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Alternate between creating "small" & "big" attributes */ @@ -9404,11 +9402,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset2); + is_dense = H5O__is_attr_dense_test(dataset2); if(u < max_compact) - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); else - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); } /* end for */ @@ -9426,8 +9424,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Check on first dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + is_dense = H5O__is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Check ref count on attributes of first dataset */ for(u = 0; u < max_compact * 2; u++) { @@ -9474,20 +9472,20 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) } /* end if */ /* Check on attribute storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); if(test_shared != 0) { /* Check on datatype storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_DTYPE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Check on dataspace storage status */ - ret = H5F_get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(mesg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(fid, H5O_SDSPACE_ID, &mesg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(mesg_count, 0, "H5F__get_sohm_mesg_count_test"); } /* end if */ /* Close file */ @@ -10958,7 +10956,7 @@ test_attr(void) CHECK(ret, FAIL, "H5Pclose"); } /* test_attr() */ - + /*------------------------------------------------------------------------- * Function: cleanup_attr * diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index 8190665..e8ea044 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -1,5 +1,5 @@ Testing error API H5Eset/get_auto Testing error API based on data I/O All error API tests passed. - This program tests the Error API compatible with HDF5 version (number). There're supposed to be some error messages + This program tests the Error API compatible with HDF5 version (number). There are supposed to be some error messages ********* Print error stack in HDF5 default way ********* HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in main(): Error test failed diff --git a/test/testframe.c b/test/testframe.c index 21f9ea3..335118c 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -146,10 +146,10 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p * Record the program name and private routines if provided. */ TestProgName = ProgName; - if (NULL != private_usage) - TestPrivateUsage = private_usage; - if (NULL != private_parser) - TestPrivateParser = private_parser; + if(NULL != private_usage) + TestPrivateUsage = private_usage; + if(NULL != private_parser) + TestPrivateParser = private_parser; } diff --git a/test/testhdf5.c b/test/testhdf5.c index 713cccf..e136086 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -90,8 +90,8 @@ main(int argc, char *argv[]) /* Exit failure if errors encountered; else exit success. */ /* No need to print anything since PerformTests() already does. */ if (GetTestNumErrs() > 0) - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); else - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); } /* end main() */ diff --git a/test/tfile.c b/test/tfile.c index d3134f8..0db4c1b 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -22,7 +22,6 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" @@ -896,15 +895,15 @@ test_file_close(void) CHECK(ret, FAIL, "H5Pget_fclose_degree"); switch(fc_degree) { - case H5F_CLOSE_STRONG: + case H5F_CLOSE_STRONG: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); /* Close second open */ ret = H5Fclose(fid2); CHECK(ret, FAIL, "H5Fclose"); - break; - case H5F_CLOSE_SEMI: + break; + case H5F_CLOSE_SEMI: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -919,8 +918,8 @@ test_file_close(void) /* Close second open */ ret = H5Fclose(fid2); CHECK(ret, FAIL, "H5Fclose"); - break; - case H5F_CLOSE_WEAK: + break; + case H5F_CLOSE_WEAK: /* Close first open */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -935,7 +934,7 @@ test_file_close(void) CHECK(ret, FAIL, "H5Gclose"); ret = H5Gclose(group_id3); CHECK(ret, FAIL, "H5Gclose"); - break; + break; case H5F_CLOSE_DEFAULT: default: CHECK(fc_degree, H5F_CLOSE_DEFAULT, "H5Pget_fclose_degree"); @@ -957,7 +956,7 @@ test_file_close(void) ****************************************************************/ static void create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1, - hid_t *ret_gid2, hid_t *ret_gid3) + hid_t *ret_gid2, hid_t *ret_gid3) { ssize_t oid_count; herr_t ret; @@ -1109,9 +1108,10 @@ test_get_obj_ids(void) oid_list = (hid_t *)HDcalloc((size_t)oid_list_size, sizeof(hid_t)); CHECK_PTR(oid_list, "HDcalloc"); - /* Call the public function H5F_get_obj_ids to use H5F_get_objects. User reported having problem here. + /* Call the public function H5F_get_obj_ids to use H5F__get_objects. User reported having problem here. * that the returned size (ret_count) from H5Fget_obj_ids is one greater than the size passed in - * (oid_list_size) */ + * (oid_list_size). + */ ret_count = H5Fget_obj_ids(fid, H5F_OBJ_ALL, (size_t)oid_list_size, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); VERIFY(ret_count, oid_list_size, "H5Fget_obj_count"); @@ -2670,8 +2670,8 @@ test_cached_stab_info(void) CHECK(file_id, FAIL, "H5Fopen"); /* Verify the cached symbol table information */ - ret = H5F_check_cached_stab_test(file_id); - CHECK(ret, FAIL, "H5F_check_cached_stab_test"); + ret = H5F__check_cached_stab_test(file_id); + CHECK(ret, FAIL, "H5F__check_cached_stab_test"); /* Close file */ ret = H5Fclose(file_id); @@ -3941,14 +3941,6 @@ error: ** This routine checks the free space available in a file as ** returned by the public routine H5Fget_freespace(). ** -** Modifications: -** Vailin Choi; July 2012 -** Remove datasets in reverse order so that all file spaces are shrunk. -** (A change due to H5FD_FLMAP_DICHOTOMY.) -** -** Vailin Choi; Dec 2012 -** Add changes due to paged aggregation via new format: -** the amount of freespace is different. ** *****************************************************************/ static void @@ -5360,7 +5352,8 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) } else /* Should fail */ VERIFY(ok, FALSE, "H5Fcreate"); - } else { /* Should succeed */ + } + else { /* Should succeed */ VERIFY(ok, TRUE, "H5Fcreate"); VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds"); @@ -7341,7 +7334,7 @@ test_file(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_file() */ - + /*------------------------------------------------------------------------- * Function: cleanup_file * diff --git a/test/tgenprop.c b/test/tgenprop.c index 5031846..151913c 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -1774,8 +1774,8 @@ test_genprop_path(void) CHECK_I(ret, "H5Pregister2"); /* Get full path for first class */ - path=H5P_get_class_path_test(cid1); - CHECK_PTR(path, "H5P_get_class_path_test"); + path = H5P__get_class_path_test(cid1); + CHECK_PTR(path, "H5P__get_class_path_test"); if(HDstrcmp(path,CLASS1_PATH)!=0) TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH); H5free_memory(path); @@ -1789,14 +1789,14 @@ test_genprop_path(void) CHECK_I(ret, "H5Pregister2"); /* Get full path for second class */ - path=H5P_get_class_path_test(cid2); - CHECK_PTR(path, "H5P_get_class_path_test"); + path = H5P__get_class_path_test(cid2); + CHECK_PTR(path, "H5P__get_class_path_test"); if(HDstrcmp(path,CLASS2_PATH)!=0) TestErrPrintf("Class names don't match!, path=%s, CLASS2_PATH=%s\n",path,CLASS2_PATH); /* Open a copy of the class with the path name */ - cid3 = H5P_open_class_path_test(path); - CHECK_I(cid3, "H5Popen_class_path"); + cid3 = H5P__open_class_path_test(path); + CHECK_I(cid3, "H5P__open_class_path_test"); /* Check that the classes are equal */ ret = H5Pequal(cid2,cid3); diff --git a/test/th5s.c b/test/th5s.c index 0619571..14f5de9 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -22,7 +22,6 @@ #include "testhdf5.h" #include "H5srcdir.h" -#include "H5Bprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" diff --git a/test/tmisc.c b/test/tmisc.c index 22e1aad..47c0606 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2713,9 +2713,6 @@ test_misc15(void) fapl = H5Fget_access_plist(file); CHECK(fapl, FAIL, "H5Fget_access_plist"); - ret = H5Pclose(fapl); - CHECK(ret, FAIL, "H5Pclose"); - ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); @@ -2723,6 +2720,9 @@ test_misc15(void) ret = H5Fis_hdf5(MISC15_FILE); CHECK(ret, FAIL, "H5Fis_hdf5"); + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + file = H5Fopen(MISC15_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file, FAIL, "H5Fopen"); @@ -4721,6 +4721,7 @@ test_misc25a(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25a() */ + /**************************************************************** ** ** test_misc25b(): Exercise null object header message merge bug @@ -4756,7 +4757,7 @@ test_misc25b(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25b() */ - + /**************************************************************** ** ** test_misc25c(): Exercise another null object header message merge bug. @@ -4890,7 +4891,7 @@ test_misc25c(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25c() */ - + /**************************************************************** ** ** test_misc26(): Regression test: ensure that copying filter @@ -4976,7 +4977,7 @@ test_misc26(void) CHECK_I(ret, "H5Pclose"); } - + /**************************************************************** ** ** test_misc27(): Ensure that objects with incorrect # of object @@ -5021,7 +5022,7 @@ test_misc27(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc27() */ - + /**************************************************************** ** ** test_misc28(): Ensure that the dataset chunk cache will hold @@ -5198,7 +5199,7 @@ test_misc28(void) CHECK_I(ret, "H5Pclose"); } /* end test_misc28() */ - + /**************************************************************** ** ** test_misc29(): Ensure that speculative metadata reads don't @@ -5247,7 +5248,7 @@ test_misc30_get_info(hid_t loc_id) return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); } - + /**************************************************************** ** ** test_misc30(): Exercise local heap code that loads prefix @@ -5312,7 +5313,7 @@ test_misc30(void) VERIFY(file_size[0], file_size[1], "test_misc30"); } /* end test_misc30() */ - + /**************************************************************** ** ** test_misc31(): Test reentering library through deprecated @@ -5410,7 +5411,7 @@ test_misc31(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end test_misc31() */ - + /**************************************************************** * * test_misc32(): Simple test of filter memory allocation @@ -5584,7 +5585,7 @@ test_misc34(void) } /* end test_misc34() */ - + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -5637,7 +5638,7 @@ test_misc(void) } /* test_misc() */ - + /*------------------------------------------------------------------------- * Function: cleanup_misc * @@ -5647,9 +5648,6 @@ test_misc(void) * * Programmer: Albert Cheng * July 2, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ void diff --git a/test/tsohm.c b/test/tsohm.c index d00a03a..718b12f 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3862,9 +3862,9 @@ test_sohm_external_dtype(void) CHECK_I(file1, "H5Fcreate"); /* Check on datatype storage status. It should be zero now. */ - ret = H5F_get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Create data set */ dataset1 = H5Dcreate2(file1, "dataset_1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT, @@ -3872,9 +3872,9 @@ test_sohm_external_dtype(void) CHECK_I(dataset1, "H5Dcreate2"); /* Check on datatype storage status. It should be 1 now. */ - ret = H5F_get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(file1, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Retieve the dataset's datatype */ dset1_tid = H5Dget_type(dataset1); @@ -3900,9 +3900,9 @@ test_sohm_external_dtype(void) CHECK_I(file2, "H5Fcreate"); /* Check on datatype storage status. It should be zero now. */ - ret = H5F_get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 0, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 0, "H5F__get_sohm_mesg_count_test"); /* Create a data set using the datatype of the dataset in the first file. */ dataset2 = H5Dcreate2(file2, "dataset_2", dset1_tid, space, H5P_DEFAULT, H5P_DEFAULT, @@ -3910,9 +3910,9 @@ test_sohm_external_dtype(void) CHECK_I(dataset2, "H5Dcreate2"); /* Check on datatype storage status. It should be 1 now. */ - ret = H5F_get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); - CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test"); - VERIFY(dmsg_count, 1, "H5F_get_sohm_mesg_count_test"); + ret = H5F__get_sohm_mesg_count_test(file2, H5O_DTYPE_ID, &dmsg_count); + CHECK(ret, FAIL, "H5F__get_sohm_mesg_count_test"); + VERIFY(dmsg_count, 1, "H5F__get_sohm_mesg_count_test"); /* Write the data to the dataset2 */ ret = H5Dwrite(dataset2, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig); diff --git a/test/tunicode.c b/test/tunicode.c index e0e1f24..5a60036 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -163,7 +163,7 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string, each with a * terminating NULL. It will look like "abcdefg\0abcdefg\0". */ - strncpy(buf, new_string, big_len); + HDstrncpy(buf, new_string, big_len); HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); diff --git a/test/tvltypes.c b/test/tvltypes.c index 91ef0c2..8824066 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -1348,7 +1348,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata[i].v.p), t2=(s2 *)(rdata[i].v.p), j=0; jstring, t2->string) ) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ @@ -1406,7 +1406,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; jstring, t2->string) ) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ diff --git a/test/unregister.c b/test/unregister.c index dbf6293..ff116cf 100644 --- a/test/unregister.c +++ b/test/unregister.c @@ -16,6 +16,7 @@ * Purpose: Tests H5Zunregister function */ #include "h5test.h" + #include "H5CXprivate.h" /* API Contexts */ const char *FILENAME[] = { @@ -24,8 +25,8 @@ const char *FILENAME[] = { NULL }; -#define GROUP_NAME "group" -#define DSET_NAME "dataset" +#define GROUP_NAME "test_group" +#define DSET_NAME "test_dataset" #define FILENAME_BUF_SIZE 1024 #define DSET_DIM1 100 #define DSET_DIM2 200 @@ -35,39 +36,34 @@ const char *FILENAME[] = { #define H5Z_FILTER_DUMMY 312 -static size_t filter_dummy(unsigned int flags, size_t cd_nelmts, +static size_t do_nothing(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); /* Dummy filter for test_unregister_filters only */ const H5Z_class2_t H5Z_DUMMY[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_DUMMY, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "dummy", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - filter_dummy, /* The actual filter function */ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DUMMY, /* Filter ID number */ + 1, 1, /* Encoding and decoding enabled */ + "dummy", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + do_nothing, /* The actual filter function */ }}; /*------------------------------------------------------------------------- - * Function: filter_dummy + * Function: do_nothing * - * Purpose: A dummy compression method that doesn't do anything. This - * filter is only for test_unregister_filters. Please don't + * Purpose: A dummy compression method that doesn't do anything. This + * filter is only for test_unregister_filters. Please don't * use it for other tests because it may mess up this test. * - * Return: Success: Data chunk size - * - * Failure: 0 - * - * Programmer: Raymond Lu - * April 24, 2013 + * Return: Data chunk size * *------------------------------------------------------------------------- */ static size_t -filter_dummy(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, +do_nothing(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { @@ -75,194 +71,233 @@ filter_dummy(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, } /*------------------------------------------------------------------------- - * Function: test_unregister_filters - * - * Purpose: Tests unregistering filter before closing the file + * Function: test_unregister_filters * - * Return: Success: 0 - * Failure: -1 + * Purpose: Tests unregistering filter before closing the file * - * Programmer: Raymond Lu - * 11 April 2013 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -test_unregister_filters(hid_t my_fapl) +test_unregister_filters(hid_t fapl_id) { - hid_t file1, file2; - hid_t dc; - hid_t gcpl, gid, group; - hid_t dataset, space; - int i, j, n; - char gname[256]; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t gid_loop = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + int i, j, n; + char group_name[32]; char filename[FILENAME_BUF_SIZE]; - const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ - hsize_t dims[2]; - int points[DSET_DIM1][DSET_DIM2]; + const hsize_t chunk_dims[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ + hsize_t dims[2]; + int data[DSET_DIM1][DSET_DIM2]; herr_t ret; TESTING("Unregistering filter"); /* Create first file */ - h5_fixname(FILENAME[0], my_fapl, filename, sizeof filename); - if((file1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) goto error; + h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename)); + if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + goto error; /* Create second file */ - h5_fixname(FILENAME[1], my_fapl, filename, sizeof filename); - if((file2 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) goto error; + h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)); + if((fid2 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + goto error; /* Register DUMMY filter */ - if(H5Zregister(H5Z_DUMMY) < 0) goto error; - - if(H5Zfilter_avail(H5Z_FILTER_DUMMY)!=TRUE) goto error; + if (H5Zregister(H5Z_DUMMY) < 0) + goto error; + if (H5Zfilter_avail(H5Z_FILTER_DUMMY) != TRUE) + goto error; + + /******************* + * PART 1 - GROUPS * + *******************/ - if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto error; - /* Use DUMMY filter for creating groups */ - if(H5Pset_filter (gcpl, H5Z_FILTER_DUMMY, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) goto error; + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto error; + if(H5Pset_filter(gcpl_id, H5Z_FILTER_DUMMY, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) + goto error; /* Create a group using this filter */ - if((gid = H5Gcreate2(file1, GROUP_NAME, H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) goto error; + if((gid = H5Gcreate2(fid1, GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Create multiple groups under the main group */ - for (i=0; i < GROUP_ITERATION; i++) { - sprintf(gname, "group_%d", i); - if((group = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if(H5Gclose(group) < 0) goto error; + for(i = 0; i < GROUP_ITERATION; i++) { + HDsprintf(group_name, "group_%d", i); + if((gid_loop = H5Gcreate2(gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Gclose(gid_loop) < 0) + goto error; } - if(H5Fflush(file1, H5F_SCOPE_GLOBAL) < 0) goto error; + /* Flush the file containing the groups */ + if(H5Fflush(fid1, H5F_SCOPE_GLOBAL) < 0) + goto error; /* Unregister the filter before closing the group. It should fail */ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } H5E_END_TRY; - if(ret>=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } /* Close the group */ - if(H5Gclose(gid) < 0) goto error; + if(H5Gclose(gid) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (gcpl) < 0) goto error; + if(H5Pclose (gcpl_id) < 0) + goto error; - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; + /********************* + * PART 2 - DATASETS * + *********************/ - if(H5Pset_filter(dc, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) goto error; + /* Use DUMMY filter for creating datasets */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0) + goto error; + if(H5Pset_filter(dcpl_id, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) + goto error; - /* Initialize the dataset */ + /* Initialize the data for writing */ for(i = n = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) - points[i][j] = n++; + data[i][j] = n++; - /* Create the data space */ + /* Create the dataspace */ dims[0] = DSET_DIM1; dims[1] = DSET_DIM2; - if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) + goto error; /* Create a dataset in the first file */ - if((dataset = H5Dcreate2(file1, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid1, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Unregister the filter before closing the dataset. It should fail */ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } H5E_END_TRY; - if(ret>=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset */ + if(H5Dclose(did) < 0) + goto error; /* Create a dataset in the second file */ - if((dataset = H5Dcreate2(file2, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid2, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset in the second file */ + if(H5Dclose(did) < 0) + goto error; /* Unregister the filter after closing all objects but before closing files. - * It should flush all files. */ - if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) goto error; + * It should flush all files. + */ + if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (dc) < 0) goto error; - if(H5Fclose(file1) < 0) goto error; - if(H5Fclose(file2) < 0) goto error; + if(H5Pclose(dcpl_id) < 0) + goto error; + if(H5Fclose(fid1) < 0) + goto error; + if(H5Fclose(fid2) < 0) + goto error; PASSED(); - return 0; + return SUCCEED; error: - return -1; + H5E_BEGIN_TRY { + H5Fclose(fid1); + H5Fclose(fid2); + H5Pclose(dcpl_id); + H5Pclose(gcpl_id); + H5Gclose(gid); + H5Gclose(gid_loop); + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; + + return FAIL; } /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Tests unregistering filter with H5Zunregister + * Function: main * - * Return: Success: exit(EXIT_SUCCESS) + * Purpose: Tests unregistering filter with H5Zunregister * - * Failure: exit(EXIT_FAILURE) - * - * Programmer: Raymond Lu - * 11 April 2013 + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl; - int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; + int nerrors = 0; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Testing setup */ h5_reset(); - fapl = h5_fileaccess(); + fapl_id = h5_fileaccess(); /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; /* Test unregistering filter in its own file */ - nerrors += (test_unregister_filters(fapl) < 0 ? 1 : 0); + nerrors += (test_unregister_filters(fapl_id) < 0 ? 1 : 0); - if(nerrors) + h5_cleanup(FILENAME, fapl_id); + + if (nerrors) goto error; - printf("All filter unregistration tests passed.\n"); + HDprintf("All filter unregistration tests passed.\n"); /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: nerrors = MAX(1, nerrors); - printf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", + HDprintf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); if(api_ctx_pushed) H5CX_pop(); - return 1; -} + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/vfd.c b/test/vfd.c index dfc5047..19223ea 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -1118,8 +1118,7 @@ error: * Purpose: Private function for test_multi() to tests wrong ways of * reopening multi file. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Thursday, May 19, 2005 @@ -1129,7 +1128,7 @@ error: static herr_t test_multi_opens(char *fname) { - hid_t file=-1; + hid_t fid = H5I_INVALID_HID; char super_name[1024]; /*name string "%%s-s.h5"*/ char sf_name[1024]; /*name string "multi_file-s.h5"*/ @@ -1138,11 +1137,11 @@ test_multi_opens(char *fname) HDsnprintf(sf_name, sizeof(sf_name), super_name, fname); H5E_BEGIN_TRY { - file = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; - return(file >= 0 ? -1 : 0); -} + return(fid >= 0 ? FAIL : SUCCEED); +} /* end test_multi_opens() */ /*------------------------------------------------------------------------- @@ -1150,8 +1149,7 @@ test_multi_opens(char *fname) * * Purpose: Tests the file handle interface for MUTLI driver * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 @@ -1365,7 +1363,7 @@ test_multi(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1374,9 +1372,10 @@ error: H5Pclose(fapl); H5Pclose(fapl2); H5Fclose(file); + H5Aclose(attr); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end test_multi() */ /*------------------------------------------------------------------------- -- cgit v0.12 From e2f6e6f62f8885e85540c870ff3e3370b7617c79 Mon Sep 17 00:00:00 2001 From: hdftest Date: Thu, 20 Sep 2018 14:54:10 -0500 Subject: Snapshot version 1.11 release 2. --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/cmake/scripts/HDF5config.cmake | 2 +- configure.ac | 2 +- java/src/hdf/hdf5lib/H5.java | 4 ++-- java/test/TestH5.java | 4 ++-- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- .../testfiles/h5repack_layout.h5-plugin_version_test.ddl | 14 +++++++------- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.txt b/README.txt index 07c231e..2d03cc7 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.2 currently under development +HDF5 version 1.11.3 currently under development ------------------------------------------------------------------------------ Please refer to the release_docs/INSTALL file for installation instructions. diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 037d4cb..c771e8b 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.11.2" +PROJECT_NUMBER = "1.11.3" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 7eaf80a..d1c3a9f 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -34,7 +34,7 @@ cmake_minimum_required (VERSION 3.10) # CTEST_SOURCE_NAME - source folder ############################################################################## -set (CTEST_SOURCE_VERSION "1.11.2") +set (CTEST_SOURCE_VERSION "1.11.3") set (CTEST_SOURCE_VERSEXT "") ############################################################################## diff --git a/configure.ac b/configure.ac index cedfcfd..e42b038 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.11.2], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.11.3], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index f58623e..be7cae4 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * exception handlers to print out the HDF-5 error stack. *
* - * @version HDF5 1.11.2
+ * @version HDF5 1.11.3
* See also: hdf.hdf5lib.HDFArray
* hdf.hdf5lib.HDF5Constants
* hdf.hdf5lib.HDF5CDataTypes
@@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 11, 2 }; + public final static int LIB_VERSION[] = { 1, 11, 3 }; public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; diff --git a/java/test/TestH5.java b/java/test/TestH5.java index b922583..738c9f1 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -162,7 +162,7 @@ public class TestH5 { */ @Test public void testH5get_libversion() { - int libversion[] = { 1, 11, 2 }; + int libversion[] = { 1, 11, 3 }; try { H5.H5get_libversion(libversion); @@ -184,7 +184,7 @@ public class TestH5 { */ @Test public void testH5check_version() { - int majnum = 1, minnum = 11, relnum = 2; + int majnum = 1, minnum = 11, relnum = 3; try { H5.H5check_version(majnum, minnum, relnum); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c8c7d5c..0da8423 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.2 currently under development +HDF5 version 1.11.3 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index a4c80cd..c247e57 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -93,10 +93,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 11 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 2 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 3 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.11.2" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.11.3" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index a1fc0cb..8f48c37 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 2 } + PARAMS { 9 1 11 3 } } } FILLVALUE { -- cgit v0.12 From b48686febd832aefbc44274bff9e0408bbc84aa0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 20 Sep 2018 13:38:40 -0700 Subject: Normalization with vol_integration (misc internal and datatype) --- src/H5AC.c | 19 ++- src/H5Aint.c | 10 +- src/H5B.c | 4 +- src/H5B2.c | 2 +- src/H5B2hdr.c | 3 +- src/H5Bdbg.c | 4 +- src/H5C.c | 33 ++-- src/H5CX.c | 6 +- src/H5Cimage.c | 14 +- src/H5Ctag.c | 2 +- src/H5F.c | 171 ++++++++++--------- src/H5FApkg.h | 15 +- src/H5Fquery.c | 6 +- src/H5HF.c | 2 +- src/H5HFdbg.c | 15 +- src/H5HFhdr.c | 6 +- src/H5HFiblock.c | 348 +++++++++++++++++++-------------------- src/H5HFman.c | 1 + src/H5HFprivate.h | 12 +- src/H5HFsection.c | 12 +- src/H5HFspace.c | 7 +- src/H5HG.c | 74 ++++----- src/H5HGcache.c | 4 +- src/H5HGpkg.h | 2 +- src/H5I.c | 6 +- src/H5Lpublic.h | 4 +- src/H5Ocopy.c | 7 +- src/H5Odtype.c | 9 +- src/H5R.c | 48 +++--- src/H5Rdeprec.c | 16 +- src/H5Rint.c | 16 +- src/H5Rpkg.h | 12 +- src/H5Rprivate.h | 6 - src/H5SM.c | 118 ++++++------- src/H5T.c | 262 ++++++++++++----------------- src/H5Tcommit.c | 236 ++++++++++++-------------- src/H5Tcompound.c | 10 +- src/H5Tconv.c | 67 ++++---- src/H5Tdeprec.c | 22 +-- src/H5Tenum.c | 2 - src/H5Toh.c | 2 +- src/H5Torder.c | 10 +- src/H5Tpkg.h | 4 +- src/H5Tprivate.h | 1 - src/H5Tvlen.c | 24 ++- src/H5Z.c | 114 +++++++------ src/H5detect.c | 421 +++++++++++++++++++++++------------------------ src/H5make_libsettings.c | 30 ++-- src/Makefile.am | 7 +- 49 files changed, 1066 insertions(+), 1160 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 989ee10..9894e39 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -2620,7 +2620,7 @@ done: * * Purpose: Sets the metadata tag property in the provided property list. * - * Return: SUCCEED on success, FAIL otherwise. + * Return: void * * Programmer: Mike McGreevy * December 1, 2009 @@ -2773,7 +2773,7 @@ H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flag HDassert(f->shared); /* Call cache level function to expunge entries with specified tag and type id */ - if(H5C_expunge_tag_type_metadata(f, tag, type_id, flags)<0) + if(H5C_expunge_tag_type_metadata(f, tag, type_id, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot expunge tagged type entries") done: @@ -2924,16 +2924,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC_set_ring + * Function: H5AC_set_ring * - * Purpose: Routine to set the ring on a DXPL (for passing through - * to the metadata cache). + * Purpose: Routine to set the ring on a DXPL (for passing through + * to the metadata cache). * - * Return: Success: Non-negative - * Failure: Negative + * Return: void * - * Programmer: Quincey Koziol - * Tuesday, September 8, 2015 + * Programmer: Quincey Koziol + * Tuesday, September 8, 2015 * *------------------------------------------------------------------------- */ @@ -2942,6 +2941,8 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Note: orig_ring can be NULL so don't check it with HDassert() */ + /* Get the current ring value and return that (if orig_ring is NOT null) */ if(orig_ring) *orig_ring = H5CX_get_ring(); diff --git a/src/H5Aint.c b/src/H5Aint.c index 807c67e..4c7568a 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -240,7 +240,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * (to maintain ref. count incr/decr similarity with "shared message" * type of datatype sharing) */ - if(H5T_committed(attr->shared->dt)) + if(H5T_is_named(attr->shared->dt)) /* Increment the reference count on the shared datatype */ if(H5T_link(attr->shared->dt, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, NULL, "unable to adjust shared datatype link count") @@ -2112,14 +2112,14 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s if(H5T_set_loc(attr_dst->shared->dt, file_dst, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "cannot mark datatype on disk") - if(!H5T_committed(attr_src->shared->dt)) { + if(!H5T_is_named(attr_src->shared->dt)) { /* If the datatype is not named, it may have been shared in the * source file's heap. Un-share it for now. We'll try to shared * it in the destination file below. */ if(H5O_msg_reset_share(H5O_DTYPE_ID, attr_dst->shared->dt) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset datatype sharing") - } /* end if */ + } /* Copy the dataspace for the attribute. Make sure the maximal dimension is also copied. * Otherwise the comparison in the test may complain about it. SLU 2011/4/12 */ @@ -2354,7 +2354,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, HDassert(file_src); HDassert(file_dst); - if(H5T_committed(attr_src->shared->dt)) { + if(H5T_is_named(attr_src->shared->dt)) { H5O_loc_t *src_oloc_dt; /* Pointer to source datatype's object location */ H5O_loc_t *dst_oloc_dt; /* Pointer to dest. datatype's object location */ @@ -2374,7 +2374,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, /* Update shared message info from named datatype info */ H5T_update_shared(attr_dst->shared->dt); - } /* end if */ + } /* Try to share both the datatype and dataset. This does nothing if the * datatype is committed or sharing is disabled. diff --git a/src/H5B.c b/src/H5B.c index 53d5529..71b9020 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -471,12 +471,12 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, * Create the new B-tree node. */ if(H5B_create(f, shared->type, udata, &split_bt_ud->addr/*out*/) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") cache_udata.f = f; cache_udata.type = shared->type; cache_udata.rc_shared = bt_ud->bt->rc_shared; if(NULL == (split_bt_ud->bt = (H5B_t *)H5AC_protect(f, H5AC_BT, split_bt_ud->addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree") split_bt_ud->bt->level = bt_ud->bt->level; /* diff --git a/src/H5B2.c b/src/H5B2.c index 1f964b8..cf8e4a9 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -220,7 +220,7 @@ H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata) /* Look up the B-tree header */ if(NULL == (hdr = H5B2__hdr_protect(f, addr, ctx_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") /* Check for pending heap deletion */ if(hdr->pending_delete) diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index e9b6810..68669e8 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -523,8 +523,7 @@ done: *------------------------------------------------------------------------- */ H5B2_hdr_t * -H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, - unsigned flags) +H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags) { H5B2_hdr_cache_ud_t udata; /* User data for cache callbacks */ H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */ diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index 5cad81b..c491783 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -80,7 +80,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); HDassert(shared); @@ -91,7 +91,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, cache_udata.type = type; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") /* * Print the values. diff --git a/src/H5C.c b/src/H5C.c index c4d4eed..a22eca0 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -1284,7 +1284,7 @@ H5C_insert_entry(H5F_t * f, insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 ); flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 ); - /* Get the ring type from the DXPL */ + /* Get the ring type from the API context */ ring = H5CX_get_ring(); entry_ptr = (H5C_cache_entry_t *)thing; @@ -2331,10 +2331,10 @@ H5C_protect(H5F_t * f, haddr_t tag; /* Tag value */ /* The entry is already in the cache, but make sure that the tag value - is still legal. This will ensure that had - the entry NOT been in the cache, tagging was still set up correctly - and it would have received a legal tag value after getting loaded - from disk. */ + * is still legal. This will ensure that had the entry NOT been in the + * cache, tagging was still set up correctly and it would have received + * a legal tag value after getting loaded from disk. + */ /* Get the tag */ tag = H5CX_get_tag(); @@ -2389,10 +2389,10 @@ H5C_protect(H5F_t * f, else empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - /* try to free up if necceary and if evictions are permitted. Note - * that if evictions are enabled, we will call H5C__make_space_in_cache() - * regardless if the min_free_space requirement is not met. - */ + /* try to free up if necceary and if evictions are permitted. Note + * that if evictions are enabled, we will call H5C__make_space_in_cache() + * regardless if the min_free_space requirement is not met. + */ if ( ( cache_ptr->evictions_enabled ) && ( ( (cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) @@ -2438,10 +2438,10 @@ H5C_protect(H5F_t * f, * * Second, when writes are not permitted it is also possible * for the cache to grow without bound. - * - * Third, the user may choose to disable evictions -- causing - * the cache to grow without bound until evictions are - * re-enabled. + * + * Third, the user may choose to disable evictions -- causing + * the cache to grow without bound until evictions are + * re-enabled. * * Finally, we usually don't check to see if the cache is * oversized at the end of an unprotect. As a result, it is @@ -4287,11 +4287,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5C__autoadjust__ageout(H5F_t * f, - double hit_rate, - enum H5C_resize_status * status_ptr, - size_t * new_max_cache_size_ptr, - hbool_t write_permitted) +H5C__autoadjust__ageout(H5F_t * f, double hit_rate, enum H5C_resize_status * status_ptr, + size_t * new_max_cache_size_ptr, hbool_t write_permitted) { H5C_t * cache_ptr = f->shared->cache; size_t test_size; diff --git a/src/H5CX.c b/src/H5CX.c index f809d1c..faf0b24 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -53,7 +53,7 @@ * each thread individually. The association of contexts to threads will * be handled by the pthread library. * - * In order for this macro to work, H5E_get_my_stack() must be preceeded + * In order for this macro to work, H5E__get_my_stack() must be preceeded * by "H5CX_node_t *ctx =". */ #define H5CX_get_my_context() H5CX__get_context() @@ -320,7 +320,9 @@ typedef struct H5CX_lapl_cache_t { /********************/ /* Local Prototypes */ /********************/ +#ifdef H5_HAVE_THREADSAFE static H5CX_node_t **H5CX__get_context(void); +#endif /* H5_HAVE_THREADSAFE */ static void H5CX__push_common(H5CX_node_t *cnode); static H5CX_node_t *H5CX__pop_common(void); @@ -862,7 +864,7 @@ done: * * Purpose: Sanity checks and sets up collective operations. * - * Note: Should be called for all API routines that modify file + * Note: Should be called for all API routines that modify file * file metadata but don't pass in an access property list. * * Return: Non-negative on success / Negative on failure diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 26b6506..bdab1a3 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -1139,22 +1139,22 @@ H5C__load_cache_image(H5F_t *f) */ if(H5F_addr_defined(cache_ptr->image_addr)) { /* Sanity checks */ - HDassert(cache_ptr->image_len > 0); + HDassert(cache_ptr->image_len > 0); HDassert(cache_ptr->image_buffer == NULL); - /* Allocate space for the image */ + /* Allocate space for the image */ if(NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer") - /* Load the image from file */ - if(H5C__read_cache_image(f, cache_ptr) < 0) + /* Load the image from file */ + if(H5C__read_cache_image(f, cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block") - /* Reconstruct cache contents, from image */ - if(H5C__reconstruct_cache_contents(f, cache_ptr) < 0) + /* Reconstruct cache contents, from image */ + if(H5C__reconstruct_cache_contents(f, cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "Can't reconstruct cache contents from image block") - /* Free the image buffer */ + /* Free the image buffer */ cache_ptr->image_buffer = H5MM_xfree(cache_ptr->image_buffer); /* Update stats -- must do this now, as we are about diff --git a/src/H5Ctag.c b/src/H5Ctag.c index 66aedd9..0f08ede 100644 --- a/src/H5Ctag.c +++ b/src/H5Ctag.c @@ -471,7 +471,7 @@ H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx) if(H5C__flush_single_entry(ctx->f, entry, H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Entry eviction failed.") ctx->evicted_entries_last_pass = TRUE; - } /* end else-if */ + } else ctx->skipped_pf_dirty_entries = TRUE; diff --git a/src/H5F.c b/src/H5F.c index 65fbc9e..68bdfd3 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -21,20 +21,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5Tprivate.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tprivate.h" /* Datatypes */ /****************/ @@ -76,10 +76,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* File ID class */ static const H5I_class_t H5I_FILE_CLS[1] = {{ - H5I_FILE, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ + H5I_FILE, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ }}; @@ -113,16 +113,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_term_package + * Function: H5F_term_package * - * Purpose: Terminate this interface: free all memory and reset global - * variables to their initial values. Release all ID groups - * associated with this interface. + * Purpose: Terminate this interface: free all memory and reset global + * variables to their initial values. Release all ID groups + * associated with this interface. + * + * Return: Success: Positive if anything was done that might + * have affected other interfaces; + * zero otherwise. + * + * Failure: Never fails * - * Return: Success: Positive if anything was done that might - * have affected other interfaces; - * zero otherwise. - * Failure: Never fails. *------------------------------------------------------------------------- */ int @@ -155,35 +157,38 @@ H5F_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Fget_create_plist + * Function: H5Fget_create_plist * - * Purpose: Get an atom for a copy of the file-creation property list for - * this file. This function returns an atom with a copy of the - * properties used to create a file. + * Purpose: Get an atom for a copy of the file-creation property list for + * this file. This function returns an atom with a copy of the + * properties used to create a file. + * + * Return: Success: Object ID for a copy of the file creation + * property list. + * + * Failure: H5I_INVALID_HID * - * Return: Success: template ID - * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Fget_create_plist(hid_t file_id) { - H5F_t *file; /* File info */ - H5P_genplist_t *plist; /* Property list */ - hid_t ret_value; /* Return value */ + H5F_t *file; /* File info */ + H5P_genplist_t *plist; /* Property list */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") if(NULL == (plist = (H5P_genplist_t *)H5I_object(file->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") - /* Create the property list object to return */ + /* Retrieve the file creation property list */ if((ret_value = H5P_copy_plist(plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file creation properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") done: FUNC_LEAVE_API(ret_value) @@ -191,37 +196,39 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_access_plist + * Function: H5Fget_access_plist * - * Purpose: Returns a copy of the file access property list of the - * specified file. + * Purpose: Returns a copy of the file access property list of the + * specified file. * * NOTE: Make sure that, if you are going to overwrite * information in the copied property list that was * previously opened and assigned to the property list, then * you must close it before overwriting the values. * - * Return: Success: Object ID for a copy of the file access - * property list. - * Failure: FAIL + * Return: Success: Object ID for a copy of the file access + * property list. + * + * Failure: H5I_INVALID_HID + * *------------------------------------------------------------------------- */ hid_t H5Fget_access_plist(hid_t file_id) { - H5F_t *f; /* File info */ - hid_t ret_value; /* Return value */ + H5F_t *file; /* File info */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* Check args */ - if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ - if((ret_value = H5F_get_access_plist(f, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list") + if((ret_value = H5F_get_access_plist(file, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") done: FUNC_LEAVE_API(ret_value) @@ -309,30 +316,30 @@ done: * Purpose: Returns a pointer to the file handle of the low-level file * driver. * - * Return: Success: non-negative value. - * Failure: negative. + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t -H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle) +H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) { - H5F_t *file; /* File to query */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ii**x", file_id, fapl, file_handle); + H5TRACE3("e", "ii**x", file_id, fapl_id, file_handle); /* Check args */ if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer") - /* Get the file */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5F_get_vfd_handle(file, fapl, file_handle) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") + if(H5F_get_vfd_handle(file, fapl_id, file_handle) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: FUNC_LEAVE_API(ret_value) @@ -340,16 +347,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fis_hdf5 + * Function: H5Fis_hdf5 * - * Purpose: Check the file signature to detect an HDF5 file. + * Purpose: Check the file signature to detect an HDF5 file. * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. + * + * Return: TRUE/FALSE/FAIL * - * Return: Success: TRUE/FALSE - * Failure: Negative *------------------------------------------------------------------------- */ htri_t @@ -360,7 +367,7 @@ H5Fis_hdf5(const char *name) FUNC_ENTER_API(FAIL) H5TRACE1("t", "*s", name); - /* Check args and all the boring stuff. */ + /* Check args */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") @@ -394,37 +401,39 @@ done: * the list of file creation and file access properties. * * Return: Success: A file ID - * Failure: FAIL + * + * Failure: H5I_INVALID_HID + * *------------------------------------------------------------------------- */ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5F_t *new_file = NULL; /* file struct for new file */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* file struct for new file */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); /* Check/fix arguments */ - if (!filename || !*filename) + if(!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") /* In this routine, we only accept the following flags: * H5F_ACC_EXCL, H5F_ACC_TRUNC and H5F_ACC_SWMR_WRITE */ - if (flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) + if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid flags") /* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */ - if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) + if((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "mutually exclusive flags for file creation") /* Check file creation property list */ - if (H5P_DEFAULT == fcpl_id) + if(H5P_DEFAULT == fcpl_id) fcpl_id = H5P_FILE_CREATE_DEFAULT; else - if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) + if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file create property list") /* Verify access property list and set up collective metadata if appropriate */ @@ -435,7 +444,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * the EXCL or TRUNC bit is set. All newly-created files are opened for * reading and writing. */ - if (0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC))) + if(0 == (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC))) flags |= H5F_ACC_EXCL; /*default*/ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; @@ -444,7 +453,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ - if ((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) + if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file") /* Keep this ID in file object structure */ diff --git a/src/H5FApkg.h b/src/H5FApkg.h index 6ce899e..8f76fc9 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -275,8 +275,7 @@ H5_DLL herr_t H5FA__hdr_decr(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr); H5_DLL size_t H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_modified(H5FA_hdr_t *hdr); -H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, - unsigned flags); +H5_DLL H5FA_hdr_t *H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags); H5_DLL herr_t H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags); H5_DLL herr_t H5FA__hdr_delete(H5FA_hdr_t *hdr); H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr); @@ -285,8 +284,7 @@ H5_DLL herr_t H5FA__hdr_dest(H5FA_hdr_t *hdr); H5_DLL H5FA_dblock_t *H5FA__dblock_alloc(H5FA_hdr_t *hdr); H5_DLL haddr_t H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty); H5_DLL unsigned H5FA__dblock_sblk_idx(const H5FA_hdr_t *hdr, hsize_t idx); -H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, - unsigned flags); +H5_DLL H5FA_dblock_t *H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags); H5_DLL herr_t H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags); H5_DLL herr_t H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr); H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock); @@ -294,16 +292,13 @@ H5_DLL herr_t H5FA__dblock_dest(H5FA_dblock_t *dblock); /* Data block page routines */ H5_DLL herr_t H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts); H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts); -H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, - size_t dblk_page_nelmts, unsigned flags); +H5_DLL H5FA_dblk_page_t *H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts, unsigned flags); H5_DLL herr_t H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags); H5_DLL herr_t H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page); /* Debugging routines for dumping file structures */ -H5_DLL herr_t H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, - int fwidth, const H5FA_class_t *cls, haddr_t obj_addr); -H5_DLL herr_t H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, - int indent, int fwidth, const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr); +H5_DLL herr_t H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t obj_addr); +H5_DLL herr_t H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr); /* Testing routines */ #ifdef H5FA_TESTING diff --git a/src/H5Fquery.c b/src/H5Fquery.c index be24072..2500ea8 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -277,11 +277,11 @@ H5F_get_nopen_objs(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_file_id + * Function: H5F_get_file_id * - * Purpose: Retrieve the file's 'file_id' value + * Purpose: Retrieve the file's 'file_id' value * - * Return: 'file_id' on success/abort on failure (shouldn't fail) + * Return: 'file_id' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ hid_t diff --git a/src/H5HF.c b/src/H5HF.c index b7a6244..3df7e7b 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -167,7 +167,7 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam) /* Create shared fractal heap header */ if(HADDR_UNDEF == (fh_addr = H5HF_hdr_create(f, cparam))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header") /* Allocate fractal heap wrapper */ if(NULL == (fh = H5FL_MALLOC(H5HF_t))) diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 70dfeed..fc437dc 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -395,7 +395,7 @@ H5HF_hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* Print the information about the heap's header */ H5HF_hdr_print(hdr, FALSE, stream, indent, fwidth); @@ -531,13 +531,13 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, hdr_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* * Load the heap direct block */ if(NULL == (dblock = H5HF__man_dblock_protect(hdr, addr, block_size, NULL, 0, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block") /* Print opening message */ HDfprintf(stream, "%*sFractal Heap Direct Block...\n", indent, ""); @@ -788,13 +788,13 @@ H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, hdr_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* * Load the heap indirect block */ if(NULL == (iblock = H5HF__man_iblock_protect(hdr, addr, nrows, NULL, 0, FALSE, H5AC__READ_ONLY_FLAG, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block") /* Print the information about the heap's indirect block */ H5HF_iblock_print(iblock, FALSE, stream, indent, fwidth); @@ -878,8 +878,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, - int fwidth) +H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, int fwidth) { H5HF_hdr_t *hdr = NULL; /* Fractal heap header info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -897,7 +896,7 @@ H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, /* Load the fractal heap header */ if(NULL == (hdr = H5HF__hdr_protect(f, fh_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") /* Initialize the free space information for the heap */ if(H5HF__space_start(hdr, FALSE) < 0) diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 8166d88..b014017 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -484,7 +484,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Second phase of header final initialization */ /* (needs ID and filter lengths set up) */ if(H5HF_hdr_finish_init_phase2(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #2 of header final initialization") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #2 of header final initialization") /* Extra checking for possible gap between max. direct block size minus * overhead and "huge" object size */ @@ -494,11 +494,11 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Allocate space for the header on disk */ if(HADDR_UNDEF == (hdr->heap_addr = H5MF_alloc(f, H5FD_MEM_FHEAP_HDR, (hsize_t)hdr->heap_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header") /* Cache the new fractal heap header */ if(H5AC_insert_entry(f, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache") /* Set address of heap header to return */ ret_value = hdr->heap_addr; diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index e5c2559..20a62b7 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -256,52 +256,52 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock) /* Check for last reference to block */ if(iblock->rc == 0) { - /* If this indirect block has a parent, reset it's child iblock pointer */ - if(iblock->parent) { - H5HF_indirect_t *par_iblock = iblock->parent; /* Parent indirect block */ - unsigned indir_idx; /* Index in parent's child iblock pointer array */ - - /* Sanity check */ - HDassert(par_iblock->child_iblocks); - HDassert(iblock->par_entry >= (iblock->hdr->man_dtable.max_direct_rows - * iblock->hdr->man_dtable.cparam.width)); - - /* Compute index in parent's child iblock pointer array */ - indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows - * iblock->hdr->man_dtable.cparam.width); - - /* Reset pointer to pinned child indirect block in parent */ - HDassert(par_iblock->child_iblocks[indir_idx]); - par_iblock->child_iblocks[indir_idx] = NULL; - } /* end if */ - else { - /* Check for root indirect block */ - if(iblock->block_off == 0) { - /* Sanity check - shouldn't be recursively unpinning root indirect block */ - HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED); - - /* Check if we should reset the root iblock pointer */ - if(H5HF_ROOT_IBLOCK_PINNED == iblock->hdr->root_iblock_flags) { - HDassert(NULL != iblock->hdr->root_iblock); - iblock->hdr->root_iblock = NULL; - } /* end if */ - - /* Indicate that the root indirect block is unpinned */ - iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED)); - } /* end if */ - } /* end else */ - - /* Check if the block is still in the cache */ - if(!iblock->removed_from_cache) { - /* Unpin the indirect block, making it evictable again */ - if(H5HF__iblock_unpin(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") - } /* end if */ - else { - /* Destroy the indirect block */ - if(H5HF_man_iblock_dest(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") - } /* end else */ + /* If this indirect block has a parent, reset it's child iblock pointer */ + if(iblock->parent) { + H5HF_indirect_t *par_iblock = iblock->parent; /* Parent indirect block */ + unsigned indir_idx; /* Index in parent's child iblock pointer array */ + + /* Sanity check */ + HDassert(par_iblock->child_iblocks); + HDassert(iblock->par_entry >= (iblock->hdr->man_dtable.max_direct_rows + * iblock->hdr->man_dtable.cparam.width)); + + /* Compute index in parent's child iblock pointer array */ + indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows + * iblock->hdr->man_dtable.cparam.width); + + /* Reset pointer to pinned child indirect block in parent */ + HDassert(par_iblock->child_iblocks[indir_idx]); + par_iblock->child_iblocks[indir_idx] = NULL; + } /* end if */ + else { + /* Check for root indirect block */ + if(iblock->block_off == 0) { + /* Sanity check - shouldn't be recursively unpinning root indirect block */ + HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED); + + /* Check if we should reset the root iblock pointer */ + if(H5HF_ROOT_IBLOCK_PINNED == iblock->hdr->root_iblock_flags) { + HDassert(NULL != iblock->hdr->root_iblock); + iblock->hdr->root_iblock = NULL; + } /* end if */ + + /* Indicate that the root indirect block is unpinned */ + iblock->hdr->root_iblock_flags &= (unsigned)(~(H5HF_ROOT_IBLOCK_PINNED)); + } /* end if */ + } /* end else */ + + /* Check if the block is still in the cache */ + if(!iblock->removed_from_cache) { + /* Unpin the indirect block, making it evictable again */ + if(H5HF__iblock_unpin(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") + } /* end if */ + else { + /* Destroy the indirect block */ + if(H5HF_man_iblock_dest(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") + } /* end else */ } /* end if */ done: @@ -408,13 +408,13 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) dblock->parent = iblock; dblock->par_entry = 0; - /* Destroy flush dependency between direct block and header */ - if(H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) + /* Destroy flush dependency between direct block and header */ + if(H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") dblock->fd_parent = NULL; - /* Create flush dependency between direct block and new root indirect block */ - if(H5AC_create_flush_dependency(iblock, dblock) < 0) + /* Create flush dependency between direct block and new root indirect block */ + if(H5AC_create_flush_dependency(iblock, dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") dblock->fd_parent = iblock; @@ -1059,14 +1059,14 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, iblock->block_off += hdr->man_dtable.row_block_off[par_entry / hdr->man_dtable.cparam.width]; iblock->block_off += hdr->man_dtable.row_block_size[par_entry / hdr->man_dtable.cparam.width] * (par_entry % hdr->man_dtable.cparam.width); - /* Set indirect block parent as flush dependency parent */ - iblock->fd_parent = par_iblock; + /* Set indirect block parent as flush dependency parent */ + iblock->fd_parent = par_iblock; } /* end if */ else { iblock->block_off = 0; /* Must be the root indirect block... */ - /* Set heap header as flush dependency parent */ - iblock->fd_parent = hdr; + /* Set heap header as flush dependency parent */ + iblock->fd_parent = hdr; } /* end else */ /* Update indirect block's statistics */ @@ -1430,69 +1430,69 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) if(H5HF__man_iblock_root_revert(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't convert root indirect block back to root direct block") - /* If the indirect block wasn't removed already (by reverting it) */ - if(!iblock->removed_from_cache) { - /* Check for reducing size of root indirect block */ - if(iblock->nchildren > 0 && hdr->man_dtable.cparam.start_root_rows != 0 - && entry > iblock->max_child) { - unsigned max_child_row; /* Row for max. child entry */ - - /* Compute information needed for determining whether to reduce size of root indirect block */ - max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; - - /* Check if the root indirect block should be reduced */ - if(iblock->nrows > 1 && max_child_row <= (iblock->nrows / 2)) - if(H5HF__man_iblock_root_halve(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce size of root indirect block") - } /* end if */ - } /* end if */ + /* If the indirect block wasn't removed already (by reverting it) */ + if(!iblock->removed_from_cache) { + /* Check for reducing size of root indirect block */ + if(iblock->nchildren > 0 && hdr->man_dtable.cparam.start_root_rows != 0 + && entry > iblock->max_child) { + unsigned max_child_row; /* Row for max. child entry */ + + /* Compute information needed for determining whether to reduce size of root indirect block */ + max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; + + /* Check if the root indirect block should be reduced */ + if(iblock->nrows > 1 && max_child_row <= (iblock->nrows / 2)) + if(H5HF__man_iblock_root_halve(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce size of root indirect block") + } /* end if */ + } /* end if */ } /* end if */ /* If the indirect block wasn't removed already (by reverting it) */ if(!iblock->removed_from_cache) { - /* Mark indirect block as modified */ - if(H5HF_iblock_dirty(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") - - /* Check for last child being removed from indirect block */ - if(iblock->nchildren == 0) { - hbool_t did_protect = FALSE; /* Whether the indirect block was protected */ - - /* If this indirect block's refcount is >1, then it's being deleted - * from the fractal heap (since its nchildren == 0), but is still - * referred to from free space sections in the heap (refcount >1). - * Its space in the file needs to be freed now, and it also needs - * to be removed from the metadata cache now, in case the space in - * the file is reused by another piece of metadata that is inserted - * into the cache before the indirect block's entry is evicted - * (having two entries at the same address would be an error, from - * the cache's perspective). - */ - /* Lock indirect block for deletion */ - if(NULL == (del_iblock = H5HF__man_iblock_protect(hdr, iblock->addr, iblock->nrows, iblock->parent, iblock->par_entry, TRUE, H5AC__NO_FLAGS_SET, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") - HDassert(did_protect == TRUE); - - /* Check for deleting root indirect block (and no root direct block) */ - if(iblock->block_off == 0 && hdr->man_dtable.curr_root_rows > 0) - /* Reset header information back to "empty heap" state */ - if(H5HF__hdr_empty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") - - /* Detach from parent indirect block */ - if(iblock->parent) { - /* Destroy flush dependency between indirect block and parent */ - if(H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") - iblock->fd_parent = NULL; - - /* Detach from parent indirect block */ - if(H5HF__man_iblock_detach(iblock->parent, iblock->par_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block") - iblock->parent = NULL; - iblock->par_entry = 0; - } /* end if */ - } /* end if */ + /* Mark indirect block as modified */ + if(H5HF_iblock_dirty(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") + + /* Check for last child being removed from indirect block */ + if(iblock->nchildren == 0) { + hbool_t did_protect = FALSE; /* Whether the indirect block was protected */ + + /* If this indirect block's refcount is >1, then it's being deleted + * from the fractal heap (since its nchildren == 0), but is still + * referred to from free space sections in the heap (refcount >1). + * Its space in the file needs to be freed now, and it also needs + * to be removed from the metadata cache now, in case the space in + * the file is reused by another piece of metadata that is inserted + * into the cache before the indirect block's entry is evicted + * (having two entries at the same address would be an error, from + * the cache's perspective). + */ + /* Lock indirect block for deletion */ + if(NULL == (del_iblock = H5HF__man_iblock_protect(hdr, iblock->addr, iblock->nrows, iblock->parent, iblock->par_entry, TRUE, H5AC__NO_FLAGS_SET, &did_protect))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") + HDassert(did_protect == TRUE); + + /* Check for deleting root indirect block (and no root direct block) */ + if(iblock->block_off == 0 && hdr->man_dtable.curr_root_rows > 0) + /* Reset header information back to "empty heap" state */ + if(H5HF__hdr_empty(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") + + /* Detach from parent indirect block */ + if(iblock->parent) { + /* Destroy flush dependency between indirect block and parent */ + if(H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + iblock->fd_parent = NULL; + + /* Detach from parent indirect block */ + if(H5HF__man_iblock_detach(iblock->parent, iblock->par_entry) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block") + iblock->parent = NULL; + iblock->par_entry = 0; + } /* end if */ + } /* end if */ } /* end if */ /* Decrement the reference count on this indirect block if we're not deleting it */ @@ -1501,48 +1501,48 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) * not being deleted) */ if(H5HF__iblock_decr(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") iblock = NULL; /* Delete indirect block from cache, if appropriate */ if(del_iblock) { - unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotect */ - hbool_t took_ownership = FALSE; /* Flag to indicate that block ownership has transitioned */ - - /* If the refcount is still >0, unpin the block and take ownership - * from the cache, otherwise let the cache destroy it. - */ - if(del_iblock->rc > 0) { - cache_flags |= (H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG); - cache_flags |= H5AC__UNPIN_ENTRY_FLAG; - took_ownership = TRUE; - } /* end if */ - else { - /* Entry should be removed from the cache */ - cache_flags |= H5AC__DELETED_FLAG; - - /* If the indirect block is in real file space, tell - * the cache to free its file space as well. - */ - if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) - cache_flags |= H5AC__FREE_FILE_SPACE_FLAG; - } /* end else */ - - /* Unprotect the indirect block, with appropriate flags */ - if(H5HF__man_iblock_unprotect(del_iblock, cache_flags, TRUE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") - - /* if took ownership, free file space & mark block as removed from cache */ - if(took_ownership) { - /* Free indirect block disk space, if it's in real space */ - if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) - if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, del_iblock->addr, (hsize_t)del_iblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") - del_iblock->addr = HADDR_UNDEF; - - /* Mark block as removed from the cache */ - del_iblock->removed_from_cache = TRUE; - } /* end if */ + unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotect */ + hbool_t took_ownership = FALSE; /* Flag to indicate that block ownership has transitioned */ + + /* If the refcount is still >0, unpin the block and take ownership + * from the cache, otherwise let the cache destroy it. + */ + if(del_iblock->rc > 0) { + cache_flags |= (H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG); + cache_flags |= H5AC__UNPIN_ENTRY_FLAG; + took_ownership = TRUE; + } /* end if */ + else { + /* Entry should be removed from the cache */ + cache_flags |= H5AC__DELETED_FLAG; + + /* If the indirect block is in real file space, tell + * the cache to free its file space as well. + */ + if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) + cache_flags |= H5AC__FREE_FILE_SPACE_FLAG; + } /* end else */ + + /* Unprotect the indirect block, with appropriate flags */ + if(H5HF__man_iblock_unprotect(del_iblock, cache_flags, TRUE) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + + /* if took ownership, free file space & mark block as removed from cache */ + if(took_ownership) { + /* Free indirect block disk space, if it's in real space */ + if(!H5F_IS_TMP_ADDR(hdr->f, del_iblock->addr)) + if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, del_iblock->addr, (hsize_t)del_iblock->size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") + del_iblock->addr = HADDR_UNDEF; + + /* Mark block as removed from the cache */ + del_iblock->removed_from_cache = TRUE; + } /* end if */ } /* end if */ done: @@ -1633,24 +1633,24 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, if(H5F_addr_defined(iblock->ents[entry].addr)) { /* Are we in a direct or indirect block row */ if(row < hdr->man_dtable.max_direct_rows) { - hsize_t dblock_size; /* Size of direct block on disk */ + hsize_t dblock_size; /* Size of direct block on disk */ - /* Check for I/O filters on this heap */ - if(hdr->filter_len > 0) - dblock_size = iblock->filt_ents[entry].size; - else - dblock_size = hdr->man_dtable.row_block_size[row]; + /* Check for I/O filters on this heap */ + if(hdr->filter_len > 0) + dblock_size = iblock->filt_ents[entry].size; + else + dblock_size = hdr->man_dtable.row_block_size[row]; /* Delete child direct block */ if(H5HF__man_dblock_delete(hdr->f, iblock->ents[entry].addr, dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap child direct block") } /* end if */ else { - hsize_t row_block_size; /* The size of blocks in this row */ + hsize_t row_block_size; /* The size of blocks in this row */ unsigned child_nrows; /* Number of rows in new indirect block */ - /* Get the row's block size */ - row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row]; + /* Get the row's block size */ + row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row]; /* Compute # of rows in next child indirect block to use */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, row_block_size); @@ -1733,30 +1733,30 @@ H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, /* Indirect entries in this indirect block */ if(iblock->nrows > hdr->man_dtable.max_direct_rows) { - unsigned first_row_bits; /* Number of bits used bit addresses in first row */ + unsigned first_row_bits; /* Number of bits used bit addresses in first row */ unsigned num_indirect_rows; /* Number of rows of blocks in each indirect block */ unsigned entry; /* Current entry in row */ size_t u; /* Local index variable */ entry = hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width; - first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + - H5VM_log2_of2(hdr->man_dtable.cparam.width); + first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + + H5VM_log2_of2(hdr->man_dtable.cparam.width); num_indirect_rows = - (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; + (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++, num_indirect_rows++) { size_t v; /* Local index variable */ - for(v = 0; v < hdr->man_dtable.cparam.width; v++, entry++) - if(H5F_addr_defined(iblock->ents[entry].addr)) - if(H5HF__man_iblock_size(f, hdr, iblock->ents[entry].addr, num_indirect_rows, iblock, entry, heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to get fractal heap storage info for indirect block") + for(v = 0; v < hdr->man_dtable.cparam.width; v++, entry++) + if(H5F_addr_defined(iblock->ents[entry].addr)) + if(H5HF__man_iblock_size(f, hdr, iblock->ents[entry].addr, num_indirect_rows, iblock, entry, heap_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to get fractal heap storage info for indirect block") } /* end for */ } /* end if */ done: /* Release the indirect block */ if(iblock && H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") iblock = NULL; FUNC_LEAVE_NOAPI(ret_value) @@ -1810,17 +1810,17 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, */ prev_par_block_off = par_block_off = 0; while(row >= hdr->man_dtable.max_direct_rows) { - /* Retain previous parent block offset */ - prev_par_block_off = par_block_off; + /* Retain previous parent block offset */ + prev_par_block_off = par_block_off; /* Compute the new parent indirect block's offset in the heap's address space */ /* (based on previous block offset) */ par_block_off += hdr->man_dtable.row_block_off[row]; par_block_off += hdr->man_dtable.row_block_size[row] * col; - /* Preserve current row & column */ - prev_row = row; - prev_col = col; + /* Preserve current row & column */ + prev_row = row; + prev_col = col; /* Look up row & column in new indirect block for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, (block_off - par_block_off), &row, &col) < 0) diff --git a/src/H5HFman.c b/src/H5HFman.c index 394bcff..7f90f49 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -140,6 +140,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) /* Check for row section */ if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) { + /* Allocate 'single' selection out of 'row' selection */ if(H5HF__man_iblock_alloc_row(hdr, &sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't break up row section") diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 5086afb..587a8fc 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -110,15 +110,13 @@ H5_DLL H5HF_t *H5HF_create(H5F_t *f, const H5HF_create_t *cparam); H5_DLL H5HF_t *H5HF_open(H5F_t *f, haddr_t fh_addr); H5_DLL herr_t H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p/*out*/); H5_DLL herr_t H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr/*out*/); -H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj, - void *id/*out*/); +H5_DLL herr_t H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id/*out*/); H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, const void *id, size_t *obj_len_p/*out*/); H5_DLL herr_t H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p/*out*/); H5_DLL herr_t H5HF_read(H5HF_t *fh, const void *id, void *obj/*out*/); H5_DLL herr_t H5HF_write(H5HF_t *fh, void *id, hbool_t *id_changed, const void *obj); -H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op, - void *op_data); +H5_DLL herr_t H5HF_op(H5HF_t *fh, const void *id, H5HF_operator_t op, void *op_data); H5_DLL herr_t H5HF_remove(H5HF_t *fh, const void *id); H5_DLL herr_t H5HF_close(H5HF_t *fh); H5_DLL herr_t H5HF_delete(H5F_t *f, haddr_t fh_addr); @@ -128,11 +126,9 @@ H5_DLL herr_t H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats); H5_DLL herr_t H5HF_size(const H5HF_t *fh, hsize_t *heap_size/*out*/); /* Debugging routines */ -H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, - int indent, int fwidth); +H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, int indent, int fwidth); #ifdef H5HF_DEBUGGING -H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, - int fwidth); +H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth); #endif /* H5HF_DEBUGGING */ #endif /* _H5HFprivate_H */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 66c8414..36e966e 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -692,8 +692,7 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, *------------------------------------------------------------------------- */ herr_t -H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - size_t amt) +H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, size_t amt) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2094,8 +2093,7 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *------------------------------------------------------------------------- */ static herr_t -H5HF__sect_row_debug(const H5FS_section_info_t *_sect, - FILE *stream, int indent, int fwidth) +H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, int fwidth) { const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Section to dump info */ @@ -2666,8 +2664,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, - unsigned start_entry, unsigned nentries) +H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ H5HF_free_section_t *first_row_sect = NULL; /* First row section in new indirect section */ @@ -2841,8 +2838,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - H5HF_indirect_t *sect_iblock) +H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_indirect_t *sect_iblock) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 5260ae2..37a0502 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -311,7 +311,7 @@ H5HF__space_revert_root(const H5HF_hdr_t *hdr) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) - /* Iterate over all sections, resetting the parent pointers in 'single' sections */ + /* Iterate over all sections, resetting the parent pointers in 'single' sections */ if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_revert_root_cb, NULL) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to reset parent pointers") @@ -404,7 +404,7 @@ H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) - /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */ + /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */ if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_create_root_cb, root_iblock) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to set parent pointers") @@ -602,8 +602,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, - uint16_t new_class) +H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16_t new_class) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HG.c b/src/H5HG.c index 53f1b2a..b9d8dc3 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -83,7 +83,7 @@ /********************/ static haddr_t H5HG__create(H5F_t *f, size_t size); - +static size_t H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr); /*********************/ /* Package Variables */ @@ -204,11 +204,11 @@ H5HG__create(H5F_t *f, size_t size) /* Add this heap to the beginning of the CWFS list */ if(H5F_cwfs_add(f, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to add global heap collection to file's CWFS") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to add global heap collection to file's CWFS") /* Add the heap to the cache */ if(H5AC_insert_entry(f, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection") ret_value = addr; @@ -223,7 +223,7 @@ done: /* Check if the heap object was allocated */ if(heap) /* Destroy the heap object */ - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection") } /* end if */ } /* end if */ @@ -275,7 +275,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HG_alloc + * Function: H5HG__alloc * * Purpose: Given a heap with enough free space, this function will split * the free space to make a new empty heap object and initialize @@ -293,14 +293,14 @@ done: *------------------------------------------------------------------------- */ static size_t -H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) +H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) { size_t idx; uint8_t *p; size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(heap); @@ -363,27 +363,27 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) heap->obj[0].begin = NULL; } /* end if */ else if(heap->obj[0].size-need >= H5HG_SIZEOF_OBJHDR (f)) { - /* - * Some free space remains and it's larger than a heap object header, - * so write the new free heap object header to the heap. - */ - heap->obj[0].size -= need; - heap->obj[0].begin += need; - p = heap->obj[0].begin; - UINT16ENCODE(p, 0); /*id*/ - UINT16ENCODE(p, 0); /*nrefs*/ - UINT32ENCODE(p, 0); /*reserved*/ - H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + /* + * Some free space remains and it's larger than a heap object header, + * so write the new free heap object header to the heap. + */ + heap->obj[0].size -= need; + heap->obj[0].begin += need; + p = heap->obj[0].begin; + UINT16ENCODE(p, 0); /*id*/ + UINT16ENCODE(p, 0); /*nrefs*/ + UINT32ENCODE(p, 0); /*reserved*/ + H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); } /* end else-if */ else { - /* - * Some free space remains but it's smaller than a heap object header, - * so we don't write the header. - */ - heap->obj[0].size -= need; - heap->obj[0].begin += need; - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + /* + * Some free space remains but it's smaller than a heap object header, + * so we don't write the header. + */ + heap->obj[0].size -= need; + heap->obj[0].begin += need; + HDassert(H5HG_ISALIGNED(heap->obj[0].size)); } /* Mark the heap as dirty */ @@ -394,7 +394,7 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) done: FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HG_alloc() */ +} /* end H5HG__alloc() */ /*------------------------------------------------------------------------- @@ -522,7 +522,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) HDassert(hobj); if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") /* Find a large enough collection on the CWFS list */ need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); @@ -548,7 +548,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") /* Split the free space to make room for the new object */ - if(0 == (idx = H5HG_alloc(f, heap, size, &heap_flags))) + if(0 == (idx = H5HG__alloc(f, heap, size, &heap_flags))) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate global heap object") /* Copy data into the heap */ @@ -608,7 +608,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size) /* Load the heap */ if(NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") HDassert(hobj->idx < heap->nused); HDassert(heap->obj[hobj->idx].begin); @@ -617,7 +617,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size) /* Allocate a buffer for the object read in, if the user didn't give one */ if(!object && NULL == (object = H5MM_malloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(object, p, size); /* @@ -678,7 +678,7 @@ H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust) HDassert(f); HDassert(hobj); if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") /* Load the heap */ if(NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__NO_FLAGS_SET))) @@ -839,11 +839,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5HG_free + * Function: H5HG__free * - * Purpose: Destroys a global heap collection in memory + * Purpose: Destroys a global heap collection in memory * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, January 15, 2003 @@ -851,7 +851,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HG_free(H5HG_heap_t *heap) +H5HG__free(H5HG_heap_t *heap) { herr_t ret_value = SUCCEED; /* Return value */ @@ -872,5 +872,5 @@ H5HG_free(H5HG_heap_t *heap) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HG_free() */ +} /* H5HG__free() */ diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 3a770ae..beaea7b 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -374,7 +374,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, done: if(!ret_value && heap) - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection") FUNC_LEAVE_NOAPI(ret_value) @@ -485,7 +485,7 @@ H5HG__cache_heap_free_icr(void *_thing) HDassert(heap->cache_info.type == H5AC_GHEAP); /* Destroy global heap collection */ - if(H5HG_free(heap) < 0) + if(H5HG__free(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap collection") done: diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index a735ba0..4ed9b10 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -137,7 +137,7 @@ struct H5HG_heap_t { /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5HG_free(H5HG_heap_t *heap); +H5_DLL herr_t H5HG__free(H5HG_heap_t *heap); H5_DLL H5HG_heap_t *H5HG__protect(H5F_t *f, haddr_t addr, unsigned flags); #endif /* _H5HGpkg_H */ diff --git a/src/H5I.c b/src/H5I.c index 3cf592d..6cb1947 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -144,7 +144,7 @@ static herr_t H5I__debug(H5I_type_t type); * Return: Success: Positive if any action was taken that might * affect some other interface; zero otherwise. * - * Failure: Negative. + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -2032,8 +2032,8 @@ done: /*------------------------------------------------------------------------- * Function: H5Iget_file_id * - * Purpose: The public version of H5I_get_file_id(), obtains the file - * ID given an object ID. User has to close this ID. + * Purpose: Obtains the file ID given an object ID. The user has to + * close this ID. * * Return: Success: The file ID associated with the object * diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index e6fd37c..7bdb001 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -41,10 +41,10 @@ #define H5L_SAME_LOC (hid_t)0 /* Current version of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS 1 +#define H5L_LINK_CLASS_T_VERS 1 /* Previous versions of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS_0 0 +#define H5L_LINK_CLASS_T_VERS_0 0 #ifdef __cplusplus extern "C" { diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index b57eaf6..fa57862 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -1541,7 +1541,7 @@ H5O_copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get attribute datatype") /* Check if the datatype is committed and search the skip list if so */ - if(H5T_committed(dt)) { + if(H5T_is_named(dt)) { /* Allocate key */ if(NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") @@ -1658,9 +1658,8 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, if(NULL == (key->dt = (H5T_t *)H5O_msg_read(obj_oloc, H5O_DTYPE_ID, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message") - /* Check if the datatype is committed and search the skip list if so - */ - if(H5T_committed(key->dt)) { + /* Check if the datatype is committed and search the skip list if so */ + if(H5T_is_named(key->dt)) { /* Get datatype object fileno */ H5F_GET_FILENO(obj_oloc->file, key->fileno); diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 8060398..b8eb4a7 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -1485,7 +1485,7 @@ H5O_dtype_can_share(const void *_mesg) HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is immutable") /* Don't share committed datatypes */ - if((tri_ret = H5T_committed(mesg)) > 0) + if((tri_ret = H5T_is_named(mesg)) > 0) HGOTO_DONE(FALSE) else if(tri_ret < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is shared") @@ -1619,14 +1619,15 @@ H5O__dtype_shared_post_copy_upd(const H5O_loc_t H5_ATTR_UNUSED *src_oloc, FUNC_ENTER_STATIC if(dt_dst->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { - HDassert(H5T_committed(dt_dst)); + HDassert(H5T_is_named(dt_dst)); if(H5O_loc_reset(&(dt_dst->oloc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to reset location") dt_dst->oloc.file = dt_dst->sh_loc.file; dt_dst->oloc.addr = dt_dst->sh_loc.u.loc.oh_addr; } /* end if */ - else - HDassert(!H5T_committed(dt_dst)); + else { + HDassert(!H5T_is_named(dt_dst)); + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5R.c b/src/H5R.c index 95abc32..65aa6cb 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -93,7 +93,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t { H5G_loc_t loc; /* File location */ H5S_t *space = NULL; /* Pointer to dataspace containing region */ - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id); @@ -101,17 +101,17 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t /* Check args */ if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - if (H5G_loc(loc_id, &loc) < 0) + if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if (ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION) + if(ref_type != H5R_OBJECT && ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported") - if (space_id == (-1) && ref_type == H5R_DATASET_REGION) + if(space_id == (-1) && ref_type == H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") - if (space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) + if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Set up collective metadata if appropriate */ @@ -165,13 +165,13 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r H5TRACE4("i", "iiRt*x", obj_id, oapl_id, ref_type, _ref); /* Check args */ - if (H5G_loc(obj_id, &loc) < 0) + if(H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if (oapl_id < 0) + if(oapl_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") - if (_ref == NULL) + if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") /* Verify access property list and set up collective metadata if appropriate */ @@ -181,7 +181,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r /* Get the file pointer from the entry */ file = loc.oloc->file; - /* Create reference */ + /* Dereference */ if((ret_value = H5R__dereference(file, oapl_id, ref_type, _ref)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") @@ -224,11 +224,11 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) H5TRACE3("i", "iRt*x", id, ref_type, ref); /* Check args */ - if (H5G_loc(id, &loc) < 0) + if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if (ref_type != H5R_DATASET_REGION) + if(ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") - if (ref == NULL) + if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") /* Get the dataspace with the correct region selected */ @@ -236,7 +236,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") /* Atomize */ - if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) + if((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: @@ -278,14 +278,14 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type); /* Check args */ - if (H5G_loc(id, &loc) < 0) + if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") - if (ref == NULL) + if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - /* Get the object information */ + /* Get the object type */ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") @@ -333,17 +333,17 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, { H5G_loc_t loc; /* Group location */ H5F_t *file; /* File object */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size); /* Check args */ - if (H5G_loc(id, &loc) < 0) + if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") - if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) + if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") - if (_ref == NULL) + if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") /* Get the file pointer from the entry */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index fb62430..41765cf 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -37,12 +37,12 @@ #include "H5Ppublic.h" /* Property lists */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object headers */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Oprivate.h" /* Object headers */ #include "H5Rpkg.h" /* References */ @@ -119,7 +119,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) /* Get the object information */ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, &obj_type) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ ret_value = H5G_map_obj_type(obj_type); @@ -166,9 +166,9 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) /* Get the file pointer from the entry */ file = loc.oloc->file; - /* Create reference */ + /* Dereference */ if((ret_value = H5R__dereference(file, H5P_DATASET_ACCESS_DEFAULT, ref_type, _ref)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, "unable dereference object") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Rint.c b/src/H5Rint.c index d2f315b..1bbe217 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -221,8 +221,7 @@ H5R_term_package(void) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, - H5S_t *space) +H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space) { H5G_loc_t obj_loc; /* Group hier. location of object */ H5G_name_t path; /* Object group hier. path */ @@ -371,8 +370,7 @@ done: Added a check for undefined reference pointer. --------------------------------------------------------------------------*/ hid_t -H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, - const void *_ref) +H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, const void *_ref) { H5O_loc_t oloc; /* Object location */ H5G_name_t path; /* Path of object */ @@ -459,7 +457,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_GROUP, group, TRUE)) < 0) { H5G_close(group); HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register group") - } /* end if */ + } break; } @@ -475,7 +473,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) { H5T_close(type); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register datatype") - } /* end if */ + } break; } @@ -492,7 +490,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) { H5D_close(dset); HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset") - } /* end if */ + } break; } @@ -536,7 +534,7 @@ H5R__get_region(H5F_t *file, const void *_ref) const uint8_t *p; /* Pointer to OID to store */ H5HG_t hobjid; /* Heap object ID */ uint8_t *buf = NULL; /* Buffer to store serialized selection in */ - H5S_t *ret_value; /* Return value */ + H5S_t *ret_value; /* Return value */ FUNC_ENTER_PACKAGE @@ -574,7 +572,7 @@ done: H5MM_xfree(buf); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R__get_region() */ +} /* end H5R__get_region() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index fbbff50..504d2af 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -50,15 +50,11 @@ /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, - H5R_type_t ref_type, H5S_t *space); -H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, - const void *_ref); +H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space); +H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, const void *_ref); H5_DLL H5S_t *H5R__get_region(H5F_t *file, const void *_ref); -H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, - const void *_ref, H5O_type_t *obj_type); -H5_DLL ssize_t H5R__get_name(H5F_t *file, hid_t id, H5R_type_t ref_type, - const void *_ref, char *name, size_t size); +H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); +H5_DLL ssize_t H5R__get_name(H5F_t *file, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size); #endif /* _H5Rpkg_H */ diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h index 8c0ba8f..1bf2e92 100644 --- a/src/H5Rprivate.h +++ b/src/H5Rprivate.h @@ -20,11 +20,6 @@ #include "H5Rpublic.h" /* Private headers needed by this file */ -#include "H5Fprivate.h" /* Files */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspaces */ - /**************************/ /* Library Private Macros */ @@ -45,6 +40,5 @@ /* Library Private Prototypes */ /******************************/ - #endif /* _H5Rprivate_H */ diff --git a/src/H5SM.c b/src/H5SM.c index 1bf6301..0fa3489 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -142,7 +142,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc) /* Initialize master table */ if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table") table->num_indexes = H5F_SOHM_NINDEXES(f); table->table_size = H5SM_TABLE_SIZE(f); @@ -209,11 +209,11 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc) /* Allocate space for the table on disk */ if(HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM_TABLE, (hsize_t)table->table_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table") /* Cache the new table */ if(H5AC_insert_entry(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache") /* Record the address of the master table in the file */ H5F_SET_SOHM_ADDR(f, table_addr); @@ -386,7 +386,7 @@ H5SM_type_shared(H5F_t *f, unsigned type_id) done: /* Release the master SOHM table */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_type_shared() */ @@ -424,11 +424,11 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Look up index for message type */ if((index_num = H5SM_get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index") /* Retrieve heap address for index */ *fheap_addr = table->indexes[index_num].heap_addr; @@ -436,7 +436,7 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) done: /* Release the master SOHM table */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_get_fheap_addr() */ @@ -648,9 +648,9 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) /* Allocate list in memory */ if(NULL == (list = H5FL_CALLOC(H5SM_list_t))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") if(NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_CALLOC(H5SM_sohm_t, num_entries))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") /* Initialize messages in list */ for(x = 0; x < num_entries; x++) @@ -661,11 +661,11 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) /* Allocate space for the list on disk */ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_SOHM_INDEX, (hsize_t)header->list_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") /* Put the list into the cache */ if(H5AC_insert_entry(f, H5AC_SOHM_LIST, addr, list, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache") /* Set return value */ ret_value = addr; @@ -773,7 +773,7 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, /* Unprotect list in cache and release heap */ if(H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") *_list = list = NULL; /* Delete the old list index (but not its heap, which the new index is @@ -973,7 +973,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, done: /* Release the master SOHM table, if we protected it */ if(my_table && my_table != table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), my_table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_can_share() */ @@ -1081,7 +1081,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* "complex" sharing checks */ if((tri_ret = H5SM_can_share(f, table, &index_num, type_id, mesg)) < 0) @@ -1103,7 +1103,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, */ if(H5SM__write_mesg(f, open_oh, &(table->indexes[index_num]), (defer_flags & H5SM_DEFER) != 0, type_id, mesg, &cache_flags) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "can't write shared message") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "can't write shared message") /* Set flags if this message was "written" without error and wasn't a * 'defer' attempt; it is now either fully shared or "shareable". @@ -1130,7 +1130,7 @@ done: /* Release the master SOHM table */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_try_share() */ @@ -1254,15 +1254,15 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Encode the message to be written */ if((buf_size = H5O_msg_raw_size(f, type_id, TRUE, mesg)) == 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size") + HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size") if(NULL == (encoding_buf = H5MM_malloc(buf_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding") if(H5O_msg_encode(f, type_id, TRUE, (unsigned char *)encoding_buf, mesg) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared") + HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared") /* Open the fractal heap for this index */ if(NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up a key for the message to be written */ key.file = f; @@ -1285,14 +1285,14 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* The index is a list; get it from the cache */ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, defer ? H5AC__READ_ONLY_FLAG : H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* See if the message is already in the index and get its location. * Also record the first empty list position we find in case we need it * later. */ if(H5SM__find_in_list(list, &key, &empty_pos, &list_pos) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") if(defer) { if(list_pos != UFAIL) @@ -1503,7 +1503,7 @@ done: /* If we got a list out of the cache, release it (it is always dirty after writing a message) */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, defer ? H5AC__NO_FLAGS_SET : H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") if(encoding_buf) encoding_buf = H5MM_xfree(encoding_buf); @@ -1557,11 +1557,11 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Find the correct index and try to delete from it */ if((index_num = H5SM_get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") /* If mesg_buf is not NULL, the message's reference count has reached * zero and any file space it uses needs to be freed. mesg_buf holds the @@ -1572,7 +1572,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) /* Release the master SOHM table */ if(H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") table = NULL; /* If buf was allocated, delete the message it holds. This message may @@ -1590,7 +1590,7 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) done: /* Release the master SOHM table (should only happen on error) */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") /* Release any native message we decoded */ if(native_mesg) @@ -1794,7 +1794,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Open the heap for this type of message. */ if(NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Get the message size and encoded message for the message to be deleted, * either from its OH or from the heap. @@ -1813,7 +1813,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Get the encoded message */ if(H5SM__read_mesg(f, &key.message, fheap, open_oh, &buf_size, &encoding_buf) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up key for message to be deleted. */ key.file = f; @@ -1833,13 +1833,13 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* If the index is stored as a list, get it from the cache */ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* Find the message in the list */ if(H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") if(list_pos == UFAIL) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") if(list->messages[list_pos].location == H5SM_IN_HEAP) --(list->messages[list_pos].u.heap_loc.ref_count); @@ -1859,7 +1859,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, * If it succeeds, a copy of the modified message will be returned. */ if(H5B2_modify(bt2, &key, H5SM__decr_ref, &message) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") /* Point to the message */ message_ptr = &message; @@ -1893,7 +1893,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Remove the message from the heap if it was stored in the heap*/ if(old_loc == H5SM_IN_HEAP) if(H5HF_remove(fheap, &(message_ptr->u.heap_loc.fheap_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap") /* Return the message's encoding so anything it references can be freed */ @@ -1905,7 +1905,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, /* Unprotect cache and release heap */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") list = NULL; HDassert(fheap); @@ -1929,7 +1929,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, done: /* Release the SOHM list */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") /* Release the fractal heap & v2 B-tree if we opened them */ if(fheap && H5HF_close(fheap) < 0) @@ -2068,7 +2068,7 @@ done: /* Release the master SOHM table if we took it out of the cache */ if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_get_info() */ @@ -2180,16 +2180,16 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &tbl_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Find the correct index and find the message in it */ if((index_num = H5SM_get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") header = &(table->indexes[index_num]); /* Open the heap for this message type */ if(NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up a SOHM message to correspond to the shared message passed in */ key.message.location = H5SM_IN_HEAP; @@ -2198,7 +2198,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* Get the encoded message */ if(H5SM__read_mesg(f, &key.message, fheap, NULL, &buf_size, &encoding_buf) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Set up key for message to locate */ key.file = f; @@ -2218,13 +2218,13 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, /* If the index is stored as a list, get it from the cache */ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &lst_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* Find the message in the list */ if(H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") if(list_pos == UFAIL) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") /* Copy the message */ message = list->messages[list_pos]; @@ -2243,7 +2243,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, if((msg_exists = H5B2_find(bt2, &key, H5SM_get_refcount_bt2_cb, &message)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "error finding message in index") if(!msg_exists) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") } /* end else */ /* Set the refcount for the message */ @@ -2253,9 +2253,9 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, done: /* Release resources */ if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") if(fheap && H5HF_close(fheap) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") if(bt2 && H5B2_close(bt2) < 0) @@ -2418,11 +2418,11 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, oloc.file = f; oloc.addr = mesg->u.mesg_loc.oh_addr; if(H5O_open(&oloc) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header") /* Load the object header from the cache */ if(NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header") } /* end if */ else oh = open_oh; @@ -2559,11 +2559,11 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, if(table_vers == UFAIL) table_vers = H5F_SOHM_VERS(f); else if(table_vers != H5F_SOHM_VERS(f)) - HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n"); + HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n"); if(num_indexes == UFAIL) num_indexes = H5F_SOHM_NINDEXES(f); else if(num_indexes != H5F_SOHM_NINDEXES(f)) - HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n"); + HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n"); /* Check arguments. Version must be 0, the only version implemented so far */ if(table_vers > HDF5_SHAREDHEADER_VERSION) @@ -2576,7 +2576,7 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, table_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") HDfprintf(stream, "%*sShared Message Master Table...\n", indent, ""); for(x = 0; x < num_indexes; ++x) { @@ -2604,7 +2604,7 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, done: if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_table_debug() */ @@ -2650,7 +2650,7 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, table_addr, &tbl_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Determine which index the list is part of */ index_num = table->num_indexes; @@ -2708,11 +2708,11 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, done: if(fh && H5HF_close(fh) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap") if(list && H5AC_unprotect(f, H5AC_SOHM_LIST, list_addr, list, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") if(table && H5AC_unprotect(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_list_debug() */ @@ -2757,7 +2757,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) /* Look up the master SOHM table */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Get SOHM header size */ *hdr_size = table->table_size; @@ -2771,7 +2771,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) if(NULL == (bt2 = H5B2_open(f, table->indexes[u].index_addr, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") - if(H5B2_size(bt2, &(ih_info->index_size)) < 0) + if(H5B2_size(bt2, &(ih_info->index_size)) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") /* Close the v2 B-tree */ @@ -2792,8 +2792,8 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Get heap storage size */ - if(H5HF_size(fheap, &(ih_info->heap_size)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") + if(H5HF_size(fheap, &(ih_info->heap_size)) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") /* Close the fractal heap */ if(H5HF_close(fheap) < 0) diff --git a/src/H5T.c b/src/H5T.c index 76b0663..a9d2168 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -28,24 +28,19 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5Tpkg.h" /* Datatypes */ - -/* Check for header needed for SGI floating-point code */ -#ifdef H5_HAVE_SYS_FPU_H -#include -#endif /* H5_HAVE_SYS_FPU_H */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tpkg.h" /* Datatypes */ /****************/ @@ -292,17 +287,13 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_lib_conv_t func); -static herr_t H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_conv_func_t *conv); -static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, - H5T_t *dst, H5T_conv_t func); +static herr_t H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_lib_conv_t func); +static herr_t H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_func_t *conv); +static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_t func); static htri_t H5T__compiler_conv(H5T_t *src, H5T_t *dst); static herr_t H5T__set_size(H5T_t *dt, size_t size); static herr_t H5T__close_cb(H5T_t *dt); -static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, - const char *name, H5T_conv_func_t *conv); +static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_func_t *conv); /*****************************/ @@ -1391,7 +1382,7 @@ H5T_top_term_package(void) if((path->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { - fprintf(H5DEBUG(T), "H5T: conversion function " + HDfprintf(H5DEBUG(T), "H5T: conversion function " "0x%08lx failed to free private data for " "%s (ignored)\n", (unsigned long)(path->conv.u.app_func), path->name); @@ -1597,6 +1588,35 @@ H5T_term_package(void) /*------------------------------------------------------------------------- + * Function: H5T__close_cb + * + * Purpose: Called when the ref count reaches zero on the datatype's ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5T__close_cb(H5T_t *dt) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(dt); + HDassert(dt->shared); + + /* Close the datatype */ + if(H5T_close(dt) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T__close_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5Tcreate * * Purpose: Create a new type and initialize it to reasonable values. @@ -1626,7 +1646,7 @@ H5Tcreate(H5T_class_t type, size_t size) /* check args. We support string (fixed-size or variable-length) now. */ if(size <= 0 && size != H5T_VARIABLE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive") /* create the type */ if(NULL == (dt = H5T__create(type, size))) @@ -1644,33 +1664,27 @@ done: /*------------------------------------------------------------------------- * Function: H5Tcopy * - * Purpose: Copies a datatype. The resulting datatype is not locked. - * The datatype should be closed when no longer needed by - * calling H5Tclose(). - * - * Return: Success: The ID of a new datatype. + * Purpose: Copies a datatype. The resulting datatype is not locked. + * The datatype should be closed when no longer needed by + * calling H5Tclose(). * - * Failure: Negative + * Return: Success: The ID of a new datatype * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * - * Modifications: + * Failure: H5I_INVALID_HID * - * Robb Matzke, 4 Jun 1998 - * The returned type is always transient and unlocked. If the TYPE_ID - * argument is a dataset instead of a datatype then this function - * returns a transient, modifiable datatype which is a copy of the - * dataset's datatype. + * Note: The returned type is always transient and unlocked. If the + * TYPE_ID argument is a dataset instead of a datatype then + * this function returns a transient, modifiable datatype + * which is a copy of the dataset's datatype. * *------------------------------------------------------------------------- */ hid_t H5Tcopy(hid_t type_id) { - H5T_t *dt; /* Pointer to the datatype to copy */ - H5T_t *new_dt = NULL; - hid_t ret_value; /* Return value */ + H5T_t *dt = NULL; /* Pointer to the datatype to copy */ + H5T_t *new_dt = NULL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", type_id); @@ -1721,7 +1735,7 @@ H5Tcopy(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(new_dt && H5T_close_real(new_dt) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release datatype info") @@ -1835,9 +1849,9 @@ H5Tlock(hid_t type_id) H5TRACE1("e", "i", type_id); /* Check args */ - if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - if(H5T_STATE_NAMED==dt->shared->state || H5T_STATE_OPEN==dt->shared->state) + if(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to lock named datatype") if(H5T_lock(dt, TRUE) < 0) @@ -1972,15 +1986,6 @@ done: * Programmer: Quincey Koziol * Wednesday, November 29, 2000 * - * Modifications: - * Raymond Lu - * 4 December 2009 - * Added a flag as a parameter to indicate whether the caller is - * H5Tdetect_class. I also added the check for VL string type - * just like the public function. Because we want to tell users - * VL string is a string type but we treat it as a VL type - * internally, H5T_detect_class needs to know where the caller - * is from. *------------------------------------------------------------------------- */ htri_t @@ -2213,7 +2218,7 @@ H5Tget_super(hid_t type) { H5T_t *dt; /* Datatype to query */ H5T_t *super = NULL; /* Supertype */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", type); @@ -2226,7 +2231,7 @@ H5Tget_super(hid_t type) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register parent datatype") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(super && H5T_close_real(super) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release super datatype info") @@ -2289,7 +2294,7 @@ H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, FUNC_ENTER_STATIC /* Check args */ - HDassert(H5T_PERS_HARD==pers || H5T_PERS_SOFT==pers); + HDassert(H5T_PERS_HARD == pers || H5T_PERS_SOFT == pers); HDassert(name && *name); HDassert(src); HDassert(dst); @@ -2354,8 +2359,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if(NULL == (new_path = H5T__path_find_real(src, dst, name, conv))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path") - /* - * Notify all other functions to recalculate private data since some + /* Notify all other functions to recalculate private data since some * functions might cache a list of conversion functions. For * instance, the compound type converter caches a list of conversion * functions for the members, so adding a new function should cause @@ -2445,7 +2449,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((old_path->conv.u.app_func)(tmp_sid, tmp_did, &(old_path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx " "failed to free private data for %s (ignored)\n", (unsigned long)(old_path->conv.u.app_func), old_path->name); #endif @@ -2455,7 +2459,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((old_path->conv.u.lib_func)(tmp_sid, tmp_did, &(old_path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " + HDfprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx " "failed to free private data for %s (ignored)\n", (unsigned long)(old_path->conv.u.lib_func), old_path->name); #endif @@ -2627,7 +2631,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((path->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " "to free private data for %s (ignored)\n", (unsigned long)(path->conv.u.app_func), path->name); #endif @@ -2637,7 +2641,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, if((path->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx failed " "to free private data for %s (ignored)\n", (unsigned long)(path->conv.u.lib_func), path->name); #endif @@ -3151,7 +3155,7 @@ H5T__create(H5T_class_t type, size_t size) case H5T_REFERENCE: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "unknown data type class") } /* end switch */ /* Set the size except VL string */ @@ -3166,8 +3170,8 @@ done: if(dt) { dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); dt = H5FL_FREE(H5T_t, dt); - } /* end if */ - } /* end if */ + } + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__create() */ @@ -3186,27 +3190,6 @@ done: * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modifications: - * - * Robb Matzke, 4 Jun 1998 - * Added the METHOD argument. If it's H5T_COPY_TRANSIENT then the - * result will be an unlocked transient type. Otherwise if it's - * H5T_COPY_ALL then the result is a named type if the original is a - * named type, but the result is not opened. Finally, if it's - * H5T_COPY_REOPEN and the original type is a named type then the result - * is a named type and the type object header is opened again. The - * H5T_COPY_REOPEN method is used when returning a named type to the - * application. - * - * Robb Matzke, 22 Dec 1998 - * Now able to copy enumeration data types. - * - * Robb Matzke, 20 May 1999 - * Now able to copy opaque types. - * - * Pedro Vicente, 21 Sep 2002 - * Added a deep copy of the symbol table entry - * *------------------------------------------------------------------------- */ H5T_t * @@ -3498,9 +3481,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_lock (H5T_t *dt, hbool_t immutable) +H5T_lock(H5T_t *dt, hbool_t immutable) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3511,7 +3494,8 @@ H5T_lock (H5T_t *dt, hbool_t immutable) dt->shared->state = immutable ? H5T_STATE_IMMUTABLE : H5T_STATE_RDONLY; break; case H5T_STATE_RDONLY: - if (immutable) dt->shared->state = H5T_STATE_IMMUTABLE; + if(immutable) + dt->shared->state = H5T_STATE_IMMUTABLE; break; case H5T_STATE_IMMUTABLE: case H5T_STATE_NAMED: @@ -3601,10 +3585,8 @@ H5T__free(H5T_t *dt) /* Free the ID to name info */ H5G_name_free(&(dt->path)); - /* - * Don't free locked datatypes. - */ - if(H5T_STATE_IMMUTABLE==dt->shared->state) + /* Don't free locked datatypes */ + if(H5T_STATE_IMMUTABLE == dt->shared->state) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close immutable datatype") /* Close the datatype */ @@ -3613,7 +3595,7 @@ H5T__free(H5T_t *dt) for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { dt->shared->u.compnd.memb[i].name = (char *)H5MM_xfree(dt->shared->u.compnd.memb[i].name); (void)H5T_close_real(dt->shared->u.compnd.memb[i].type); - } /* end for */ + } dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_xfree(dt->shared->u.compnd.memb); dt->shared->u.compnd.nmembs = 0; break; @@ -3661,7 +3643,7 @@ done: * * Purpose: Frees a datatype and all associated memory. * - * Hote: Does _not_ deal with open hamed datatypes, etc. + * Hote: Does _not_ deal with open named datatypes, etc. * * Return: Non-negative on success/Negative on failure * @@ -3700,41 +3682,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__close_cb - * - * Purpose: Callback routine for closing a datatype ID. Closes the datatype - * object that was attached to the ID. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T__close_cb(H5T_t *dt) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* check args */ - HDassert(dt && dt->shared); - - /* Call actual datatype close routine */ - if(H5T_close(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T__close_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5T_close + * Function: H5T_close * - * Purpose: Frees a data type and all associated memory. Deals with - * open named datatypes appropriately. + * Purpose: Frees a data type and all associated memory. Deals with + * open named datatypes appropriately. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Monday, December 8, 1997 @@ -3749,7 +3702,8 @@ H5T_close(H5T_t *dt) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dt && dt->shared); + HDassert(dt); + HDassert(dt->shared); /* Named datatype cleanups */ if(dt->shared->state == H5T_STATE_OPEN) { @@ -3761,8 +3715,7 @@ H5T_close(H5T_t *dt) HDassert(H5F_addr_defined(dt->sh_loc.u.loc.oh_addr)); HDassert(H5F_addr_defined(dt->oloc.addr)); - /* - * If a named type is being closed then close the object header and + /* If a named type is being closed then close the object header and * remove from the list of open objects in the file. */ @@ -3862,7 +3815,7 @@ H5T__set_size(H5T_t *dt, size_t size) dt->shared->size = dt->shared->parent->shared->size * dt->shared->u.array.nelem; else if(dt->shared->type!=H5T_VLEN) dt->shared->size = dt->shared->parent->shared->size; - } /* end if */ + } else { if (H5T_IS_ATOMIC(dt->shared)) { offset = dt->shared->u.atomic.offset; @@ -3876,7 +3829,7 @@ H5T__set_size(H5T_t *dt, size_t size) offset = 8 * size - prec; if (prec > 8*size) prec = 8 * size; - } /* end if */ + } else prec = offset = 0; @@ -3974,7 +3927,7 @@ H5T__set_size(H5T_t *dt, size_t size) dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset || dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first"); - } /* end if */ + } break; case H5T_ENUM: @@ -4000,7 +3953,7 @@ H5T__set_size(H5T_t *dt, size_t size) if (H5T_IS_ATOMIC(dt->shared)) { dt->shared->u.atomic.offset = offset; dt->shared->u.atomic.prec = prec; - } /* end if */ + } } /* end if */ /* Check if the new compound type is packed */ @@ -4038,7 +3991,7 @@ H5T_get_size(const H5T_t *dt) HDassert(dt); FUNC_LEAVE_NOAPI(dt->shared->size) -} +} /* end H5T_get_size() */ /*------------------------------------------------------------------------- @@ -4615,7 +4568,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if(H5T__conv_noop((hid_t)FAIL, (hid_t)FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); + HDfprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); #endif H5E_clear_stack(NULL); /*ignore the error*/ } /* end if */ @@ -4623,8 +4576,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_g.npaths = 1; } /* end if */ - /* - * Find the conversion path. If source and destination types are equal + /* Find the conversion path. If source and destination types are equal * then use entry[0], otherwise do a binary search over the * remaining entries. * @@ -4663,8 +4615,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, */ old_npaths = H5T_g.npaths; - /* - * If we didn't find the path, if the caller is an API function specifying + /* If we didn't find the path, if the caller is an API function specifying * a new hard conversion function, or if the caller is a private function * specifying a new hard conversion and the path is a soft conversion, then * create a new path and add the new function to the path. @@ -4686,8 +4637,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, else path = table; - /* - * If a hard conversion function is specified and none is defined for the + /* If a hard conversion function is specified and none is defined for the * path, or the caller is an API function, or the caller is a private function but * the existing path is a soft function, then add the new conversion to the path * and initialize its conversion data. @@ -4793,7 +4743,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if((table->conv.u.app_func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", (unsigned long)(path->conv.u.app_func), path->name); #endif H5E_clear_stack(NULL); /*ignore the failure*/ @@ -4803,7 +4753,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, if((table->conv.u.lib_func)((hid_t)FAIL, (hid_t)FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if(H5DEBUG(T)) - fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", + HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", (unsigned long)(path->conv.u.lib_func), path->name); #endif H5E_clear_stack(NULL); /*ignore the failure*/ @@ -5028,7 +4978,7 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, H5_timer_end(&(tpath->stats.timer), &timer); tpath->stats.ncalls++; tpath->stats.nelmts += nelmts; - } /* end if */ + } #endif done: @@ -5150,14 +5100,10 @@ done: /*------------------------------------------------------------------------- * Function: H5T_is_named * - * Purpose: Check if a datatype is named. - * - * Return: TRUE + * Purpose: Check if a datatype is named/committed. * - * FALSE + * Return: TRUE/FALSE/FAIL * - * Programmer: Pedro Vicente - * Tuesday, Sep 3, 2002 *------------------------------------------------------------------------- */ htri_t @@ -5213,7 +5159,7 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path") dt->shared->state = H5T_STATE_TRANSIENT; - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 649bd2e..ce537dc 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -56,8 +56,6 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); -static hid_t H5T__get_create_plist(const H5T_t *type); static H5T_t *H5T__open_oid(const H5G_loc_t *loc); @@ -83,15 +81,12 @@ static H5T_t *H5T__open_oid(const H5G_loc_t *loc); /*------------------------------------------------------------------------- - * Function: H5Tcommit2 + * Function: H5Tcommit2 * - * Purpose: Save a transient datatype to a file and turn the type handle - * into a "named", immutable type. + * Purpose: Save a transient datatype to a file and turn the type handle + * into a "named", immutable type. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * April 5, 2007 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -100,7 +95,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Location to create datatype */ - H5T_t *type; /* Datatype for ID */ + H5T_t *type = NULL; /* Datatype for ID */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -108,11 +103,13 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Get correct property list */ if(H5P_DEFAULT == lcpl_id) @@ -134,7 +131,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* Commit the type */ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: FUNC_LEAVE_API(ret_value) @@ -194,7 +191,7 @@ done: * to return it to the state it was in before it was committed. */ if(ret_value < 0 && (NULL != ocrt_info.new_obj)) { - if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { + if(dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { /* Remove the datatype from the list of opened objects in the file */ if(H5FO_top_decr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object") @@ -212,9 +209,9 @@ done: /* Mark datatype as being back in memory */ if(H5T_set_loc(dt, dt->sh_loc.file, H5T_LOC_MEMORY)) HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to return datatype to memory") - dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; + dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; dt->shared->state = old_state; - } /* end if */ + } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -222,21 +219,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tcommit_anon + * Function: H5Tcommit_anon * - * Purpose: Save a transient datatype to a file and turn the type handle - * into a "named", immutable type. + * Purpose: Save a transient datatype to a file and turn the type handle + * into a "named", immutable type. * * The resulting ID should be linked into the file with * H5Olink or it will be deleted when closed. * - * Note: Datatype access property list is unused currently, but is - * checked for sanity anyway. + * Note: The datatype access property list is unused currently, but + * is checked for sanity anyway. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Peter Cao - * May 17, 2005 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -244,7 +238,7 @@ herr_t H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Group location for location */ - H5T_t *type = NULL; /* Datatype created */ + H5T_t *type = NULL; /* Datatype created */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -252,9 +246,11 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_is_named(type)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") /* Get correct property list */ if(H5P_DEFAULT == tcpl_id) @@ -267,9 +263,9 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Commit the type */ + /* Commit the datatype */ if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: FUNC_LEAVE_API(ret_value) @@ -277,24 +273,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__commit_anon + * Function: H5T__commit_anon * - * Purpose: Create an anonymous committed datatype. + * Purpose: Create an anonymous committed datatype. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 12, 2017 * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) { H5O_loc_t *oloc; /* Object location for datatype */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(file); @@ -303,7 +299,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) /* Commit the type */ if(H5T__commit(file, type, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Release the datatype's object header */ @@ -392,9 +388,9 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id) * type message and then give the object header a name. */ if(H5O_create(file, dtype_size, (size_t)1, tcpl_id, &temp_oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header") if(H5O_msg_create(&temp_oloc, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, type) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message") /* Copy the new object header's location into the datatype, taking ownership of it */ if(H5O_loc_copy(&(type->oloc), &temp_oloc, H5_COPY_SHALLOW) < 0) @@ -442,23 +438,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tcommitted - * - * Purpose: Determines if a datatype is committed or not. - * - * Return: Success: TRUE if committed, FALSE otherwise. + * Function: H5Tcommitted * - * Failure: Negative + * Purpose: Determines if a datatype is committed or not. * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 + * Return: TRUE/FALSE/FAIL * *------------------------------------------------------------------------- */ htri_t H5Tcommitted(hid_t type_id) { - H5T_t *type; /* Datatype to query */ + H5T_t *type; /* Datatype to query */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -466,10 +457,10 @@ H5Tcommitted(hid_t type_id) /* Check arguments */ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Set return value */ - ret_value = H5T_committed(type); + ret_value = H5T_is_named(type); done: FUNC_LEAVE_API(ret_value) @@ -477,30 +468,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_committed - * - * Purpose: Determines if a datatype is committed or not. - * - * Return: Success: TRUE if committed, FALSE otherwise. - * - * Programmer: Quincey Koziol - * Wednesday, September 24, 2003 - * - *------------------------------------------------------------------------- - */ -htri_t -H5T_committed(const H5T_t *type) -{ - /* Use no-init for efficiency */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(type); - - FUNC_LEAVE_NOAPI(H5T_STATE_OPEN == type->shared->state || H5T_STATE_NAMED == type->shared->state) -} /* end H5T_committed() */ - - -/*------------------------------------------------------------------------- * Function: H5T_link * * Purpose: Adjust the link count for an object header by adding @@ -519,14 +486,14 @@ H5T_link(const H5T_t *type, int adjust) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) HDassert(type); HDassert(type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); /* Adjust the link count on the named datatype */ if((ret_value = H5O_link(&type->oloc, adjust)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_LINKCOUNT, FAIL, "unable to adjust named datatype link count") + HGOTO_ERROR(H5E_DATATYPE, H5E_LINKCOUNT, (-1), "unable to adjust named datatype link count") done: FUNC_LEAVE_NOAPI(ret_value) @@ -534,16 +501,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Topen2 + * Function: H5Topen2 * - * Purpose: Opens a named datatype using a Datatype Access Property + * Purpose: Opens a named datatype using a Datatype Access Property * List. * - * Return: Success: Object ID of the named datatype. - * Failure: Negative + * Return: Success: Object ID of the named datatype * - * Programmer: James Laird - * Thursday July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -560,24 +525,26 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Open it */ + /* Open the datatype */ if(NULL == (type = H5T__open_name(&loc, 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 = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(type != NULL) (void)H5T_close(type); @@ -586,47 +553,56 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tget_create_plist - * - * Purpose: Returns a copy of the datatype creation property list. + * Function: H5Tget_create_plist * - * Note: There are no datatype creation properties currently, just - * object creation ones. + * Purpose: Returns a copy of the datatype creation property list. * - * Return: Success: ID for a copy of the datatype creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Note: There are no datatype creation properties currently, just + * object creation ones. * - * Failure: FAIL + * Return: Success: ID for a copy of the datatype creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Tget_create_plist(hid_t dtype_id) { - H5T_t *type; /* Datatype object for ID */ - herr_t status; /* Generic status value */ - hid_t ret_value = FAIL; /* Return value */ + H5T_t *type = NULL; /* Datatype object for ID */ + htri_t is_named = FAIL; /* Is the datatype named? */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dtype_id); /* Check arguments */ if(NULL == (type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype") /* Check if the datatype is committed */ - if((status = H5T_committed(type)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check whether datatype is committed") + if(FAIL == (is_named = H5T_is_named(type))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't check whether datatype is committed") - /* Retrieve further information, if the datatype is committed */ - if(status > 0) - /* Retrieve datatype creation properties */ + /* If the datatype is not committed/named, just copy the default + * creation property list and return that. + */ + if(FALSE == is_named) { + H5P_genplist_t *tcpl_plist = NULL; + + /* Copy the default datatype creation property list */ + if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list") + if((ret_value = H5P_copy_plist(tcpl_plist, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") + } + /* If the datatype is committed, retrieve further information */ + else { if((ret_value = H5T__get_create_plist(type)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") + } done: FUNC_LEAVE_API(ret_value) @@ -666,7 +642,7 @@ H5Tflush(hid_t type_id) /* Flush metadata for named datatype */ if(H5O_flush_common(&dt->oloc, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") done: FUNC_LEAVE_API(ret_value) @@ -704,7 +680,7 @@ H5Trefresh(hid_t type_id) if(H5CX_set_loc(type_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call private function to refresh datatype object */ + /* Refresh the datatype's metadata */ if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") @@ -714,50 +690,50 @@ done: /*------------------------------------------------------------------------- - * Function: H5T__get_create_plist + * Function: H5T__get_create_plist * - * Purpose: Returns a copy of the datatype creation property list. + * Purpose: Returns a copy of the datatype creation property list. * - * Note: There are no datatype creation properties currently, just - * object creation ones. + * Note: There are no datatype creation properties currently, just + * object creation ones. * - * Return: Success: ID for a copy of the datatype creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Return: Success: ID for a copy of the datatype creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Wednesday, December 13, 2017 * *------------------------------------------------------------------------- */ -static hid_t +hid_t H5T__get_create_plist(const H5T_t *type) { H5P_genplist_t *tcpl_plist; /* Existing datatype creation propertty list */ H5P_genplist_t *new_plist; /* New datatype creation property list */ hid_t new_tcpl_id = FAIL; /* New datatype creation property list */ - hid_t ret_value = FAIL; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(type); /* Copy the default datatype creation property list */ if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "can't get default creation property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list") if((new_tcpl_id = H5P_copy_plist(tcpl_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to copy the creation property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") /* Get property list object for new TCPL */ if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_tcpl_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get property list") /* Retrieve any object creation properties */ if(H5O_get_create_plist(&type->oloc, new_plist) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") /* Set the return value */ ret_value = new_tcpl_id; @@ -766,7 +742,7 @@ done: if(ret_value < 0) if(new_tcpl_id > 0) if(H5I_dec_app_ref(new_tcpl_id) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to close temporary object") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, H5I_INVALID_HID, "unable to close temporary object") FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_create_plist() */ @@ -981,11 +957,11 @@ H5T__open_oid(const H5G_loc_t *loc) /* Open named datatype object in file */ if(H5O_open(loc->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") /* Deserialize the datatype message into a datatype in memory */ if(NULL == (dt = (H5T_t *)H5O_msg_read(loc->oloc, H5O_DTYPE_ID, NULL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header") /* Mark the type as named and open */ dt->shared->state = H5T_STATE_OPEN; diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index feece57..d4f1008 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -202,7 +202,7 @@ done: * modifying the returned datatype does not * modify the member type. * - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, January 7, 1998 @@ -221,17 +221,17 @@ H5Tget_member_type(hid_t type_id, unsigned membno) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a compound datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a compound datatype") if(membno >= dt->shared->u.compnd.nmembs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number") /* Retrieve the datatype for the member */ if(NULL == (memb_dt = H5T_get_member_type(dt, membno, H5T_COPY_REOPEN))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type") /* Get an ID for the datatype */ if((ret_value = H5I_register(H5I_DATATYPE, memb_dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype atom") done: if(ret_value < 0) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 803a6da..563de65 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2962,7 +2962,7 @@ H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne src_parent = src->shared->parent; if(NULL == (tpath = H5T_path_find(src_parent, dst))) { - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype") } else if(!H5T_path_noop(tpath)) { if((src_parent_id = H5I_register(H5I_DATATYPE, H5T_copy(src_parent, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") @@ -8295,14 +8295,6 @@ H5_GCC_DIAG_ON(float-equal) * Programmer: Raymond Lu * Wednesday, Jan 21, 2004 * - * Raymond Lu - * Wednesday, April 21, 2004 - * There is a new design for exception handling like overflow, - * which is passed in as a transfer property. - * - * Raymond Lu - * Monday, March 13, 2006 - * Added support for VAX floating-point types. *------------------------------------------------------------------------- */ herr_t @@ -9008,8 +9000,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } #endif - /* - * Put the data in little endian order so our loops aren't so + /* Put the data in little endian order so our loops aren't so * complicated. We'll do all the conversion stuff assuming * little endian and then we'll fix the order at the end. */ @@ -9022,26 +9013,23 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } } - /*zero-set all destination bits*/ + /* Zero-set all destination bits*/ H5T__bit_set (d, dst.offset, dst.prec, FALSE); /* Copy source into a temporary buffer */ H5T__bit_copy(int_buf, (size_t)0, s, src.offset, src.prec); - /* - * Find the sign bit value of the source. - */ + /* Find the sign bit value of the source */ if(H5T_SGN_2 == src.u.i.sign) sign = (size_t)H5T__bit_get_d(int_buf, src.prec - 1, (size_t)1); - /* - * What is the bit position(starting from 0 as first one) for the most significant - * bit(MSB) of S which is set? + /* What is the bit position(starting from 0 as first one) for the most significant + * bit(MSB) of S which is set? */ if(H5T_SGN_2 == src.u.i.sign) { sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE); if(sign && sfirst < 0) - /* The case 0x80...00, which is negative with maximal value */ + /* The case 0x80...00, which is negative with maximal value */ is_max_neg = 1; } else if(H5T_SGN_NONE == src.u.i.sign) sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec, H5T_BIT_MSB, TRUE); @@ -9050,9 +9038,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(!sign && sfirst < 0) goto padding; - /* - * Convert source integer if it's negative - */ + /* Convert source integer if it's negative */ if(H5T_SGN_2 == src.u.i.sign && sign) { if(!is_max_neg) { /* Equivalent to ~(i - 1) */ @@ -9060,10 +9046,10 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, H5T__bit_neg(int_buf, (size_t)0, buf_size * 8); sfirst = H5T__bit_find(int_buf, (size_t)0, src.prec - 1, H5T_BIT_MSB, TRUE); } else { - /* If it's maximal negative number 0x80...000, treat it as if it overflowed - * (create a carry) to help conversion. i.e. a character type number 0x80 - * is treated as 0x100. - */ + /* If it's maximal negative number 0x80...000, treat it as if it overflowed + * (create a carry) to help conversion. i.e. a character type number 0x80 + * is treated as 0x100. + */ sfirst = (ssize_t)(src.prec - 1); is_max_neg = 0; } @@ -9072,7 +9058,8 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Sign bit has been negated if bit vector isn't 0x80...00. Set all bits in front of * sign bit to 0 in the temporary buffer because they're all negated from the previous - * step. */ + * step. + */ H5T__bit_set(int_buf, src.prec, (buf_size * 8) - src.prec, 0); /* Set sign bit in destination */ @@ -9081,14 +9068,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, first = (size_t)sfirst; - /* - * Calculate the true destination exponent by adjusting according to + /* Calculate the true destination exponent by adjusting according to * the destination exponent bias. Implied and non-implied normalization * should be the same. */ if (H5T_NORM_NONE==dst.u.f.norm || H5T_NORM_IMPLIED==dst.u.f.norm) { expo = first + dst.u.f.ebias; - } else { + } + else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet") } @@ -9096,13 +9083,14 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (H5T_NORM_IMPLIED==dst.u.f.norm) { /* Imply first bit */ H5T__bit_set(int_buf, first, (size_t)1, 0); - } else if (H5T_NORM_NONE==dst.u.f.norm) { - first++; + } + else if (H5T_NORM_NONE==dst.u.f.norm) { + first++; } /* Roundup for mantissa */ if(first > dst.u.f.msize) { - /* If the bit sequence is bigger than the mantissa part, there'll be some + /* If the bit sequence is bigger than the mantissa part, there'll be some * precision loss. Let user's handler deal with the case if it's present */ if(cb_struct.func) { @@ -9114,14 +9102,15 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if(except_ret == H5T_CONV_HANDLED) { reverse = FALSE; goto padding; - } else if(except_ret == H5T_CONV_ABORT) + } + else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") - /* If user's exception handler does deal with it, we do it by dropping off the - * extra bits at the end and do rounding. If we have .50...0(decimal) after radix - * point, we do roundup when the least significant digit before radix is odd, we do - * rounddown if it's even. - */ + /* If user's exception handler does deal with it, we do it by dropping off the + * extra bits at the end and do rounding. If we have .50...0(decimal) after radix + * point, we do roundup when the least significant digit before radix is odd, we do + * rounddown if it's even. + */ /* Check 1st dropoff bit, see if it's set. */ if(H5T__bit_get_d(int_buf, ((first - dst.u.f.msize) - 1), (size_t)1)) { diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 13d2f5f..a7f54a7 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -109,19 +109,19 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Commit the datatype to the file, using default property list values */ + /* Commit the datatype */ if(H5T__commit_named(&loc, name, type, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: FUNC_LEAVE_API(ret_value) @@ -137,7 +137,7 @@ done: * * Return: Success: Object ID of the named datatype. * - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Monday, June 1, 1998 @@ -149,7 +149,7 @@ H5Topen1(hid_t loc_id, const char *name) { H5T_t *type = NULL; H5G_loc_t loc; - hid_t ret_value = H5I_INVALID_HID; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); @@ -160,19 +160,19 @@ H5Topen1(hid_t loc_id, const char *name) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") - /* Open it */ + /* Open the datatype */ if(NULL == (type = H5T__open_name(&loc, 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 = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(type && H5T_close(type) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype") FUNC_LEAVE_API(ret_value) } /* end H5Topen1() */ diff --git a/src/H5Tenum.c b/src/H5Tenum.c index ade7d08..0ed1775 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -46,8 +46,6 @@ static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name, * Programmer: Robb Matzke * Tuesday, December 22, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t diff --git a/src/H5Toh.c b/src/H5Toh.c index c0139fe..c5ee994 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -180,7 +180,7 @@ H5O__dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) /* Commit the type to the file */ if(H5T__commit(f, crt_info->dt, crt_info->tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") /* Set up the new named datatype's location */ if(NULL == (obj_loc->oloc = H5T_oloc(crt_info->dt))) diff --git a/src/H5Torder.c b/src/H5Torder.c index 877316d..1995a03 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -199,7 +199,7 @@ done: herr_t H5Tset_order(hid_t type_id, H5T_order_t order) { - H5T_t *dt; /* Datatype to modify */ + H5T_t *dt = NULL; /* Datatype to modify */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -207,15 +207,15 @@ H5Tset_order(hid_t type_id, H5T_order_t order) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") if(order < H5T_ORDER_LE || order > H5T_ORDER_NONE || order == H5T_ORDER_MIXED) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order") if(H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") /* Call internal routine to set the order */ if(H5T_set_order(dt, order) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index e1b996c..04e9451 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -167,7 +167,7 @@ struct H5T_path_t { char name[H5T_NAMELEN]; /*name for debugging only */ H5T_t *src; /*source datatype */ H5T_t *dst; /*destination datatype */ - H5T_conv_func_t conv; /* Conversion funcion */ + H5T_conv_func_t conv; /* Conversion function */ hbool_t is_hard; /*is it a hard function? */ hbool_t is_noop; /*is it the noop conversion? */ hbool_t are_compounds; /*are source and dest both compounds?*/ @@ -447,10 +447,12 @@ H5_DLL herr_t H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, H5_DLL herr_t H5T__upgrade_version(H5T_t *dt, unsigned new_version); /* Committed / named datatype routines */ +H5_DLL herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); H5_DLL herr_t H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id); H5_DLL herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_id, hid_t tcpl_id); H5_DLL H5T_t *H5T__open_name(const H5G_loc_t *loc, const char *name); +H5_DLL hid_t H5T__get_create_plist(const H5T_t *type); /* Conversion functions */ H5_DLL herr_t H5T__conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 89cdcfd..9dae53b 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -144,7 +144,6 @@ H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); /* Operations on named datatypes */ H5_DLL H5T_t *H5T_open(const H5G_loc_t *loc); -H5_DLL htri_t H5T_committed(const H5T_t *type); H5_DLL int H5T_link(const H5T_t *type, int adjust); H5_DLL herr_t H5T_update_shared(H5T_t *type); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index ba31cd1..467847f 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -204,7 +204,7 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) dt->shared->u.vlen.read = H5T_vlen_seq_mem_read; dt->shared->u.vlen.write = H5T_vlen_seq_mem_write; dt->shared->u.vlen.setnull = H5T_vlen_seq_mem_setnull; - } /* end if */ + } else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) { /* size in memory, disk size is different */ dt->shared->size = sizeof(char *); @@ -216,9 +216,10 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) dt->shared->u.vlen.read = H5T_vlen_str_mem_read; dt->shared->u.vlen.write = H5T_vlen_str_mem_write; dt->shared->u.vlen.setnull = H5T_vlen_str_mem_setnull; - } /* end else-if */ - else + } + else { HDassert(0 && "Invalid VL type"); + } /* Reset file ID (since this VL is in memory) */ dt->shared->u.vlen.f = NULL; @@ -667,8 +668,7 @@ H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len) */ static herr_t H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_alloc_info, - void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, - size_t base_size) + void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { char *t; /* Pointer to temporary buffer allocated */ size_t len; /* Maximum length of the string to copy */ @@ -847,10 +847,11 @@ H5T_vlen_disk_read(H5F_t *f, void *_vl, void *buf, size_t H5_ATTR_UNUSED len) UINT32DECODE(vl, hobjid.idx); /* Check if this sequence actually has any data */ - if(hobjid.addr > 0) + if(hobjid.addr > 0) { /* Read the VL information from disk */ if(NULL == H5HG_read(f, &hobjid, buf, NULL)) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "Unable to read VL information") + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -898,10 +899,11 @@ H5T_vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_all UINT32DECODE(bg, bg_hobjid.idx); /* Free heap object for old data */ - if(bg_hobjid.addr > 0) + if(bg_hobjid.addr > 0) { /* Free heap object */ if(H5HG_remove(f, &bg_hobjid) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") + } } /* end if */ /* Set the length of the sequence */ @@ -1159,6 +1161,10 @@ done: * * Purpose: Alternative method to reclaim any VL data for a buffer element. * + * Use this function when the datatype is already available, but + * the allocation info is needed from the context before jumping + * into recursion. + * * Return: Non-negative on success/Negative on failure * * Programmer: Mike McGreevy @@ -1169,8 +1175,8 @@ done: herr_t H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt) { - H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */ - herr_t ret_value = SUCCEED; /* return value */ + H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */ + herr_t ret_value = SUCCEED; /* return value */ HDassert(dt); HDassert(elem); diff --git a/src/H5Z.c b/src/H5Z.c index 14b0400..9dc358c 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -43,10 +43,10 @@ typedef struct H5Z_stats_t { #endif /* H5Z_DEBUG */ typedef struct H5Z_object_t { - H5Z_filter_t filter_id; /* ID of the filter we're looking for */ - htri_t found; /* Whether we find an object using the filter */ + H5Z_filter_t filter_id; /* ID of the filter we're looking for */ + htri_t found; /* Whether we find an object using the filter */ #ifdef H5_HAVE_PARALLEL - hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */ + hbool_t sanity_checked; /* Whether the sanity check for collectively calling H5Zunregister has been done */ #endif /* H5_HAVE_PARALLEL */ } H5Z_object_t; @@ -339,12 +339,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Zunregister + * Function: H5Zunregister * - * Purpose: This function unregisters a filter. + * Purpose: This function unregisters a filter. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success - * Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -371,13 +371,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__unregister + * Function: H5Z__unregister * - * Purpose: Same as the public version except this one allows filters - * to be unset for predefined method numbers found = TRUE; ret_value = TRUE; - } /* end if */ + } done: if (ocpl_id > 0) @@ -518,15 +522,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__check_unregister_dset_cb + * Function: H5Z__check_unregister_dset_cb + * + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened objects. If the object is a dataset + * or a group and it uses the filter to be unregistered, the + * function returns TRUE. * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened objects. If the object is a dataset - * or a group and it uses the filter to be unregistered, the - * function returns TRUE. + * Return: TRUE if the object uses the filter + * FALSE if not + * NEGATIVE on error * - * Return: TRUE if the object uses the filter. - * FALSE otherwise. *------------------------------------------------------------------------- */ static int @@ -555,7 +561,7 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * if (filter_in_pline) { object->found = TRUE; ret_value = TRUE; - } /* end if */ + } done: if (ocpl_id > 0) @@ -567,27 +573,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5Z__flush_file_cb + * Function: H5Z__flush_file_cb * - * Purpose: The callback function for H5Z__unregister. It iterates - * through all opened files and flush them. + * Purpose: The callback function for H5Z__unregister. It iterates + * through all opened files and flush them. * - * Return: FALSE if finishes flushing and moves on - * FAIL if there is an error + * Return: NON-NEGATIVE if finishes flushing and moves on + * NEGATIVE if there is an error *------------------------------------------------------------------------- */ static int H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) { - H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ - H5Z_object_t *object = (H5Z_object_t *)key; - int ret_value = FALSE; /* Return value */ + H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ + H5Z_object_t *object = (H5Z_object_t *)key; + int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC /* Sanity checks */ - HDassert(f); - HDassert(object); + HDassert(obj_ptr); + HDassert(key); /* Do a global flush if the file is opened for write */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { @@ -817,11 +823,11 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get dataset creation property list object */ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") /* Peek at the layout information */ if (H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, dcpl_layout) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Check if the dataset is chunked */ if (H5D_CHUNKED == dcpl_layout->type) { @@ -829,7 +835,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get I/O pipeline information */ if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") /* Check if the chunks have filters */ if (dcpl_pline.nused > 0) { @@ -846,12 +852,12 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type /* Get ID for dataspace to pass to filter routines */ if ((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) { (void)H5S_close(space); - HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") } /* Make the callbacks */ if (H5Z_prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") } } } @@ -1519,13 +1525,13 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) /* if the pipeline has no filters, just return */ if (pline->nused == 0) - HGOTO_DONE (SUCCEED) + HGOTO_DONE(SUCCEED) /* Delete all filters */ if (H5Z_FILTER_ALL == filter) { if (H5O_msg_reset(H5O_PLINE_ID, pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFREE, FAIL, "can't release pipeline info") - } /* end if */ + } /* Delete filter */ else { size_t idx; /* Index of filter in pipeline */ @@ -1568,7 +1574,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) pline->nused--; /* Reset information for previous last filter in pipeline */ - HDmemset (&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); + HDmemset(&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); } /* end else */ done: @@ -1596,7 +1602,7 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) /* Get the filter info */ if (H5Z_get_filter_info(filter, filter_config_flags) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5detect.c b/src/H5detect.c index aac58de..4424009 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -150,12 +150,13 @@ static H5JMP_BUF jbuf_g; #endif + /*------------------------------------------------------------------------- - * Function: precision + * Function: precision * - * Purpose: Determine the precision and offset. + * Purpose: Determine the precision and offset. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -163,22 +164,22 @@ precision (detected_t *d) { unsigned int n; - if (0 == d->msize) { + if(0 == d->msize) { /* * An integer. The permutation can have negative values at the * beginning or end which represent padding of bytes. We must adjust * the precision and offset accordingly. */ - if (d->perm[0] < 0) { + if(d->perm[0] < 0) { /* * Lower addresses are padded. */ - for (n = 0; n < d->size && d->perm[n] < 0; n++) + for(n = 0; n < d->size && d->perm[n] < 0; n++) /*void*/; d->precision = 8 * (d->size - n); d->offset = 0; } - else if (d->perm[d->size - 1] < 0) { + else if(d->perm[d->size - 1] < 0) { /* * Higher addresses are padded. */ @@ -202,18 +203,18 @@ precision (detected_t *d) } } - + /*------------------------------------------------------------------------- - * Function: DETECT_I/DETECT_BYTE + * Function: DETECT_I/DETECT_BYTE * - * Purpose: These macro takes a type like `int' and a base name like - * `nati' and detects the byte order. The VAR is used to - * construct the names of the C variables defined. + * Purpose: These macro takes a type like `int' and a base name like + * `nati' and detects the byte order. The VAR is used to + * construct the names of the C variables defined. * - * DETECT_I is used for types that are larger than one byte, - * DETECT_BYTE is used for types that are exactly one byte. + * DETECT_I is used for types that are larger than one byte, + * DETECT_BYTE is used for types that are exactly one byte. * - * Return: void + * Return: void * * Modifications: * @@ -276,15 +277,15 @@ precision (detected_t *d) DETECT_I_BYTE_CORE(TYPE,VAR,INFO,TYPE) \ } - + /*------------------------------------------------------------------------- - * Function: DETECT_F + * Function: DETECT_F * - * Purpose: This macro takes a floating point type like `double' and - * a base name like `natd' and detects byte order, mantissa - * location, exponent location, sign bit location, presence or - * absence of implicit mantissa bit, and exponent bias and - * initializes a detected_t structure with those properties. + * Purpose: This macro takes a floating point type like `double' and + * a base name like `natd' and detects byte order, mantissa + * location, exponent location, sign bit location, presence or + * absence of implicit mantissa bit, and exponent bias and + * initializes a detected_t structure with those properties. *------------------------------------------------------------------------- */ #define DETECT_F(TYPE,VAR,INFO) { \ @@ -373,15 +374,15 @@ precision (detected_t *d) } \ } - + /*------------------------------------------------------------------------- - * Function: DETECT_M + * Function: DETECT_M * - * Purpose: This macro takes only miscellaneous structures or pointer - * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It - * constructs the names and decides the alignment in structure. + * Purpose: This macro takes only miscellaneous structures or pointer + * (pointer, hvl_t, hobj_ref_t, hdset_reg_ref_t). It + * constructs the names and decides the alignment in structure. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ #define DETECT_M(TYPE,VAR,INFO) { \ @@ -449,15 +450,16 @@ precision (detected_t *d) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- - * Function: sigsegv_handler + * Function: sigsegv_handler * - * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGSEGV. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -481,15 +483,16 @@ sigsegv_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- - * Function: sigbus_handler + * Function: sigbus_handler * - * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGBUS. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -513,15 +516,16 @@ sigbus_handler(int H5_ATTR_UNUSED signo) #if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) + /*------------------------------------------------------------------------- - * Function: sigill_handler + * Function: sigill_handler * - * Purpose: Handler for SIGILL. We use signal() instead of sigaction() - * because it's more portable to non-Posix systems. Although - * it's not nearly as nice to work with, it does the job for - * this simple stuff. + * Purpose: Handler for SIGILL. We use signal() instead of sigaction() + * because it's more portable to non-Posix systems. Although + * it's not nearly as nice to work with, it does the job for + * this simple stuff. * - * Return: Returns via H5LONGJMP to jbuf_g. + * Return: Returns via H5LONGJMP to jbuf_g. *------------------------------------------------------------------------- */ static void @@ -543,13 +547,13 @@ sigill_handler(int H5_ATTR_UNUSED signo) } #endif - + /*------------------------------------------------------------------------- - * Function: print_results + * Function: print_results * - * Purpose: Prints information about the detected data types. + * Purpose: Prints information about the detected data types. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -696,7 +700,7 @@ H5T__init_native(void)\n\ d[i].precision); /*precision */ /*HDassert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */ - if (0 == d[i].msize) { + if(0 == d[i].msize) { /* The part unique to fixed point types */ fprintf(rawoutstream, "\ dt->shared->u.atomic.u.i.sign = H5T_SGN_%s;\n", @@ -822,13 +826,13 @@ done:\n\ fprintf(rawoutstream, "/* sigill_handler called: %d times */\n", sigill_handler_called_g); } /* end print_results() */ - + /*------------------------------------------------------------------------- - * Function: iprint + * Function: iprint * - * Purpose: Prints information about the fields of a floating point format. + * Purpose: Prints information about the fields of a floating point format. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ @@ -837,17 +841,17 @@ iprint(detected_t *d) { unsigned int pass; - for (pass = (d->size - 1) / 4; ; --pass) { + for(pass = (d->size - 1) / 4; ; --pass) { unsigned int i, k; /* * Print the byte ordering above the bit fields. */ fprintf(rawoutstream, " * "); - for (i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) { + for(i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) { fprintf(rawoutstream, "%4d", d->perm[i]); - if (i > pass * 4) + if(i > pass * 4) HDfputs(" ", stdout); - if (!i) + if(!i) break; } @@ -855,24 +859,24 @@ iprint(detected_t *d) * Print the bit fields */ fprintf(rawoutstream, "\n * "); - for (i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, + for(i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, 8 * d->size - 1); i >= pass * 4; --i) { unsigned int j; - for (j = 8; j > 0; --j) { - if (k == d->sign && d->msize) { + for(j = 8; j > 0; --j) { + if(k == d->sign && d->msize) { HDfputc('S', rawoutstream); } - else if (k >= d->epos && k < d->epos + d->esize) { + else if(k >= d->epos && k < d->epos + d->esize) { HDfputc('E', rawoutstream); } - else if (k >= d->mpos && k < d->mpos + d->msize) { + else if(k >= d->mpos && k < d->mpos + d->msize) { HDfputc('M', rawoutstream); } - else if (d->msize) { + else if(d->msize) { HDfputc('?', rawoutstream); /*unknown floating point bit */ } - else if (d->sign) { + else if(d->sign) { HDfputc('I', rawoutstream); } else { @@ -880,27 +884,30 @@ iprint(detected_t *d) } --k; } - if (i > pass * 4) HDfputc(' ', rawoutstream); - if (!i) break; + if(i > pass * 4) + HDfputc(' ', rawoutstream); + if(!i) + break; } HDfputc('\n', rawoutstream); - if (!pass) break; + if(!pass) + break; } /* * Is there an implicit bit in the mantissa. */ - if (d->msize) { + if(d->msize) { fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no"); } /* * Alignment */ - if (0 == d->align) { + if(0 == d->align) { fprintf(rawoutstream, " * Alignment: NOT CALCULATED\n"); } - else if (1 == d->align) { + else if(1 == d->align) { fprintf(rawoutstream, " * Alignment: none\n"); } else { @@ -909,17 +916,17 @@ iprint(detected_t *d) } - + /*------------------------------------------------------------------------- - * Function: byte_cmp + * Function: byte_cmp * - * Purpose: Compares two chunks of memory A and B and returns the - * byte index into those arrays of the first byte that - * differs between A and B. Ignores differences where the - * corresponding bit in pad_mask is set to 0. + * Purpose: Compares two chunks of memory A and B and returns the + * byte index into those arrays of the first byte that + * differs between A and B. Ignores differences where the + * corresponding bit in pad_mask is set to 0. * - * Return: Success: Index of differing byte. - * Failure: -1 if all bytes are the same. + * Return: Success: Index of differing byte. + * Failure: -1 if all bytes are the same. *------------------------------------------------------------------------- */ static int @@ -936,17 +943,17 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) return -1; } - + /*------------------------------------------------------------------------- - * Function: bit_cmp + * Function: bit_cmp * - * Purpose: Compares two bit vectors and returns the index for the - * first bit that differs between the two vectors. The - * size of the vector is NBYTES. PERM is a mapping from - * actual order to little endian. Ignores differences where - * the corresponding bit in pad_mask is set to 0. + * Purpose: Compares two bit vectors and returns the index for the + * first bit that differs between the two vectors. The + * size of the vector is NBYTES. PERM is a mapping from + * actual order to little endian. Ignores differences where + * the corresponding bit in pad_mask is set to 0. * - * Return: Index of first differing bit. + * Return: Index of first differing bit. * *------------------------------------------------------------------------- */ @@ -959,14 +966,14 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, unsigned char *b = (unsigned char *) _b; unsigned char aa, bb; - for (i = 0; i < nbytes; i++) { + for(i = 0; i < nbytes; i++) { HDassert(perm[i] < (int) nbytes); - if ((aa = (unsigned char) (a[perm[i]] & pad_mask[perm[i]])) + if((aa = (unsigned char) (a[perm[i]] & pad_mask[perm[i]])) != (bb = (unsigned char) (b[perm[i]] & pad_mask[perm[i]]))) { unsigned int j; - for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { - if ((aa & 1) != (bb & 1)) return i * 8 + j; + for(j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { + if((aa & 1) != (bb & 1)) return i * 8 + j; } fprintf(stderr, "INTERNAL ERROR"); HDabort(); @@ -977,19 +984,19 @@ bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, return 0; } - + /*------------------------------------------------------------------------- - * Function: fix_order + * Function: fix_order * - * Purpose: Given an array PERM with elements FIRST through LAST - * initialized with zero origin byte numbers, this function - * creates a permutation vector that maps the actual order - * of a floating point number to little-endian. + * Purpose: Given an array PERM with elements FIRST through LAST + * initialized with zero origin byte numbers, this function + * creates a permutation vector that maps the actual order + * of a floating point number to little-endian. * - * This function assumes that the mantissa byte ordering - * implies the total ordering. + * This function assumes that the mantissa byte ordering + * implies the total ordering. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -997,28 +1004,28 @@ fix_order(int n, int last, int *perm, const char **mesg) { int i; - if (last > 1) { + if(last > 1) { /* * We have at least three points to consider. */ - if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { + if(perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { /* * Little endian. */ - if (mesg) + if(mesg) *mesg = "Little-endian"; - for (i = 0; i < n; i++) + for(i = 0; i < n; i++) perm[i] = i; } - else if (perm[last] > perm[last - 1] + else if(perm[last] > perm[last - 1] && perm[last - 1] > perm[last - 2]) { /* * Big endian. */ - if (mesg) + if(mesg) *mesg = "Big-endian"; - for (i = 0; i < n; i++) + for(i = 0; i < n; i++) perm[i] = (n - 1) - i; } @@ -1030,9 +1037,9 @@ fix_order(int n, int last, int *perm, const char **mesg) * case - JKM & QAK) */ HDassert(0 == n % 2); - if (mesg) + if(mesg) *mesg = "VAX"; - for (i = 0; i < n; i += 2) { + for(i = 0; i < n; i += 2) { perm[i] = (n - 2) - i; perm[i + 1] = (n - 1) - i; } @@ -1045,34 +1052,31 @@ fix_order(int n, int last, int *perm, const char **mesg) } } - + /*------------------------------------------------------------------------- - * Function: imp_bit - * - * Purpose: Looks for an implicit bit in the mantissa. The value - * of _A should be 1.0 and the value of _B should be 0.5. - * Some floating-point formats discard the most significant - * bit of the mantissa after normalizing since it will always - * be a one (except for 0.0). If this is true for the native - * floating point values stored in _A and _B then the function - * returns non-zero. + * Function: imp_bit * - * This function assumes that the exponent occupies higher - * order bits than the mantissa and that the most significant - * bit of the mantissa is next to the least significant bit - * of the exponent. + * Purpose: Looks for an implicit bit in the mantissa. The value + * of _A should be 1.0 and the value of _B should be 0.5. + * Some floating-point formats discard the most significant + * bit of the mantissa after normalizing since it will always + * be a one (except for 0.0). If this is true for the native + * floating point values stored in _A and _B then the function + * returns non-zero. * + * This function assumes that the exponent occupies higher + * order bits than the mantissa and that the most significant + * bit of the mantissa is next to the least significant bit + * of the exponent. * - * Return: Success: Non-zero if the most significant bit - * of the mantissa is discarded (ie, the - * mantissa has an implicit `one' as the - * most significant bit). Otherwise, - * returns zero. * - * Failure: 1 + * Return: Success: Non-zero if the most significant bit + * of the mantissa is discarded (ie, the + * mantissa has an implicit `one' as the + * most significant bit). Otherwise, + * returns zero. * - * Modifications: - * Fixed a bug that occurs with non-implicit architectures. + * Failure: 1 * *------------------------------------------------------------------------- */ @@ -1102,7 +1106,7 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ return (a[perm[major]] >> minor) & 0x01 ? 0 : 1; } - + /*------------------------------------------------------------------------- * Function: find_bias * @@ -1111,10 +1115,6 @@ imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_ * * Return: The exponent bias. * - * Modifications: - * Fixed a bug with non-implicit architectures returning the - * wrong exponent bias. - * *------------------------------------------------------------------------- */ H5_ATTR_PURE static unsigned int @@ -1124,7 +1124,7 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) unsigned char mask; unsigned int b, shift = 0, nbits, bias = 0; - while (esize > 0) { + while(esize > 0) { nbits = MIN(esize, (8 - epos % 8)); mask = (unsigned char) ((1 << nbits) - 1); b = (unsigned int) (a[perm[epos / 8]] >> (epos % 8)) & mask; @@ -1137,13 +1137,13 @@ find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) return bias; } - + /*------------------------------------------------------------------------- - * Function: print_header + * Function: print_header * - * Purpose: Prints the C file header for the generated file. + * Purpose: Prints the C file header for the generated file. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void @@ -1210,8 +1210,8 @@ bit.\n"; { size_t n; char *comma; - if ((pwd = HDgetpwuid(HDgetuid()))) { - if ((comma = HDstrchr(pwd->pw_gecos, ','))) { + if((pwd = HDgetpwuid(HDgetuid()))) { + if((comma = HDstrchr(pwd->pw_gecos, ','))) { n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos)); HDstrncpy(real_name, pwd->pw_gecos, n); real_name[n] = '\0'; @@ -1221,9 +1221,8 @@ bit.\n"; real_name[sizeof(real_name) - 1] = '\0'; } } - else { + else real_name[0] = '\0'; - } } #else real_name[0] = '\0'; @@ -1233,7 +1232,7 @@ bit.\n"; * The FQDM of this host or the empty string. */ #ifdef H5_HAVE_GETHOSTNAME - if (HDgethostname(host_name, sizeof(host_name)) < 0) { + if(HDgethostname(host_name, sizeof(host_name)) < 0) { host_name[0] = '\0'; } #else @@ -1248,23 +1247,23 @@ bit.\n"; fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year); - if (pwd || real_name[0] || host_name[0]) { + if(pwd || real_name[0] || host_name[0]) { fprintf(rawoutstream, " *\t\t\t"); - if (real_name[0]) + if(real_name[0]) fprintf(rawoutstream, "%s <", real_name); #ifdef H5_HAVE_GETPWUID - if (pwd) HDfputs(pwd->pw_name, rawoutstream); + if(pwd) HDfputs(pwd->pw_name, rawoutstream); #endif - if (host_name[0]) + if(host_name[0]) fprintf(rawoutstream, "@%s", host_name); - if (real_name[0]) + if(real_name[0]) fprintf(rawoutstream, ">"); HDfputc('\n', rawoutstream); } fprintf(rawoutstream, " *\n * Purpose:\t\t"); - for (s = purpose; *s; s++) { + for(s = purpose; *s; s++) { HDfputc(*s, rawoutstream); - if ('\n' == *s && s[1]) + if('\n' == *s && s[1]) fprintf(rawoutstream, " *\t\t\t"); } @@ -1273,19 +1272,19 @@ bit.\n"; fprintf(rawoutstream, " *\tIt was generated by code in `H5detect.c'.\n"); fprintf(rawoutstream, " *\n *"); - for (i = 0; i < 73; i++) + for(i = 0; i < 73; i++) HDfputc('-', rawoutstream); fprintf(rawoutstream, "\n */\n\n"); } - + /*------------------------------------------------------------------------- - * Function: detect_C89_integers + * Function: detect_C89_integers * - * Purpose: Detect C89 integer types + * Purpose: Detect C89 integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1301,13 +1300,13 @@ detect_C89_integers(void) DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++; } - + /*------------------------------------------------------------------------- - * Function: detect_C89_floats + * Function: detect_C89_floats * - * Purpose: Detect C89 floating point types + * Purpose: Detect C89 floating point types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1317,13 +1316,13 @@ detect_C89_floats(void) DETECT_F(double, DOUBLE, d_g[nd_g]); nd_g++; } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers8 + * Function: detect_C99_integers8 * - * Purpose: Detect C99 8 bit integer types + * Purpose: Detect C99 8 bit integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1373,13 +1372,13 @@ detect_C99_integers8(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers16 + * Function: detect_C99_integers16 * - * Purpose: Detect C99 16 bit integer types + * Purpose: Detect C99 16 bit integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1405,13 +1404,13 @@ detect_C99_integers16(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers32 + * Function: detect_C99_integers32 * - * Purpose: Detect C99 32 bit integer types + * Purpose: Detect C99 32 bit integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1437,13 +1436,13 @@ detect_C99_integers32(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers64 + * Function: detect_C99_integers64 * - * Purpose: Detect C99 64 bit integer types + * Purpose: Detect C99 64 bit integer types * - * Return: void + * Return: void * *------------------------------------------------------------------------- */ @@ -1483,13 +1482,13 @@ detect_C99_integers64(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_C99_integers + * Function: detect_C99_integers * - * Purpose: Detect C99 integer types + * Purpose: Detect C99 integer types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1503,13 +1502,13 @@ detect_C99_integers(void) detect_C99_integers64(); } - + /*------------------------------------------------------------------------- - * Function: detect_C99_floats + * Function: detect_C99_floats * - * Purpose: Detect C99 floating point types + * Purpose: Detect C99 floating point types * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1528,13 +1527,13 @@ detect_C99_floats(void) #endif } - + /*------------------------------------------------------------------------- - * Function: detect_alignments + * Function: detect_alignments * - * Purpose: Detect structure alignments + * Purpose: Detect structure alignments * - * Return: void + * Return: void *------------------------------------------------------------------------- */ static void HDF_NO_UBSAN @@ -1570,9 +1569,9 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) volatile int nfailures = 0; volatile int nsuccesses = 0; - for (i=0;i0 || nsuccesses != ntries) { + if(nfailures>0 || nsuccesses != ntries) { fprintf(stderr, "verify_signal_handlers for signal %d did %d tries. " "Found %d failures and %d successes\n", signum, ntries, nfailures, nsuccesses); @@ -1605,13 +1604,13 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) } #endif - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Main entry point. + * Purpose: Main entry point. * - * Return: Success: 0 + * Return: Success: EXIT_SUCCESS * * Modifications: * Some compilers, e.g., Intel C v7.0, took a long time to compile @@ -1628,17 +1627,16 @@ main(int argc, char *argv[]) FILE *f; /* temporary holding place for the stream pointer * so that rawoutstream is changed only when succeeded */ - if (argc > 1) { + if(argc > 1) fname = argv[1]; - } + /* First check if filename is string "NULL" */ - if (fname != NULL) { + if(fname != NULL) { /* binary output */ - if ((f = HDfopen(fname, "w")) != NULL) { + if((f = HDfopen(fname, "w")) != NULL) rawoutstream = f; - } } - if (!rawoutstream) + if(!rawoutstream) rawoutstream = stdout; #if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) @@ -1650,7 +1648,7 @@ main(int argc, char *argv[]) int nvpairs[2]; nvpairs[0] = SSIN_UACPROC; nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS; - if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { + if(setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) { fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno)); } @@ -1659,15 +1657,15 @@ main(int argc, char *argv[]) #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ - if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { + if(verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigbus_handler", SIGBUS); } - if (verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) { + if(verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigsegv_handler", SIGSEGV); } - if (verify_signal_handlers(SIGILL, sigill_handler) != 0) { + if(verify_signal_handlers(SIGILL, sigill_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigill_handler", SIGILL); } @@ -1694,8 +1692,8 @@ main(int argc, char *argv[]) print_results (nd_g, d_g, na_g, m_g); - if (rawoutstream && rawoutstream != stdout) { - if (HDfclose(rawoutstream)) + if(rawoutstream && rawoutstream != stdout) { + if(HDfclose(rawoutstream)) fprintf(stderr, "closing rawoutstream"); else rawoutstream = NULL; @@ -1703,3 +1701,4 @@ main(int argc, char *argv[]) return EXIT_SUCCESS; } + diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index d4caabb..da7c8d9 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -40,6 +40,7 @@ static const char *FileHeader = "\n\ FILE *rawoutstream = NULL; + /*------------------------------------------------------------------------- * Function: insert_libhdf5_settings * @@ -104,7 +105,7 @@ insert_libhdf5_settings(FILE *flibinfo) #endif } /* insert_libhdf5_settings() */ - + /*------------------------------------------------------------------------- * Function: make_libinfo * @@ -122,7 +123,7 @@ make_libinfo(void) insert_libhdf5_settings(rawoutstream); } - + /*------------------------------------------------------------------------- * Function: print_header * @@ -228,7 +229,7 @@ information about the library build configuration\n"; fprintf(rawoutstream, "\n */\n\n"); } - + /*------------------------------------------------------------------------- * Function: print_footer * @@ -243,13 +244,13 @@ print_footer(void) /* nothing */ } - + /*------------------------------------------------------------------------- * Function: main * * Purpose: Main entry point. * - * Return: Success: 0 + * Return: Success: EXIT_SUCCESS *------------------------------------------------------------------------- */ int @@ -257,19 +258,19 @@ main(int argc, char *argv[]) { char *fname = NULL; FILE *f; /* temporary holding place for the stream pointer - * so that rawoutstream is changed only when succeeded */ + * so that rawoutstream is changed only when succeeded + */ - if (argc > 1) { + if(argc > 1) fname = argv[1]; - } + /* First check if filename is string "NULL" */ - if (fname != NULL) { + if(fname != NULL) { /* binary output */ - if ((f = HDfopen(fname, "w")) != NULL) { + if((f = HDfopen(fname, "w")) != NULL) rawoutstream = f; - } } - if (!rawoutstream) + if(!rawoutstream) rawoutstream = stdout; print_header(); @@ -279,8 +280,8 @@ main(int argc, char *argv[]) print_footer(); - if (rawoutstream && rawoutstream != stdout) { - if (HDfclose(rawoutstream)) + if(rawoutstream && rawoutstream != stdout) { + if(HDfclose(rawoutstream)) fprintf(stderr, "closing rawoutstream"); else rawoutstream = NULL; @@ -288,3 +289,4 @@ main(int argc, char *argv[]) HDexit(EXIT_SUCCESS); } + diff --git a/src/Makefile.am b/src/Makefile.am index bc5c09e..472dfc6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -113,7 +113,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \ H5Topaque.c \ H5Torder.c \ - H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ + H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ + H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ H5Zscaleoffset.c H5Zszip.c H5Ztrans.c @@ -138,8 +139,8 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ - H5Rpublic.h H5Spublic.h \ - H5Tpublic.h H5Zpublic.h + H5Rpublic.h H5Spublic.h H5Tpublic.h \ + H5Zpublic.h # install libhdf5.settings in lib directory settingsdir=$(libdir) -- cgit v0.12 From 265652fe5466dc9e30d7bdf60a24a355852f0bfe Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 21 Sep 2018 12:12:05 -0700 Subject: Normalization with vol_integration (property lists, file drivers, other misc). --- src/H5FD.c | 978 +++++++++++++++++++++++--------------------- src/H5FDint.c | 167 ++++---- src/H5FDmpi.c | 2 +- src/H5FDpkg.h | 7 +- src/H5FDprivate.h | 8 +- src/H5FDspace.c | 15 +- src/H5FS.c | 68 +-- src/H5FScache.c | 11 +- src/H5FSpkg.h | 16 +- src/H5FSsection.c | 297 +++++++------- src/H5G.c | 27 +- src/H5Gint.c | 44 +- src/H5Glink.c | 2 +- src/H5Gloc.c | 163 ++++---- src/H5Gname.c | 46 ++- src/H5Gobj.c | 3 +- src/H5Goh.c | 4 +- src/H5Gstab.c | 24 +- src/H5I.c | 13 +- src/H5Iprivate.h | 1 - src/H5Lexternal.c | 58 +-- src/H5Ocopy.c | 56 ++- src/H5P.c | 134 +++--- src/H5Pacpl.c | 42 +- src/H5Pdapl.c | 16 +- src/H5Pdcpl.c | 46 +-- src/H5Pdeprec.c | 4 +- src/H5Pdxpl.c | 46 +-- src/H5Pencdec.c | 2 +- src/H5Pfapl.c | 258 ++++++------ src/H5Pfcpl.c | 31 +- src/H5Pfmpl.c | 2 +- src/H5Pgcpl.c | 16 +- src/H5Pint.c | 589 +++++++++++++------------- src/H5Plapl.c | 14 +- src/H5Plcpl.c | 20 +- src/H5Pocpl.c | 24 +- src/H5Pocpypl.c | 6 +- src/H5Ppkg.h | 44 +- src/H5Pprivate.h | 1 - src/H5Pstrcpl.c | 2 +- src/H5Ptest.c | 6 +- test/testfiles/err_compat_1 | 4 +- 43 files changed, 1647 insertions(+), 1670 deletions(-) diff --git a/src/H5FD.c b/src/H5FD.c index d74ea31..5585f37 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -23,22 +23,22 @@ /* Module Setup */ /****************/ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ #include "H5FDmodule.h" /* This source code file is part of the H5FD module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5FDpkg.h" /* File Drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDpkg.h" /* File Drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ @@ -58,8 +58,8 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5FD_free_cls(H5FD_class_t *cls); -static int H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/); +static herr_t H5FD__free_cls(H5FD_class_t *cls); +static herr_t H5FD__query(const H5FD_t *f, unsigned long *flags/*out*/); /*********************/ /* Package Variables */ @@ -94,21 +94,20 @@ static unsigned long H5FD_file_serial_no_g; /* File driver ID class */ static const H5I_class_t H5I_VFL_CLS[1] = {{ - H5I_VFL, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5FD_free_cls /* Callback routine for closing objects of this class */ + H5I_VFL, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5FD__free_cls /* Callback routine for closing objects of this class */ }}; /*------------------------------------------------------------------------- - * Function: H5FD__init_package + * Function: H5FD__init_package * - * Purpose: Initialize the virtual file layer. + * Purpose: Initialize the virtual file layer. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -131,16 +130,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_term_package + * Function: H5FD_term_package + * + * Purpose: Terminate this interface: free all memory and reset global + * variables to their initial values. Release all ID groups + * associated with this interface. * - * Purpose: Terminate this interface: free all memory and reset global - * variables to their initial values. Release all ID groups - * associated with this interface. + * Return: Success: Positive if anything was done that might + * have affected other interfaces; zero + * otherwise. * - * Return: Success: Positive if anything was done that might - * have affected other interfaces; zero - * otherwise. - * Failure: Never fails. + * Failure: Never fails. * *------------------------------------------------------------------------- */ @@ -171,26 +171,24 @@ H5FD_term_package(void) /*------------------------------------------------------------------------- - * Function: H5FD_free_cls + * Function: H5FD__free_cls * - * Purpose: Frees a file driver class struct and returns an indication of - * success. This function is used as the free callback for the - * virtual file layer object identifiers (cf H5FD__init_package). - * - * Return: Success: Non-negative + * Purpose: Frees a file driver class struct and returns an indication of + * success. This function is used as the free callback for the + * virtual file layer object identifiers (cf H5FD__init_package). * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5FD_free_cls(H5FD_class_t *cls) +H5FD__free_cls(H5FD_class_t *cls) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - /* Sanity check */ + /* Sanity checks */ HDassert(cls); /* If the file driver has a terminate callback, call it to give the file @@ -219,37 +217,37 @@ done: * library is closed or the driver is * unregistered. * - * Failure: A negative value. + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5FDregister(const H5FD_class_t *cls) { - hid_t ret_value; - H5FD_mem_t type; + H5FD_mem_t type; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*x", cls); /* Check arguments */ if(!cls) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "null class pointer is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null class pointer is disallowed") if(!cls->open || !cls->close) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`open' and/or `close' methods are not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'open' and/or 'close' methods are not defined") if(!cls->get_eoa || !cls->set_eoa) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eoa' and/or `set_eoa' methods are not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eoa' and/or 'set_eoa' methods are not defined") if(!cls->get_eof) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eof' method is not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eof' method is not defined") if(!cls->read || !cls->write) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'read' and/or 'write' method is not defined") for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) if(cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid free-list mapping") /* Create the new class ID */ if((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") done: FUNC_LEAVE_API(ret_value) @@ -268,7 +266,7 @@ done: * library is closed or the driver is * unregistered. * - * Failure: A negative value. + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -276,34 +274,35 @@ hid_t H5FD_register(const void *_cls, size_t size, hbool_t app_ref) { const H5FD_class_t *cls = (const H5FD_class_t *)_cls; - H5FD_class_t *saved = NULL; - H5FD_mem_t type; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5FD_class_t *saved = NULL; + H5FD_mem_t type; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) - /* Check arguments */ + /* Sanity checks */ HDassert(cls); HDassert(cls->open && cls->close); HDassert(cls->get_eoa && cls->set_eoa); HDassert(cls->get_eof); HDassert(cls->read && cls->write); - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES); + } /* Copy the class structure so the caller can reuse or free it */ if(NULL == (saved = (H5FD_class_t *)H5MM_malloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for file driver class struct") HDmemcpy(saved, cls, size); /* Create the new class ID */ if((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file driver ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(saved) - H5MM_xfree(saved); + saved = (H5FD_class_t *)H5MM_xfree(saved); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_register() */ @@ -317,9 +316,7 @@ done: * this driver or files which are already opened under this * driver. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -333,11 +330,11 @@ H5FDunregister(hid_t driver_id) /* Check arguments */ if(NULL == H5I_object_verify(driver_id, H5I_VFL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver") /* The H5FD_class_t struct will be freed by this function */ if(H5I_dec_app_ref(driver_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "unable to unregister file driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "unable to unregister file driver") done: FUNC_LEAVE_API(ret_value) @@ -345,19 +342,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_class + * Function: H5FD_get_class * - * Purpose: Obtains a pointer to the driver struct containing all the - * callback pointers, etc. The PLIST_ID argument can be a file - * access property list, a data transfer property list, or a - * file driver identifier. + * Purpose: Obtains a pointer to the driver struct containing all the + * callback pointers, etc. The PLIST_ID argument can be a file + * access property list, a data transfer property list, or a + * file driver identifier. * - * Return: Success: Ptr to the driver information. The pointer is - * only valid as long as the driver remains - * registered or some file or property list - * exists which references the driver. + * Return: Success: Ptr to the driver information. The pointer is + * only valid as long as the driver remains + * registered or some file or property list + * exists which references the driver. * - * Failure: NULL + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -369,7 +366,7 @@ H5FD_get_class(hid_t id) FUNC_ENTER_NOAPI(NULL) if(H5I_VFL == H5I_get_type(id)) - ret_value = (H5FD_class_t *)H5I_object(id); + ret_value = (H5FD_class_t *)H5I_object(id); else { H5P_genplist_t *plist; /* Property list pointer */ @@ -394,29 +391,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sb_size + * Function: H5FD_sb_size * - * Purpose: Obtains the number of bytes required to store the driver file - * access data in the HDF5 superblock. + * Purpose: Obtains the number of bytes required to store the driver file + * access data in the HDF5 superblock. * - * Return: Success: Number of bytes required. + * Return: Success: Number of bytes required. May be zero if the + * driver has no data to store in the superblock. * - * Failure: 0 if an error occurs or if the driver has no - * data to store in the superblock. + * Failure: This function cannot indicate errors. * *------------------------------------------------------------------------- */ hsize_t H5FD_sb_size(H5FD_t *file) { - hsize_t ret_value=0; + hsize_t ret_value = 0; FUNC_ENTER_NOAPI(0) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->sb_size) - ret_value = (file->cls->sb_size)(file); + ret_value = (file->cls->sb_size)(file); done: FUNC_LEAVE_NOAPI(ret_value) @@ -424,31 +424,33 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sb_encode + * Function: H5FD_sb_encode * - * Purpose: Encode driver-specific data into the output arguments. The - * NAME is a nine-byte buffer which should get an - * eight-character driver name and/or version followed by a null - * terminator. The BUF argument is a buffer to receive the - * encoded driver-specific data. The size of the BUF array is - * the size returned by the H5FD_sb_size() call. + * Purpose: Encode driver-specific data into the output arguments. The + * NAME is a nine-byte buffer which should get an + * eight-character driver name and/or version followed by a null + * terminator. The BUF argument is a buffer to receive the + * encoded driver-specific data. The size of the BUF array is + * the size returned by the H5FD_sb_size() call. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + + /* Dispatch to driver */ if(file->cls->sb_encode && (file->cls->sb_encode)(file, name/*out*/, buf/*out*/) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -456,12 +458,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD__sb_decode + * Function: H5FD__sb_decode * - * Purpose: Decodes the driver information block. + * Purpose: Decodes the driver information block. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -472,11 +473,13 @@ H5FD__sb_decode(H5FD_t *file, const char *name, const uint8_t *buf) FUNC_ENTER_STATIC - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); - /* Decode driver information */ + /* Dispatch to driver */ if(file->cls->sb_decode && (file->cls->sb_decode)(file, name, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -484,12 +487,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sb_load + * Function: H5FD_sb_load * - * Purpose: Validate and decode the driver information block. + * Purpose: Validate and decode the driver information block. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -500,7 +502,9 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); /* Check if driver matches driver information saved. Unfortunately, we can't push this * function to each specific driver because we're checking if the driver is correct. @@ -520,37 +524,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_fapl_get + * Function: H5FD_fapl_get + * + * Purpose: Gets the file access property list associated with a file. + * Usually the file will copy what it needs from the original + * file access property list when the file is created. The + * purpose of this function is to create a new file access + * property list based on the settings in the file, which may + * have been modified from the original file access property + * list. * - * Purpose: Gets the file access property list associated with a file. - * Usually the file will copy what it needs from the original - * file access property list when the file is created. The - * purpose of this function is to create a new file access - * property list based on the settings in the file, which may - * have been modified from the original file access property - * list. + * Return: Success: Pointer to a new file access property list + * with all members copied. If the file is + * closed then this property list lives on, and + * vice versa. * - * Return: Success: Pointer to a new file access property list - * with all members copied. If the file is - * closed then this property list lives on, and - * vice versa. + * This can be NULL if the file has no properties. * - * Failure: NULL, including when the file has no - * properties. + * Failure: This function cannot indicate errors. * *------------------------------------------------------------------------- */ void * H5FD_fapl_get(H5FD_t *file) { - void *ret_value=NULL; + void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) + /* Sanity checks */ HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->fapl_get) - ret_value = (file->cls->fapl_get)(file); + ret_value = (file->cls->fapl_get)(file); done: FUNC_LEAVE_NOAPI(ret_value) @@ -558,12 +566,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_fapl_close + * Function: H5FD_fapl_close * - * Purpose: Closes a driver for a dataset transfer property list + * Purpose: Closes a driver for a dataset transfer property list * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -574,7 +581,6 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) FUNC_ENTER_NOAPI(FAIL) - /* Check args */ if(driver_id > 0) { H5FD_class_t *driver; @@ -589,7 +595,7 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") } /* end if */ else - H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */ + driver_info = H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */ } /* end if */ } /* end if */ @@ -599,59 +605,59 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDopen + * Function: H5FDopen * - * Purpose: Opens a file named NAME for the type(s) of access described - * by the bit vector FLAGS according to a file access property - * list FAPL_ID (which may be the constant H5P_DEFAULT). The - * file should expect to handle format addresses in the range [0, - * MAXADDR] (if MAXADDR is the undefined address then the caller - * doesn't care about the address range). + * Purpose: Opens a file named NAME for the type(s) of access described + * by the bit vector FLAGS according to a file access property + * list FAPL_ID (which may be the constant H5P_DEFAULT). The + * file should expect to handle format addresses in the range [0, + * MAXADDR] (if MAXADDR is the undefined address then the caller + * doesn't care about the address range). * - * Possible values for the FLAGS bits are: + * Possible values for the FLAGS bits are: * - * H5F_ACC_RDWR: Open the file for read and write access. If - * this bit is not set then open the file for - * read only access. It is permissible to open a - * file for read and write access when only read - * access is requested by the library (the - * library will never attempt to write to a file - * which it opened with only read access). + * H5F_ACC_RDWR: Open the file for read and write access. If + * this bit is not set then open the file for + * read only access. It is permissible to open a + * file for read and write access when only read + * access is requested by the library (the + * library will never attempt to write to a file + * which it opened with only read access). * - * H5F_ACC_CREATE: Create the file if it doesn't already exist. - * However, see H5F_ACC_EXCL below. + * H5F_ACC_CREATE: Create the file if it doesn't already exist. + * However, see H5F_ACC_EXCL below. * - * H5F_ACC_TRUNC: Truncate the file if it already exists. This - * is equivalent to deleting the file and then - * creating a new empty file. + * H5F_ACC_TRUNC: Truncate the file if it already exists. This + * is equivalent to deleting the file and then + * creating a new empty file. * - * H5F_ACC_EXCL: When used with H5F_ACC_CREATE, if the file - * already exists then the open should fail. - * Note that this is unsupported/broken with - * some file drivers (e.g., sec2 across nfs) and - * will contain a race condition when used to - * perform file locking. + * H5F_ACC_EXCL: When used with H5F_ACC_CREATE, if the file + * already exists then the open should fail. + * Note that this is unsupported/broken with + * some file drivers (e.g., sec2 across nfs) and + * will contain a race condition when used to + * perform file locking. * - * The MAXADDR is the maximum address which will be requested by - * the library during an allocation operation. Usually this is - * the same value as the MAXADDR field of the class structure, - * but it can be smaller if the driver is being used under some - * other driver. + * The MAXADDR is the maximum address which will be requested by + * the library during an allocation operation. Usually this is + * the same value as the MAXADDR field of the class structure, + * but it can be smaller if the driver is being used under some + * other driver. * - * Note that when the driver `open' callback gets control that - * the public part of the file struct (the H5FD_t part) will be - * incomplete and will be filled in after that callback returns. + * Note that when the driver 'open' callback gets control that + * the public part of the file struct (the H5FD_t part) will be + * incomplete and will be filled in after that callback returns. * - * Return: Success: Pointer to a new file driver struct. + * Return: Success: Pointer to a new file driver struct. * - * Failure: NULL + * Failure: NULL * *------------------------------------------------------------------------- */ H5FD_t * H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_t *ret_value=NULL; + H5FD_t *ret_value = NULL; FUNC_ENTER_API(NULL) H5TRACE4("*x", "*sIuia", name, flags, fapl_id, maxaddr); @@ -660,11 +666,12 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if(H5P_DEFAULT == fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; else - if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS)) + if(TRUE != H5P_isa_class(fapl_id,H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL==(ret_value=H5FD_open(name, flags, fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file") + /* Call private function */ + if(NULL == (ret_value = H5FD_open(name, flags, fapl_id, maxaddr))) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file") done: FUNC_LEAVE_API(ret_value) @@ -672,13 +679,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_open + * Function: H5FD_open * - * Purpose: Private version of H5FDopen() + * Purpose: Private version of H5FDopen() * - * Return: Success: Pointer to a new file driver struct + * Return: Success: Pointer to a new file driver struct * - * Failure: NULL + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -695,9 +702,9 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) FUNC_ENTER_NOAPI(NULL) - /* Sanity check */ + /* Sanity checks */ if(0 == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range") /* Get file access property list */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) @@ -709,9 +716,9 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get driver info */ if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list") if(NULL == driver->open) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method") /* Query driver flag */ if(H5FD_driver_query(driver, &driver_flags) < 0) @@ -731,13 +738,12 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if(HADDR_UNDEF == maxaddr) maxaddr = driver->maxaddr; if(NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed") /* Set the file access flags */ file->access_flags = flags; - /* - * Fill in public fields. We must increment the reference count on the + /* Fill in public fields. We must increment the reference count on the * driver ID to prevent it from being freed while this file is open. */ file->driver_id = driver_prop.driver_id; @@ -751,7 +757,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment") /* Retrieve the VFL driver feature flags */ - if(H5FD_query(file, &(file->feature_flags)) < 0) + if(H5FD__query(file, &(file->feature_flags)) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver") /* Increment the global serial number & assign it to this H5FD_t object */ @@ -775,32 +781,35 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDclose + * Function: H5FDclose * - * Purpose: Closes the file by calling the driver `close' callback, which - * should free all driver-private data and free the file struct. - * Note that the public part of the file struct (the H5FD_t part) - * will be all zero during the driver close callback like during - * the `open' callback. + * Purpose: Closes the file by calling the driver 'close' callback, which + * should free all driver-private data and free the file struct. + * Note that the public part of the file struct (the H5FD_t part) + * will be all zero during the driver close callback like during + * the 'open' callback. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FDclose(H5FD_t *file) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "*x", file); - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + /* Call private function */ if(H5FD_close(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") done: FUNC_LEAVE_API(ret_value) @@ -808,12 +817,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_close + * Function: H5FD_close * - * Purpose: Private version of H5FDclose() + * Purpose: Private version of H5FDclose() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -825,16 +833,16 @@ H5FD_close(H5FD_t *file) FUNC_ENTER_NOAPI(FAIL) - /* check args */ - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); /* Prepare to close file by clearing all public fields */ driver = file->cls; if(H5I_dec_ref(file->driver_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") - /* - * Dispatch to the driver for actual close. If the driver fails to + /* Dispatch to the driver for actual close. If the driver fails to * close the file then the file will be in an unusable state. */ HDassert(driver->close); @@ -847,47 +855,48 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDcmp + * Function: H5FDcmp * - * Purpose: Compare the keys of two files using the file driver callback - * if the files belong to the same driver, otherwise sort the - * files by driver class pointer value. + * Purpose: Compare the keys of two files using the file driver callback + * if the files belong to the same driver, otherwise sort the + * files by driver class pointer value. * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: Must never fail. If both file handles are - * invalid then they compare equal. If one file - * handle is invalid then it compares less than - * the other. If both files belong to the same - * driver and the driver doesn't provide a - * comparison callback then the file pointers - * themselves are compared. + * Failure: Must never fail. If both file handles are + * invalid then they compare equal. If one file + * handle is invalid then it compares less than + * the other. If both files belong to the same + * driver and the driver doesn't provide a + * comparison callback then the file pointers + * themselves are compared. * *------------------------------------------------------------------------- */ int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2) { - int ret_value; + int ret_value = -1; - FUNC_ENTER_API(-1) /*return value is arbitrary*/ + FUNC_ENTER_API(-1) /* return value is arbitrary */ H5TRACE2("Is", "*x*x", f1, f2); + /* Call private function */ ret_value = H5FD_cmp(f1, f2); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5FDcmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_cmp + * Function: H5FD_cmp * - * Purpose: Private version of H5FDcmp() + * Purpose: Private version of H5FDcmp() * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: Must never fail. + * Failure: Must never fail. * *------------------------------------------------------------------------- */ @@ -896,7 +905,7 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI(-1) /*return value is arbitrary*/ + FUNC_ENTER_NOAPI(-1) /* return value is arbitrary */ if((!f1 || !f1->cls) && (!f2 || !f2->cls)) HGOTO_DONE(0) @@ -911,43 +920,50 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) /* Files are same driver; no cmp callback */ if(!f1->cls->cmp) { - if(f1f2) + if(f1 > f2) HGOTO_DONE(1) - HGOTO_DONE(0) + HGOTO_DONE(0) } + /* Dispatch to driver */ ret_value = (f1->cls->cmp)(f1, f2); done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FDquery - * - * Purpose: Query a VFL driver for its feature flags. (listed in H5FDpublic.h) + * Function: H5FDquery * - * Return: Success: non-negative + * Purpose: Query a VFL driver for its feature flags. (listed in H5FDpublic.h) * - * Failure: negative + * Return: Success: 0 + * Failure: -1 * *------------------------------------------------------------------------- */ int -H5FDquery(const H5FD_t *f, unsigned long *flags/*out*/) +H5FDquery(const H5FD_t *file, unsigned long *flags/*out*/) { - int ret_value; + int ret_value = 0; - FUNC_ENTER_API(FAIL) - H5TRACE2("Is", "*xx", f, flags); + FUNC_ENTER_API((-1)) + H5TRACE2("Is", "*xx", file, flags); - HDassert(f); - HDassert(flags); + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file class pointer cannot be NULL") + if(!flags) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "flags parameter cannot be NULL") - ret_value = H5FD_query(f, flags); + /* Call private function */ + if(H5FD__query(file, flags) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "unable to query feature flags") done: FUNC_LEAVE_API(ret_value) @@ -955,69 +971,72 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_query - * - * Purpose: Private version of H5FDquery() + * Function: H5FD_query * - * Return: Success: non-negative + * Purpose: Private version of H5FDquery() * - * Failure: negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int -H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/) +static herr_t +H5FD__query(const H5FD_t *file, unsigned long *flags/*out*/) { - int ret_value = 0; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC - HDassert(f); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); HDassert(flags); - /* Check for query driver and call it */ - if(f->cls->query) - ret_value = (f->cls->query)(f, flags); + /* Dispatch to driver (if available) */ + if(file->cls->query) { + if((file->cls->query)(file, flags) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to query feature flags") + } else *flags=0; +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_query() */ /*------------------------------------------------------------------------- - * Function: H5FDalloc + * Function: H5FDalloc * - * Purpose: Allocates SIZE bytes of memory from the FILE. The memory will - * be used according to the allocation class TYPE. First we try - * to satisfy the request from one of the free lists, according - * to the free list map provided by the driver. The free list - * array has one entry for each request type and the value of - * that array element can be one of four possibilities: + * Purpose: Allocates SIZE bytes of memory from the FILE. The memory will + * be used according to the allocation class TYPE. First we try + * to satisfy the request from one of the free lists, according + * to the free list map provided by the driver. The free list + * array has one entry for each request type and the value of + * that array element can be one of four possibilities: * - * It can be the constant H5FD_MEM_DEFAULT (or zero) which - * indicates that the identity mapping is used. In other - * words, the request type maps to its own free list. + * It can be the constant H5FD_MEM_DEFAULT (or zero) which + * indicates that the identity mapping is used. In other + * words, the request type maps to its own free list. * - * It can be the request type itself, which has the same - * effect as the H5FD_MEM_DEFAULT value above. + * It can be the request type itself, which has the same + * effect as the H5FD_MEM_DEFAULT value above. * - * It can be the ID for another request type, which - * indicates that the free list for the specified type - * should be used instead. + * It can be the ID for another request type, which + * indicates that the free list for the specified type + * should be used instead. * - * It can be the constant H5FD_MEM_NOLIST which means that - * no free list should be used for this type of request. + * It can be the constant H5FD_MEM_NOLIST which means that + * no free list should be used for this type of request. * - * If the request cannot be satisfied from a free list then - * either the driver's `alloc' callback is invoked (if one was - * supplied) or the end-of-address marker is extended. The - * `alloc' callback is always called with the same arguments as - * the H5FDalloc(). + * If the request cannot be satisfied from a free list then + * either the driver's 'alloc' callback is invoked (if one was + * supplied) or the end-of-address marker is extended. The + * 'alloc' callback is always called with the same arguments as + * the H5FDalloc(). * - * Return: Success: The format address of the new file memory. + * Return: Success: The format address of the new file memory. * - * Failure: The undefined address HADDR_UNDEF + * Failure: The undefined address HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1029,13 +1048,15 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) FUNC_ENTER_API(HADDR_UNDEF) H5TRACE4("a", "*xMtih", file, type, dxpl_id, size); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type") if(size == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request") if(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else @@ -1045,9 +1066,9 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ if(HADDR_UNDEF == (ret_value = H5FD__alloc_real(file, type, size, NULL, NULL))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory") /* (Note compensating for base address subtraction in internal routine) */ ret_value += file->base_addr; @@ -1058,32 +1079,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDfree + * Function: H5FDfree * - * Purpose: Frees format addresses starting with ADDR and continuing for - * SIZE bytes in the file FILE. The type of space being freed is - * specified by TYPE, which is mapped to a free list as - * described for the H5FDalloc() function above. If the request - * doesn't map to a free list then either the application `free' - * callback is invoked (if defined) or the memory is leaked. - * - * Return: Success: Non-negative + * Purpose: Frees format addresses starting with ADDR and continuing for + * SIZE bytes in the file FILE. The type of space being freed is + * specified by TYPE, which is mapped to a free list as + * described for the H5FDalloc() function above. If the request + * doesn't map to a free list then either the application 'free' + * callback is invoked (if defined) or the memory is leaked. * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*xMtiah", file, type, dxpl_id, addr, size); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type") if(H5P_DEFAULT == dxpl_id) @@ -1095,9 +1116,9 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ - if(H5FD_free_real(file, type, addr - file->base_addr, size) < 0) + if(H5FD__free_real(file, type, addr - file->base_addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed") done: @@ -1124,13 +1145,15 @@ H5FDget_eoa(H5FD_t *file, H5FD_mem_t type) FUNC_ENTER_API(HADDR_UNDEF) H5TRACE2("a", "*xMt", file, type); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type") - /* The real work */ + /* Call private function */ if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed") @@ -1171,15 +1194,17 @@ H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xMta", file, type, addr); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file type") if(!H5F_addr_defined(addr) || addr > file->maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value") - /* The real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if(H5FD_set_eoa(file, type, addr - file->base_addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed") @@ -1190,23 +1215,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDget_eof + * Function: H5FDget_eof * - * Purpose: Returns the end-of-file address, which is the greater of the - * end-of-format address and the actual EOF marker. This - * function is called after an existing file is opened in order - * for the library to learn the true size of the underlying file - * and to determine whether the hdf5 data has been truncated. + * Purpose: Returns the end-of-file address, which is the greater of the + * end-of-format address and the actual EOF marker. This + * function is called after an existing file is opened in order + * for the library to learn the true size of the underlying file + * and to determine whether the hdf5 data has been truncated. * - * It is also used when a file is first opened to learn whether - * the file is empty or not. + * It is also used when a file is first opened to learn whether + * the file is empty or not. * - * It is permissible for the driver to return the maximum address - * for the file size if the file is not empty. + * It is permissible for the driver to return the maximum address + * for the file size if the file is not empty. * - * Return: Success: The EOF address. + * Return: Success: The EOF address. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1219,10 +1244,12 @@ H5FDget_eof(H5FD_t *file, H5FD_mem_t type) H5TRACE2("a", "*xMt", file, type); /* Check arguments */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") - /* The real work */ + /* Call private function */ if(HADDR_UNDEF == (ret_value = H5FD_get_eof(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed") @@ -1235,12 +1262,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_maxaddr + * Function: H5FD_get_maxaddr * - * Purpose: Private version of H5FDget_eof() + * Purpose: Private version of H5FDget_eof() * - * Return: Success: The maximum address allowed in the file. - * Failure: HADDR_UNDEF + * Return: Success: The maximum address allowed in the file. + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -1251,6 +1278,7 @@ H5FD_get_maxaddr(const H5FD_t *file) FUNC_ENTER_NOAPI(HADDR_UNDEF) + /* Sanity checks */ HDassert(file); /* Set return value */ @@ -1262,12 +1290,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_feature_flags + * Function: H5FD_get_feature_flags * - * Purpose: Retrieve the feature flags for the VFD + * Purpose: Retrieve the feature flags for the VFD * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1276,6 +1303,7 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(feature_flags); @@ -1287,12 +1315,11 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags) /*------------------------------------------------------------------------- - * Function: H5FD_set_feature_flags + * Function: H5FD_set_feature_flags * - * Purpose: Set the feature flags for the VFD + * Purpose: Set the feature flags for the VFD * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1301,6 +1328,7 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); /* Set the file's feature flags */ @@ -1311,12 +1339,11 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags) /*------------------------------------------------------------------------- - * Function: H5FD_get_fs_type_map + * Function: H5FD_get_fs_type_map * - * Purpose: Retrieve the free space type mapping for the VFD + * Purpose: Retrieve the free space type mapping for the VFD * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1327,8 +1354,9 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map) FUNC_ENTER_NOAPI(FAIL) - /* Sanity check */ - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); HDassert(type_map); /* Check for VFD class providing a type map retrieval rouine */ @@ -1347,18 +1375,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDread + * Function: H5FDread * - * Purpose: Reads SIZE bytes from FILE beginning at address ADDR - * according to the data transfer property list DXPL_ID (which may - * be the constant H5P_DEFAULT). The result is written into the - * buffer BUF. + * Purpose: Reads SIZE bytes from FILE beginning at address ADDR + * according to the data transfer property list DXPL_ID (which may + * be the constant H5P_DEFAULT). The result is written into the + * buffer BUF. * - * Return: Success: Non-negative. The read result is written into - * the BUF buffer which should be allocated by - * the caller. + * Return: Success: SUCCEED + * The read result is written into the BUF buffer + * which should be allocated by the caller. * - * Failure: Negative. The contents of BUF is undefined. + * Failure: FAIL + * The contents of BUF are undefined. * *------------------------------------------------------------------------- */ @@ -1366,14 +1395,18 @@ herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "*xMtiazx", file, type, dxpl_id, addr, size, buf); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + if(!buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL") /* Get the default dataset transfer property list if the user didn't provide one */ if(H5P_DEFAULT == dxpl_id) @@ -1381,16 +1414,14 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") - if(!buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if(H5FD_read(file, type, addr - file->base_addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed") done: FUNC_LEAVE_API(ret_value) @@ -1398,16 +1429,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDwrite + * Function: H5FDwrite * - * Purpose: Writes SIZE bytes to FILE beginning at address ADDR according - * to the data transfer property list DXPL_ID (which may be the - * constant H5P_DEFAULT). The bytes to be written come from the - * buffer BUF. - * - * Return: Success: Non-negative + * Purpose: Writes SIZE bytes to FILE beginning at address ADDR according + * to the data transfer property list DXPL_ID (which may be the + * constant H5P_DEFAULT). The bytes to be written come from the + * buffer BUF. * - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1415,30 +1444,33 @@ herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "*xMtiaz*x", file, type, dxpl_id, addr, size, buf); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + if(!buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL") + /* Get the default dataset transfer property list if the user didn't provide one */ if(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") - if(!buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* The real work */ + /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if(H5FD_write(file, type, addr - file->base_addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed") done: FUNC_LEAVE_API(ret_value) @@ -1446,17 +1478,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDflush - * - * Purpose: Notify driver to flush all cached data. If the driver has no - * flush method then nothing happens. - * - * Return: Success: Non-negative + * Function: H5FDflush * - * Failure: Negative + * Purpose: Notify driver to flush all cached data. If the driver has no + * flush method then nothing happens. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1468,9 +1495,12 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xib", file, dxpl_id, closing); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + if(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else @@ -1480,9 +1510,9 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ if(H5FD_flush(file, closing) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "file flush request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "file flush request failed") done: FUNC_LEAVE_API(ret_value) @@ -1490,12 +1520,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_flush + * Function: H5FD_flush * - * Purpose: Private version of H5FDflush() + * Purpose: Private version of H5FDflush() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1507,8 +1536,10 @@ H5FD_flush(H5FD_t *file, hbool_t closing) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->flush && (file->cls->flush)(file, H5CX_get_dxpl(), closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed") @@ -1518,12 +1549,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDtruncate + * Function: H5FDtruncate * - * Purpose: Notify driver to truncate the file back to the allocated size. + * Purpose: Notify driver to truncate the file back to the allocated size. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1535,9 +1565,11 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) FUNC_ENTER_API(FAIL) H5TRACE3("e", "*xib", file, dxpl_id, closing); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") if(H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else @@ -1547,9 +1579,9 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Do the real work */ + /* Call private function */ if(H5FD_truncate(file, closing) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed") done: FUNC_LEAVE_API(ret_value) @@ -1559,22 +1591,22 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_truncate * - * Purpose: Private version of H5FDtruncate() + * Purpose: Private version of H5FDtruncate() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FD_truncate(H5FD_t *file, hbool_t closing) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(file->cls); /* Dispatch to driver */ if(file->cls->truncate && (file->cls->truncate)(file, H5CX_get_dxpl(), closing) < 0) @@ -1586,12 +1618,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDlock + * Function: H5FDlock * - * Purpose: Set a file lock + * Purpose: Set a file lock * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1603,13 +1634,15 @@ H5FDlock(H5FD_t *file, hbool_t rw) FUNC_ENTER_API(FAIL) H5TRACE2("e", "*xb", file, rw); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") - /* The real work */ + /* Call private function */ if(H5FD_lock(file, rw) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file lock request failed") done: FUNC_LEAVE_API(ret_value) @@ -1618,12 +1651,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_lock + * Function: H5FD_lock * - * Purpose: Private version of H5FDlock() + * Purpose: Private version of H5FDlock() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1634,8 +1666,11 @@ H5FD_lock(H5FD_t *file, hbool_t rw) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->lock && (file->cls->lock)(file, rw) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver lock request failed") @@ -1645,12 +1680,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FDunlock + * Function: H5FDunlock * - * Purpose: Remove a file lock + * Purpose: Remove a file lock * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1662,13 +1696,15 @@ H5FDunlock(H5FD_t *file) FUNC_ENTER_API(FAIL) H5TRACE1("e", "*x", file); - /* Check args */ - if(!file || !file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + /* Check arguments */ + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") - /* The real work */ + /* Call private function */ if(H5FD_unlock(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file unlock request failed") done: FUNC_LEAVE_API(ret_value) @@ -1676,12 +1712,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_unlock + * Function: H5FD_unlock * - * Purpose: Private version of H5FDunlock() + * Purpose: Private version of H5FDunlock() * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1692,8 +1727,11 @@ H5FD_unlock(H5FD_t *file) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); + /* Sanity checks */ + HDassert(file); + HDassert(file->cls); + /* Dispatch to driver */ if(file->cls->unlock && (file->cls->unlock)(file) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver unlock request failed") @@ -1703,13 +1741,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_fileno + * Function: H5FD_get_fileno * - * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value - * (Mainly added to stop non-file routines from poking about in the - * H5FD_t data structure) + * Purpose: Quick and dirty routine to retrieve the file's 'fileno' value + * (Mainly added to stop non-file routines from poking about in the + * H5FD_t data structure) * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1718,6 +1756,7 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(filenum); @@ -1734,28 +1773,36 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum) * Purpose: Returns a pointer to the file handle of low-level virtual * file driver. * - * Return: Non-negative if succeed; negative otherwise. - * - * Programmer: Raymond Lu - * Sep. 16, 2002 + * Return: SUCCEED/FAIL * *-------------------------------------------------------------------------- */ herr_t -H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle) +H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle) { - herr_t ret_value; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*xi**x", file, fapl, file_handle); + H5TRACE3("e", "*xi**x", file, fapl_id, file_handle); /* Check arguments */ - HDassert(file); - HDassert(file_handle); - - ret_value = H5FD_get_vfd_handle(file, fapl, file_handle); + if(!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + if(!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + if(FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fapl_id parameter is not a file access property list") + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle parameter cannot be NULL") + + /* Call private function */ + if(H5FD_get_vfd_handle(file, fapl_id, file_handle) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") done: + if(FAIL == ret_value) + *file_handle = NULL; + FUNC_LEAVE_API(ret_value) } /* end H5FDget_vfd_handle() */ @@ -1763,29 +1810,28 @@ done: /*-------------------------------------------------------------------------- * Function: H5FD_get_vfd_handle * - * Purpose: Retrieve the file handle for file driver. + * Purpose: Private version of H5FDget_vfd_handle() * - * Return: Non-negative if succeed; negative if fails. - * - * Programmer: Raymond Lu - * Sep. 16, 2002 + * Return: SUCCEED/FAIL * *-------------------------------------------------------------------------- */ herr_t -H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void **file_handle) +H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - /* Sanity check */ + /* Sanity checks */ HDassert(file); + HDassert(file->cls); HDassert(file_handle); + /* Dispatch to driver */ if(NULL == file->cls->get_handle) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `get_vfd_handle' method") - if((file->cls->get_handle)(file, fapl, file_handle) < 0) + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `get_vfd_handle' method") + if((file->cls->get_handle)(file, fapl_id, file_handle) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") done: @@ -1798,7 +1844,7 @@ done: * * Purpose: Set the base address for the file * - * Return: Non-negative if succeed; negative if fails. + * Return: SUCCEED (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1807,6 +1853,7 @@ H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); HDassert(H5F_addr_defined(base_addr)); @@ -1822,8 +1869,8 @@ H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr) * * Purpose: Get the base address for the file * - * Return: Success: The absolute base address of the file - * Failure: The undefined address (HADDR_UNDEF) + * Return: Success: The absolute base address of the file + * (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1832,6 +1879,7 @@ H5FD_get_base_addr(const H5FD_t *file) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); /* Return the file's base address */ @@ -1844,7 +1892,7 @@ H5FD_get_base_addr(const H5FD_t *file) * * Purpose: Set "paged_aggr" for the file. * - * Return: Non-negative if succeed; negative if fails. + * Return: SUCCEED (Can't fail) * *-------------------------------------------------------------------------- */ @@ -1853,6 +1901,7 @@ H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged) { FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Sanity checks */ HDassert(file); /* Indicate whether paged aggregation for handling file space is enabled or not */ @@ -1883,6 +1932,7 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", driver_id, flags); + /* Check arguments */ if(NULL == flags) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flags parameter cannot be NULL") diff --git a/src/H5FDint.c b/src/H5FDint.c index 023ff57..ea8c4d8 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FDint.c - * Jan 17 2008 - * Quincey Koziol + * Created: H5FDint.c * - * Purpose: Internal routine for VFD operations + * Purpose: Internal routine for VFD operations * *------------------------------------------------------------------------- */ @@ -32,12 +30,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDpkg.h" /* File Drivers */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDpkg.h" /* File Drivers */ +#include "H5Iprivate.h" /* IDs */ /****************/ @@ -83,26 +81,26 @@ * signature can appear at address 0, or any power of two * beginning with 512. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) { - haddr_t addr, eoa, eof; + haddr_t addr = HADDR_UNDEF; + haddr_t eoa = HADDR_UNDEF; + haddr_t eof = HADDR_UNDEF; uint8_t buf[H5F_SIGNATURE_LEN]; - unsigned n, maxpow; + unsigned n; + unsigned maxpow; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Sanity checks */ HDassert(file); + HDassert(sig_addr); /* Find the least N such that 2^N is larger than the file size */ eof = H5FD_get_eof(file, H5FD_MEM_SUPER); @@ -114,8 +112,7 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) addr >>= 1; maxpow = MAX(maxpow, 9); - /* - * Search for the file signature at format address zero followed by + /* Search for the file signature at format address zero followed by * powers of two larger than 9. */ for(n = 8; n < maxpow; n++) { @@ -126,17 +123,16 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature") if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) break; - } /* end for */ + } - /* - * If the signature was not found then reset the EOA value and return + /* If the signature was not found then reset the EOA value and return * HADDR_UNDEF. */ if(n >= maxpow) { if(H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value") *sig_addr = HADDR_UNDEF; - } /* end if */ + } else /* Set return value */ *sig_addr = addr; @@ -147,44 +143,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_read - * - * Purpose: Private version of H5FDread() + * Function: H5FD_read * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Private version of H5FDread() * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, - void *buf/*out*/) +H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { - hid_t dxpl_id; /* DXPL for operation */ - herr_t ret_value = SUCCEED; /* Return value */ + hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(file->cls); HDassert(buf); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); #ifndef H5_HAVE_PARALLEL - /* Do not return early for Parallel mode since the I/O could be a */ - /* collective transfer. */ - /* The no-op case */ + /* The no-op case + * + * Do not return early for Parallel mode since the I/O could be a + * collective transfer. + */ if(0 == size) HGOTO_DONE(SUCCEED) #endif /* H5_HAVE_PARALLEL */ - /* - * If the file is open for SWMR read access, allow access to data past + /* If the file is open for SWMR read access, allow access to data past * the end of the allocated space (the 'eoa'). This is done because the * eoa stored in the file's superblock might be out of sync with the * objects being written within the file by the application performing @@ -198,7 +191,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, if((addr + file->base_addr + size) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu", (unsigned long long)(addr + file->base_addr), (unsigned long long)size, (unsigned long long)eoa) - } /* end if */ + } /* Dispatch to driver */ if((file->cls->read)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0) @@ -210,45 +203,43 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_write - * - * Purpose: Private version of H5FDwrite() + * Function: H5FD_write * - * Return: Success: Non-negative - * Failure: Negative + * Purpose: Private version of H5FDwrite() * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, - const void *buf) +H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { - hid_t dxpl_id; /* DXPL for operation */ - haddr_t eoa = HADDR_UNDEF; /* EOA for file */ - herr_t ret_value = SUCCEED; /* Return value */ + hid_t dxpl_id; /* DXPL for operation */ + haddr_t eoa = HADDR_UNDEF; /* EOA for file */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file && file->cls); + HDassert(file); + HDassert(file->cls); HDassert(buf); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); #ifndef H5_HAVE_PARALLEL - /* Do not return early for Parallel mode since the I/O could be a */ - /* collective transfer. */ - /* The no-op case */ + /* The no-op case + * + * Do not return early for Parallel mode since the I/O could be a + * collective transfer. + */ if(0 == size) HGOTO_DONE(SUCCEED) #endif /* H5_HAVE_PARALLEL */ if(HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") if((addr + file->base_addr + size) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size=%llu, eoa=%llu", (unsigned long long)(addr+ file->base_addr), (unsigned long long)size, (unsigned long long)eoa) @@ -263,20 +254,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_set_eoa + * Function: H5FD_set_eoa * - * Purpose: Private version of H5FDset_eoa() + * Purpose: Private version of H5FDset_eoa() * * This function expects the EOA is a RELATIVE address, i.e. * relative to the base address. This is NOT the same as the * EOA stored in the superblock, which is an absolute * address. Object addresses are relative. * - * Return: Success: Non-negative - * Failure: Negative, no side effect - * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -292,7 +279,7 @@ H5FD_set_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) /* Dispatch to driver, convert to absolute address */ if((file->cls->set_eoa)(file, type, addr + file->base_addr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -300,20 +287,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_eoa + * Function: H5FD_get_eoa * - * Purpose: Private version of H5FDget_eoa() + * Purpose: Private version of H5FDget_eoa() * * This function returns the EOA as a RELATIVE address, i.e. * relative to the base address. This is NOT the same as the * EOA stored in the superblock, which is an absolute * address. Object addresses are relative. * - * Return: Success: First byte after allocated memory. - * Failure: HADDR_UNDEF + * Return: Success: First byte after allocated memory * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -328,7 +313,7 @@ H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type) /* Dispatch to driver */ if(HADDR_UNDEF == (ret_value = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") /* Adjust for base address in file (convert to relative address) */ ret_value -= file->base_addr; @@ -339,23 +324,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_eof + * Function: H5FD_get_eof * - * Purpose: Private version of H5FDget_eof() + * Purpose: Private version of H5FDget_eof() * * This function returns the EOF as a RELATIVE address, i.e. * relative to the base address. This will be different * from the end of the physical file if there is a user * block. * - * Return: Success: The EOF address. + * Return: Success: The EOF address. * - * Failure: HADDR_UNDEF - * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * - * Modifications: + * Failure: HADDR_UNDEF * *------------------------------------------------------------------------- */ @@ -370,11 +350,11 @@ H5FD_get_eof(const H5FD_t *file, H5FD_mem_t type) /* Dispatch to driver */ if(file->cls->get_eof) { - if(HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed") - } /* end if */ + if(HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file, type))) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed") + } else - ret_value = file->maxaddr; + ret_value = file->maxaddr; /* Adjust for base address in file (convert to relative address) */ ret_value -= file->base_addr; @@ -385,17 +365,14 @@ done: /*------------------------------------------------------------------------- -* Function: H5FD_driver_query -* -* Purpose: Similar to H5FD_query(), but intended for cases when we don't -* have a file available (e.g. before one is opened). Since we -* can't use the file to get the driver, the driver is passed in -* as a parameter. +* Function: H5FD_driver_query * -* Return: SUCCEED/FAIL +* Purpose: Similar to H5FD_query(), but intended for cases when we don't +* have a file available (e.g. before one is opened). Since we +* can't use the file to get the driver, the driver is passed in +* as a parameter. * -* Programmer: Jacob Gruber -* Wednesday, August 17, 2011 +* Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 4b42a73..7d58b7a 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -153,7 +153,7 @@ done: * * Return: Success: SUCCEED * - * Failure: Negative + * Failure: FAIL * * Programmer: John Mainzer * 4/4/17 diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h index e51050e..22b5d17 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -30,7 +30,6 @@ #include "H5FDprivate.h" /* File drivers */ /* Other private headers needed by this file */ -#include "H5FLprivate.h" /* Free lists */ /**************************/ /* Package Private Macros */ @@ -50,10 +49,8 @@ /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL haddr_t H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, - haddr_t *align_addr, hsize_t *align_size); -H5_DLL herr_t H5FD_free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, - hsize_t size); +H5_DLL haddr_t H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *align_addr, hsize_t *align_size); +H5_DLL herr_t H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size); /* Testing functions */ #ifdef H5FD_TESTING diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 0430064..c79d676 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -130,7 +130,7 @@ H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, H5_DLL herr_t H5FD_close(H5FD_t *file); H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2); H5_DLL herr_t H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/); -H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, +H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size); H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f, haddr_t addr, hsize_t size); @@ -143,10 +143,8 @@ H5_DLL haddr_t H5FD_get_maxaddr(const H5FD_t *file); H5_DLL herr_t H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags); H5_DLL herr_t H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags); H5_DLL herr_t H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map); -H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, - size_t size, void *buf/*out*/); -H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, - size_t size, const void *buf); +H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5FD_flush(H5FD_t *file, hbool_t closing); H5_DLL herr_t H5FD_truncate(H5FD_t *file, hbool_t closing); H5_DLL herr_t H5FD_lock(H5FD_t *file, hbool_t rw); diff --git a/src/H5FDspace.c b/src/H5FDspace.c index 69fcb96..e1f0cb2 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -274,7 +274,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_free_real + * Function: H5FD__free_real * * Purpose: Release space back to the VFD * @@ -287,11 +287,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) +H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check args */ HDassert(file); @@ -349,13 +349,13 @@ HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", FUN done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_free_real() */ +} /* end H5FD__free_real() */ /*------------------------------------------------------------------------- * Function: H5FD_free * - * Purpose: Wrapper for H5FD_free_real, to make certain EOA changes are + * Purpose: Wrapper for H5FD__free_real, to make certain EOA changes are * reflected in superblock. * * Note: When the metadata cache routines are updated to allow @@ -384,7 +384,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t addr, hsize_t size) HDassert(size > 0); /* Call the real 'free' routine */ - if(H5FD_free_real(file, type, addr, size) < 0) + if(H5FD__free_real(file, type, addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "real 'free' request failed") /* Mark EOA info dirty in cache, so change will get encoded */ @@ -415,8 +415,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end, - hsize_t extra_requested) +H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end, hsize_t extra_requested) { haddr_t eoa; /* End of allocated space in file */ htri_t ret_value = FALSE; /* Return value */ diff --git a/src/H5FS.c b/src/H5FS.c index 113c8ae..8fee634 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -58,8 +58,8 @@ /********************/ /* Section info routines */ -static herr_t H5FS_sinfo_free_sect_cb(void *item, void *key, void *op_data); -static herr_t H5FS_sinfo_free_node_cb(void *item, void *key, void *op_data); +static herr_t H5FS__sinfo_free_sect_cb(void *item, void *key, void *op_data); +static herr_t H5FS__sinfo_free_node_cb(void *item, void *key, void *op_data); /*********************/ @@ -221,7 +221,7 @@ HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc); /* Increment the reference count on the free space manager header */ HDassert(fspace->rc <= 1); - if(H5FS_incr(fspace) < 0) + if(H5FS__incr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header") fspace->alignment = alignment; @@ -545,7 +545,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); } /* end if */ /* Destroy section info */ - if(H5FS_sinfo_dest(fspace->sinfo) < 0) + if(H5FS__sinfo_dest(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "unable to destroy free space section info") } /* end else */ @@ -560,7 +560,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); } /* end else */ /* Decrement the reference count on the free space manager header */ - if(H5FS_decr(fspace) < 0) + if(H5FS__decr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header") done: @@ -683,7 +683,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) /*------------------------------------------------------------------------- - * Function: H5FS_incr + * Function: H5FS__incr * * Purpose: Increment reference count on free space header * @@ -695,11 +695,11 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) *------------------------------------------------------------------------- */ herr_t -H5FS_incr(H5FS_t *fspace) +H5FS__incr(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); #endif /* H5FS_DEBUG */ @@ -719,11 +719,11 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_incr() */ +} /* end H5FS__incr() */ /*------------------------------------------------------------------------- - * Function: H5FS_decr + * Function: H5FS__decr * * Purpose: Decrement reference count on free space header * @@ -735,11 +735,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_decr(H5FS_t *fspace) +H5FS__decr(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); #endif /* H5FS_DEBUG */ @@ -766,11 +766,11 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_decr() */ +} /* end H5FS__decr() */ /*------------------------------------------------------------------------- - * Function: H5FS_dirty + * Function: H5FS__dirty * * Purpose: Mark free space header as dirty * @@ -782,11 +782,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_dirty(H5FS_t *fspace) +H5FS__dirty(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE #ifdef QAK HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); #endif /* QAK */ @@ -802,7 +802,7 @@ HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_dirty() */ +} /* end H5FS__dirty() */ /*------------------------------------------------------------------------- @@ -875,7 +875,7 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace) fspace->alloc_sect_size = fspace->sect_size; /* Mark free-space header as dirty */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") /* Cache the free-space section info */ @@ -959,7 +959,7 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space) } /* end if */ /* Mark free-space manager header as dirty */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ @@ -1052,7 +1052,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_sect_cb + * Function: H5FS__sinfo_free_sect_cb * * Purpose: Free a size-tracking node for a bin * @@ -1064,12 +1064,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) +H5FS__sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) { H5FS_section_info_t *sect = (H5FS_section_info_t *)_sect; /* Section to free */ const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)op_data; /* Free space manager for section */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(sect); HDassert(sinfo); @@ -1078,11 +1078,11 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) (*sinfo->fspace->sect_cls[sect->type].free)(sect); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sinfo_free_sect_cb() */ +} /* H5FS__sinfo_free_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_node_cb + * Function: H5FS__sinfo_free_node_cb * * Purpose: Free a size-tracking node for a bin * @@ -1094,27 +1094,27 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) +H5FS__sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) { H5FS_node_t *fspace_node = (H5FS_node_t *)item; /* Temporary pointer to free space list node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(fspace_node); HDassert(op_data); /* Release the skip list for sections of this size */ - H5SL_destroy(fspace_node->sect_list, H5FS_sinfo_free_sect_cb, op_data); + H5SL_destroy(fspace_node->sect_list, H5FS__sinfo_free_sect_cb, op_data); /* Release free space list node */ fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sinfo_free_node_cb() */ +} /* H5FS__sinfo_free_node_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_dest + * Function: H5FS__sinfo_dest * * Purpose: Destroys a free space section info in memory. * @@ -1126,12 +1126,12 @@ H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) *------------------------------------------------------------------------- */ herr_t -H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) +H5FS__sinfo_dest(H5FS_sinfo_t *sinfo) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1143,7 +1143,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) /* Clear out lists of nodes */ for(u = 0; u < sinfo->nbins; u++) if(sinfo->bins[u].bin_list) { - H5SL_destroy(sinfo->bins[u].bin_list, H5FS_sinfo_free_node_cb, sinfo); + H5SL_destroy(sinfo->bins[u].bin_list, H5FS__sinfo_free_node_cb, sinfo); sinfo->bins[u].bin_list = NULL; } /* end if */ @@ -1160,7 +1160,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) * disappearing immediately) */ sinfo->fspace->sinfo = NULL; - if(H5FS_decr(sinfo->fspace) < 0) + if(H5FS__decr(sinfo->fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header") sinfo->fspace = NULL; @@ -1169,7 +1169,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_sinfo_dest() */ +} /* end H5FS__sinfo_dest() */ herr_t H5FS_get_sect_count(const H5FS_t *frsp, hsize_t *tot_sect_count) diff --git a/src/H5FScache.c b/src/H5FScache.c index fa04ba1..ac0874e 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -926,7 +926,7 @@ H5FS__cache_sinfo_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU uint32_t computed_chksum; /* Computed metadata checksum value */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(image); @@ -981,7 +981,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, HDassert(dirty); /* Allocate a new free space section info */ - if(NULL == (sinfo = H5FS_sinfo_new(udata->f, fspace))) + if(NULL == (sinfo = H5FS__sinfo_new(udata->f, fspace))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* initialize old_sect_size */ @@ -1087,7 +1087,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, done: if(!ret_value && sinfo) - if(H5FS_sinfo_dest(sinfo) < 0) + if(H5FS__sinfo_dest(sinfo) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space info") FUNC_LEAVE_NOAPI(ret_value) @@ -1321,7 +1321,7 @@ H5FS__cache_sinfo_notify(H5AC_notify_action_t action, void *_thing) H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(sinfo); @@ -1404,7 +1404,7 @@ H5FS__cache_sinfo_free_icr(void *_thing) HDassert(fspace->cache_info.is_pinned); /* Destroy free space info */ - if(H5FS_sinfo_dest(sinfo) < 0) + if(H5FS__sinfo_dest(sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space info") done: @@ -1512,3 +1512,4 @@ H5FS__sinfo_serialize_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sinfo_serialize_node_cb() */ + diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index f160055..2c56ab6 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -215,24 +215,22 @@ H5FL_EXTERN(H5FS_t); /******************************/ /* Generic routines */ -H5_DLL herr_t H5FS__create_flush_depend(H5AC_info_t *parent_entry, - H5AC_info_t *child_entry); -H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, - H5AC_info_t *child_entry); +H5_DLL herr_t H5FS__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); +H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry); /* Free space manager header routines */ H5_DLL H5FS_t *H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata); -H5_DLL herr_t H5FS_incr(H5FS_t *fspace); -H5_DLL herr_t H5FS_decr(H5FS_t *fspace); -H5_DLL herr_t H5FS_dirty(H5FS_t *fspace); +H5_DLL herr_t H5FS__incr(H5FS_t *fspace); +H5_DLL herr_t H5FS__decr(H5FS_t *fspace); +H5_DLL herr_t H5FS__dirty(H5FS_t *fspace); /* Free space section routines */ -H5_DLL H5FS_sinfo_t *H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace); +H5_DLL H5FS_sinfo_t *H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace); /* Routines for destroying structures */ H5_DLL herr_t H5FS__hdr_dest(H5FS_t *hdr); -H5_DLL herr_t H5FS_sinfo_dest(H5FS_sinfo_t *sinfo); +H5_DLL herr_t H5FS__sinfo_dest(H5FS_sinfo_t *sinfo); /* Sanity check routines */ #ifdef H5FS_DEBUG_ASSERT diff --git a/src/H5FSsection.c b/src/H5FSsection.c index a58347f..27486f1 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -64,26 +64,26 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ -static herr_t H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned flags); -static herr_t H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls); -static herr_t H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, +static herr_t H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls); +static herr_t H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, const H5FS_section_class_t *cls); -static herr_t H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_unlink_rest(H5FS_t *fspace, +static herr_t H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect); -static herr_t H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect); +static herr_t H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect, unsigned flags); -static herr_t H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, +static herr_t H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags); -static herr_t H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, +static herr_t H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data); -static htri_t H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node); -static herr_t H5FS_sect_serialize_size(H5FS_t *fspace); +static htri_t H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node); +static herr_t H5FS__sect_serialize_size(H5FS_t *fspace); /*********************/ @@ -112,7 +112,7 @@ H5FL_DEFINE(H5FS_sinfo_t); /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_new + * Function: H5FS__sinfo_new * * Purpose: Create new section info structure * @@ -125,12 +125,12 @@ H5FL_DEFINE(H5FS_sinfo_t); *------------------------------------------------------------------------- */ H5FS_sinfo_t * -H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace) +H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) { H5FS_sinfo_t *sinfo = NULL; /* Section information struct created */ H5FS_sinfo_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(f); @@ -160,7 +160,7 @@ HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space section bin array") /* Increment the reference count on the free space manager header */ - if(H5FS_incr(fspace) < 0) + if(H5FS__incr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header") sinfo->fspace = fspace; @@ -183,11 +183,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_new() */ +} /* H5FS__sinfo_new() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_lock + * Function: H5FS__sinfo_lock * * Purpose: Make certain the section info for the free space manager is * in memory. @@ -204,12 +204,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) +H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) { H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, fspace->addr, fspace->sinfo, fspace->sect_addr); @@ -280,7 +280,7 @@ HDfprintf(stderr, "%s: Creating new section info\n", FUNC); HDassert(fspace->ghost_sect_count == 0); /* Allocate and initialize free space section info */ - if(NULL == (fspace->sinfo = H5FS_sinfo_new(f, fspace))) + if(NULL == (fspace->sinfo = H5FS__sinfo_new(f, fspace))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create section info") /* Set initial size of section info to 0 */ @@ -298,11 +298,11 @@ HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->s HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_lock() */ +} /* H5FS__sinfo_lock() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_unlock + * Function: H5FS__sinfo_unlock * * Purpose: Release the section info, either giving ownership back to * the cache or letting the free space header keep it. @@ -315,11 +315,11 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) +H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", FUNC, modified, fspace->addr, fspace->sect_addr); HDfprintf(stderr, "%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %t, fspace->sinfo_protected = %t\n", FUNC, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected); @@ -347,7 +347,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /* Assume that the modification will affect the statistics in the header * and mark that dirty also */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ @@ -442,7 +442,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC); /* If we haven't already marked the header dirty, do so now */ if(!modified) - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") #ifdef H5FS_SINFO_DEBUG @@ -460,11 +460,11 @@ done: HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_unlock() */ +} /* H5FS__sinfo_unlock() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_serialize_size + * Function: H5FS__sect_serialize_size * * Purpose: Determine serialized size of all sections in free space manager * @@ -476,17 +476,17 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_serialize_size(H5FS_t *fspace) +H5FS__sect_serialize_size(H5FS_t *fspace) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments. */ HDassert(fspace); #ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS_sect_serialize_size", fspace->sect_size); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count); -HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS_sect_serialize_size", fspace->alloc_sect_size); -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count); +HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->sect_size); +HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); +HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->alloc_sect_size); +HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); #endif /* QAK */ /* Compute the size of the buffer required to serialize all the sections */ @@ -498,8 +498,8 @@ HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_ser /* Count for each differently sized serializable section */ #ifdef QAK -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count); +HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); +HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); #endif /* QAK */ sect_buf_size += fspace->sinfo->serial_size_count * H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); @@ -523,11 +523,11 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ fspace->sect_size = fspace->sinfo->sect_prefix_size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sect_serialize_size() */ +} /* H5FS__sect_serialize_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_increase + * Function: H5FS__sect_increase * * Purpose: Increase the size of the serialized free space section info * on disk @@ -540,12 +540,12 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned flags) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -577,18 +577,18 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); /* Update the free space sections' serialized size */ /* (if we're not deserializing the sections from disk) */ if(!(flags & H5FS_ADD_DESERIALIZING)) { - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") } /* end if */ } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_increase() */ +} /* H5FS__sect_increase() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_decrease + * Function: H5FS__sect_decrease * * Purpose: Decrease the size of the serialized free space section info * on disk @@ -601,11 +601,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) +H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -635,17 +635,17 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); fspace->sinfo->serial_size -= cls->serial_size; /* Update the free space sections' serialized size */ - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_decrease() */ +} /* H5FS__sect_decrease() */ /*------------------------------------------------------------------------- - * Function: H5FS_size_node_decr + * Function: H5FS__size_node_decr * * Purpose: Decrement the number of sections of a particular size * @@ -657,12 +657,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, +H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, const H5FS_section_class_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sinfo); @@ -728,11 +728,11 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_size_node_decr() */ +} /* H5FS__size_node_decr() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_size + * Function: H5FS__sect_unlink_size * * Purpose: Remove a section node from size tracking data structures for * a free space manager @@ -745,7 +745,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { H5FS_node_t *fspace_node; /* Free list size node */ @@ -753,7 +753,7 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, unsigned bin; /* Bin to put the free space section in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sinfo); @@ -777,16 +777,16 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(sinfo, bin, fspace_node, cls) < 0) + if(H5FS__size_node_decr(sinfo, bin, fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_unlink_size() */ +} /* H5FS__sect_unlink_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_rest + * Function: H5FS__sect_unlink_rest * * Purpose: Finish unlinking a section from the rest of the free space * manager's data structures, after the section has been removed @@ -800,12 +800,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -826,7 +826,7 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC } /* end if */ /* Update section info & check if we need less room for the serialized free space sections */ - if(H5FS_sect_decrease(fspace, cls) < 0) + if(H5FS__sect_decrease(fspace, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") /* Decrement amount of free space managed */ @@ -837,11 +837,11 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_unlink_rest() */ +} /* H5FS__sect_unlink_rest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove_real + * Function: H5FS__sect_remove_real * * Purpose: Remove a section from the free space manager * @@ -853,12 +853,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) +H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) { const H5FS_section_class_t *cls; /* Class of section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -869,16 +869,16 @@ H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) cls = &fspace->sect_cls[sect->type]; /* Remove node from size tracked data structures */ - if(H5FS_sect_unlink_size(fspace->sinfo, cls, sect) < 0) + if(H5FS__sect_unlink_size(fspace->sinfo, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from size tracking data structures") /* Update rest of free space manager data structures for node removal */ - if(H5FS_sect_unlink_rest(fspace, cls, sect) < 0) + if(H5FS__sect_unlink_rest(fspace, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_remove_real() */ +} /* H5FS__sect_remove_real() */ /*------------------------------------------------------------------------- @@ -907,17 +907,17 @@ H5FS_sect_remove(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect) HDassert(sect); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; /* Perform actual section removal */ - if(H5FS_sect_remove_real(fspace, sect) < 0) + if(H5FS__sect_remove_real(fspace, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove section") done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, TRUE) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -925,7 +925,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_size + * Function: H5FS__sect_link_size * * Purpose: Add a section of free space to the free list bins * @@ -937,7 +937,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */ @@ -945,7 +945,7 @@ H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, unsigned bin; /* Bin to put the free space section in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef QAK HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, sect->addr); #endif /* QAK */ @@ -1028,11 +1028,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link_size() */ +} /* H5FS__sect_link_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_rest + * Function: H5FS__sect_link_rest * * Purpose: Link a section into the rest of the non-size tracking * free space manager data structures @@ -1045,12 +1045,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect, unsigned flags) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1070,7 +1070,7 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN } /* end if */ /* Update section info & check if we need more room for the serialized free space sections */ - if(H5FS_sect_increase(fspace, cls, flags) < 0) + if(H5FS__sect_increase(fspace, cls, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") /* Increment amount of free space managed */ @@ -1078,11 +1078,11 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link_rest() */ +} /* H5FS__sect_link_rest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_link + * Function: H5FS__sect_link * * Purpose: Link a section into the internal data structures * @@ -1094,12 +1094,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) +H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) { const H5FS_section_class_t *cls; /* Class of section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1113,14 +1113,14 @@ H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) #ifdef QAK HDfprintf(stderr, "%s: Check 1.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); #endif /* QAK */ - if(H5FS_sect_link_size(fspace->sinfo, cls, sect) < 0) + if(H5FS__sect_link_size(fspace->sinfo, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to size tracking data structures") #ifdef QAK HDfprintf(stderr, "%s: Check 2.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); #endif /* QAK */ /* Update rest of free space manager data structures for section addition */ - if(H5FS_sect_link_rest(fspace, cls, sect, flags) < 0) + if(H5FS__sect_link_rest(fspace, cls, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to non-size tracking data structures") #ifdef QAK HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); @@ -1128,11 +1128,11 @@ HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link() */ +} /* H5FS__sect_link() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_merge + * Function: H5FS__sect_merge * * Purpose: Attempt to merge a returned free space section with existing * free space. @@ -1145,7 +1145,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) +H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) { H5FS_section_class_t *sect_cls; /* Section's class */ hbool_t modified; /* Flag to indicate merge or shrink occurred */ @@ -1153,7 +1153,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) htri_t status; /* Status value */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1203,7 +1203,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) HDassert(tmp_sect_cls->merge); /* Remove 'less than' node from data structures */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Merge the two sections together */ @@ -1249,7 +1249,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) HDassert(sect_cls->merge); /* Remove 'greater than' node from data structures */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Merge the two sections together */ @@ -1290,7 +1290,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); /* Remove SECT from free-space manager */ /* (only possible to happen on second+ pass through loop) */ if(remove_sect) { - if(H5FS_sect_remove_real(fspace, *sect) < 0) + if(H5FS__sect_remove_real(fspace, *sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") remove_sect = FALSE; } /* end if */ @@ -1342,7 +1342,7 @@ done: HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_merge() */ +} /* H5FS__sect_merge() */ /*------------------------------------------------------------------------- @@ -1379,7 +1379,7 @@ HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", FUNC, sect->addr, sect->siz HDassert(sect->size); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1396,7 +1396,7 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC); #endif /* H5FS_SINFO_DEBUG */ /* Attempt to merge returned section with existing sections */ - if(H5FS_sect_merge(fspace, §, op_data) < 0) + if(H5FS__sect_merge(fspace, §, op_data) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") } /* end if */ @@ -1405,7 +1405,7 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC); * be NULL at this point - QAK) */ if(sect) - if(H5FS_sect_link(fspace, sect, flags) < 0) + if(H5FS__sect_link(fspace, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") #ifdef H5FS_SINFO_DEBUG @@ -1418,7 +1418,7 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") #ifdef H5FS_DEBUG_ASSERT @@ -1475,7 +1475,7 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se H5FS_section_info_t *sect; /* Temporary free space section */ /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1511,7 +1511,7 @@ if(_section_) H5FS_section_class_t *cls; /* Section's class */ /* Remove section from data structures */ - if(H5FS_sect_remove_real(fspace, sect) < 0) + if(H5FS__sect_remove_real(fspace, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Get class for section */ @@ -1537,7 +1537,7 @@ if(_section_) /* Re-adding the section could cause it to disappear (particularly when paging) */ if(sect) { /* Re-add adjusted section to free sections data structures */ - if(H5FS_sect_link(fspace, sect, 0) < 0) + if(H5FS__sect_link(fspace, sect, 0) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") } /* end if */ } /* end if */ @@ -1561,7 +1561,7 @@ if(_section_) done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -1601,13 +1601,13 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, HDassert(sect->size); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; saved_fs_size = sect->size; /* Attempt to merge/shrink section with existing sections */ - if(H5FS_sect_merge(fspace, §, op_data) < 0) + if(H5FS__sect_merge(fspace, §, op_data) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") /* Check if section is shrunk and/or merged away completely */ @@ -1618,7 +1618,7 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, else { /* Check if section is merged */ if(sect->size > saved_fs_size) { - if(H5FS_sect_link(fspace, sect, flags) < 0) + if(H5FS__sect_link(fspace, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") sinfo_modified = TRUE; HGOTO_DONE(TRUE) @@ -1627,7 +1627,7 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -1635,7 +1635,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_find_node + * Function: H5FS__sect_find_node * * Purpose: Locate a section of free space (in existing free space list * bins) that is large enough to fulfill request. @@ -1648,7 +1648,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) +H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) { H5FS_node_t *fspace_node; /* Free list size node */ unsigned bin; /* Bin to put the free space section in */ @@ -1658,7 +1658,7 @@ H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) const H5FS_section_class_t *cls; /* Class of section */ hsize_t alignment; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1696,9 +1696,9 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); /* Get section's class */ cls = &fspace->sect_cls[(*node)->type]; /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) + if(H5FS__size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + if(H5FS__sect_unlink_rest(fspace, cls, *node) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") /* Indicate that we found a node for the request */ HGOTO_DONE(TRUE) @@ -1741,10 +1741,10 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove(curr_fspace_node->sect_list, &curr_sect->addr))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0) + if(H5FS__size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + if(H5FS__sect_unlink_rest(fspace, cls, *node) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") /* @@ -1755,7 +1755,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); */ if(mis_align) { split_sect = cls->split(*node, frag_size); - if((H5FS_sect_link(fspace, split_sect, 0) < 0)) + if((H5FS__sect_link(fspace, split_sect, 0) < 0)) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") /* sanity check */ HDassert(split_sect->addr < (*node)->addr); @@ -1780,7 +1780,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_find_node() */ +} /* H5FS__sect_find_node() */ /*------------------------------------------------------------------------- @@ -1823,12 +1823,12 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se #endif /* QAK */ if(fspace->tot_sect_count > 0) { /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; /* Look for node in bins */ - if((ret_value = H5FS_sect_find_node(fspace, request, node)) < 0) + if((ret_value = H5FS__sect_find_node(fspace, request, node)) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from bins") /* Decrement # of sections on free list, if we found an object */ @@ -1843,7 +1843,7 @@ HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") #ifdef H5FS_DEBUG_ASSERT @@ -1965,7 +1965,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c unsigned bin; /* Current bin we are on */ /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1985,7 +1985,7 @@ HDfprintf(stderr, "%s: Iterate over section bins\n", FUNC); done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, FALSE) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, FALSE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2054,7 +2054,7 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, HDassert(new_class < fspace->nclasses); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -2179,12 +2179,12 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC fspace->sinfo->serial_size += fspace->sect_cls[new_class].serial_size; /* Update current space used for free space sections */ - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, TRUE) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2343,13 +2343,12 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_shrink_eoa + * Function: H5FS_sect_try_shrink_eoa * - * Purpose: To shrink the last section on the merge list if the section - * is at EOF. + * Purpose: To shrink the last section on the merge list if the section + * is at EOF. * - * Return: Success: non-negative (TRUE/FALSE) - * Failure: negative + * Return: TRUE/FALSE/FAIL * * Programmer: Vailin Choi * @@ -2367,7 +2366,7 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) /* Check arguments. */ HDassert(fspace); - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -2382,30 +2381,30 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) /* Get the pointer to the last section, from the last node */ tmp_sect = (H5FS_section_info_t *)H5SL_item(last_node); HDassert(tmp_sect); - tmp_sect_cls = &fspace->sect_cls[tmp_sect->type]; - if(tmp_sect_cls->can_shrink) { + tmp_sect_cls = &fspace->sect_cls[tmp_sect->type]; + if(tmp_sect_cls->can_shrink) { /* Check if the section can be shrunk away */ - if((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") - if(ret_value > 0) { - HDassert(tmp_sect_cls->shrink); + if((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") + if(ret_value > 0) { + HDassert(tmp_sect_cls->shrink); /* Remove section from free space manager */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") section_removed = TRUE; /* Shrink away section */ - if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container") - } /* end if */ - } /* end if */ - } /* end if */ + if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container") + } /* end if */ + } /* end if */ + } /* end if */ } /* end if */ done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, section_removed) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, section_removed) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2557,15 +2556,15 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, if(H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "hdr file space alloc will overlap into 'temporary' file space") - hdr_alloc_size = H5FS_HEADER_SIZE(f); + hdr_alloc_size = H5FS_HEADER_SIZE(f); - /* if page allocation is enabled, extend the hdr_alloc_size to the - * next page boundary. + /* if page allocation is enabled, extend the hdr_alloc_size to the + * next page boundary. */ if(H5F_PAGED_AGGR(f)) { HDassert(0 == (eoa % f->shared->fs_page_size)); - hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; + hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; HDassert(hdr_alloc_size >= H5FS_HEADER_SIZE(f)); HDassert((hdr_alloc_size % f->shared->fs_page_size) == 0); @@ -2599,13 +2598,13 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, sinfo_alloc_size = fspace->sect_size; - /* if paged allocation is enabled, extend the sinfo_alloc_size to the - * next page boundary. + /* if paged allocation is enabled, extend the sinfo_alloc_size to the + * next page boundary. */ if(H5F_PAGED_AGGR(f)) { HDassert(0 == (eoa % f->shared->fs_page_size)); - sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; + sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; HDassert(sinfo_alloc_size >= fspace->sect_size); HDassert((sinfo_alloc_size % f->shared->fs_page_size) == 0); diff --git a/src/H5G.c b/src/H5G.c index cbf3a8e..e54e5cd 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -14,14 +14,12 @@ /*------------------------------------------------------------------------- * * Created: H5G.c - * Jul 18 1997 - * Robb Matzke * * Purpose: Symbol table functions. The functions that begin with - * `H5G_stab_' don't understand the naming system; they operate + * 'H5G_stab_' don't understand the naming system; they operate * on a single symbol table at a time. * - * The functions that begin with `H5G_node_' operate on the leaf + * The functions that begin with 'H5G_node_' operate on the leaf * nodes of a symbol table B-tree. They should be defined in * the H5Gnode.c file. * @@ -42,11 +40,11 @@ * +--------------+----------- +--------------------------------+ * | Location ID | Name | Meaning | * +--------------+------------+--------------------------------+ - * | File ID | "/foo/bar" | Find `foo' within `bar' within | + * | File ID | "/foo/bar" | Find 'foo' within 'bar' within | * | | | the root group of the specified| * | | | file. | * +--------------+------------+--------------------------------+ - * | File ID | "foo/bar" | Find `foo' within `bar' within | + * | File ID | "foo/bar" | Find 'foo' within 'bar' within | * | | | the root group of the specified| * | | | file. | * +--------------+------------+--------------------------------+ @@ -56,11 +54,11 @@ * | File ID | "." | The root group of the specified| * | | | the specified file. | * +--------------+------------+--------------------------------+ - * | Group ID | "/foo/bar" | Find `foo' within `bar' within | + * | Group ID | "/foo/bar" | Find 'foo' within 'bar' within | * | | | the root group of the file | * | | | containing the specified group.| * +--------------+------------+--------------------------------+ - * | Group ID | "foo/bar" | File `foo' within `bar' within | + * | Group ID | "foo/bar" | File 'foo' within 'bar' within | * | | | the specified group. | * +--------------+------------+--------------------------------+ * | Group ID | "/" | The root group of the file | @@ -83,13 +81,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ /****************/ diff --git a/src/H5Gint.c b/src/H5Gint.c index 8fd7514..51d3b91 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -32,13 +32,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -805,12 +805,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_iterate + * Function: H5G_iterate * * Purpose: Private function for iterating over links in a group * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Oct 3, 2005 @@ -860,7 +859,7 @@ done: if(gid > 0) { if(H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - } /* end if */ + } else if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") @@ -1054,9 +1053,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_visit + * Function: H5G_visit * - * Purpose: Recursively visit all the links in a group and all + * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within * each group are visited according to the order within the * specified index (unless the specified index does not exist for @@ -1068,18 +1067,13 @@ done: * callback with more than one link that points to a particular * _object_. * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. - * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * - * - * Programmer: Quincey Koziol - * November 4 2007 + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * *------------------------------------------------------------------------- */ @@ -1193,7 +1187,7 @@ done: if(gid > 0) { if(H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - } /* end if */ + } else if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") diff --git a/src/H5Glink.c b/src/H5Glink.c index 509e511..82a2dcf 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -568,7 +568,7 @@ H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, const H5O_link_ obj_path_r = H5G_build_fullpath_refstr_str(grp_full_path_r, lnk->name); if(H5G_name_replace(lnk, H5G_NAME_DELETE, file, obj_path_r, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to replace name") - } /* end if */ + } done: if(obj_path_r) diff --git a/src/H5Gloc.c b/src/H5Gloc.c index f5a14a1..2f935e8 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -137,15 +137,11 @@ static herr_t H5G__loc_get_comment_cb(H5G_loc_t *grp_loc, const char *name, /*------------------------------------------------------------------------- - * Function: H5G_loc + * Function: H5G_loc * - * Purpose: Given an object ID return a location for the object. + * Purpose: Given an object ID return a location for the object. * - * Return: Success: Group pointer. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Tuesday, September 13, 2005 + * Returns: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -158,92 +154,94 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) switch(H5I_get_type(loc_id)) { case H5I_FILE: - { - H5F_t *f; + { + H5F_t *f = NULL; - /* Get the file struct */ - if(NULL == (f = (H5F_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file ID") + /* Get the file struct */ + if(NULL == (f = (H5F_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file ID") - /* Construct a group location for root group of the file */ - if(H5G_root_loc(f, loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file") - } /* end case */ + /* Construct a group location for root group of the file */ + if(H5G_root_loc(f, loc) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file") break; - - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list") - - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of error class, message or stack") + } case H5I_GROUP: - { - H5G_t *group; - - if(NULL == (group = (H5G_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group ID") - if(NULL == (loc->oloc = H5G_oloc(group))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group") - if(NULL == (loc->path = H5G_nameof(group))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of group") - } /* end case */ + { + H5G_t *group = NULL; + + if(NULL == (group = (H5G_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group ID") + if(NULL == (loc->oloc = H5G_oloc(group))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group") + if(NULL == (loc->path = H5G_nameof(group))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of group") break; + } case H5I_DATATYPE: - { - H5T_t *dt; - - if(NULL == (dt = (H5T_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid type ID") - if(NULL == (loc->oloc = H5T_oloc(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype") - if(NULL == (loc->path = H5T_nameof(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of datatype") - } /* end case */ + { + H5T_t *dt = NULL; + + if(NULL == (dt = (H5T_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid type ID") + if(NULL == (loc->oloc = H5T_oloc(dt))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype") + if(NULL == (loc->path = H5T_nameof(dt))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of datatype") break; - - case H5I_DATASPACE: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace") + } case H5I_DATASET: - { - H5D_t *dset; - - if(NULL == (dset = (H5D_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data ID") - if(NULL == (loc->oloc = H5D_oloc(dset))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset") - if(NULL == (loc->path = H5D_nameof(dset))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of dataset") - } /* end case */ + { + H5D_t *dset = NULL; + + if(NULL == (dset = (H5D_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data ID") + if(NULL == (loc->oloc = H5D_oloc(dset))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset") + if(NULL == (loc->path = H5D_nameof(dset))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of dataset") break; + } case H5I_ATTR: - { - H5A_t *attr; - - if(NULL == (attr = (H5A_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid attribute ID") - if(NULL == (loc->oloc = H5A_oloc(attr))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute") - if(NULL == (loc->path = H5A_nameof(attr))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of attribute") - } /* end case */ + { + H5A_t *attr = NULL; + + if(NULL == (attr = (H5A_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid attribute ID") + if(NULL == (loc->oloc = H5A_oloc(attr))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute") + if(NULL == (loc->path = H5A_nameof(attr))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of attribute") break; + } case H5I_REFERENCE: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of reference") + case H5I_DATASPACE: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace") + + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list") + + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of error class, message or stack") + + case H5I_VFL: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual file driver (VFD)") + case H5I_UNINIT: case H5I_BADID: - case H5I_VFL: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid location ID") } /* end switch */ done: @@ -764,7 +762,7 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A /* Check for existing comment message */ if((exists = H5O_msg_exists(obj_loc->oloc, H5O_NAME_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") /* Remove the previous comment message if any */ if(exists) @@ -774,9 +772,9 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A /* Add the new message */ if(udata->comment && *udata->comment) { /* Casting away const OK -QAK */ - comment.s = (char *)udata->comment; - if(H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message") + comment.s = (char *)udata->comment; + if(H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message") } /* end if */ done: @@ -854,20 +852,21 @@ H5G__loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A /* Query object comment */ comment.s = NULL; if(NULL == H5O_msg_read(obj_loc->oloc, H5O_NAME_ID, &comment)) { - if(udata->comment && udata->bufsize > 0) + if(udata->comment && udata->bufsize > 0) udata->comment[0] = '\0'; - udata->comment_size = 0; - } /* end if */ + udata->comment_size = 0; + } else { if(udata->comment && udata->bufsize) - HDstrncpy(udata->comment, comment.s, udata->bufsize); - udata->comment_size = (ssize_t)HDstrlen(comment.s); - H5O_msg_reset(H5O_NAME_ID, &comment); - } /* end else */ + HDstrncpy(udata->comment, comment.s, udata->bufsize); + udata->comment_size = (ssize_t)HDstrlen(comment.s); + H5O_msg_reset(H5O_NAME_ID, &comment); + } done: /* Indicate that this callback didn't take ownership of the group * - * location for the object */ + * location for the object. + */ *own_loc = H5G_OWN_NONE; FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gname.c b/src/H5Gname.c index c1156ca..8aa0b45 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -1155,7 +1155,7 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, else { /* We pass NULL as link pointer when we need to search all IDs */ search_group = search_dataset = search_datatype = TRUE; - } /* end else */ + } /* Check if we need to operate on the objects affected */ if(search_group || search_dataset || search_datatype) { @@ -1166,26 +1166,26 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, src_file = H5F_PARENT(src_file); /* Set up common information for callback */ - names.src_file = src_file; - names.src_full_path_r = src_full_path_r; - names.dst_file = dst_file; - names.dst_full_path_r = dst_full_path_r; - names.op = op; + names.src_file = src_file; + names.src_full_path_r = src_full_path_r; + names.dst_file = dst_file; + names.dst_full_path_r = dst_full_path_r; + names.op = op; /* Search through group IDs */ if(search_group) if(H5I_iterate(H5I_GROUP, H5G_name_replace_cb, &names, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups") /* Search through dataset IDs */ if(search_dataset) if(H5I_iterate(H5I_DATASET, H5G_name_replace_cb, &names, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets") /* Search through datatype IDs */ if(search_datatype) if(H5I_iterate(H5I_DATATYPE, H5G_name_replace_cb, &names, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes") } /* end if */ } /* end if */ @@ -1269,10 +1269,11 @@ done: * * Purpose: Tries to figure out the path to an object from it's address * - * Return: returns size of path name, and copies it into buffer - * pointed to by name if that buffer is big enough. - * 0 if it cannot find the path - * negative on failure. + * Return: Success: Returns size of path name, and copies it into buffer + * pointed to by name if that buffer is big enough. + * 0 if it cannot find the path + * + * Failure: -1 * * Programmer: Quincey Koziol * November 4 2007 @@ -1283,25 +1284,25 @@ ssize_t H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, char *name, size_t size) { - H5G_gnba_iter_t udata; /* User data for iteration */ - H5G_loc_t root_loc; /* Root group's location */ - hbool_t found_obj = FALSE; /* If we found the object */ - herr_t status; /* Status from iteration */ - ssize_t ret_value = -1; /* Return value */ + H5G_gnba_iter_t udata; /* User data for iteration */ + H5G_loc_t root_loc; /* Root group's location */ + hbool_t found_obj = FALSE; /* If we found the object */ + herr_t status; /* Status from iteration */ + ssize_t ret_value = -1; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ HDmemset(&udata, 0, sizeof(udata)); - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) /* Construct the link info for the file's root group */ if(H5G_loc(file, &root_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get root group's location") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get root group's location") /* Check for root group being the object looked for */ if(root_loc.oloc->addr == loc->addr && root_loc.oloc->file == loc->file) { if(NULL == (udata.path = H5MM_strdup(""))) - HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "can't duplicate path string") + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, (-1), "can't duplicate path string") found_obj = TRUE; } /* end if */ else { @@ -1311,7 +1312,7 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, /* Visit all the links in the file */ if((status = H5G_visit(file, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group traversal failed while looking for object name") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name") else if(status > 0) found_obj = TRUE; } /* end else */ @@ -1342,3 +1343,4 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_get_name_by_addr() */ + diff --git a/src/H5Gobj.c b/src/H5Gobj.c index e93896c..15dbd79 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -36,7 +36,6 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5Gpkg.h" /* Groups */ -#include "H5HLprivate.h" /* Local Heaps */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ @@ -257,7 +256,7 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, * incremented if the object is added to the group directed graph. */ if(H5O_create(f, hdr_size, (size_t)1, gcpl_id, oloc/*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header") /* Check for format of group to create */ if(use_at_least_v18) { diff --git a/src/H5Goh.c b/src/H5Goh.c index 38570f9..ec3d30d 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -193,9 +193,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__group_open + * Function: H5O__group_open * - * Purpose: Open a group at a particular location + * Purpose: Open a group at a particular location * * Return: Success: Open object identifier * Failure: Negative diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 64c4054..9072b97 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -225,14 +225,14 @@ H5G__stab_create(H5O_loc_t *grp_oloc, const H5O_ginfo_t *ginfo, H5O_stab_t *stab /* Go create the B-tree & local heap */ if(H5G__stab_create_components(grp_oloc->file, stab, size_hint) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components") /* * Insert the symbol table message into the object header and the symbol * table entry. */ if(H5O_msg_create(grp_oloc, H5O_STAB_ID, 0, H5O_UPDATE_TIME, stab) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -534,7 +534,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, /* Get the B-tree info */ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Pin the heap down in memory */ if(NULL == (heap = H5HL_protect(oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) @@ -626,7 +626,7 @@ H5G__stab_count(const H5O_loc_t *oloc, hsize_t *num_objs) /* Get the B-tree info */ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Iterate over the group members */ if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_sumup, num_objs) < 0) @@ -757,7 +757,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t /* Get the B-tree & local heap info */ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Pin the heap down in memory */ if(NULL == (heap = H5HL_protect(oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) @@ -785,11 +785,11 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t /* Iterate over the group members */ if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") /* If we don't know the name now, we almost certainly went out of bounds */ if(udata.name == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound") /* Get the length of the name */ ret_value = (ssize_t)HDstrlen(udata.name); @@ -979,7 +979,7 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ /* Get the B-tree & local heap info */ if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") /* Pin the heap down in memory */ if(NULL == (heap = H5HL_protect(grp_oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) @@ -1007,11 +1007,11 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ /* Iterate over the group members */ if(H5B_iterate(grp_oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") /* If we didn't find the link, we almost certainly went out of bounds */ if(!udata.found) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound") done: /* Release resources */ @@ -1193,7 +1193,7 @@ H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) /* Get the B-tree & local heap info */ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") /* Set iteration information */ udata.common.idx = idx; @@ -1204,7 +1204,7 @@ H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) /* Iterate over the group members */ if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed") /* If we don't know the type now, we almost certainly went out of bounds */ if(udata.type == H5G_UNKNOWN) diff --git a/src/H5I.c b/src/H5I.c index 6cb1947..293a0ea 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -128,6 +128,7 @@ static int H5I__inc_type_ref(H5I_type_t type); static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); +static hid_t H5I__get_file_id(hid_t obj_id, H5I_type_t id_type); #ifdef H5I_DEBUG_OUTPUT static int H5I__debug_cb(void *_item, void *_key, void *_udata); static herr_t H5I__debug(H5I_type_t type); @@ -2055,7 +2056,7 @@ H5Iget_file_id(hid_t obj_id) /* Call internal function */ if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - if ((ret_value = H5I_get_file_id(obj_id, type)) < 0) + if ((ret_value = H5I__get_file_id(obj_id, type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") } else @@ -2067,7 +2068,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_get_file_id + * Function: H5I__get_file_id * * Purpose: The private version of H5Iget_file_id(), obtains the file * ID given an object ID. @@ -2077,12 +2078,12 @@ done: * *------------------------------------------------------------------------- */ -hid_t -H5I_get_file_id(hid_t obj_id, H5I_type_t type) +static hid_t +H5I__get_file_id(hid_t obj_id, H5I_type_t type) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Process based on object type */ if (type == H5I_FILE) { @@ -2107,7 +2108,7 @@ H5I_get_file_id(hid_t obj_id, H5I_type_t type) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_get_file_id() */ +} /* end H5I__get_file_id() */ #ifdef H5I_DEBUG_OUTPUT diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 3bfde93..a10147d 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -72,7 +72,6 @@ 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 hid_t H5I_get_file_id(hid_t obj_id, H5I_type_t id_type); 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); diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 7c32309..1cab17d 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -102,7 +102,7 @@ static const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ * link access property list, appends that prefix to the * filename being opened. * - * Return: ID of the opened object on success/Negative on failure + * Return: ID of the opened object on success/H5I_INVALID_HID on failure * * Programmer: James Laird * Monday, July 10, 2006 @@ -129,8 +129,8 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, char *parent_group_name = NULL;/* Temporary pointer to group name */ char local_group_name[H5L_EXT_TRAVERSE_BUF_SIZE]; /* Local buffer to hold group name */ H5P_genplist_t *fa_plist; /* File access property list pointer */ - H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ - char *elink_prefix; /* Pointer to elink prefix */ + H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ + char *elink_prefix = NULL; /* Pointer to elink prefix */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -140,9 +140,9 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Check external link version & flags */ if(((*p >> 4) & 0x0F) > H5L_EXT_VERSION) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad version number for external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad version number for external link") if((*p & 0x0F) & ~H5L_EXT_FLAGS_ALL) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad flags for external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad flags for external link") p++; /* Gather some information from the external link's user data */ @@ -152,19 +152,19 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") /* Get the fapl_id set for lapl_id if any */ if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get fapl for links") /* Get the location for the group holding the external link */ if(H5G_loc(cur_group, &loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get object location") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get object location") /* get the access flags set for lapl_id if any */ if(H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, &intent) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink file access flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink file access flags") /* get the file access mode flags for the parent file, if they were not set * on lapl_id */ @@ -172,15 +172,15 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, intent = H5F_INTENT(loc.oloc->file); if((fapl_id == H5P_DEFAULT) && ((fapl_id = H5F_get_access_plist(loc.oloc->file, FALSE)) < 0)) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get parent's file access property list") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get parent's file access property list") /* Get callback_info */ if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink callback info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink callback info") /* Get file access property list */ if(NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") /* Make callback if it exists */ if(cb_info.func) { @@ -192,7 +192,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Query length of parent group name */ if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve length of group name") /* Account for null terminator */ group_name_len++; @@ -200,43 +200,43 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Check if we need to allocate larger buffer */ if((size_t)group_name_len > sizeof(local_group_name)) { if(NULL == (parent_group_name = (char *)H5MM_malloc((size_t)group_name_len))) - HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len) + HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len) } /* end if */ else parent_group_name = local_group_name; /* Get parent group name */ if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve group name") /* Make callback */ if((cb_info.func)(parent_file_name, parent_group_name, file_name, obj_name, &intent, fapl_id, cb_info.user_data) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "traversal operator failed") + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, H5I_INVALID_HID, "traversal operator failed") /* Check access flags */ if((intent & H5F_ACC_TRUNC) || (intent & H5F_ACC_EXCL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags") } /* end if */ /* Set file close degree for new file to "weak" */ if(H5P_set(fa_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") /* Get the current elink prefix */ if(H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &elink_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get external link prefix") /* Search for the target file */ if(NULL == (ext_file = H5F_prefix_open_file(loc.oloc->file, H5F_PREFIX_ELINK, elink_prefix, file_name, intent, fapl_id))) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s'", file_name) + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open external file, external link file name = '%s'", file_name) /* Retrieve the "group location" for the file's root group */ if(H5G_root_loc(ext_file, &root_loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "unable to create location for file") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, H5I_INVALID_HID, "unable to create location for file") /* Open the object referenced in the external file */ if((ext_obj = H5O_open_name(&root_loc, obj_name, FALSE)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Set return value */ ret_value = ext_obj; @@ -244,15 +244,15 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, done: /* Release resources */ if(fapl_id > 0 && H5I_dec_ref(fapl_id) < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") + HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for file access property list") if(ext_file && H5F_efc_close(loc.oloc->file, ext_file) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, FAIL, "problem closing external file") + HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problem closing external file") if(parent_group_name && parent_group_name != local_group_name) parent_group_name = (char *)H5MM_xfree(parent_group_name); if(ret_value < 0) { /* Close object if it's open and something failed */ if(ext_obj >= 0 && H5I_dec_ref(ext_obj) < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom for external object") + HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for external object") } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -312,7 +312,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Lcreate_external * - * Purpose: Creates an external link from LINK_NAME to OBJ_NAME. + * Purpose: Creates an external link from LINK_NAME to OBJ_NAME. * * External links are links to objects in other HDF5 files. They * are allowed to "dangle" like soft links internal to a file. @@ -322,9 +322,9 @@ done: * LINK_NAME is interpreted relative to LINK_LOC_ID, which is * either a file ID or a group ID. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 18, 2005 * *------------------------------------------------------------------------- @@ -380,7 +380,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, /* Create an external link */ if(H5L__create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link") done: H5MM_xfree(ext_link_buf); diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index fa57862..8a44902 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -195,10 +195,7 @@ H5FL_DEFINE(haddr_t); * hid_t lcpl_id IN: Properties which apply to the new hard link * * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Peter Cao - * June 4, 2005 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -216,19 +213,33 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Check arguments */ if(H5G_loc(src_loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(H5G_loc(dst_loc_id, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!src_name || !*src_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source name specified") if(!dst_name || !*dst_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") + + /* Get correct property lists */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + else + if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") + + /* Get object copy property list */ + if (H5P_DEFAULT == ocpypl_id) + ocpypl_id = H5P_OBJECT_COPY_DEFAULT; + else + if(TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(src_loc_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine to copy object */ + /* Copy the object */ if(H5O__copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") @@ -240,10 +251,9 @@ done: /*------------------------------------------------------------------------- * Function: H5O__copy * - * Purpose: Internal routine to copy an object + * Purpose: Private version of H5Ocopy * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 29, 2017 @@ -260,7 +270,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, htri_t dst_exists; /* Does destination name exist already? */ hbool_t loc_found = FALSE; /* Location at 'name' found */ hbool_t obj_open = FALSE; /* Entry at 'name' found */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -272,7 +282,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, /* Check if destination name already exists */ if((dst_exists = H5L_exists_tolerant(dst_loc, dst_name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") if(TRUE == dst_exists) HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists") @@ -291,24 +301,6 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") obj_open = TRUE; - /* Get correct property lists */ - if(H5P_DEFAULT == lcpl_id) { - if((lcpl_id = H5P_get_default(H5P_CLS_LCRT)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to get default lcpl") - } /* end if */ - else - if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") - - /* Get object copy property list */ - if(H5P_DEFAULT == ocpypl_id) { - if((ocpypl_id = H5P_get_default(H5P_CLS_OCPY)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to get default ocpypl") - } /* end if */ - else - if(TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list") - /* Do the actual copying of the object */ if(H5O__copy_obj(&src_loc, dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") diff --git a/src/H5P.c b/src/H5P.c index 733af42..72d7ae8 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -82,7 +82,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; hid_t id; IN: Property list or class ID to copy RETURNS Success: valid property list ID on success (non-negative) - Failure: negative + Failure: H5I_INVALID_HID (negative) DESCRIPTION Copy a property list or class and return the ID. This routine calls the class 'copy' callback after any property 'copy' callbacks are called @@ -97,37 +97,37 @@ hid_t H5Pcopy(hid_t id) { void *obj; /* Property object to copy */ - hid_t ret_value=FALSE; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", id); - if(H5P_DEFAULT==id) + if(H5P_DEFAULT == id) HGOTO_DONE(H5P_DEFAULT); /* Check arguments. */ if(H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property object"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not property object"); if(NULL == (obj = H5I_object(id))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "property object doesn't exist"); /* Compare property lists */ if(H5I_GENPROP_LST == H5I_get_type(id)) { if((ret_value = H5P_copy_plist((H5P_genplist_t *)obj, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property list"); } /* end if */ /* Must be property classes */ else { H5P_genclass_t *copy_class; /* Copy of class */ /* Copy the class */ - if((copy_class = H5P_copy_pclass((H5P_genclass_t *)obj)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property class"); + if((copy_class = H5P__copy_pclass((H5P_genclass_t *)obj)) == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property class"); /* Get an atom for the copied class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, copy_class, TRUE)) < 0) { - H5P_close_class(copy_class); - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + H5P__close_class(copy_class); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); } /* end if */ } /* end else */ @@ -162,7 +162,7 @@ done: void *close_data; IN: Pointer to user data to pass along to class close callback. RETURNS - Returns a valid property list class ID on success, NULL on failure. + Returns a valid property list class ID on success, H5I_INVALID_HID on failure. DESCRIPTION Allocates memory and attaches a class to the property list class hierarchy. GLOBAL VARIABLES @@ -179,39 +179,39 @@ H5Pcreate_class(hid_t parent, const char *name, { H5P_genclass_t *par_class = NULL; /* Pointer to the parent class */ H5P_genclass_t *pclass = NULL; /* Property list class created */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE8("i", "i*sx*xx*xx*x", parent, name, cls_create, create_data, cls_copy, copy_data, cls_close, close_data); /* Check arguments. */ if(H5P_DEFAULT!=parent && (H5I_GENPROP_CLS!=H5I_get_type(parent))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list class") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid class name") if((create_data != NULL && cls_create == NULL) || (copy_data != NULL && cls_copy == NULL) || (close_data != NULL && cls_close == NULL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data specified, but no callback provided") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "data specified, but no callback provided") /* Get the pointer to the parent class */ if(parent == H5P_DEFAULT) par_class = NULL; else if(NULL == (par_class = (H5P_genclass_t *)H5I_object(parent))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve parent class") /* Create the new property list class */ - if(NULL == (pclass = H5P_create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class") + if(NULL == (pclass = H5P__create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list class") /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class") done: - if(ret_value < 0 && pclass) - H5P_close_class(pclass); + if(H5I_INVALID_HID == ret_value && pclass) + H5P__close_class(pclass); FUNC_LEAVE_API(ret_value) } /* H5Pcreate_class() */ @@ -226,7 +226,7 @@ done: hid_t H5Pcreate(cls_id) hid_t cls_id; IN: Property list class create list from RETURNS - Returns a valid property list ID on success, FAIL on failure. + Returns a valid property list ID on success, H5I_INVALID_HID on failure. DESCRIPTION Creates a property list of a given class. If a 'create' callback exists for the property list class, it is called before the @@ -243,18 +243,18 @@ hid_t H5Pcreate(hid_t cls_id) { H5P_genclass_t *pclass; /* Property list class to modify */ - hid_t ret_value; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", cls_id); /* Check arguments. */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(cls_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list class"); /* Create the new property list */ if((ret_value = H5P_create_id(pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list"); done: FUNC_LEAVE_API(ret_value) @@ -440,7 +440,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, /* Create the new property list class */ orig_pclass = pclass; - if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) + if((ret_value = H5P__register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class") /* Check if the property class changed and needs to be substituted in the ID */ @@ -453,7 +453,7 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, HDassert(old_pclass == orig_pclass); /* Close the previous class */ - if(H5P_close_class(old_pclass) < 0) + if(H5P__close_class(old_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ @@ -738,7 +738,7 @@ H5Pexist(hid_t id, const char *name) if(H5I_GENPROP_CLS == H5I_get_type(id)) { if(NULL == (pclass = (H5P_genclass_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); - if((ret_value = H5P_exist_pclass(pclass, name)) < 0) + if((ret_value = H5P__exist_pclass(pclass, name)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property does not exist in class"); } /* end if */ else @@ -795,7 +795,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Check the property size */ - if((ret_value = H5P_get_size_plist(plist, name, size)) < 0) + if((ret_value = H5P__get_size_plist(plist, name, size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query size in plist"); } /* end if */ else @@ -804,7 +804,7 @@ H5Pget_size(hid_t id, const char *name, size_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Check the property size */ - if((ret_value = H5P_get_size_pclass(pclass, name, size)) < 0) + if((ret_value = H5P__get_size_pclass(pclass, name, size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query size in plist"); } /* end if */ else @@ -867,8 +867,8 @@ done: hid_t H5Pdecode(buf) void *buf; IN: buffer that holds the encoded plist RETURNS - Returns non-negative ID of new property list object on success, negative - on failure. + Success: ID of new property list object + Failure: H5I_INVALID_HID (negative) DESCRIPTION Decodes a property list from a binary buffer. The contents of the buffer contain the values for the correponding properties of the plist. The decode @@ -884,14 +884,14 @@ done: hid_t H5Pdecode(const void *buf) { - hid_t ret_value = SUCCEED; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*x", buf); /* Call the internal decode routine */ if((ret_value = H5P__decode(buf)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "unable to decode property list"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, H5I_INVALID_HID, "unable to decode property list"); done: FUNC_LEAVE_API(ret_value) @@ -908,7 +908,7 @@ done: hid_t plist_id; IN: Property list to query RETURNS Success: ID of class object - Failure: negative + Failure: H5I_INVALID_HID (negative) DESCRIPTION This routine retrieves the class of a property list. @@ -923,30 +923,30 @@ H5Pget_class(hid_t plist_id) { H5P_genplist_t *plist; /* Property list to query */ H5P_genclass_t *pclass=NULL; /* Property list class */ - hid_t ret_value=FAIL; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", plist_id); /* Check arguments. */ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); /* Retrieve the property list class */ if((pclass = H5P_get_class(plist)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to query class of property list"); + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to query class of property list"); /* Increment the outstanding references to the class object */ - if(H5P_access_class(pclass, H5P_MOD_INC_REF) < 0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ID ref count"); + if(H5P__access_class(pclass, H5P_MOD_INC_REF) < 0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID,"Can't increment class ID ref count"); /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class"); done: - if(ret_value<0 && pclass) - H5P_close_class(pclass); + if(H5I_INVALID_HID == ret_value && pclass) + H5P__close_class(pclass); FUNC_LEAVE_API(ret_value) } /* H5Pget_class() */ @@ -994,7 +994,7 @@ H5Pget_nprops(hid_t id, size_t *nprops) if(H5I_GENPROP_LST == H5I_get_type(id)) { if(NULL == (plist = (H5P_genplist_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); - if(H5P_get_nprops_plist(plist, nprops) < 0) + if(H5P__get_nprops_plist(plist, nprops) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to query # of properties in plist"); } /* end if */ else @@ -1054,7 +1054,7 @@ H5Pequal(hid_t id1, hid_t id2) if(H5I_GENPROP_LST == H5I_get_type(id1)) { int cmp_ret = 0; - if(H5P_cmp_plist((const H5P_genplist_t *)obj1, (const H5P_genplist_t *)obj2, &cmp_ret) < 0) + if(H5P__cmp_plist((const H5P_genplist_t *)obj1, (const H5P_genplist_t *)obj2, &cmp_ret) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOMPARE, FAIL, "can't compare property lists") /* Set return value */ @@ -1062,7 +1062,7 @@ H5Pequal(hid_t id1, hid_t id2) } /* end if */ /* Must be property classes */ else { - if(H5P_cmp_class((const H5P_genclass_t *)obj1, (const H5P_genclass_t *)obj2) == 0) + if(H5P__cmp_class((const H5P_genclass_t *)obj1, (const H5P_genclass_t *)obj2) == 0) ret_value = TRUE; } /* end else */ @@ -1236,13 +1236,13 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data) if(H5I_GENPROP_LST == H5I_get_type(id)) { /* Iterate over a property list */ - if((ret_value = H5P_iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) + if((ret_value = H5P__iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list"); } /* end if */ else if(H5I_GENPROP_CLS == H5I_get_type(id)) { /* Iterate over a property class */ - if((ret_value = H5P_iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) + if((ret_value = H5P__iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over class"); } /* end if */ else @@ -1419,12 +1419,12 @@ H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name) /* Compare property lists */ if(H5I_GENPROP_LST == src_id_type) { - if(H5P_copy_prop_plist(dst_id, src_id, name) < 0) + if(H5P__copy_prop_plist(dst_id, src_id, name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between lists") } /* end if */ /* Must be property classes */ else { - if(H5P_copy_prop_pclass(dst_id, src_id, name) < 0) + if(H5P__copy_prop_pclass(dst_id, src_id, name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between classes") } /* end else */ @@ -1470,7 +1470,7 @@ H5Punregister(hid_t pclass_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); /* Remove the property list from class */ - if((ret_value = H5P_unregister(pclass, name)) < 0) + if((ret_value = H5P__unregister(pclass, name)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to remove property from class"); done: @@ -1575,7 +1575,7 @@ done: hid_t pclass_id; IN: Property class to query RETURNS Success: ID of parent class object - Failure: NULL + Failure: H5I_INVALID_HID (negative) DESCRIPTION This routine retrieves an ID for the parent class of a property class. @@ -1589,30 +1589,30 @@ H5Pget_class_parent(hid_t pclass_id) { H5P_genclass_t *pclass; /* Property class to query */ H5P_genclass_t *parent = NULL; /* Parent's property class */ - hid_t ret_value; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", pclass_id); /* Check arguments. */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property class") /* Retrieve the property class's parent */ - if(NULL == (parent = H5P_get_class_parent(pclass))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to query class of property list") + if(NULL == (parent = H5P__get_class_parent(pclass))) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to query class of property list") /* Increment the outstanding references to the class object */ - if(H5P_access_class(parent, H5P_MOD_INC_REF) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't increment class ID ref count") + if(H5P__access_class(parent, H5P_MOD_INC_REF) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID,"Can't increment class ID ref count") /* Get an atom for the class */ if((ret_value = H5I_register(H5I_GENPROP_CLS, parent, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list class") done: - if(ret_value < 0 && parent) - H5P_close_class(parent); + if(H5I_INVALID_HID == ret_value && parent) + H5P__close_class(parent); FUNC_LEAVE_API(ret_value) } /* H5Pget_class_parent() */ diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c index 4368dd6..530ede3 100644 --- a/src/H5Pacpl.c +++ b/src/H5Pacpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pacpl.c - * January 2 2006 - * James Laird + * Created: H5Pacpl.c * - * Purpose: Attribute creation property list class routines + * Purpose: Attribute creation property list class routines * *------------------------------------------------------------------------- */ @@ -32,9 +30,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Ppkg.h" /* Property lists */ /****************/ @@ -63,21 +61,21 @@ /* Attribute creation property list class library initialization object */ const H5P_libclass_t H5P_CLS_ACRT[1] = {{ - "attribute create", /* Class name for debugging */ - H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */ - - &H5P_CLS_STRING_CREATE_g, /* Parent class */ - &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */ - &H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */ - &H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */ - NULL, /* Default property registration routine */ - - NULL, /* Class creation callback */ - NULL, /* Class creation callback info */ - NULL, /* Class copy callback */ - NULL, /* Class copy callback info */ - NULL, /* Class close callback */ - NULL /* Class close callback info */ + "attribute create", /* Class name for debugging */ + H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */ + + &H5P_CLS_STRING_CREATE_g, /* Parent class */ + &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */ + &H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */ + &H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ }}; diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index da06297..00e598f 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -204,46 +204,46 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, + if(H5P__register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, + if(H5P__register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, + if(H5P__register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, H5D_ACS_PREEMPT_READ_CHUNKS_ENC, H5D_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the VDS view option */ - if(H5P_register_real(pclass, H5D_ACS_VDS_VIEW_NAME, H5D_ACS_VDS_VIEW_SIZE, &virtual_view, + if(H5P__register_real(pclass, H5D_ACS_VDS_VIEW_NAME, H5D_ACS_VDS_VIEW_SIZE, &virtual_view, NULL, NULL, NULL, H5D_ACS_VDS_VIEW_ENC, H5D_ACS_VDS_VIEW_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the VDS printf gap */ - if(H5P_register_real(pclass, H5D_ACS_VDS_PRINTF_GAP_NAME, H5D_ACS_VDS_PRINTF_GAP_SIZE, &printf_gap, + if(H5P__register_real(pclass, H5D_ACS_VDS_PRINTF_GAP_NAME, H5D_ACS_VDS_PRINTF_GAP_SIZE, &printf_gap, NULL, NULL, NULL, H5D_ACS_VDS_PRINTF_GAP_ENC, H5D_ACS_VDS_PRINTF_GAP_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for vds prefix */ - if(H5P_register_real(pclass, H5D_ACS_VDS_PREFIX_NAME, H5D_ACS_VDS_PREFIX_SIZE, &H5D_def_vds_prefix_g, + if(H5P__register_real(pclass, H5D_ACS_VDS_PREFIX_NAME, H5D_ACS_VDS_PREFIX_SIZE, &H5D_def_vds_prefix_g, NULL, H5D_ACS_VDS_PREFIX_SET, H5D_ACS_VDS_PREFIX_GET, H5D_ACS_VDS_PREFIX_ENC, H5D_ACS_VDS_PREFIX_DEC, H5D_ACS_VDS_PREFIX_DEL, H5D_ACS_VDS_PREFIX_COPY, H5D_ACS_VDS_PREFIX_CMP, H5D_ACS_VDS_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register info for append flush */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g, + if(H5P__register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external file prefix */ - if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, + if(H5P__register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, NULL, H5D_ACS_EFILE_PREFIX_SET, H5D_ACS_EFILE_PREFIX_GET, H5D_ACS_EFILE_PREFIX_ENC, H5D_ACS_EFILE_PREFIX_DEC, H5D_ACS_EFILE_PREFIX_DEL, H5D_ACS_EFILE_PREFIX_COPY, H5D_ACS_EFILE_PREFIX_CMP, H5D_ACS_EFILE_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index cb13ff3..7e9fc52 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Pdcpl.c - * February 26 1998 - * Robb Matzke + * Created: H5Pdcpl.c * - * Purpose: Dataset creation property list class routines + * Purpose: Dataset creation property list class routines * *------------------------------------------------------------------------- */ @@ -33,19 +31,19 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Ppkg.h" /* Property lists */ -#include "H5Sprivate.h" /* Dataspaces */ -#include "H5Tprivate.h" /* Datatypes */ -#include "H5VMprivate.h" /* Vectors and arrays */ -#include "H5Zprivate.h" /* Data filters */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5Zprivate.h" /* Data filters */ /****************/ @@ -242,30 +240,30 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE; static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Register the storage layout property */ - if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g, + if(H5P__register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g, NULL, H5D_CRT_LAYOUT_SET, H5D_CRT_LAYOUT_GET, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC, H5D_CRT_LAYOUT_DEL, H5D_CRT_LAYOUT_COPY, H5D_CRT_LAYOUT_CMP, H5D_CRT_LAYOUT_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the fill value property */ - if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g, + if(H5P__register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g, NULL, H5D_CRT_FILL_VALUE_SET, H5D_CRT_FILL_VALUE_GET, H5D_CRT_FILL_VALUE_ENC, H5D_CRT_FILL_VALUE_DEC, H5D_CRT_FILL_VALUE_DEL, H5D_CRT_FILL_VALUE_COPY, H5D_CRT_FILL_VALUE_CMP, H5D_CRT_FILL_VALUE_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the space allocation time state property */ - if(H5P_register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &H5D_def_alloc_time_state_g, + if(H5P__register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &H5D_def_alloc_time_state_g, NULL, NULL, NULL, H5D_CRT_ALLOC_TIME_STATE_ENC, H5D_CRT_ALLOC_TIME_STATE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the external file list property */ - if(H5P_register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g, + if(H5P__register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g, NULL, H5D_CRT_EXT_FILE_LIST_SET, H5D_CRT_EXT_FILE_LIST_GET, H5D_CRT_EXT_FILE_LIST_ENC, H5D_CRT_EXT_FILE_LIST_DEC, H5D_CRT_EXT_FILE_LIST_DEL, H5D_CRT_EXT_FILE_LIST_COPY, H5D_CRT_EXT_FILE_LIST_CMP, H5D_CRT_EXT_FILE_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -3206,10 +3204,10 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) H5T_path_t *tpath; /* Conversion information */ /* Retrieve pointer to datatype */ - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - /* Set the fill value */ + /* Set the fill value */ if(NULL == (fill.type = H5T_copy(type, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy datatype") fill.size = (ssize_t)H5T_get_size(type); diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index 226d206..4a63b36 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -242,7 +242,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, /* Create the new property list class */ orig_pclass = pclass; - if((ret_value = H5P_register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0) + if((ret_value = H5P__register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class"); /* Check if the property class changed and needs to be substituted in the ID */ @@ -255,7 +255,7 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, HDassert(old_pclass == orig_pclass); /* Close the previous class */ - if(H5P_close_class(orig_pclass) < 0) + if(H5P__close_class(orig_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index e6eed32..bfc1d93 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -271,131 +271,131 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the max. temp buffer size property */ - if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &H5D_def_max_temp_buf_g, + if(H5P__register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &H5D_def_max_temp_buf_g, NULL, NULL, NULL, H5D_XFER_MAX_TEMP_BUF_ENC, H5D_XFER_MAX_TEMP_BUF_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the type conversion buffer property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &H5D_def_tconv_buf_g, + if(H5P__register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &H5D_def_tconv_buf_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the background buffer property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &H5D_def_bkgr_buf_g, + if(H5P__register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &H5D_def_bkgr_buf_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the background buffer type property */ - if(H5P_register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &H5D_def_bkgr_buf_type_g, + if(H5P__register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &H5D_def_bkgr_buf_type_g, NULL, NULL, NULL, H5D_XFER_BKGR_BUF_TYPE_ENC, H5D_XFER_BKGR_BUF_TYPE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the B-Tree node splitting ratios property */ - if(H5P_register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, H5D_def_btree_split_ratio_g, + if(H5P__register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, H5D_def_btree_split_ratio_g, NULL, NULL, NULL, H5D_XFER_BTREE_SPLIT_RATIO_ENC, H5D_XFER_BTREE_SPLIT_RATIO_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen allocation function property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &H5D_def_vlen_alloc_g, + if(H5P__register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &H5D_def_vlen_alloc_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen allocation information property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &H5D_def_vlen_alloc_info_g, + if(H5P__register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &H5D_def_vlen_alloc_info_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen free function property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &H5D_def_vlen_free_g, + if(H5P__register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &H5D_def_vlen_free_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vlen free information property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &H5D_def_vlen_free_info_g, + if(H5P__register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &H5D_def_vlen_free_info_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the vector size property */ - if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &H5D_def_hyp_vec_size_g, + if(H5P__register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &H5D_def_hyp_vec_size_g, NULL, NULL, NULL, H5D_XFER_HYPER_VECTOR_SIZE_ENC, H5D_XFER_HYPER_VECTOR_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the I/O transfer mode properties */ - if(H5P_register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &H5D_def_io_xfer_mode_g, + if(H5P__register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &H5D_def_io_xfer_mode_g, NULL, NULL, NULL, H5D_XFER_IO_XFER_MODE_ENC, H5D_XFER_IO_XFER_MODE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &H5D_def_mpio_collective_opt_mode_g, + if(H5P__register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &H5D_def_mpio_collective_opt_mode_g, NULL, NULL, NULL, H5D_XFER_MPIO_COLLECTIVE_OPT_ENC, H5D_XFER_MPIO_COLLECTIVE_OPT_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &H5D_def_mpio_chunk_opt_mode_g, + if(H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &H5D_def_mpio_chunk_opt_mode_g, NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_HARD_ENC, H5D_XFER_MPIO_CHUNK_OPT_HARD_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &H5D_def_mpio_chunk_opt_num_g, + if(H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &H5D_def_mpio_chunk_opt_num_g, NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_NUM_ENC, H5D_XFER_MPIO_CHUNK_OPT_NUM_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &H5D_def_mpio_chunk_opt_ratio_g, + if(H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &H5D_def_mpio_chunk_opt_ratio_g, NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_RATIO_ENC, H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the chunk optimization mode property. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &H5D_def_mpio_actual_chunk_opt_mode_g, + if(H5P__register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &H5D_def_mpio_actual_chunk_opt_mode_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the actual I/O mode property. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &H5D_def_mpio_actual_io_mode_g, + if(H5P__register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &H5D_def_mpio_actual_io_mode_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the local cause of broken collective I/O */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, + if(H5P__register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the global cause of broken collective I/O */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, + if(H5P__register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the EDC property */ - if(H5P_register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &H5D_def_enable_edc_g, + if(H5P__register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &H5D_def_enable_edc_g, NULL, NULL, NULL, H5D_XFER_EDC_ENC, H5D_XFER_EDC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the filter callback property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &H5D_def_filter_cb_g, + if(H5P__register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &H5D_def_filter_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the type conversion callback property */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &H5D_def_conv_cb_g, + if(H5P__register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &H5D_def_conv_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data transform property */ - if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g, + if(H5P__register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g, NULL, H5D_XFER_XFORM_SET, H5D_XFER_XFORM_GET, H5D_XFER_XFORM_ENC, H5D_XFER_XFORM_DEC, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index 73c48d7..8b9962f 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -428,7 +428,7 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, /* Iterate over all properties in property list, encoding them */ idx = 0; - if(H5P_iterate_plist(plist, enc_all_prop, &idx, H5P__encode_cb, &udata) < 0) + if(H5P__iterate_plist(plist, enc_all_prop, &idx, H5P__encode_cb, &udata) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADITER, FAIL, "can't iterate over properties") /* Encode a terminator for list of properties */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 7ba9c11..5320da1 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -398,7 +398,7 @@ static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF; static const unsigned H5F_def_page_buf_min_meta_perc_g = H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF; /* Default page buffer minimum metadata size */ static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer mininum raw data size */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_reg_prop * @@ -419,110 +419,110 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register the initial metadata cache resize configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, + if(H5P__register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache (elements) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, + if(H5P__register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, + if(H5P__register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the preemption for reading chunks */ - if(H5P_register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, + if(H5P__register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the threshold for alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, + if(H5P__register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the alignment */ - if(H5P_register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, + if(H5P__register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum metadata allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, + if(H5P__register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the maximum sieve buffer size */ - if(H5P_register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, + if(H5P__register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the minimum "small data" allocation block size */ - if(H5P_register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, + if(H5P__register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the garbage collection reference */ - if(H5P_register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, + if(H5P__register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file driver ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, + if(H5P__register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, H5F_ACS_FILE_DRV_CRT, H5F_ACS_FILE_DRV_SET, H5F_ACS_FILE_DRV_GET, NULL, NULL, H5F_ACS_FILE_DRV_DEL, H5F_ACS_FILE_DRV_COPY, H5F_ACS_FILE_DRV_CMP, H5F_ACS_FILE_DRV_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file close degree */ - if(H5P_register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, + if(H5P__register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the offset of family driver info */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, + if(H5P__register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of new family file size. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, + if(H5P__register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, + if(H5P__register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the data type of multi driver info */ - if(H5P_register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, + if(H5P__register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 'low' bound of library format versions */ - if(H5P_register_real(pclass, H5F_ACS_LIBVER_LOW_BOUND_NAME, H5F_ACS_LIBVER_LOW_BOUND_SIZE, &H5F_def_libver_low_bound_g, + if(H5P__register_real(pclass, H5F_ACS_LIBVER_LOW_BOUND_NAME, H5F_ACS_LIBVER_LOW_BOUND_SIZE, &H5F_def_libver_low_bound_g, NULL, NULL, NULL, H5F_ACS_LIBVER_LOW_BOUND_ENC, H5F_ACS_LIBVER_LOW_BOUND_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 'high' bound of library format versions */ - if(H5P_register_real(pclass, H5F_ACS_LIBVER_HIGH_BOUND_NAME, H5F_ACS_LIBVER_HIGH_BOUND_SIZE, &H5F_def_libver_high_bound_g, + if(H5P__register_real(pclass, H5F_ACS_LIBVER_HIGH_BOUND_NAME, H5F_ACS_LIBVER_HIGH_BOUND_SIZE, &H5F_def_libver_high_bound_g, NULL, NULL, NULL, H5F_ACS_LIBVER_HIGH_BOUND_ENC, H5F_ACS_LIBVER_HIGH_BOUND_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -530,116 +530,116 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) /* Register the private property of whether to retrieve the file descriptor from the core VFD */ /* (used internally to the library only) */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, + if(H5P__register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the external file cache size */ - if(H5P_register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, + if(H5P__register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the initial file image info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, + if(H5P__register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, NULL, H5F_ACS_FILE_IMAGE_INFO_SET, H5F_ACS_FILE_IMAGE_INFO_GET, NULL, NULL, H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the core VFD backing store write tracking flag */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g, + if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the core VFD backing store page size */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g, + if(H5P__register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the # of read attempts */ - if(H5P_register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, + if(H5P__register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object flush callback */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, + if(H5P__register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to clear the superblock status_flags. It's used by h5clear only. */ - if(H5P_register_real(pclass, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, H5F_ACS_CLEAR_STATUS_FLAGS_SIZE, &H5F_def_clear_status_flags_g, + if(H5P__register_real(pclass, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, H5F_ACS_CLEAR_STATUS_FLAGS_SIZE, &H5F_def_clear_status_flags_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to skip EOF check. It's used by h5clear only. */ - if(H5P_register_real(pclass, H5F_ACS_SKIP_EOF_CHECK_NAME, H5F_ACS_SKIP_EOF_CHECK_SIZE, &H5F_def_skip_eof_check_g, + if(H5P__register_real(pclass, H5F_ACS_SKIP_EOF_CHECK_NAME, H5F_ACS_SKIP_EOF_CHECK_SIZE, &H5F_def_skip_eof_check_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the private property of whether to drop free-space to the floor. It's used by h5clear only. */ - if(H5P_register_real(pclass, H5F_ACS_NULL_FSM_ADDR_NAME, H5F_ACS_NULL_FSM_ADDR_SIZE, &H5F_def_null_fsm_addr_g, + if(H5P__register_real(pclass, H5F_ACS_NULL_FSM_ADDR_NAME, H5F_ACS_NULL_FSM_ADDR_SIZE, &H5F_def_null_fsm_addr_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata cache logging flag. */ - if(H5P_register_real(pclass, H5F_ACS_USE_MDC_LOGGING_NAME, H5F_ACS_USE_MDC_LOGGING_SIZE, &H5F_def_use_mdc_logging_g, + if(H5P__register_real(pclass, H5F_ACS_USE_MDC_LOGGING_NAME, H5F_ACS_USE_MDC_LOGGING_SIZE, &H5F_def_use_mdc_logging_g, NULL, NULL, NULL, H5F_ACS_USE_MDC_LOGGING_ENC, H5F_ACS_USE_MDC_LOGGING_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata cache log location. */ - if(H5P_register_real(pclass, H5F_ACS_MDC_LOG_LOCATION_NAME, H5F_ACS_MDC_LOG_LOCATION_SIZE, &H5F_def_mdc_log_location_g, + if(H5P__register_real(pclass, H5F_ACS_MDC_LOG_LOCATION_NAME, H5F_ACS_MDC_LOG_LOCATION_SIZE, &H5F_def_mdc_log_location_g, NULL, NULL, NULL, H5F_ACS_MDC_LOG_LOCATION_ENC, H5F_ACS_MDC_LOG_LOCATION_DEC, H5F_ACS_MDC_LOG_LOCATION_DEL, H5F_ACS_MDC_LOG_LOCATION_COPY, H5F_ACS_MDC_LOG_LOCATION_CMP, H5F_ACS_MDC_LOG_LOCATION_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the flag that indicates whether mdc logging starts on file access. */ - if(H5P_register_real(pclass, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, H5F_ACS_START_MDC_LOG_ON_ACCESS_SIZE, &H5F_def_start_mdc_log_on_access_g, + if(H5P__register_real(pclass, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, H5F_ACS_START_MDC_LOG_ON_ACCESS_SIZE, &H5F_def_start_mdc_log_on_access_g, NULL, NULL, NULL, H5F_ACS_START_MDC_LOG_ON_ACCESS_ENC, H5F_ACS_START_MDC_LOG_ON_ACCESS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the evict on close flag */ - if(H5P_register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, + if(H5P__register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, + if(H5P__register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective write flag */ - if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, + if(H5P__register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #endif /* H5_HAVE_PARALLEL */ /* Register the initial metadata cache image configuration */ - if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, + if(H5P__register_real(pclass, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE, &H5F_def_mdc_initCacheImageCfg_g, NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, + if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer minimum metadata size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, + if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the page buffer minimum raw data size */ - if(H5P_register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, + if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -648,7 +648,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_reg_prop() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_alignment * @@ -706,7 +706,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pget_alignment * @@ -747,7 +747,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_alignment() */ - + /*------------------------------------------------------------------------- * Function: H5P_set_driver * @@ -795,7 +795,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_set_driver() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_driver * @@ -838,7 +838,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_driver() */ - + /*------------------------------------------------------------------------- * Function: H5P_peek_driver * @@ -882,7 +882,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_peek_driver() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_driver * @@ -923,7 +923,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_driver() */ - + /*------------------------------------------------------------------------- * Function: H5P_peek_driver_info * @@ -965,7 +965,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_peek_driver_info() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_driver_info * @@ -1005,7 +1005,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_driver_info() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_driver_copy * @@ -1071,7 +1071,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_driver_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_driver_free * @@ -1123,7 +1123,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_driver_free() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_create * @@ -1152,7 +1152,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_create() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_set * @@ -1185,7 +1185,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_set() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_get * @@ -1218,7 +1218,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_get() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_del * @@ -1247,7 +1247,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_del() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_copy * @@ -1276,7 +1276,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_cmp * @@ -1335,7 +1335,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_driver_close * @@ -1364,7 +1364,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_driver_close() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_family_offset * @@ -1403,7 +1403,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_family_offset() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_family_offset * @@ -1444,7 +1444,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_family_offset() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_multi_type * @@ -1483,7 +1483,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_multi_type() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_multi_type * @@ -1524,7 +1524,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_multi_type() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_cache * @@ -1578,7 +1578,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_cache() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_cache * @@ -1630,7 +1630,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_cache() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_mdc_image_config * @@ -1674,7 +1674,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_mdc_image_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_mdc_image_config * @@ -1725,7 +1725,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_mdc_image_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_mdc_config * @@ -1769,7 +1769,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_mdc_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_mdc_config * @@ -1820,7 +1820,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_mdc_config() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_gc_references * @@ -1873,7 +1873,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pget_gc_references * @@ -1916,7 +1916,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pset_fclose_degree * @@ -1952,7 +1952,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_fclose_degree() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_fclose_degree * @@ -1987,7 +1987,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_fclose_degree() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_meta_block_size * @@ -2038,7 +2038,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pget_meta_block_size * @@ -2082,7 +2082,7 @@ done: FUNC_LEAVE_API(ret_value) } - + /*------------------------------------------------------------------------- * Function: H5Pset_sieve_buf_size * @@ -2133,7 +2133,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_sieve_buf_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_sieve_buf_size * @@ -2176,7 +2176,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_sieve_buf_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_small_data_block_size * @@ -2222,7 +2222,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_small_data_block_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_small_data_block_size * @@ -2261,7 +2261,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_small_data_block_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_libver_bounds * @@ -2403,14 +2403,14 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_libver_bounds() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_libver_bounds * - * Purpose: Returns the current settings for the library version format bounds - * from a file access property list. + * Purpose: Returns the current settings for the library version format bounds + * from a file access property list. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, January 3, 2008 @@ -2446,7 +2446,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_libver_bounds() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_elink_file_cache_size * @@ -2484,7 +2484,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_elink_file_cache_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_elink_file_cache_size * @@ -2523,7 +2523,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_elink_file_cache_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_file_image * @@ -2604,7 +2604,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_file_image() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_file_image * @@ -2693,7 +2693,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_file_image */ - + /*------------------------------------------------------------------------- * Function: H5Pset_file_image_callbacks * @@ -2770,7 +2770,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_file_image_callbacks() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_file_image_callbacks * @@ -2826,7 +2826,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_file_image_callbacks() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_image_info_copy * @@ -2904,7 +2904,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_image_info_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__file_image_info_free * @@ -2959,7 +2959,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_image_info_free() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_image_config_cmp * @@ -3002,7 +3002,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_image_config_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_image_config_enc * @@ -3048,7 +3048,7 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_cache_image_config_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_image_config_dec * @@ -3100,7 +3100,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_image_config_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_set * @@ -3133,7 +3133,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_set() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_get * @@ -3166,7 +3166,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_get() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_del * @@ -3197,7 +3197,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_del() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_copy * @@ -3227,7 +3227,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_cmp * @@ -3286,7 +3286,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_file_image_info_close * @@ -3316,7 +3316,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_file_image_info_close() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_config_cmp * @@ -3428,7 +3428,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_config_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_config_enc * @@ -3573,7 +3573,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_cache_config_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_cache_config_dec * @@ -3708,7 +3708,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_cache_config_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_fclose_degree_enc * @@ -3746,7 +3746,7 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_fclose_degree_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_fclose_degree_dec * @@ -3781,7 +3781,7 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_fclose_degree_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_multi_type_enc * @@ -3819,7 +3819,7 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_multi_type_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_multi_type_dec * @@ -3854,7 +3854,7 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__facc_multi_type_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P__facc_libver_type_enc * @@ -3966,7 +3966,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_core_write_tracking() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_core_write_tracking * @@ -4008,7 +4008,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_core_write_tracking() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_metadata_read_attempts * @@ -4051,7 +4051,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_metadata_read_attempts() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_metadata_read_attempts * @@ -4092,7 +4092,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_metadata_read_attempts() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_obj_flush_cb * @@ -4136,7 +4136,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pset_obj_flush_cb() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_obj_flush_cb * @@ -4177,7 +4177,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_obj_flush_cb() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_mdc_log_options * @@ -4229,7 +4229,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_mdc_log_options() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_mdc_log_options * @@ -4284,7 +4284,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_mdc_log_options() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_enc * @@ -4337,7 +4337,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_enc() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_dec * @@ -4391,7 +4391,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_facc_mdc_log_location_dec() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_del * @@ -4414,7 +4414,7 @@ H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_del() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_copy * @@ -4436,7 +4436,7 @@ H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_copy() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_cmp * @@ -4468,7 +4468,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_facc_mdc_log_location_cmp() */ - + /*------------------------------------------------------------------------- * Function: H5P_facc_mdc_log_location_close * @@ -4491,7 +4491,7 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P_facc_mdc_log_location_close() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_evict_on_close * @@ -4539,7 +4539,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_evict_on_close() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_evict_on_close * @@ -4583,7 +4583,7 @@ done: } /* end H5Pget_evict_on_close() */ #ifdef H5_HAVE_PARALLEL - + /*------------------------------------------------------------------------- * Function: H5P__encode_coll_md_read_flag_t * @@ -4621,7 +4621,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__encode_coll_md_read_flag_t() */ - + /*------------------------------------------------------------------------- * Function: H5P__decode_coll_md_read_flag_t * @@ -4655,7 +4655,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__decode_coll_md_read_flag_t() */ - + /*------------------------------------------------------------------------- * Function: H5Pset_all_coll_metadata_ops * @@ -4714,7 +4714,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_all_coll_metadata_ops() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_all_coll_metadata_ops * @@ -4772,7 +4772,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Pget_all_coll_metadata_ops */ - + /*------------------------------------------------------------------------- * Function: H5Pset_coll_metadata_write * @@ -4811,7 +4811,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_coll_metadata_write() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_coll_metadata_write * @@ -4849,7 +4849,7 @@ done: } /* end H5Pget_coll_metadata_write() */ #endif /* H5_HAVE_PARALLEL */ - + /*------------------------------------------------------------------------- * Function: H5Pset_page_buffer_size * @@ -4897,7 +4897,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_page_buffer_size() */ - + /*------------------------------------------------------------------------- * Function: H5Pget_page_buffer_size * diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index f90dae5..56af8b1 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -36,7 +36,6 @@ #include "H5Bprivate.h" /* B-tree subclass names */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ -#include "H5SMprivate.h" /* Shared object header messages */ #include "H5Ppkg.h" /* Property lists */ @@ -213,85 +212,85 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT /* Register the user block size */ - if(H5P_register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g, + if(H5P__register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g, NULL, NULL, NULL, H5F_CRT_USER_BLOCK_ENC, H5F_CRT_USER_BLOCK_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 1/2 rank for symbol table leaf nodes */ - if(H5P_register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &H5F_def_sym_leaf_k_g, + if(H5P__register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &H5F_def_sym_leaf_k_g, NULL, NULL, NULL, H5F_CRT_SYM_LEAF_ENC, H5F_CRT_SYM_LEAF_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the 1/2 rank for btree internal nodes */ - if(H5P_register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, H5F_def_btree_k_g, + if(H5P__register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, H5F_def_btree_k_g, NULL, NULL, NULL, H5F_CRT_BTREE_RANK_ENC, H5F_CRT_BTREE_RANK_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the byte number for an address */ - if(H5P_register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &H5F_def_sizeof_addr_g, + if(H5P__register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &H5F_def_sizeof_addr_g, NULL, NULL, NULL, H5F_CRT_ADDR_BYTE_NUM_ENC, H5F_CRT_ADDR_BYTE_NUM_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the byte number for object size */ - if(H5P_register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &H5F_def_sizeof_size_g, + if(H5P__register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &H5F_def_sizeof_size_g, NULL, NULL, NULL, H5F_CRT_OBJ_BYTE_NUM_ENC, H5F_CRT_OBJ_BYTE_NUM_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the superblock version number */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &H5F_def_superblock_ver_g, + if(H5P__register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &H5F_def_superblock_ver_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the shared OH message information */ - if(H5P_register_real(pclass, H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &H5F_def_num_sohm_indexes_g, + if(H5P__register_real(pclass, H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &H5F_def_num_sohm_indexes_g, NULL, NULL, NULL, H5F_CRT_SHMSG_NINDEXES_ENC, H5F_CRT_SHMSG_NINDEXES_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g, + if(H5P__register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g, NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_TYPES_ENC, H5F_CRT_SHMSG_INDEX_TYPES_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g, + if(H5P__register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g, NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_MINSIZE_ENC, H5F_CRT_SHMSG_INDEX_MINSIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the shared OH cutoff size information */ - if(H5P_register_real(pclass, H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &H5F_def_sohm_list_max_g, + if(H5P__register_real(pclass, H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &H5F_def_sohm_list_max_g, NULL, NULL, NULL, H5F_CRT_SHMSG_LIST_MAX_ENC, H5F_CRT_SHMSG_LIST_MAX_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g, + if(H5P__register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g, NULL, NULL, NULL, H5F_CRT_SHMSG_BTREE_MIN_ENC, H5F_CRT_SHMSG_BTREE_MIN_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file space handling strategy */ - if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &H5F_def_file_space_strategy_g, + if(H5P__register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &H5F_def_file_space_strategy_g, NULL, NULL, NULL, H5F_CRT_FILE_SPACE_STRATEGY_ENC, H5F_CRT_FILE_SPACE_STRATEGY_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the free-space persist flag */ - if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_PERSIST_NAME, H5F_CRT_FREE_SPACE_PERSIST_SIZE, &H5F_def_free_space_persist_g, + if(H5P__register_real(pclass, H5F_CRT_FREE_SPACE_PERSIST_NAME, H5F_CRT_FREE_SPACE_PERSIST_SIZE, &H5F_def_free_space_persist_g, NULL, NULL, NULL, H5F_CRT_FREE_SPACE_PERSIST_ENC, H5F_CRT_FREE_SPACE_PERSIST_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the free space section threshold */ - if(H5P_register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g, + if(H5P__register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g, NULL, NULL, NULL, H5F_CRT_FREE_SPACE_THRESHOLD_ENC, H5F_CRT_FREE_SPACE_THRESHOLD_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file space page size */ - if(H5P_register_real(pclass, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE, &H5F_def_file_space_page_size_g, + if(H5P__register_real(pclass, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE, &H5F_def_file_space_page_size_g, NULL, NULL, NULL, H5F_CRT_FILE_SPACE_PAGE_SIZE_ENC, H5F_CRT_FILE_SPACE_PAGE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c index e858a79..1e39749 100644 --- a/src/H5Pfmpl.c +++ b/src/H5Pfmpl.c @@ -124,7 +124,7 @@ H5P_fmnt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT /* Register property of whether symlinks is local to file */ - if(H5P_register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g, + if(H5P__register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 6f1fab1..e2fdcea 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -32,12 +32,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Ppkg.h" /* Property lists */ /****************/ @@ -133,13 +133,13 @@ H5P__gcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register group info property */ - if(H5P_register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g, + if(H5P__register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g, NULL, NULL, NULL, H5G_CRT_GROUP_INFO_ENC, H5G_CRT_GROUP_INFO_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register link info property */ - if(H5P_register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g, + if(H5P__register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g, NULL, NULL, NULL, H5G_CRT_LINK_INFO_ENC, H5G_CRT_LINK_INFO_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pint.c b/src/H5Pint.c index 6a0cc14..179f883 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -100,11 +100,23 @@ typedef herr_t (*H5P_do_pclass_op_t)(H5P_genplist_t *plist, const char *name, H5 /********************/ /* General helper routines */ -static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type); -static herr_t H5P_free_prop(H5P_genprop_t *prop); -static int H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2); +static H5P_genplist_t *H5P__create(H5P_genclass_t *pclass); +static H5P_genprop_t *H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type, + const void *value, H5P_prp_create_func_t prp_create, + H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, + H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, + H5P_prp_delete_func_t prp_delete, + H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, + H5P_prp_close_func_t prp_close); +static H5P_genprop_t *H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type); +static herr_t H5P__free_prop(H5P_genprop_t *prop); +static int H5P__cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2); static herr_t H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op, H5P_do_pclass_op_t pclass_op, void *udata); +static int H5P__open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key); +static H5P_genprop_t *H5P__find_prop_pclass(H5P_genclass_t *pclass, const char *name); +static herr_t H5P__free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data); +static herr_t H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data); /*********************/ @@ -336,7 +348,7 @@ static const H5I_class_t H5I_GENPROPCLS_CLS[1] = {{ H5I_GENPROP_CLS, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5P_close_class /* Callback routine for closing objects of this class */ + (H5I_free_t)H5P__close_class /* Callback routine for closing objects of this class */ }}; /* Generic Property List ID class */ @@ -425,7 +437,7 @@ H5P__init_package(void) HDassert(lib_class->par_pclass || lib_class == H5P_CLS_ROOT); /* Allocate the new class */ - if(NULL == (*lib_class->pclass = H5P_create_class(lib_class->par_pclass ? *lib_class->par_pclass : NULL, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data))) + if(NULL == (*lib_class->pclass = H5P__create_class(lib_class->par_pclass ? *lib_class->par_pclass : NULL, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") /* Call routine to register properties for class */ @@ -626,14 +638,14 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed") /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") /* Copy the changed value into the new property */ HDmemcpy(pcopy->value, tmp_value, prop->size); /* Insert the changed property into the property list */ - if(H5P_add_prop(slist, pcopy) < 0) + if(H5P__add_prop(slist, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into skip list") done: @@ -644,7 +656,7 @@ done: /* Cleanup on failure */ if(ret_value < 0) if(pcopy) - H5P_free_prop(pcopy); + H5P__free_prop(pcopy); FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__do_prop_cb1() */ @@ -652,11 +664,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_copy_pclass + H5P__copy_pclass PURPOSE Internal routine to copy a generic property class USAGE - hid_t H5P_copy_pclass(pclass) + hid_t H5P__copy_pclass(pclass) H5P_genclass_t *pclass; IN: Property class to copy RETURNS Success: valid property class ID on success (non-negative) @@ -671,13 +683,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_copy_pclass(H5P_genclass_t *pclass) +H5P__copy_pclass(H5P_genclass_t *pclass) { H5P_genclass_t *new_pclass = NULL; /* Property list class copied */ H5P_genprop_t *pcopy; /* Copy of property to insert into class */ H5P_genclass_t *ret_value=NULL; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); @@ -686,7 +698,7 @@ H5P_copy_pclass(H5P_genclass_t *pclass) */ /* Create the new property list class */ - if(NULL == (new_pclass = H5P_create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) + if(NULL == (new_pclass = H5P__create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class") /* Copy the properties registered for this class */ @@ -697,11 +709,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass) curr_node=H5SL_first(pclass->props); while(curr_node!=NULL) { /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) + if(NULL == (pcopy = H5P__dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL,"Can't copy property") /* Insert the initialized property into the property list */ - if(H5P_add_prop(new_pclass->props,pcopy) < 0) + if(H5P__add_prop(new_pclass->props,pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, NULL,"Can't insert property into class") /* Increment property count for class */ @@ -716,11 +728,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass) ret_value=new_pclass; done: - if(ret_value==NULL && new_pclass) - H5P_close_class(new_pclass); + if(NULL == ret_value && new_pclass) + H5P__close_class(new_pclass); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_copy_pclass() */ +} /* H5P__copy_pclass() */ /*-------------------------------------------------------------------------- @@ -733,7 +745,7 @@ done: hid_t old_plist_id; IN: Property list ID to copy RETURNS Success: valid property list ID on success (non-negative) - Failure: negative + Failure: H5I_INVALID_HID DESCRIPTION Copy a property list and return the ID. This routine calls the class 'copy' callback after any property 'copy' callbacks are called @@ -756,9 +768,9 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) H5SL_t *seen=NULL; /* Skip list containing properties already seen */ size_t nseen; /* Number of items 'seen' */ hbool_t has_parent_class; /* Flag to indicate that this property list's class has a parent */ - hid_t ret_value=FAIL; /* return value */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) HDassert(old_plist); @@ -768,7 +780,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Allocate room for the property list */ if(NULL==(new_plist = H5FL_CALLOC(H5P_genplist_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,"memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Set class state */ new_plist->pclass = old_plist->pclass; @@ -777,80 +789,80 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Initialize the skip list to hold the changed properties */ if((new_plist->props = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for changed properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for changed properties") /* Create the skip list for deleted properties */ if((new_plist->del = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for deleted properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for deleted properties") /* Create the skip list to hold names of properties already seen * (This prevents a property in the class hierarchy from having it's * 'create' callback called, if a property in the class hierarchy has * already been seen) */ - if((seen = H5SL_create(H5SL_TYPE_STR, NULL))== NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties") + if((seen = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for seen properties") nseen = 0; /* Cycle through the deleted properties & copy them into the new list's deleted section */ - if(H5SL_count(old_plist->del)>0) { - curr_node=H5SL_first(old_plist->del); + if(H5SL_count(old_plist->del) > 0) { + curr_node = H5SL_first(old_plist->del); while(curr_node) { char *new_name; /* Pointer to new name */ /* Duplicate string for insertion into new deleted property skip list */ - if((new_name=H5MM_xstrdup((char *)H5SL_item(curr_node))) == NULL) - HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed") + if((new_name = H5MM_xstrdup((char *)H5SL_item(curr_node))) == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Insert property name into deleted list */ if(H5SL_insert(new_plist->del,new_name,new_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into deleted skip list") /* Add property name to "seen" list */ if(H5SL_insert(seen,new_name,new_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list") nseen++; /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end if */ /* Cycle through the properties and copy them also */ - if(H5SL_count(old_plist->props)>0) { - curr_node=H5SL_first(old_plist->props); + if(H5SL_count(old_plist->props) > 0) { + curr_node = H5SL_first(old_plist->props); while(curr_node) { /* Get a pointer to the node's property */ tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Make a copy of the list's property */ - if(NULL == (new_prop = H5P_dup_prop(tmp, H5P_PROP_WITHIN_LIST))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") + if(NULL == (new_prop = H5P__dup_prop(tmp, H5P_PROP_WITHIN_LIST))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property") /* Call property copy callback, if it exists */ if(new_prop->copy) { if((new_prop->copy)(new_prop->name,new_prop->size,new_prop->value) < 0) { - H5P_free_prop(new_prop); - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") + H5P__free_prop(new_prop); + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property") } /* end if */ } /* end if */ /* Insert the initialized property into the property list */ - if(H5P_add_prop(new_plist->props,new_prop) < 0) { - H5P_free_prop(new_prop); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list") + if(H5P__add_prop(new_plist->props,new_prop) < 0) { + H5P__free_prop(new_prop); + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "Can't insert property into list") } /* end if */ /* Add property name to "seen" list */ if(H5SL_insert(seen,new_prop->name,new_prop->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list") nseen++; /* Increment the number of properties in list */ new_plist->nprops++; /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end if */ @@ -860,27 +872,27 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) */ tclass=old_plist->pclass; has_parent_class = (hbool_t)(tclass != NULL && tclass->parent != NULL && tclass->parent->nprops > 0); - while(tclass!=NULL) { + while(tclass != NULL) { if(tclass->nprops>0) { /* Walk through the properties in the old class */ - curr_node=H5SL_first(tclass->props); + curr_node = H5SL_first(tclass->props); while(curr_node!=NULL) { /* Get pointer to property from node */ tmp = (H5P_genprop_t *)H5SL_item(curr_node); /* Only "copy" properties we haven't seen before */ - if(nseen==0 || H5SL_search(seen,tmp->name) == NULL) { + if(nseen == 0 || H5SL_search(seen,tmp->name) == NULL) { /* Call property copy callback, if it exists */ if(tmp->copy) { /* Call the callback & insert changed value into skip list (if necessary) */ if(H5P__do_prop_cb1(new_plist->props, tmp, tmp->copy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't create property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't create property") } /* end if */ /* Add property name to "seen" list, if we have other classes to work on */ if(has_parent_class) { if(H5SL_insert(seen,tmp->name,tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert property into seen skip list") nseen++; } /* end if */ @@ -889,24 +901,24 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) } /* end if */ /* Get the next property node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end if */ /* Go up to parent class */ - tclass=tclass->parent; + tclass = tclass->parent; } /* end while */ /* Increment the number of property lists derived from class */ - if(H5P_access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't increment class ref count") + if(H5P__access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ref count") /* Get an atom for the property list */ if((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list") /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ - new_plist->plist_id=new_plist_id; + new_plist->plist_id = new_plist_id; /* Call the class callback (if it exists) now that we have the property list ID * (up through chain of parent classes also) @@ -917,7 +929,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) if((tclass->copy_func)(new_plist_id, old_plist->plist_id, old_plist->pclass->copy_data) < 0) { /* Delete ID, ignore return value */ H5I_remove(new_plist_id); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property") } /* end if */ } /* end if */ @@ -933,10 +945,10 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) done: /* Release the list of 'seen' properties */ - if(seen!=NULL) + if(seen != NULL) H5SL_close(seen); - if(ret_value<0 && new_plist) + if(H5I_INVALID_HID == ret_value && new_plist) H5P_close(new_plist); FUNC_LEAVE_NOAPI(ret_value) @@ -945,11 +957,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_dup_prop + H5P__dup_prop PURPOSE Internal routine to duplicate a property USAGE - H5P_genprop_t *H5P_dup_prop(oprop) + H5P_genprop_t *H5P__dup_prop(oprop) H5P_genprop_t *oprop; IN: Pointer to property to copy H5P_prop_within_t type; IN: Type of object the property will be inserted into RETURNS @@ -963,12 +975,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genprop_t * -H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) +H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) { H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(oprop); HDassert(type != H5P_PROP_WITHIN_UNKNOWN); @@ -1037,16 +1049,16 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_dup_prop() */ +} /* H5P__dup_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_create_prop + H5P__create_prop PURPOSE Internal routine to create a new property USAGE - H5P_genprop_t *H5P_create_prop(name,size,type,value,prp_create,prp_set, + H5P_genprop_t *H5P__create_prop(name,size,type,value,prp_create,prp_set, prp_get,prp_delete,prp_close, prp_encode, prp_decode) const char *name; IN: Name of property to register size_t size; IN: Size of property in bytes @@ -1074,7 +1086,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genprop_t * -H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, +H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type, const void *value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, @@ -1085,7 +1097,7 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(name); HDassert((size > 0 && value != NULL) || (size == 0)); @@ -1141,16 +1153,16 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_create_prop() */ +} /* H5P__create_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_add_prop + H5P__add_prop PURPOSE Internal routine to insert a property into a property skip list USAGE - herr_t H5P_add_prop(slist, prop) + herr_t H5P__add_prop(slist, prop) H5SL_t *slist; IN/OUT: Pointer to skip list of properties H5P_genprop_t *prop; IN: Pointer to property to insert RETURNS @@ -1163,11 +1175,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_add_prop(H5SL_t *slist, H5P_genprop_t *prop) +H5P__add_prop(H5SL_t *slist, H5P_genprop_t *prop) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(slist); HDassert(prop); @@ -1179,7 +1191,7 @@ H5P_add_prop(H5SL_t *slist, H5P_genprop_t *prop) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_add_prop() */ +} /* H5P__add_prop() */ /*-------------------------------------------------------------------------- @@ -1244,11 +1256,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_find_prop_pclass + H5P__find_prop_pclass PURPOSE Internal routine to check for a property in a class skip list USAGE - H5P_genprop_t *H5P_find_prop_class(pclass, name) + H5P_genprop_t *H5P__find_prop_class(pclass, name) H5P_genclass *pclass; IN: Pointer generic property class to check const char *name; IN: Name of property to check for RETURNS @@ -1261,11 +1273,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genprop_t * -H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name) +H5P__find_prop_pclass(H5P_genclass_t *pclass, const char *name) { H5P_genprop_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pclass); HDassert(name); @@ -1276,16 +1288,16 @@ H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_find_prop_pclass() */ +} /* H5P__find_prop_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_free_prop + H5P__free_prop PURPOSE Internal routine to destroy a property node USAGE - herr_t H5P_free_prop(prop) + herr_t H5P__free_prop(prop) H5P_genprop_t *prop; IN: Pointer to property to destroy RETURNS Returns non-negative on success, negative on failure. @@ -1298,9 +1310,9 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P_free_prop(H5P_genprop_t *prop) +H5P__free_prop(H5P_genprop_t *prop) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(prop); @@ -1315,16 +1327,16 @@ H5P_free_prop(H5P_genprop_t *prop) prop = H5FL_FREE(H5P_genprop_t, prop); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5P_free_prop() */ +} /* H5P__free_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_free_prop_cb + H5P__free_prop_cb PURPOSE Internal routine to properties from a property skip list USAGE - herr_t H5P_free_prop_cb(item, key, op_data) + herr_t H5P__free_prop_cb(item, key, op_data) void *item; IN/OUT: Pointer to property void *key; IN/OUT: Pointer to property key void *_make_cb; IN: Whether to make property callbacks or not @@ -1339,12 +1351,12 @@ H5P_free_prop(H5P_genprop_t *prop) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) +H5P__free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) { H5P_genprop_t *tprop=(H5P_genprop_t *)item; /* Temporary pointer to property */ hbool_t make_cb = *(hbool_t *)op_data; /* Whether to make property 'close' callback */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(tprop); @@ -1353,19 +1365,19 @@ H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) (tprop->close)(tprop->name, tprop->size, tprop->value); /* Free the property, ignoring return value, nothing we can do */ - H5P_free_prop(tprop); + H5P__free_prop(tprop); FUNC_LEAVE_NOAPI(0) -} /* H5P_free_prop_cb() */ +} /* H5P__free_prop_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_free_del_name_cb + H5P__free_del_name_cb PURPOSE Internal routine to free 'deleted' property name USAGE - herr_t H5P_free_del_name_cb(item, key, op_data) + herr_t H5P__free_del_name_cb(item, key, op_data) void *item; IN/OUT: Pointer to deleted name void *key; IN/OUT: Pointer to key void *op_data; IN: Operator callback data (unused) @@ -1379,11 +1391,11 @@ H5P_free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) +H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) { char *del_name=(char *)item; /* Temporary pointer to deleted name */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(del_name); @@ -1391,17 +1403,17 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED * H5MM_xfree(del_name); FUNC_LEAVE_NOAPI(0) -} /* H5P_free_del_name_cb() */ +} /* H5P__free_del_name_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_access_class + H5P__access_class PURPOSE - Internal routine to increment or decrement list & class dependencies on a + Internal routine to increment or decrement list & class dependancies on a property list class USAGE - herr_t H5P_access_class(pclass,mod) + herr_t H5P__access_class(pclass,mod) H5P_genclass_t *pclass; IN: Pointer to class to modify H5P_class_mod_t mod; IN: Type of modification to class RETURNS @@ -1417,9 +1429,9 @@ H5P_free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED * REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) +H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass); HDassert(mod > H5P_MOD_ERR && mod < H5P_MOD_MAX); @@ -1473,27 +1485,27 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) if(pclass->props) { hbool_t make_cb = FALSE; - H5SL_destroy(pclass->props, H5P_free_prop_cb, &make_cb); + H5SL_destroy(pclass->props, H5P__free_prop_cb, &make_cb); } /* end if */ pclass = H5FL_FREE(H5P_genclass_t, pclass); /* Reduce the number of dependent classes on parent class also */ if(par_class != NULL) - H5P_access_class(par_class, H5P_MOD_DEC_CLS); + H5P__access_class(par_class, H5P_MOD_DEC_CLS); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5P_access_class() */ +} /* H5P__access_class() */ /*-------------------------------------------------------------------------- NAME - H5P_open_class_path_cb + H5P__open_class_path_cb PURPOSE Internal callback routine to check for duplicated names in parent class. USAGE - int H5P_open_class_path_cb(obj, id, key) + int H5P__open_class_path_cb(obj, id, key) H5P_genclass_t *obj; IN: Pointer to class hid_t id; IN: ID of object being looked at const void *key; IN: Pointer to information used to compare @@ -1509,13 +1521,13 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) REVISION LOG --------------------------------------------------------------------------*/ static int -H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) +H5P__open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) { H5P_genclass_t *obj = (H5P_genclass_t *)_obj; /* Pointer to the class for this ID */ H5P_check_class_t *key = (H5P_check_class_t *)_key; /* Pointer to key information for comparison */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(obj); HDassert(H5I_GENPROP_CLS == H5I_get_type(id)); @@ -1531,16 +1543,16 @@ H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_open_class_path_cb() */ +} /* end H5P__open_class_path_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_create_class + H5P__create_class PURPOSE Internal routine to create a new property list class. USAGE - H5P_genclass_t H5P_create_class(par_class, name, type, + H5P_genclass_t H5P__create_class(par_class, name, type, cls_create, create_data, cls_close, close_data) H5P_genclass_t *par_class; IN: Pointer to parent class const char *name; IN: Name of class we are creating @@ -1568,7 +1580,7 @@ H5P_open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, +H5P__create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data) @@ -1576,7 +1588,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t H5P_genclass_t *pclass = NULL; /* Property list class created */ H5P_genclass_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_PACKAGE HDassert(name); /* Allow internal classes to break some rules */ @@ -1614,7 +1626,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t /* Increment parent class's derived class value */ if(par_class != NULL) { - if(H5P_access_class(par_class, H5P_MOD_INC_CLS) < 0) + if(H5P__access_class(par_class, H5P_MOD_INC_CLS) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL, "Can't increment parent class ref count") } /* end if */ @@ -1630,22 +1642,22 @@ done: if(pclass->props) { hbool_t make_cb = FALSE; - H5SL_destroy(pclass->props, H5P_free_prop_cb, &make_cb); + H5SL_destroy(pclass->props, H5P__free_prop_cb, &make_cb); } /* end if */ pclass = H5FL_FREE(H5P_genclass_t, pclass); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_create_class() */ +} /* H5P__create_class() */ /*-------------------------------------------------------------------------- NAME - H5P_create + H5P__create PURPOSE Internal routine to create a new property list of a property list class. USAGE - H5P_genplist_t *H5P_create(class) + H5P_genplist_t *H5P__create(class) H5P_genclass_t *class; IN: Property list class create list from RETURNS Returns a pointer to the newly created property list on success, @@ -1665,7 +1677,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static H5P_genplist_t * -H5P_create(H5P_genclass_t *pclass) +H5P__create(H5P_genclass_t *pclass) { H5P_genclass_t *tclass; /* Temporary class pointer */ H5P_genplist_t *plist = NULL; /* New property list created */ @@ -1673,7 +1685,7 @@ H5P_create(H5P_genclass_t *pclass) H5SL_t *seen = NULL; /* Skip list to hold names of properties already seen */ H5P_genplist_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pclass); @@ -1748,7 +1760,7 @@ H5P_create(H5P_genclass_t *pclass) } /* end while */ /* Increment the number of property lists derived from class */ - if(H5P_access_class(plist->pclass,H5P_MOD_INC_LST) < 0) + if(H5P__access_class(plist->pclass,H5P_MOD_INC_LST) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL,"Can't increment class ref count") /* Set return value */ @@ -1766,7 +1778,7 @@ done: if(plist->props) { unsigned make_cb=1; - H5SL_destroy(plist->props,H5P_free_prop_cb,&make_cb); + H5SL_destroy(plist->props, H5P__free_prop_cb, &make_cb); } /* end if */ /* Close the deleted property skip list */ @@ -1779,7 +1791,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_create() */ +} /* H5P__create() */ /*-------------------------------------------------------------------------- @@ -1791,7 +1803,7 @@ done: hid_t H5P_create_id(pclass) H5P_genclass_t *pclass; IN: Property list class create list from RETURNS - Returns a valid property list ID on success, FAIL on failure. + Returns a valid property list ID on success, H5I_INVALID_HID on failure. DESCRIPTION Creates a property list of a given class. If a 'create' callback exists for the property list class, it is called before the @@ -1812,20 +1824,20 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) hid_t plist_id = FAIL; /* Property list ID */ hid_t ret_value = H5I_INVALID_HID; /* return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) HDassert(pclass); /* Create the new property list */ - if((plist=H5P_create(pclass)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list") + if((plist = H5P__create(pclass)) == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list") /* Get an atom for the property list */ if((plist_id = H5I_register(H5I_GENPROP_LST, plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize property list") /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ - plist->plist_id=plist_id; + plist->plist_id = plist_id; /* Call the class callback (if it exists) now that we have the property list ID * (up through chain of parent classes also) @@ -1836,7 +1848,7 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) if((tclass->create_func)(plist_id, tclass->create_data) < 0) { /* Delete ID, ignore return value */ H5I_remove(plist_id); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Can't initialize property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property") } /* end if */ } /* end if */ @@ -1848,10 +1860,10 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) plist->class_init = TRUE; /* Set the return value */ - ret_value=plist_id; + ret_value = plist_id; done: - if(ret_value<0 && plist) + if(H5I_INVALID_HID == ret_value && plist) H5P_close(plist); FUNC_LEAVE_NOAPI(ret_value) @@ -1860,11 +1872,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_register_real + H5P__register_real PURPOSE Internal routine to register a new property in a property list class. USAGE - herr_t H5P_register_real(class, name, size, default, prp_create, prp_set, + herr_t H5P__register_real(class, name, size, default, prp_create, prp_set, prp_get, prp_close, prp_encode, prp_decode) H5P_genclass_t *class; IN: Property list class to modify const char *name; IN: Name of property to register @@ -2043,7 +2055,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, +H5P__register_real(H5P_genclass_t *pclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, @@ -2054,7 +2066,7 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, H5P_genprop_t *new_prop = NULL; /* Temporary property pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE HDassert(pclass); HDassert(0 == pclass->plists); @@ -2067,13 +2079,13 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists") /* Create property object from parameters */ - if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_CLASS, + if(NULL == (new_prop = H5P__create_prop(name, size, H5P_PROP_WITHIN_CLASS, def_value, prp_create, prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property") /* Insert property into property list class */ - if(H5P_add_prop(pclass->props, new_prop) < 0) + if(H5P__add_prop(pclass->props, new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ @@ -2084,20 +2096,20 @@ H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, done: if(ret_value < 0) - if(new_prop && H5P_free_prop(new_prop) < 0) + if(new_prop && H5P__free_prop(new_prop) < 0) HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property") FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_register_real() */ +} /* H5P__register_real() */ /*-------------------------------------------------------------------------- NAME - H5P_register + H5P__register PURPOSE Internal routine to register a new property in a property list class. USAGE - herr_t H5P_register(class, name, size, default, prp_create, prp_set, prp_get, prp_close) + herr_t H5P__register(class, name, size, default, prp_create, prp_set, prp_get, prp_close) H5P_genclass_t **class; IN: Property list class to modify const char *name; IN: Name of property to register size_t size; IN: Size of property in bytes @@ -2275,7 +2287,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, +H5P__register(H5P_genclass_t **ppclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, @@ -2287,7 +2299,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, H5P_genclass_t *new_class = NULL; /* New class pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(ppclass); @@ -2297,7 +2309,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, * been created since the last modification was made to the class. */ if(pclass->plists > 0 || pclass->classes > 0) { - if(NULL == (new_class = H5P_create_class(pclass->parent, pclass->name, + if(NULL == (new_class = H5P__create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) @@ -2313,11 +2325,11 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, H5P_genprop_t *pcopy; /* Property copy */ /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) + if(NULL == (pcopy = H5P__dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") /* Insert the initialized property into the property class */ - if(H5P_add_prop(new_class->props, pcopy) < 0) + if(H5P__add_prop(new_class->props, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ @@ -2333,7 +2345,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, } /* end if */ /* Really register the property in the class */ - if(H5P_register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get, + if(H5P__register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't register property") @@ -2343,11 +2355,11 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size, done: if(ret_value < 0) - if(new_class && H5P_close_class(new_class) < 0) + if(new_class && H5P__close_class(new_class) < 0) HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close new property class") FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_register() */ +} /* H5P__register() */ /*-------------------------------------------------------------------------- @@ -2570,13 +2582,13 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, /* Ok to add to property list */ /* Create property object from parameters */ - if(NULL == (new_prop = H5P_create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL, + if(NULL == (new_prop = H5P__create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL, prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property") /* Insert property into property list class */ - if(H5P_add_prop(plist->props, new_prop) < 0) + if(H5P__add_prop(plist->props, new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class") /* Increment property count for class */ @@ -2584,7 +2596,7 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, done: if(ret_value < 0) - if(new_prop && H5P_free_prop(new_prop) < 0) + if(new_prop && H5P__free_prop(new_prop) < 0) HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property") FUNC_LEAVE_NOAPI(ret_value) @@ -2764,20 +2776,20 @@ H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") HDmemcpy(pcopy->value, udata->value, pcopy->size); /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props, pcopy) < 0) + if(H5P__add_prop(plist->props, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") done: /* Cleanup on failure */ if(ret_value < 0) if(pcopy) - H5P_free_prop(pcopy); + H5P__free_prop(pcopy); FUNC_LEAVE_NOAPI(ret_value) } /* H5P__poke_pclass_cb() */ @@ -2970,13 +2982,13 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, prp_value = udata->value; /* Make a copy of the class's property */ - if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + if(NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") HDmemcpy(pcopy->value, prp_value, pcopy->size); /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props, pcopy) < 0) + if(H5P__add_prop(plist->props, pcopy) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") done: @@ -2987,7 +2999,7 @@ done: /* Cleanup on failure */ if(ret_value < 0) if(pcopy) - H5P_free_prop(pcopy); + H5P__free_prop(pcopy); FUNC_LEAVE_NOAPI(ret_value) } /* H5P__set_pclass_cb() */ @@ -3109,11 +3121,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_exist_pclass + H5P__exist_pclass PURPOSE Internal routine to query the existance of a property in a property class. USAGE - herr_t H5P_exist_pclass(pclass, name) + herr_t H5P__exist_pclass(pclass, name) H5P_genclass_t *pclass; IN: Property class to check const char *name; IN: Name of property to check for RETURNS @@ -3129,11 +3141,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5P_exist_pclass(H5P_genclass_t *pclass, const char *name) +H5P__exist_pclass(H5P_genclass_t *pclass, const char *name) { htri_t ret_value = FAIL; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass); HDassert(name); @@ -3159,16 +3171,16 @@ H5P_exist_pclass(H5P_genclass_t *pclass, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_exist_pclass() */ +} /* H5P__exist_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_get_size_plist + H5P__get_size_plist PURPOSE Internal routine to query the size of a property in a property list. USAGE - herr_t H5P_get_size_plist(plist, name) + herr_t H5P__get_size_plist(plist, name) const H5P_genplist_t *plist; IN: Property list to check const char *name; IN: Name of property to query size_t *size; OUT: Size of property @@ -3185,12 +3197,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) +H5P__get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) { H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(plist); HDassert(name); @@ -3205,16 +3217,16 @@ H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_size_plist() */ +} /* H5P__get_size_plist() */ /*-------------------------------------------------------------------------- NAME - H5P_get_size_pclass + H5P__get_size_pclass PURPOSE Internal routine to query the size of a property in a property class. USAGE - herr_t H5P_get_size_pclass(pclass, name) + herr_t H5P__get_size_pclass(pclass, name) H5P_genclass_t *pclass; IN: Property class to check const char *name; IN: Name of property to query size_t *size; OUT: Size of property @@ -3231,36 +3243,36 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size) +H5P__get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size) { H5P_genprop_t *prop; /* Temporary property pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); HDassert(name); HDassert(size); /* Find property */ - if((prop=H5P_find_prop_pclass(pclass,name)) == NULL) + if((prop = H5P__find_prop_pclass(pclass,name)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") /* Get property size */ - *size=prop->size; + *size = prop->size; done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_size_pclass() */ +} /* H5P__get_size_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_get_nprops_plist + H5P__get_nprops_plist PURPOSE Internal routine to query the number of properties in a property list USAGE - herr_t H5P_get_nprops_plist(plist, nprops) + herr_t H5P__get_nprops_plist(plist, nprops) H5P_genplist_t *plist; IN: Property list to check size_t *nprops; OUT: Number of properties in the property list RETURNS @@ -3275,9 +3287,9 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) +H5P__get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(plist); HDassert(nprops); @@ -3286,7 +3298,7 @@ H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) *nprops = plist->nprops; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5P_get_nprops_plist() */ +} /* H5P__get_nprops_plist() */ /*-------------------------------------------------------------------------- @@ -3337,11 +3349,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_cmp_prop + H5P__cmp_prop PURPOSE Internal routine to compare two generic properties USAGE - int H5P_cmp_prop(prop1, prop2) + int H5P__cmp_prop(prop1, prop2) H5P_genprop_t *prop1; IN: 1st property to compare H5P_genprop_t *prop1; IN: 2nd property to compare RETURNS @@ -3358,12 +3370,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static int -H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) +H5P__cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) { int cmp_value; /* Value from comparison */ int ret_value = 0; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(prop1); HDassert(prop2); @@ -3432,16 +3444,16 @@ H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_cmp_prop() */ +} /* H5P__cmp_prop() */ /*-------------------------------------------------------------------------- NAME - H5P_cmp_class + H5P__cmp_class PURPOSE Internal routine to compare two generic property classes USAGE - int H5P_cmp_class(pclass1, pclass2) + int H5P__cmp_class(pclass1, pclass2) H5P_genclass_t *pclass1; IN: 1st property class to compare H5P_genclass_t *pclass2; IN: 2nd property class to compare RETURNS @@ -3458,13 +3470,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) +H5P__cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) { H5SL_node_t *tnode1, *tnode2; /* Temporary pointer to property nodes */ int cmp_value; /* Value from comparison */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass1); HDassert(pclass2); @@ -3528,7 +3540,7 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) /* Compare the two properties */ prop1 = (H5P_genprop_t *)H5SL_item(tnode1); prop2 = (H5P_genprop_t *)H5SL_item(tnode2); - if((cmp_value = H5P_cmp_prop(prop1, prop2)) != 0) + if((cmp_value = H5P__cmp_prop(prop1, prop2)) != 0) HGOTO_DONE(cmp_value); /* Advance the pointers */ @@ -3538,7 +3550,7 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_cmp_class() */ +} /* H5P__cmp_class() */ /*-------------------------------------------------------------------------- @@ -3588,7 +3600,7 @@ H5P__cmp_plist_cb(H5P_genprop_t *prop, void *_udata) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5_ITER_ERROR, "property doesn't exist") /* Compare the two properties */ - if((udata->cmp_value = H5P_cmp_prop(prop, prop2)) != 0) + if((udata->cmp_value = H5P__cmp_prop(prop, prop2)) != 0) HGOTO_DONE(H5_ITER_STOP); } /* end if */ else { @@ -3604,11 +3616,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_cmp_plist + H5P__cmp_plist PURPOSE Internal routine to compare two generic property lists USAGE - herr_t H5P_cmp_plist(plist1, plist2, cmp_ret) + herr_t H5P__cmp_plist(plist1, plist2, cmp_ret) H5P_genplist_t *plist1; IN: 1st property list to compare H5P_genplist_t *plist2; IN: 2nd property list to compare int *cmp_ret; OUT: Comparison value for two property lists @@ -3627,14 +3639,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, +H5P__cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, int *cmp_ret) { H5P_plist_cmp_ud_t udata; /* User data for callback */ int idx = 0; /* Index of property to begin with */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(plist1); HDassert(plist2); @@ -3665,7 +3677,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, udata.plist2 = plist2; /* Iterate over properties in first property list */ - if((ret_value = H5P_iterate_plist(plist1, TRUE, &idx, H5P__cmp_plist_cb, &udata)) < 0) + if((ret_value = H5P__iterate_plist(plist1, TRUE, &idx, H5P__cmp_plist_cb, &udata)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list") if(ret_value != 0) { *cmp_ret = udata.cmp_value; @@ -3673,7 +3685,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, } /* end if */ /* Check the parent classes */ - if((*cmp_ret = H5P_cmp_class(plist1->pclass, plist2->pclass)) != 0) + if((*cmp_ret = H5P__cmp_class(plist1->pclass, plist2->pclass)) != 0) HGOTO_DONE(SUCCEED); /* Property lists must be equal, set comparison value to 0 */ @@ -3681,7 +3693,7 @@ H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_cmp_plist() */ +} /* H5P__cmp_plist() */ /*-------------------------------------------------------------------------- @@ -3718,7 +3730,7 @@ H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) HDassert(pclass2); /* Compare property classes */ - if(H5P_cmp_class(pclass1, pclass2) == 0) { + if(H5P__cmp_class(pclass1, pclass2) == 0) { HGOTO_DONE(TRUE); } else { /* Check if the class is derived, and walk up the chain, if so */ @@ -3931,11 +3943,11 @@ H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata) /*-------------------------------------------------------------------------- NAME - H5P_iterate_plist + H5P__iterate_plist PURPOSE Internal routine to iterate over the properties in a property list USAGE - int H5P_iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data) + int H5P__iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data) const H5P_genplist_t *plist; IN: Property list to iterate over hbool_t iter_all_prop; IN: Whether to iterate over all properties (TRUE), or just non-default (i.e. changed) @@ -3984,7 +3996,7 @@ iteration, the function's behavior is undefined. REVISION LOG --------------------------------------------------------------------------*/ int -H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, +H5P__iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, H5P_iterate_int_t cb_func, void *udata) { H5P_genclass_t *tclass; /* Temporary class pointer */ @@ -3993,7 +4005,7 @@ H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, int curr_idx = 0; /* Current iteration index */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(plist); @@ -4042,7 +4054,7 @@ done: H5SL_close(seen); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_iterate_plist() */ +} /* H5P__iterate_plist() */ /*-------------------------------------------------------------------------- @@ -4098,11 +4110,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_iterate_pclass + H5P__iterate_pclass PURPOSE Internal routine to iterate over the properties in a property class USAGE - herr_t H5P_iterate_pclass(pclass, idx, cb_func, iter_data) + herr_t H5P__iterate_pclass(pclass, idx, cb_func, iter_data) const H5P_genpclass_t *pclass; IN: Property list class to iterate over int *idx; IN/OUT: Index of the property to begin with H5P_iterate_t cb_func; IN: Function pointer to function to be @@ -4148,14 +4160,14 @@ iteration, the function's behavior is undefined. REVISION LOG --------------------------------------------------------------------------*/ int -H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, +H5P__iterate_pclass(const H5P_genclass_t *pclass, int *idx, H5P_iterate_int_t cb_func, void *udata) { H5P_iter_pclass_ud_t udata_int; /* User data for skip list iterator */ int curr_idx = 0; /* Current iteration index */ int ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(pclass); @@ -4178,7 +4190,7 @@ done: *idx = curr_idx; FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_iterate_pclass() */ +} /* H5P__iterate_pclass() */ /*-------------------------------------------------------------------------- @@ -4450,7 +4462,7 @@ H5P__del_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from skip list") /* Free the property, ignoring return value, nothing we can do */ - H5P_free_prop(prop); + H5P__free_prop(prop); /* Decrement the number of properties in list */ plist->nprops--; @@ -4586,11 +4598,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_copy_prop_plist + H5P__copy_prop_plist PURPOSE Internal routine to copy a property from one list to another USAGE - herr_t H5P_copy_prop_plist(dst_plist, src_plist, name) + herr_t H5P__copy_prop_plist(dst_plist, src_plist, name) hid_t dst_id; IN: ID of destination property list or class hid_t src_id; IN: ID of source property list or class const char *name; IN: Name of property to copy @@ -4616,7 +4628,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) +H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) { H5P_genplist_t *dst_plist; /* Pointer to destination property list */ H5P_genplist_t *src_plist; /* Pointer to source property list */ @@ -4624,7 +4636,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) H5P_genprop_t *new_prop=NULL; /* Pointer to new property */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(name); @@ -4642,7 +4654,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) prop = H5P__find_prop_plist(src_plist, name); /* Make a copy of the source property */ - if((new_prop=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) + if((new_prop = H5P__dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") /* Call property copy callback, if it exists */ @@ -4652,7 +4664,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) } /* end if */ /* Insert the initialized property into the property list */ - if(H5P_add_prop(dst_plist->props,new_prop) < 0) + if(H5P__add_prop(dst_plist->props,new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into list") /* Increment the number of properties in list */ @@ -4664,7 +4676,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) prop = H5P__find_prop_plist(src_plist, name); /* Create property object from parameters */ - if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value, + if(NULL == (new_prop = H5P__create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value, prop->create, prop->set, prop->get, prop->encode, prop->decode, prop->del, prop->copy, prop->cmp, prop->close))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL,"Can't create property") @@ -4676,7 +4688,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) } /* end if */ /* Insert property into property list class */ - if(H5P_add_prop(dst_plist->props, new_prop) < 0) + if(H5P__add_prop(dst_plist->props, new_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into class") /* Increment property count for class */ @@ -4685,22 +4697,22 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) done: /* Cleanup, if necessary */ - if(ret_value<0) { - if(new_prop!=NULL) - H5P_free_prop(new_prop); + if(ret_value < 0) { + if(new_prop != NULL) + H5P__free_prop(new_prop); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_copy_prop_plist() */ +} /* H5P__copy_prop_plist() */ /*-------------------------------------------------------------------------- NAME - H5P_copy_prop_pclass + H5P__copy_prop_pclass PURPOSE Internal routine to copy a property from one class to another USAGE - herr_t H5P_copy_prop_pclass(dst_pclass, src_pclass, name) + herr_t H5P__copy_prop_pclass(dst_pclass, src_pclass, name) H5P_genclass_t *dst_pclass; IN: Pointer to destination class H5P_genclass_t *src_pclass; IN: Pointer to source class const char *name; IN: Name of property to copy @@ -4724,7 +4736,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) +H5P__copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) { H5P_genclass_t *src_pclass; /* Source property class, containing property to copy */ H5P_genclass_t *dst_pclass; /* Destination property class */ @@ -4732,7 +4744,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(name); @@ -4744,19 +4756,19 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "destination property class object doesn't exist") /* Get the property from the source */ - if(NULL == (prop = H5P_find_prop_pclass(src_pclass, name))) + if(NULL == (prop = H5P__find_prop_pclass(src_pclass, name))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to locate property") /* If the property exists in the destination already */ - if(H5P_exist_pclass(dst_pclass, name)) { + if(H5P__exist_pclass(dst_pclass, name)) { /* Delete the old property from the destination class */ - if(H5P_unregister(dst_pclass, name) < 0) + if(H5P__unregister(dst_pclass, name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") } /* end if */ /* Register the property into the destination */ orig_dst_pclass = dst_pclass; - if(H5P_register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get, + if(H5P__register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get, prop->encode, prop->decode, prop->del, prop->copy, prop->cmp, prop->close) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") @@ -4770,7 +4782,7 @@ H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) HDassert(old_dst_pclass == orig_dst_pclass); /* Close the previous class */ - if(H5P_close_class(old_dst_pclass) < 0) + if(H5P__close_class(old_dst_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close original property class after substitution") } /* end if */ @@ -4778,16 +4790,16 @@ done: /* Cleanup, if necessary */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_copy_prop_pclass() */ +} /* H5P__copy_prop_pclass() */ /*-------------------------------------------------------------------------- NAME - H5P_unregister + H5P__unregister PURPOSE Internal routine to remove a property from a property list class. USAGE - herr_t H5P_unregister(pclass, name) + herr_t H5P__unregister(pclass, name) H5P_genclass_t *pclass; IN: Property list class to modify const char *name; IN: Name of property to remove RETURNS @@ -4803,12 +4815,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_unregister(H5P_genclass_t *pclass, const char *name) +H5P__unregister(H5P_genclass_t *pclass, const char *name) { H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); HDassert(name); @@ -4822,7 +4834,7 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name) HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from skip list") /* Free the property, ignoring return value, nothing we can do */ - H5P_free_prop(prop); + H5P__free_prop(prop); /* Decrement the number of registered properties in class */ pclass->nprops--; @@ -4832,7 +4844,7 @@ H5P_unregister(H5P_genclass_t *pclass, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_unregister() */ +} /* H5P__unregister() */ /*-------------------------------------------------------------------------- @@ -4982,18 +4994,18 @@ H5P_close(void *_plist) } /* end while */ /* Decrement class's dependent property list value! */ - if(H5P_access_class(plist->pclass,H5P_MOD_DEC_LST) < 0) + if(H5P__access_class(plist->pclass,H5P_MOD_DEC_LST) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't decrement class ref count") /* Free the list of 'seen' properties */ H5SL_close(seen); - seen=NULL; + seen = NULL; /* Free the list of deleted property names */ - H5SL_destroy(plist->del,H5P_free_del_name_cb,NULL); + H5SL_destroy(plist->del, H5P__free_del_name_cb, NULL); /* Free the properties */ - H5SL_destroy(plist->props,H5P_free_prop_cb,&make_cb); + H5SL_destroy(plist->props, H5P__free_prop_cb, &make_cb); /* Destroy property list object */ plist = H5FL_FREE(H5P_genplist_t, plist); @@ -5046,11 +5058,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_get_class_path + H5P__get_class_path PURPOSE Internal routine to query the full path of a generic property list class USAGE - char *H5P_get_class_name(pclass) + char *H5P__get_class_name(pclass) H5P_genclass_t *pclass; IN: Property list class to check RETURNS Success: Pointer to a malloc'ed string containing the full path of class @@ -5066,11 +5078,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ char * -H5P_get_class_path(H5P_genclass_t *pclass) +H5P__get_class_path(H5P_genclass_t *pclass) { char *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(pclass); @@ -5079,7 +5091,7 @@ H5P_get_class_path(H5P_genclass_t *pclass) char *par_path; /* Parent class's full path */ /* Get the parent class's path */ - par_path = H5P_get_class_path(pclass->parent); + par_path = H5P__get_class_path(pclass->parent); if(par_path != NULL) { size_t ret_str_len; @@ -5104,16 +5116,16 @@ H5P_get_class_path(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_class_path() */ +} /* H5P__get_class_path() */ /*-------------------------------------------------------------------------- NAME - H5P_open_class_path + H5P__open_class_path PURPOSE Internal routine to open [a copy of] a class with its full path name USAGE - H5P_genclass_t *H5P_open_class_path(path) + H5P_genclass_t *H5P__open_class_path(path) const char *path; IN: Full path name of class to open [copy of] RETURNS Success: Pointer to a generic property class object @@ -5127,7 +5139,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_open_class_path(const char *path) +H5P__open_class_path(const char *path) { char *tmp_path = NULL; /* Temporary copy of the path */ char *curr_name; /* Pointer to current component of path name */ @@ -5136,7 +5148,7 @@ H5P_open_class_path(const char *path) H5P_check_class_t check_info; /* Structure to hold the information for checking duplicate names */ H5P_genclass_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE HDassert(path); @@ -5157,8 +5169,8 @@ H5P_open_class_path(const char *path) check_info.new_class = NULL; /* Find the class with this name & parent by iterating over the open classes */ - if(H5I_iterate(H5I_GENPROP_CLS, H5P_open_class_path_cb, &check_info, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes") + if(H5I_iterate(H5I_GENPROP_CLS, H5P__open_class_path_cb, &check_info, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes") else if(NULL == check_info.new_class) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class") @@ -5175,13 +5187,13 @@ H5P_open_class_path(const char *path) check_info.new_class = NULL; /* Find the class with this name & parent by iterating over the open classes */ - if(H5I_iterate(H5I_GENPROP_CLS, H5P_open_class_path_cb, &check_info, FALSE) < 0) + if(H5I_iterate(H5I_GENPROP_CLS, H5P__open_class_path_cb, &check_info, FALSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes") else if(NULL == check_info.new_class) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class") /* Copy it */ - if(NULL == (ret_value = H5P_copy_pclass(check_info.new_class))) + if(NULL == (ret_value = H5P__copy_pclass(check_info.new_class))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "can't copy property class") done: @@ -5189,16 +5201,16 @@ done: H5MM_xfree(tmp_path); FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_open_class_path() */ +} /* H5P__open_class_path() */ /*-------------------------------------------------------------------------- NAME - H5P_get_class_parent + H5P__get_class_parent PURPOSE Internal routine to query the parent class of a generic property class USAGE - H5P_genclass_t *H5P_get_class_parent(pclass) + H5P_genclass_t *H5P__get_class_parent(pclass) H5P_genclass_t *pclass; IN: Property class to check RETURNS Success: Pointer to the parent class of a property class @@ -5212,11 +5224,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5P_genclass_t * -H5P_get_class_parent(const H5P_genclass_t *pclass) +H5P__get_class_parent(const H5P_genclass_t *pclass) { H5P_genclass_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(pclass); @@ -5224,16 +5236,16 @@ H5P_get_class_parent(const H5P_genclass_t *pclass) ret_value = pclass->parent; FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get_class_parent() */ +} /* H5P__get_class_parent() */ /*-------------------------------------------------------------------------- NAME - H5P_close_class + H5P__close_class PURPOSE Internal routine to close a property list class. USAGE - herr_t H5P_close_class(class) + herr_t H5P__close_class(class) H5P_genclass_t *class; IN: Property list class to close RETURNS Returns non-negative on success, negative on failure. @@ -5245,7 +5257,7 @@ H5P_get_class_parent(const H5P_genclass_t *pclass) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_close_class(void *_pclass) +H5P__close_class(void *_pclass) { H5P_genclass_t *pclass = (H5P_genclass_t *)_pclass; herr_t ret_value = SUCCEED; /* Return value */ @@ -5255,12 +5267,12 @@ H5P_close_class(void *_pclass) HDassert(pclass); /* Decrement the reference count & check if the object should go away */ - if(H5P_access_class(pclass, H5P_MOD_DEC_REF) < 0) + if(H5P__access_class(pclass, H5P_MOD_DEC_REF) < 0) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't decrement ID ref count") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_close_class() */ +} /* H5P__close_class() */ /*------------------------------------------------------------------------- @@ -5269,7 +5281,7 @@ done: * Purpose: Create a new property list, of a given type * * Return: Success: ID of new property list - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * Thursday, August 2, 2012 @@ -5291,9 +5303,9 @@ H5P__new_plist_of_type(H5P_plist_type_t type) /* Check arguments */ if(type == H5P_TYPE_USER) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't create user property list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, H5I_INVALID_HID, "can't create user property list"); if(type == H5P_TYPE_ROOT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "shouldn't be creating root class property list"); + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, H5I_INVALID_HID, "shouldn't be creating root class property list"); /* Instantiate a property list of the proper type */ switch(type) { @@ -5374,11 +5386,11 @@ H5P__new_plist_of_type(H5P_plist_type_t type) /* Get the class object */ if(NULL == (pclass = (H5P_genclass_t *)H5I_object(class_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property class") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property class") /* Create the new property list */ if((ret_value = H5P_create_id(pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5394,7 +5406,7 @@ done: * H5P_genplist_t data structure) * * Return: Success: Non-negative ID of property list. - * Failure: negative. + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * April 22, 2014 @@ -5440,32 +5452,3 @@ H5P_get_class(const H5P_genplist_t *plist) FUNC_LEAVE_NOAPI(plist->pclass) } /* end H5P_get_class() */ - -/*------------------------------------------------------------------------- - * Function: H5P_get_default - * - * Purpose: Get the default property list ID, for a property class. - * - * Return: Success: Non-negative ID of property list. - * Failure: negative. - * - * Programmer: Quincey Koziol - * December 29, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5P_get_default(const H5P_libclass_t *libclass) -{ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_NOAPI(H5I_INVALID_HID) - - HDassert(libclass); - - ret_value = *libclass->def_plist_id; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_default() */ - diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 18b81ac..bedeed9 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -194,38 +194,38 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register property for number of links traversed */ - if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g, + if(H5P__register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g, NULL, NULL, NULL, H5L_ACS_NLINKS_ENC, H5L_ACS_NLINKS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link prefix */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g, + if(H5P__register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g, NULL, H5L_ACS_ELINK_PREFIX_SET, H5L_ACS_ELINK_PREFIX_GET, H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register fapl for link access */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g, + if(H5P__register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g, NULL, H5L_ACS_ELINK_FAPL_SET, H5L_ACS_ELINK_FAPL_GET, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link file access flags */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &H5L_def_elink_flags_g, + if(H5P__register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &H5L_def_elink_flags_g, NULL, NULL, NULL, H5L_ACS_ELINK_FLAGS_ENC, H5L_ACS_ELINK_FLAGS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for external link file traversal callback */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &H5L_def_elink_cb_g, + if(H5P__register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &H5L_def_elink_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g, + if(H5P__register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g, NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -569,7 +569,7 @@ H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_ if(obj1 && obj2) { herr_t status; - status = H5P_cmp_plist(obj1, obj2, &ret_value); + status = H5P__cmp_plist(obj1, obj2, &ret_value); HDassert(status >= 0); } /* end if */ diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 6508a82..1d45bed 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Plcpl.c - * May 8 2006 - * Peter Cao + * Created: H5Plcpl.c * - * Purpose: Link creation property list class routines + * Purpose: Link creation property list class routines * *------------------------------------------------------------------------- */ @@ -32,11 +30,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5Ppkg.h" /* Property lists */ /****************/ @@ -120,12 +118,12 @@ static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF; herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Register create intermediate groups property */ - if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g, + if(H5P__register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g, NULL, NULL, NULL, H5L_CRT_INTERMEDIATE_GROUP_ENC, H5L_CRT_INTERMEDIATE_GROUP_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index be41e32..c2bf6cb 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -165,25 +165,25 @@ H5P__ocrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register max. compact attribute storage property */ - if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g, + if(H5P__register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g, NULL, NULL, NULL, H5O_CRT_ATTR_MAX_COMPACT_ENC, H5O_CRT_ATTR_MAX_COMPACT_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register min. dense attribute storage property */ - if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g, + if(H5P__register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g, NULL, NULL, NULL, H5O_CRT_ATTR_MIN_DENSE_ENC, H5O_CRT_ATTR_MIN_DENSE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register object header flags property */ - if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g, + if(H5P__register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g, NULL, NULL, NULL, H5O_CRT_OHDR_FLAGS_ENC, H5O_CRT_OHDR_FLAGS_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the pipeline property */ - if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, + if(H5P__register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, NULL, H5O_CRT_PIPELINE_SET, H5O_CRT_PIPELINE_GET, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC, H5O_CRT_PIPELINE_DEL, H5O_CRT_PIPELINE_COPY, H5O_CRT_PIPELINE_CMP, H5O_CRT_PIPELINE_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -899,7 +899,7 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, filter = &pline.filter[idx]; /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) + if(H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") /* Set return value */ @@ -952,7 +952,7 @@ H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid") /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) + if(H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") done: @@ -1118,7 +1118,7 @@ H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_filter_by_id() */ +} /* end H5P_filter_in_pline() */ /*------------------------------------------------------------------------- @@ -1292,7 +1292,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_filter + * Function: H5P__get_filter * * Purpose: Internal component of H5Pget_filter & H5Pget_filter_id * @@ -1304,12 +1304,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, +H5P__get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/, unsigned *filter_config /*out*/) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ HDassert(filter); @@ -1364,7 +1364,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, H5Z_get_filter_info(filter->id, filter_config); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_get_filter() */ +} /* end H5P__get_filter() */ /*------------------------------------------------------------------------- @@ -1893,7 +1893,7 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, filter = &pline.filter[idx]; /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) + if(H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") /* Set return value */ diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 47bba05..666a945 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -161,20 +161,20 @@ H5P__ocpy_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register copy options property */ - if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g, + if(H5P__register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g, NULL, NULL, NULL, H5O_CPY_OPTION_ENC, H5O_CPY_OPTION_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register merge named dtype list property */ - if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g, + if(H5P__register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g, NULL, H5O_CPY_MERGE_COMM_DT_LIST_SET, H5O_CPY_MERGE_COMM_DT_LIST_GET, H5O_CPY_MERGE_COMM_DT_LIST_ENC, H5O_CPY_MERGE_COMM_DT_LIST_DEC, H5O_CPY_MERGE_COMM_DT_LIST_DEL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for callback when completing the search for a matching named datatype from the named dtype list */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &H5O_def_mcdt_cb_g, + if(H5P__register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &H5O_def_mcdt_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 19ff7f9..13f3b13 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -129,48 +129,48 @@ struct H5Z_filter_info_t; /******************************/ /* Private functions, not part of the publicly documented API */ -H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, +H5_DLL H5P_genclass_t *H5P__create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data); -H5_DLL H5P_genclass_t *H5P_copy_pclass(H5P_genclass_t *pclass); -H5_DLL herr_t H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, +H5_DLL H5P_genclass_t *H5P__copy_pclass(H5P_genclass_t *pclass); +H5_DLL herr_t H5P__register_real(H5P_genclass_t *pclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); -H5_DLL herr_t H5P_register(H5P_genclass_t **pclass, const char *name, size_t size, +H5_DLL herr_t H5P__register(H5P_genclass_t **pclass, const char *name, size_t size, const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); -H5_DLL herr_t H5P_add_prop(H5SL_t *props, H5P_genprop_t *prop); -H5_DLL herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); -H5_DLL htri_t H5P_exist_pclass(H5P_genclass_t *pclass, const char *name); -H5_DLL herr_t H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, +H5_DLL herr_t H5P__add_prop(H5SL_t *props, H5P_genprop_t *prop); +H5_DLL herr_t H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); +H5_DLL htri_t H5P__exist_pclass(H5P_genclass_t *pclass, const char *name); +H5_DLL herr_t H5P__get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size); -H5_DLL herr_t H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, +H5_DLL herr_t H5P__get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size); -H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops); -H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); -H5_DLL herr_t H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, +H5_DLL herr_t H5P__get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops); +H5_DLL int H5P__cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); +H5_DLL herr_t H5P__cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, int *cmp_ret); -H5_DLL int H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, +H5_DLL int H5P__iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, H5P_iterate_int_t iter_func, void *iter_data); -H5_DLL int H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, +H5_DLL int H5P__iterate_pclass(const H5P_genclass_t *pclass, int *idx, H5P_iterate_int_t iter_func, void *iter_data); -H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name); -H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name); -H5_DLL herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name); -H5_DLL char *H5P_get_class_path(H5P_genclass_t *pclass); -H5_DLL H5P_genclass_t *H5P_open_class_path(const char *path); -H5_DLL H5P_genclass_t *H5P_get_class_parent(const H5P_genclass_t *pclass); -H5_DLL herr_t H5P_close_class(void *_pclass); +H5_DLL herr_t H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name); +H5_DLL herr_t H5P__copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name); +H5_DLL herr_t H5P__unregister(H5P_genclass_t *pclass, const char *name); +H5_DLL char *H5P__get_class_path(H5P_genclass_t *pclass); +H5_DLL H5P_genclass_t *H5P__open_class_path(const char *path); +H5_DLL H5P_genclass_t *H5P__get_class_parent(const H5P_genclass_t *pclass); +H5_DLL herr_t H5P__close_class(void *_pclass); H5_DLL H5P_genprop_t *H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name); H5_DLL hid_t H5P__new_plist_of_type(H5P_plist_type_t type); @@ -194,7 +194,7 @@ H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, siz H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value); /* Private OCPL routines */ -H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter, +H5_DLL herr_t H5P__get_filter(const struct H5Z_filter_info_t *filter, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 1a2bb95..7792671 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -190,7 +190,6 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id); -H5_DLL hid_t H5P_get_default(const H5P_libclass_t *pclass); /* Query internal fields of the property list struct */ H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist); diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index fb91356..45343c6 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -130,7 +130,7 @@ H5P__strcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC /* Register character encoding */ - if(H5P_register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &H5P_def_char_encoding_g, + if(H5P__register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &H5P_def_char_encoding_g, NULL, NULL, NULL, H5P_STRCRT_CHAR_ENCODING_ENC, H5P_STRCRT_CHAR_ENCODING_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 075040d..114b37b 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -68,7 +68,7 @@ H5P__get_class_path_test(hid_t pclass_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property class"); /* Get the property list class path */ - if(NULL == (ret_value = H5P_get_class_path(pclass))) + if(NULL == (ret_value = H5P__get_class_path(pclass))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "unable to query full path of class") done: @@ -109,7 +109,7 @@ H5P__open_class_path_test(const char *path) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid class path"); /* Open the property list class */ - if(NULL == (pclass = H5P_open_class_path(path))) + if(NULL == (pclass = H5P__open_class_path(path))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to find class with full path"); /* Get an atom for the class */ @@ -118,7 +118,7 @@ H5P__open_class_path_test(const char *path) done: if(H5I_INVALID_HID == ret_value && pclass) - H5P_close_class(pclass); + H5P__close_class(pclass); FUNC_LEAVE_NOAPI(ret_value) } /* H5P__open_class_path_test() */ diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index e8ea044..d81dba1 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -15,7 +15,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): not a location ID major: Invalid arguments to routine minor: Inappropriate type - #001: (file name) line (number) in H5G_loc(): invalid object ID + #001: (file name) line (number) in H5G_loc(): invalid location ID major: Invalid arguments to routine minor: Bad value @@ -43,7 +43,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): not a location ID major: Invalid arguments to routine minor: Inappropriate type - #001: (file name) line (number) in H5G_loc(): invalid object ID + #001: (file name) line (number) in H5G_loc(): invalid location ID major: Invalid arguments to routine minor: Bad value -- cgit v0.12 From 30cd579a149acb063e258aac89bbe7fef3f5ac0a Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 24 Sep 2018 08:35:13 -0700 Subject: H5S adjust callbacks now return an herr_t instead of void. --- src/H5S.c | 4 ++-- src/H5Sall.c | 10 +++++----- src/H5Shyper.c | 8 ++++---- src/H5Snone.c | 10 +++++----- src/H5Spkg.h | 2 +- src/H5Spoint.c | 12 ++++++------ src/H5Sprivate.h | 2 +- src/H5Sselect.c | 12 +++++++----- 8 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/H5S.c b/src/H5S.c index 88c2f72..4c11268 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1974,7 +1974,7 @@ done: /*------------------------------------------------------------------------- * Function: H5S_set_extent * - * Purpose: Modify the dimensions of a dataspace. Based on H5S_extend + * Purpose: Modify the dimensions of a dataspace. * * Return: Success: Non-negative * Failure: Negative @@ -2055,7 +2055,7 @@ H5S_has_extent(const H5S_t *ds) /*------------------------------------------------------------------------- * Function: H5S_set_extent_real * - * Purpose: Modify the dimensions of a dataspace. Based on H5S_extend + * Purpose: Modify the dimensions of a dataspace. * * Return: Success: Non-negative * Failure: Negative diff --git a/src/H5Sall.c b/src/H5Sall.c index 28395b1..3b77b98 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -46,7 +46,7 @@ static int H5S__all_unlim_dim(const H5S_t *space); static htri_t H5S__all_is_contiguous(const H5S_t *space); static htri_t H5S__all_is_single(const H5S_t *space); static htri_t H5S__all_is_regular(const H5S_t *space); -static void H5S__all_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S__all_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__all_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S__all_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -785,11 +785,11 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Adjust an "all" selection by subtracting an offset USAGE - void H5S__all_adjust_u(space, offset) + herr_t H5S__all_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves selection by subtracting an offset from it. GLOBAL VARIABLES @@ -797,7 +797,7 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset) { FUNC_ENTER_STATIC_NOERR @@ -806,7 +806,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off HDassert(space); HDassert(offset); - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S__all_adjust_u() */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 7a6d1be..ed3fa45 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -92,7 +92,7 @@ static herr_t H5S__hyper_num_elem_non_unlim(const H5S_t *space, static htri_t H5S__hyper_is_contiguous(const H5S_t *space); static htri_t H5S__hyper_is_single(const H5S_t *space); static htri_t H5S__hyper_is_regular(const H5S_t *space); -static void H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S__hyper_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -4203,7 +4203,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves a hyperslab selection by subtracting an offset from it. GLOBAL VARIABLES @@ -4211,7 +4211,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) { FUNC_ENTER_STATIC_NOERR @@ -4238,7 +4238,7 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) H5S__hyper_span_scratch(space->select.sel_info.hslab->span_lst); } /* end if */ - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_adjust_u() */ diff --git a/src/H5Snone.c b/src/H5Snone.c index a46a71a..a8aaf7e 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -47,7 +47,7 @@ static int H5S__none_unlim_dim(const H5S_t *space); static htri_t H5S_none_is_contiguous(const H5S_t *space); static htri_t H5S_none_is_single(const H5S_t *space); static htri_t H5S_none_is_regular(const H5S_t *space); -static void H5S_none_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S_none_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S_none_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S_none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -744,11 +744,11 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Adjust an "none" selection by subtracting an offset USAGE - void H5S_none_adjust_u(space, offset) + herr_t H5S_none_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves selection by subtracting an offset from it. GLOBAL VARIABLES @@ -756,7 +756,7 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -765,7 +765,7 @@ H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off HDassert(space); HDassert(offset); - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_none_adjust_u() */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 6ded287..d895f40 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -161,7 +161,7 @@ typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space); /* Method to determine if current selection is "regular" */ typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space); /* Method to adjust a selection by an offset */ -typedef void (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset); +typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset); /* Method to construct single element projection onto scalar dataspace */ typedef herr_t (*H5S_sel_project_scalar)(const H5S_t *space, hsize_t *offset); /* Method to construct selection projection onto/into simple dataspace */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index fb8e311..9924920 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -48,7 +48,7 @@ static int H5S__point_unlim_dim(const H5S_t *space); static htri_t H5S_point_is_contiguous(const H5S_t *space); static htri_t H5S_point_is_single(const H5S_t *space); static htri_t H5S_point_is_regular(const H5S_t *space); -static void H5S_point_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S_point_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S_point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); @@ -686,7 +686,7 @@ done: static htri_t H5S_point_is_valid (const H5S_t *space) { - H5S_pnt_node_t *curr; /* Point information nodes */ + H5S_pnt_node_t *curr; /* Point information nodes */ unsigned u; /* Counter */ htri_t ret_value = TRUE; /* Return value */ @@ -1354,11 +1354,11 @@ H5S_point_is_regular(const H5S_t *space) PURPOSE Adjust a "point" selection by subtracting an offset USAGE - void H5S_point_adjust_u(space, offset) + herr_t H5S_point_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves a point selection by subtracting an offset from it. GLOBAL VARIABLES @@ -1366,7 +1366,7 @@ H5S_point_is_regular(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) { H5S_pnt_node_t *node; /* Point node */ @@ -1396,7 +1396,7 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) node = node->next; } /* end while */ - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_adjust_u() */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 15ce75d..32ac51a 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -259,7 +259,7 @@ H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p); H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_select_is_single(const H5S_t *space); H5_DLL htri_t H5S_select_is_regular(const H5S_t *space); -H5_DLL void H5S_select_adjust_u(H5S_t *space, const hsize_t *offset); +H5_DLL herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset); H5_DLL herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset); H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); H5_DLL herr_t H5S_select_project_intersection(const H5S_t *src_space, diff --git a/src/H5Sselect.c b/src/H5Sselect.c index ec74523..2ce3f10 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -893,11 +893,11 @@ H5S_select_is_regular(const H5S_t *space) PURPOSE Adjust a selection by subtracting an offset USAGE - void H5S_select_adjust_u(space, offset) + herr_t H5S_select_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS - None + Non-negative on success, negative on failure DESCRIPTION Moves a selection by subtracting an offset from it. GLOBAL VARIABLES @@ -908,18 +908,20 @@ H5S_select_is_regular(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -void +herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) { + herr_t ret_value = FAIL; /* Return value */ + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(space); HDassert(offset); - (*space->select.type->adjust_u)(space, offset); + ret_value = (*space->select.type->adjust_u)(space, offset); - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_select_adjust_u() */ -- cgit v0.12 From a56b4db4ae25d30e6e7eb96f27d7b91e35148591 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 24 Sep 2018 12:23:41 -0700 Subject: Remainder of vol_normalization changes (dataset, attribute, files, objects). --- src/H5A.c | 532 ++++++++++---------- src/H5Adense.c | 174 +++---- src/H5Adeprec.c | 131 ++--- src/H5Aint.c | 192 ++++---- src/H5Apkg.h | 1 + src/H5D.c | 544 +++++++++++---------- src/H5Dbtree.c | 9 +- src/H5Dbtree2.c | 2 +- src/H5Dchunk.c | 73 ++- src/H5Ddbg.c | 29 +- src/H5Ddeprec.c | 134 +++--- src/H5Dfill.c | 2 +- src/H5Dint.c | 134 +++--- src/H5Dio.c | 59 ++- src/H5Dlayout.c | 4 +- src/H5Dmpio.c | 3 +- src/H5Doh.c | 10 +- src/H5Dpkg.h | 22 +- src/H5Dscatgath.c | 12 +- src/H5Dsingle.c | 8 +- src/H5Dvirtual.c | 8 +- src/H5F.c | 772 ++++++++++++++++++++---------- src/H5Fdeprec.c | 34 +- src/H5Fint.c | 638 ++++++++++++------------ src/H5Fio.c | 6 +- src/H5Fmount.c | 4 +- src/H5Fmpi.c | 12 +- src/H5Fpkg.h | 27 +- src/H5Fprivate.h | 5 +- src/H5Fsfile.c | 54 +-- src/H5Fsuper.c | 115 ++--- src/H5Fsuper_cache.c | 1 - src/H5G.c | 238 +++++---- src/H5Gcompact.c | 33 +- src/H5Gdense.c | 5 +- src/H5Gdeprec.c | 157 +++--- src/H5Gint.c | 68 +-- src/H5Gname.c | 2 +- src/H5Gpkg.h | 1 - src/H5Gprivate.h | 6 +- src/H5Gtraverse.c | 50 +- src/H5L.c | 557 +++++++++++---------- src/H5Lprivate.h | 15 + src/H5O.c | 244 +++++----- src/H5Oalloc.c | 134 +++--- src/H5Oattr.c | 110 ++--- src/H5Oattribute.c | 322 +++++++------ src/H5Obogus.c | 2 +- src/H5Ocache.c | 20 +- src/H5Ochunk.c | 58 +-- src/H5Ocont.c | 38 +- src/H5Ocopy.c | 54 +-- src/H5Odbg.c | 125 +++-- src/H5Odeprec.c | 40 +- src/H5Odtype.c | 14 +- src/H5Ofill.c | 6 +- src/H5Oflush.c | 137 +++--- src/H5Oginfo.c | 4 +- src/H5Oint.c | 166 ++++--- src/H5Olinfo.c | 12 +- src/H5Omessage.c | 84 ++-- src/H5Omtime.c | 4 +- src/H5Opkg.h | 43 +- src/H5Oprivate.h | 12 +- src/H5Oshared.c | 107 +++-- src/H5Oshared.h | 24 +- src/H5Ostab.c | 44 +- src/H5Otest.c | 6 +- src/H5Ounknown.c | 6 +- tools/test/h5dump/errfiles/tattr-3.err | 2 +- tools/test/h5dump/errfiles/tqmarkfile.err | 4 +- tools/testfiles/tstarfile.ddl | 4 +- 72 files changed, 3443 insertions(+), 3266 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index a0408c3..6f810be 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -16,22 +16,21 @@ /****************/ #include "H5Amodule.h" /* This source code file is part of the H5A module */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /* Suppress error about including H5Opkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Sprivate.h" /* Dataspace functions */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Sprivate.h" /* Dataspace functions */ /****************/ @@ -123,7 +122,7 @@ H5A__init_package(void) * Create attribute ID type. */ if(H5I_register_type(H5I_ATTR_CLS) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Mark "top" of interface as initialized, too */ H5A_top_package_initialize_s = TRUE; @@ -216,33 +215,38 @@ H5A_term_package(void) /*-------------------------------------------------------------------------- - NAME - H5Acreate2 - PURPOSE - Creates an attribute on an object - USAGE - hid_t H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, - aapl_id) - hid_t loc_id; IN: Object (dataset or group) to be attached to - const char *attr_name; IN: Name of attribute to locate and open - hid_t type_id; IN: ID of datatype for attribute - hid_t space_id; IN: ID of dataspace for attribute - hid_t acpl_id; IN: ID of creation property list (currently not used) - hid_t aapl_id; IN: Attribute access property list - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function creates an attribute which is attached to the object - specified with 'loc_id'. The name specified with 'attr_name' for - each attribute for an object must be unique for that object. The 'type_id' - and 'space_id' are created with the H5T and H5S interfaces respectively. - The 'aapl_id' property list is currently unused, but will be used in the - future for optional attribute access properties. The attribute ID returned - from this function must be released with H5Aclose or resource leaks will - develop. - ---------------------------------------------------------------------------*/ + * Function: H5Acreate2 + * + * Purpose: Creates an attribute on an object + * + * Usage: + * hid_t H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, + * aapl_id) + * + * Description: This function creates an attribute which is attached to the + * object specified with 'loc_id'. The name specified with + * 'attr_name' for each attribute for an object must be unique + * for that object. The 'type_id' and 'space_id' are created + * with the H5T and H5S interfaces respectively. The 'aapl_id' + * property list is currently unused, but will be used in the + * future for optional attribute access properties. The + * attribute ID returned from this function must be released + * with H5Aclose or resource leaks will develop. + * + * Parameters: + * hid_t loc_id; IN: Object (dataset or group) to be attached to + * const char *attr_name; IN: Name of attribute to locate and open + * hid_t type_id; IN: ID of datatype for attribute + * hid_t space_id; IN: ID of dataspace for attribute + * hid_t acpl_id; IN: ID of creation property list (currently not used) + * hid_t aapl_id; IN: Attribute access property list + * + * Return: Success: An ID for the created attribute + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id) @@ -251,41 +255,44 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE6("i", "i*siiii", loc_id, attr_name, type_id, space_id, acpl_id, aapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") - if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file") + if(!attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be NULL") + if(!*attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be an empty string") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a type") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Go do the real work for attaching the attribute to the object */ + /* Create the attribute */ if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") + 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0 && attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + if(H5I_INVALID_HID == ret_value) + if(attr && H5A__close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Acreate2() */ @@ -308,7 +315,7 @@ done: hid_t aapl_id; IN: Attribute access property list hid_t lapl_id; IN: Link access property list RETURNS - Non-negative on success/Negative on failure + Non-negative on success/H5I_INVALID_HID on failure DESCRIPTION This function creates an attribute which is attached to the object @@ -330,27 +337,27 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE8("i", "i*s*siiiii", loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a type") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) @@ -358,22 +365,23 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); - } /* end if */ + } - /* Create the attribute on the object */ + /* Create the attribute */ if(NULL == (attr = H5A__create_by_name(&loc, obj_name, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") + 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0 && attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + if(H5I_INVALID_HID == ret_value) + if(attr && H5A__close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Acreate_by_name() */ @@ -390,7 +398,7 @@ done: const char *attr_name; IN: Name of attribute to locate and open hid_t aapl_id; IN: Attribute access property list RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -403,36 +411,38 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, attr_name, aapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") + if(!attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*attr_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Read in attribute from object header */ + /* Open the attribute */ if(NULL == (attr = H5A__open(&loc, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name) + 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen() */ @@ -451,7 +461,7 @@ done: hid_t aapl_id; IN: Attribute access property list hid_t lapl_id; IN: Link access property list RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -465,47 +475,48 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*s*sii", loc_id, obj_name, attr_name, aapl_id, lapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Set lapl_id and add to context */ if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); - } /* end if */ + } - /* Open the attribute on the object header */ + /* Open the attribute */ if(NULL == (attr = H5A__open_by_name(&loc, obj_name, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) -} /* H5Aopen_by_name() */ +} /* end H5Aopen_by_name() */ /*-------------------------------------------------------------------------- @@ -524,7 +535,7 @@ done: hid_t aapl_id; IN: Attribute access property list hid_t lapl_id; IN: Link access property list RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -538,47 +549,48 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE7("i", "i*sIiIohii", loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Set lapl_id and add to context */ if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); - } /* end if */ + } - /* Open the attribute in the object header */ + /* Open the attribute */ if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") + 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_by_idx() */ @@ -603,26 +615,26 @@ done: herr_t H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) { - H5A_t *attr; /* Attribute object for ID */ + H5A_t *attr; /* Attribute object for ID */ H5T_t *mem_type; /* Memory datatype */ - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); - /* check arguments */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(NULL == buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(attr_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") - /* Go write the actual data to the attribute */ + /* Write the attribute data */ if((ret_value = H5A__write(attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") @@ -650,22 +662,22 @@ done: herr_t H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) { - H5A_t *attr; /* Attribute object for ID */ + H5A_t *attr; /* Attribute object for ID */ H5T_t *mem_type; /* Memory datatype */ - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); - /* check arguments */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(NULL == buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") - /* Go write the actual data to the attribute */ + /* Read the attribute data */ if((ret_value = H5A__read(attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") @@ -683,7 +695,7 @@ done: hid_t H5Aget_space (attr_id) hid_t attr_id; IN: Attribute to get dataspace of RETURNS - A dataspace ID on success, negative on failure + A dataspace ID on success, H5I_INVALID_HID on failure DESCRIPTION This function retrieves a copy of the dataspace for an attribute. @@ -693,18 +705,20 @@ done: hid_t H5Aget_space(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ - hid_t ret_value; /* Return value */ + H5A_t *attr = NULL; /* Attribute object for ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); - /* check arguments */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + /* Get the dataspace */ if((ret_value = H5A_get_space(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute") + done: FUNC_LEAVE_API(ret_value) } /* H5Aget_space() */ @@ -719,7 +733,7 @@ done: hid_t H5Aget_type (attr_id) hid_t attr_id; IN: Attribute to get datatype of RETURNS - A datatype ID on success, negative on failure + A datatype ID on success, H5I_INVALID_HID on failure DESCRIPTION This function retrieves a copy of the datatype for an attribute. @@ -729,18 +743,19 @@ done: hid_t H5Aget_type(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ - hid_t ret_value; /* Return value */ + H5A_t *attr = NULL; /* Attribute object for ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); - /* check arguments */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + /* Get the datatype */ if((ret_value = H5A__get_type(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute") done: FUNC_LEAVE_API(ret_value) @@ -757,7 +772,7 @@ done: hid_t attr_id; IN: Attribute to get name of RETURNS This function returns the ID of a copy of the attribute's creation - property list, or negative on failure. + property list, or H5I_INVALID_HID on failure. ERRORS @@ -769,20 +784,21 @@ done: hid_t H5Aget_create_plist(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ - hid_t ret_value; + H5A_t *attr = NULL; /* Attribute object for ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); HDassert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1); - /* Get attribute and default attribute creation property list*/ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + /* Get the acpl */ if((ret_value = H5A__get_create_plist(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute") done: FUNC_LEAVE_API(ret_value) @@ -813,21 +829,21 @@ done: ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) { - H5A_t *my_attr; /* Attribute object for ID */ - ssize_t ret_value; + H5A_t *attr = NULL; /* Attribute object for ID */ + ssize_t ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "iz*s", attr_id, buf_size, buf); /* check arguments */ - if(NULL == (my_attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an attribute") if(!buf && buf_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero") - /* Call private function in turn */ - if(0 > (ret_value = H5A__get_name(my_attr, buf_size, buf))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name") + /* Get the attribute name */ + if((ret_value = H5A__get_name(attr, buf_size, buf)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") done: FUNC_LEAVE_API(ret_value) @@ -866,15 +882,15 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Check args */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) @@ -887,12 +903,12 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Get the length of the name */ ret_value = (ssize_t)HDstrlen(attr->shared->name); - /* Copy the name into the user's buffer, if given */ + /* Get the name and store in the user's buffer */ if(name) { HDstrncpy(name, attr->shared->name, MIN((size_t)(ret_value + 1), size)); if((size_t)ret_value >= size) name[size - 1]='\0'; - } /* end if */ + } done: /* Release resources */ @@ -929,11 +945,11 @@ H5Aget_storage_size(hid_t attr_id) FUNC_ENTER_API(0) H5TRACE1("h", "i", attr_id); - /* Check args */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") - /* Set return value */ + /* Get the storage size */ ret_value = attr->shared->data_size; done: @@ -963,13 +979,13 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", attr_id, ainfo); - /* Check args */ + /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* Get the attribute information */ if(H5A__get_info(attr, ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: FUNC_LEAVE_API(ret_value) @@ -1002,13 +1018,13 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Check args */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") @@ -1022,7 +1038,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Get the attribute information */ if(H5A__get_info(attr, ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: /* Release resources */ @@ -1061,15 +1077,15 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Check args */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") @@ -1083,7 +1099,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Get the attribute information */ if(H5A__get_info(attr, ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: /* Release resources */ @@ -1095,12 +1111,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Arename + * Function: H5Arename * * Purpose: Rename an attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * October 23, 2002 @@ -1117,25 +1132,25 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) /* check arguments */ if(!old_name || !new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil") if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_name, new_name)) { H5G_loc_t loc; /* Object location */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") - /* Call private attribute rename routine */ + /* Rename the attribute */ if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } /* end if */ + } done: FUNC_LEAVE_API(ret_value) @@ -1143,12 +1158,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Arename_by_name + * Function: H5Arename_by_name * * Purpose: Rename an attribute * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 20, 2007 @@ -1167,13 +1181,13 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!old_attr_name || !*old_attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name") if(!new_attr_name || !*new_attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { @@ -1183,13 +1197,14 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Get the location object */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Call private attribute rename routine */ + /* Rename the attribute */ if(H5A__rename_by_name(loc, obj_name, old_attr_name, new_attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } /* end if */ + } done: FUNC_LEAVE_API(ret_value) @@ -1248,15 +1263,15 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - /* Call attribute iteration routine */ + /* Iterate over attributes */ if((ret_value = H5A__iterate(loc_id, idx_type, order, idx, op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") done: FUNC_LEAVE_API(ret_value) @@ -1312,7 +1327,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ - herr_t ret_value; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op, @@ -1320,23 +1335,23 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call attribute iteration by name routine */ + /* Iterate over attributes */ if((ret_value = H5A__iterate_by_name(&loc, obj_name, idx_type, order, idx, op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -1361,24 +1376,26 @@ herr_t H5Adelete(hid_t loc_id, const char *name) { H5G_loc_t loc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", loc_id, name); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") - /* Delete the attribute from the location */ + /* Delete the attribute */ if(H5O__attr_remove(loc.oloc, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1413,21 +1430,21 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*s*si", loc_id, obj_name, attr_name, lapl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Delete the attribute from the location */ + /* Delete the attribute */ if(H5A__delete_by_name(&loc, obj_name, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1472,15 +1489,15 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) @@ -1495,21 +1512,17 @@ done: } /* H5Adelete_by_idx() */ -/*-------------------------------------------------------------------------- - NAME - H5Aclose - PURPOSE - Close an attribute ID - USAGE - herr_t H5Aclose (attr_id) - hid_t attr_id; IN: Attribute to release access to - RETURNS - Non-negative on success/Negative on failure - - DESCRIPTION - This function releases an attribute from use. Further use of the - attribute ID will result in undefined behavior. ---------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------- + * Function: H5Aclose + * + * Purpose: Closes access to an attribute and releases resources used by + * it. It is illegal to subsequently use that same dataset + * ID in calls to other attribute functions. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ herr_t H5Aclose(hid_t attr_id) { @@ -1518,7 +1531,7 @@ H5Aclose(hid_t attr_id) FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", attr_id); - /* check arguments */ + /* Check arguments */ if(NULL == H5I_object_verify(attr_id, H5I_ATTR)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") @@ -1554,12 +1567,12 @@ H5Aexists(hid_t obj_id, const char *attr_name) FUNC_ENTER_API(FAIL) H5TRACE2("t", "i*s", obj_id, attr_name); - /* check arguments */ - if (H5I_ATTR == H5I_get_type(obj_id)) + /* Check arguments */ + if(H5I_ATTR == H5I_get_type(obj_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if (H5G_loc(obj_id, &loc) < 0) + if(H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (!attr_name || !*attr_name) + if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Check if the attribute exists */ @@ -1595,20 +1608,21 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5TRACE4("t", "i*s*si", loc_id, obj_name, attr_name, lapl_id); /* check arguments */ - if (H5I_ATTR == H5I_get_type(loc_id)) + if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if (H5G_loc(loc_id, &loc) < 0) + if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if (!obj_name || !*obj_name) + if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") - if (!attr_name || !*attr_name) + if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - if ((ret_value = H5A__exists_by_name(loc, obj_name, attr_name)) < 0) + /* Check existence of attribute */ + if((ret_value = H5A__exists_by_name(loc, obj_name, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5Adense.c b/src/H5Adense.c index 3701022..5bed82d 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -164,11 +164,11 @@ typedef struct H5A_bt2_ud_rmbi_t { /*------------------------------------------------------------------------- - * Function: H5A__dense_create + * Function: H5A__dense_create * - * Purpose: Creates dense attribute storage structures for an object + * Purpose: Creates dense attribute storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -188,9 +188,7 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); @@ -286,11 +284,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_fnd_cb + * Function: H5A__dense_fnd_cb * - * Purpose: Callback when an attribute is located in an index + * Purpose: Callback when an attribute is located in an index * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -305,9 +303,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) FUNC_ENTER_STATIC_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(attr); HDassert(user_attr); @@ -320,11 +316,11 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) /*------------------------------------------------------------------------- - * Function: H5A__dense_open + * Function: H5A__dense_open * - * Purpose: Open an attribute in dense storage structures for an object + * Purpose: Open an attribute in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -345,9 +341,7 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(name); @@ -411,11 +405,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_insert + * Function: H5A__dense_insert * - * Purpose: Insert an attribute into dense storage structures for an object + * Purpose: Insert an attribute into dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -439,9 +433,7 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(attr); @@ -570,13 +562,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_write_bt2_cb2 + * Function: H5A__dense_write_bt2_cb2 * - * Purpose: v2 B-tree 'modify' callback to update the record for a creation - * order index + * Purpose: v2 B-tree 'modify' callback to update the record for a creation + * order index * - * Return: Success: 0 - * Failure: 1 + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, February 20, 2007 @@ -591,9 +582,7 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed) FUNC_ENTER_STATIC_NOERR - /* - * Check arguments. - */ + /* Check arguments */ HDassert(record); HDassert(new_heap_id); @@ -608,12 +597,11 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed) /*------------------------------------------------------------------------- - * Function: H5A__dense_write_bt2_cb + * Function: H5A__dense_write_bt2_cb * - * Purpose: v2 B-tree 'modify' callback to update the data for an attribute + * Purpose: v2 B-tree 'modify' callback to update the data for an attribute * - * Return: Success: 0 - * Failure: 1 + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -632,9 +620,7 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) FUNC_ENTER_STATIC - /* - * Check arguments. - */ + /* Check arguments */ HDassert(record); HDassert(op_data); @@ -722,11 +708,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_write + * Function: H5A__dense_write * - * Purpose: Modify an attribute in dense storage structures for an object + * Purpose: Modify an attribute in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -747,9 +733,7 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(H5F_addr_defined(ainfo->fheap_addr)); @@ -820,12 +804,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_copy_fh_cb + * Function: H5A__dense_copy_fh_cb * - * Purpose: Callback for fractal heap operator, to make copy of attribute + * Purpose: Callback for fractal heap operator, to make copy of attribute * for calling routine * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -864,11 +848,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_rename + * Function: H5A__dense_rename * - * Purpose: Rename an attribute in dense storage structures for an object + * Purpose: Rename an attribute in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -892,9 +876,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(old_name); @@ -996,7 +978,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count") } /* end if */ else if(shared_mesg < 0) - HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") /* Delete old attribute from dense storage */ if(H5A__dense_remove(f, ainfo, old_name) < 0) @@ -1018,11 +1000,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_iterate_bt2_cb + * Function: H5A__dense_iterate_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage iterator + * Purpose: v2 B-tree callback for dense attribute storage iterator * - * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP + * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1030,7 +1012,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +static int H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) { const H5A_dense_bt2_name_rec_t *record = (const H5A_dense_bt2_name_rec_t *)_record; /* Record from B-tree */ @@ -1114,11 +1096,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_iterate + * Function: H5A__dense_iterate * - * Purpose: Iterate over attributes in dense storage structures for an object + * Purpose: Iterate over attributes in dense storage structures for an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1140,9 +1122,7 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(H5F_addr_defined(ainfo->fheap_addr)); @@ -1251,11 +1231,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_remove_bt2_cb + * Function: H5A__dense_remove_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage record removal + * Purpose: v2 B-tree callback for dense attribute storage record removal * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1315,11 +1295,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_remove + * Function: H5A__dense_remove * - * Purpose: Remove an attribute from the dense storage of an object + * Purpose: Remove an attribute from the dense storage of an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1340,9 +1320,7 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(name && *name); @@ -1398,18 +1376,18 @@ done: if(bt2_name && H5B2_close(bt2_name) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") if(attr_copy) - H5O__msg_free_real(H5O_MSG_ATTR, attr_copy); + H5O_msg_free_real(H5O_MSG_ATTR, attr_copy); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_remove() */ /*------------------------------------------------------------------------- - * Function: H5A__dense_remove_by_idx_bt2_cb + * Function: H5A__dense_remove_by_idx_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage record removal by index + * Purpose: v2 B-tree callback for dense attribute storage record removal by index * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1530,12 +1508,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_remove_by_idx + * Function: H5A__dense_remove_by_idx * - * Purpose: Remove an attribute from the dense storage of an object, - * according to the order within an index + * Purpose: Remove an attribute from the dense storage of an object, + * according to the order within an index * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1556,9 +1534,7 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); @@ -1660,12 +1636,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_exists + * Function: H5A__dense_exists * - * Purpose: Check if an attribute exists in dense storage structures for + * Purpose: Check if an attribute exists in dense storage structures for * an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1685,9 +1661,7 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); HDassert(name); @@ -1749,11 +1723,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_delete_bt2_cb + * Function: H5A__dense_delete_bt2_cb * - * Purpose: v2 B-tree callback for dense attribute storage deletion + * Purpose: v2 B-tree callback for dense attribute storage deletion * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1806,18 +1780,18 @@ H5A__dense_delete_bt2_cb(const void *_record, void *_bt2_udata) done: /* Release resources */ if(attr) - H5O__msg_free_real(H5O_MSG_ATTR, attr); + H5O_msg_free_real(H5O_MSG_ATTR, attr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_delete_bt2_cb() */ /*------------------------------------------------------------------------- - * Function: H5A__dense_delete + * Function: H5A__dense_delete * - * Purpose: Delete all dense storage structures for attributes on an object + * Purpose: Delete all dense storage structures for attributes on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1834,9 +1808,7 @@ H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo) FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(ainfo); diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 99c1c0c..e88c8c3 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -36,13 +36,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Opkg.h" /* Object headers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Opkg.h" /* Object headers */ /****************/ @@ -95,7 +95,7 @@ hid_t space_id; IN: ID of dataspace for attribute hid_t acpl_id; IN: ID of creation property list (currently not used) RETURNS - Non-negative on success/Negative on failure + Non-negative on success/H5I_INVALID_HID on failure DESCRIPTION This function creates an attribute which is attached to the object @@ -111,50 +111,51 @@ --------------------------------------------------------------------------*/ hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, - hid_t acpl_id) + hid_t acpl_id) { H5A_t *attr = NULL; /* Attribute created */ H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, acpl_id); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a type") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read") - /* Go do the real work for attaching the attribute to the dataset */ + /* Create the attribute */ if(NULL == (attr = H5A__create(&loc, name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") + 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: - /* Cleanup on failure */ - if(ret_value < 0 && attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + /* Clean up on failure */ + if(H5I_INVALID_HID == ret_value) + if(attr && H5A__close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) -} /* H5Acreate1() */ +} /* end H5Acreate1() */ /*-------------------------------------------------------------------------- @@ -167,7 +168,7 @@ done: hid_t loc_id; IN: Object (dataset or group) to be attached to const char *name; IN: Name of attribute to locate and open RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -184,32 +185,32 @@ H5Aopen_name(hid_t loc_id, const char *name) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") - /* Open the attribute on the object header */ + /* Open the attribute */ if(NULL == (attr = H5A__open_by_name(&loc, ".", name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute: '%s'", name) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute: '%s'", name) /* Register the attribute and get an ID for it */ if((ret_value = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: - /* Cleanup on failure */ - if(ret_value < 0) + /* Clean up on failure */ + if(H5I_INVALID_HID == ret_value) if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_name() */ @@ -225,7 +226,7 @@ done: hid_t loc_id; IN: Object that attribute is attached to unsigned idx; IN: Index (0-based) attribute to open RETURNS - ID of attribute on success, negative on failure + ID of attribute on success, H5I_INVALID_HID on failure DESCRIPTION This function opens an existing attribute for access. The attribute @@ -242,30 +243,30 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "iIu", loc_id, idx); - /* check arguments */ + /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - /* Open the attribute in the object header */ + /* Open the attribute */ if(NULL == (attr = H5A__open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: - /* Cleanup on failure */ - if(ret_value < 0) + /* Clean up on failure */ + if(H5I_INVALID_HID == ret_value) if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* H5Aopen_idx() */ @@ -292,34 +293,34 @@ done: int H5Aget_num_attrs(hid_t loc_id) { - H5O_loc_t *loc; /* Object location for attribute */ - void *obj; - int ret_value; + H5O_loc_t *loc; /* Object location for attribute */ + void *obj; + int ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", loc_id); - /* check arguments */ if(H5I_BADID == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "bad location ID") if(H5I_FILE == H5I_get_type(loc_id) || H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "location is not valid for an attribute") if(NULL == (obj = H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, FAIL, "illegal object atom") + HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, (-1), "illegal object atom") + switch(H5I_get_type (loc_id)) { case H5I_DATASET: if(NULL == (loc = H5D_oloc((H5D_t*)obj))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "can't get location for object") break; case H5I_DATATYPE: if(NULL == (loc = H5T_oloc((H5T_t*)obj))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "target datatype is not committed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "target datatype is not committed") break; case H5I_GROUP: if(NULL == (loc = H5G_oloc((H5G_t*)obj))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get location for object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "can't get location for object") break; case H5I_UNINIT: @@ -336,12 +337,12 @@ H5Aget_num_attrs(hid_t loc_id) case H5I_ERROR_STACK: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target") - } /*lint !e788 All appropriate cases are covered */ + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "inappropriate attribute target") + } /* Look up the # of attributes for the object */ if((ret_value = H5O__attr_count(loc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, (-1), "can't get attribute count for object") done: FUNC_LEAVE_API(ret_value) @@ -388,14 +389,14 @@ done: herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) { - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data); /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") /* Call attribute iteration routine */ if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0) diff --git a/src/H5Aint.c b/src/H5Aint.c index 4c7568a..8268a01 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -87,7 +87,6 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr); static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/); static herr_t H5A__dense_build_table_cb(const H5A_t *attr, void *_udata); @@ -137,7 +136,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); *------------------------------------------------------------------------- */ H5A_t * -H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, +H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, const H5S_t *space, hid_t acpl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -150,7 +149,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, /* Check args */ HDassert(loc); - HDassert(name); + HDassert(attr_name); HDassert(type); HDassert(space); @@ -159,7 +158,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * name, but it's going to be hard to unwind all the special cases on * failure, so just check first, for now - QAK) */ - if((exists = H5O__attr_exists(loc->oloc, name)) < 0) + if((exists = H5O__attr_exists(loc->oloc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes") else if(exists > 0) HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists") @@ -194,7 +193,7 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, } /* end else */ /* Copy the attribute name */ - attr->shared->name = H5MM_xstrdup(name); + attr->shared->name = H5MM_xstrdup(attr_name); /* Copy datatype */ if(NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL))) @@ -232,9 +231,9 @@ H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * SOHM table */ if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed") if(H5SM_try_share(attr->oloc.file, NULL, 0, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed") /* Check whether datatype is committed & increment ref count * (to maintain ref. count incr/decr similarity with "shared message" @@ -365,12 +364,12 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -514,11 +513,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__open_by_name + * Function: H5A__open_by_name * - * Purpose: Open an attribute in an object header, according to it's name + * Purpose: Open an attribute in an object header, according to it's name * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 11, 2006 @@ -922,8 +921,9 @@ H5A__get_type(H5A_t *attr) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") done: - if(H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0)) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") + if(H5I_INVALID_HID == ret_value) + if(dt && H5T_close(dt) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_type() */ @@ -1017,21 +1017,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__copy + * Function: H5A__copy * - * Purpose: Copies attribute OLD_ATTR. + * Purpose: Copies attribute OLD_ATTR. * - * Return: Success: Pointer to a new copy of the OLD_ATTR argument. + * Return: Success: Pointer to a new copy of the OLD_ATTR argument. * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modification:Raymond Lu - * 4 June 2008 - * Changed some attribute information to be shared. - * *------------------------------------------------------------------------- */ H5A_t * @@ -1084,18 +1080,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__free + * Function: H5A__free * - * Purpose: Frees all memory associated with an attribute, but does not + * Purpose: Frees all memory associated with an attribute, but does not * free the H5A_t structure (which should be done in H5T_close). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, November 15, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1114,12 +1108,12 @@ H5A__free(H5A_t *attr) } if(attr->shared->dt) { if(H5T_close_real(attr->shared->dt) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info") attr->shared->dt = NULL; } if(attr->shared->ds) { if(H5S_close(attr->shared->ds) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") attr->shared->ds = NULL; } if(attr->shared->data) @@ -1131,21 +1125,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__close_cb + * Function: H5A__close_cb * - * Purpose: Frees an attribute and all associated memory. + * Purpose: Called when the ref count reaches zero on the attribute's ID * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Sunday, February 18, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5A__close_cb(H5A_t *attr) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1153,9 +1144,9 @@ H5A__close_cb(H5A_t *attr) HDassert(attr); HDassert(attr->shared); - /* Call the actual close routine */ + /* Close the attribute */ if(H5A__close(attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1163,11 +1154,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__close + * Function: H5A__close * - * Purpose: Frees an attribute and all associated memory. + * Purpose: Frees an attribute and all associated memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, December 8, 1997 @@ -1310,12 +1301,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__exists_by_name + * Function: H5A__exists_by_name * - * Purpose: Private version of H5Aexists_by_name + * Purpose: Private version of H5Aexists_by_name * - * Return: Success: TRUE/FALSE - * Failure: Negative + * Return: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol * Thursday, November 1, 2007 @@ -1423,11 +1413,10 @@ done: * Purpose: Builds a table containing a sorted list of attributes for * an object * - * Note: Used for building table of attributes in non-native iteration + * Note: Used for building table of attributes in non-native iteration * order for an index * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 18, 2006 @@ -1526,17 +1515,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__dense_build_table + * Function: H5A__dense_build_table * * Purpose: Builds a table containing a sorted list of attributes for * an object * - * Note: Used for building table of attributes in non-native iteration + * Note: Used for building table of attributes in non-native iteration * order for an index. Uses the "name" index to retrieve records, - * but the 'idx_type' index for sorting them. + * but the 'idx_type' index for sorting them. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 11, 2006 @@ -1783,13 +1771,12 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, /*------------------------------------------------------------------------- - * Function: H5A__attr_iterate_table + * Function: H5A__attr_iterate_table * * Purpose: Iterate over table containing a list of attributes for an object, * making appropriate callbacks * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 18, 2006 @@ -1866,12 +1853,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__attr_release_table + * Function: H5A__attr_release_table * - * Purpose: Release table containing a list of attributes for an object + * Purpose: Release table containing a list of attributes for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Dec 11, 2006 @@ -1913,8 +1899,8 @@ done: * Purpose: Retrieves the "attribute info" message for an object. Also * sets the number of attributes correctly, if it isn't set up yet. * - * Return: Success: TRUE/FALSE whether message was found & retrieved - * Failure: FAIL if error occurred + * Return: Success: TRUE/FALSE whether message was found & retrieved + * Failure: FAIL if error occurred * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1978,8 +1964,7 @@ done: * Chooses the oldest version possible, unless the * file's low bound indicates otherwise. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -2137,9 +2122,9 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s * committed or sharing is disabled. */ if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype") if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace") /* Compute the sizes of the datatype and dataspace. This is their raw * size unless they're shared. @@ -2326,7 +2311,7 @@ done: * an object may have a reference attribute that points to the * object itself. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * March 6, 2005 @@ -2477,8 +2462,7 @@ done: * * Purpose: Copy all dense attributes from SRC to DST. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * xcao@hdfgroup.org @@ -2521,12 +2505,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__rename_by_name + * Function: H5A__rename_by_name * * Purpose: Private version of H5Arename_by_name * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 20, 2007 @@ -2545,19 +2528,22 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na FUNC_ENTER_PACKAGE - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); - - /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") - loc_found = TRUE; - - /* Call attribute rename routine */ - if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + /* Avoid thrashing things if the names are the same */ + if(HDstrcmp(old_attr_name, new_attr_name)) { + /* Set up opened group location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object's location */ + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") + loc_found = TRUE; + + /* Call attribute rename routine */ + if(H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + } /* end if */ done: /* Release resources */ @@ -2569,12 +2555,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__iterate_common + * Function: H5A__iterate_common * * Purpose: Internal common version of H5Aiterate * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2605,12 +2590,11 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, /*------------------------------------------------------------------------- - * Function: H5A__iterate + * Function: H5A__iterate * * Purpose: Private version of H5Aiterate2 * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2636,17 +2620,16 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5A__iterate() */ +} /* end H5A__iterate() */ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5A__iterate_old + * Function: H5A__iterate_old * * Purpose: Private version of H5Aiterate1 * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2689,8 +2672,7 @@ done: * * Purpose: Private version of H5Aiterate_by_name * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2722,12 +2704,12 @@ H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ loc_found = TRUE; /* Open the object */ - if((obj_loc_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0) + if((obj_loc_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Build attribute operator info */ - attr_op.op_type = H5A_ATTR_OP_APP2; - attr_op.u.app_op2 = op; + attr_op.op_type = H5A_ATTR_OP_APP2; + attr_op.u.app_op2 = op; /* Call attribute iteration routine */ if((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0) @@ -2738,12 +2720,12 @@ done: if(obj_loc_id > 0) { if(H5I_dec_app_ref(obj_loc_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - } /* end if */ + } else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") FUNC_LEAVE_NOAPI(ret_value) -} /* H5A__iterate_by_name() */ +} /* end H5A__iterate_by_name() */ /*------------------------------------------------------------------------- @@ -2751,8 +2733,7 @@ done: * * Purpose: Private version of H5Adelete_by_name * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 @@ -2798,8 +2779,7 @@ done: * * Purpose: Private version of H5Adelete_by_idx * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 6, 2017 diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 0bb6d8f..85f0254 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -191,6 +191,7 @@ H5_DLL H5A_t *H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name); H5_DLL H5A_t *H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); +H5_DLL herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr); H5_DLL H5A_t *H5A__copy(H5A_t *new_attr, const H5A_t *old_attr); H5_DLL hid_t H5A__get_type(H5A_t *attr); H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo); diff --git a/src/H5D.c b/src/H5D.c index 0ea7e4a..af99a1f 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -21,12 +21,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ /****************/ @@ -73,31 +73,28 @@ H5FL_BLK_EXTERN(type_conv); /*------------------------------------------------------------------------- - * Function: H5Dcreate2 + * Function: H5Dcreate2 * - * Purpose: Creates a new dataset named NAME at LOC_ID, opens the - * dataset for access, and associates with that dataset constant - * and initial persistent properties including the type of each - * datapoint as stored in the file (TYPE_ID), the size of the - * dataset (SPACE_ID), and other initial miscellaneous - * properties (DCPL_ID). + * Purpose: Creates a new dataset named NAME at LOC_ID, opens the + * dataset for access, and associates with that dataset constant + * and initial persistent properties including the type of each + * datapoint as stored in the file (TYPE_ID), the size of the + * dataset (SPACE_ID), and other initial miscellaneous + * properties (DCPL_ID). * - * All arguments are copied into the dataset, so the caller is - * allowed to derive new types, dataspaces, and creation - * parameters from the old ones and reuse them in calls to - * create other datasets. + * All arguments are copied into the dataset, so the caller is + * allowed to derive new types, dataspaces, and creation + * parameters from the old ones and reuse them in calls to + * create other datasets. * - * Return: Success: The object ID of the new dataset. At this - * point, the dataset is ready to receive its - * raw data. Attempting to read raw data from - * the dataset will probably return the fill - * value. The dataset should be closed when the - * caller is no longer interested in it. + * Return: Success: The object ID of the new dataset. At this + * point, the dataset is ready to receive its + * raw data. Attempting to read raw data from + * the dataset will probably return the fill + * value. The dataset should be closed when the + * caller is no longer interested in it. * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Thursday, April 5, 2007 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -105,88 +102,91 @@ hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id) { - H5G_loc_t loc; /* Object location to insert dataset into */ - H5D_t *dset = NULL; /* New dataset's info */ - const H5S_t *space; /* Dataspace for dataset */ - hid_t ret_value; /* Return value */ + H5D_t *dset = NULL; /* New dataset's info */ + H5G_loc_t loc; /* Object location to insert dataset into */ + const H5S_t *space; /* Dataspace for dataset */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE7("i", "i*siiiii", loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID") if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID") - /* Get correct property list */ + /* Get link creation property list */ if(H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list") - /* Get correct property list */ + /* Get dataset creation property list */ if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "dcpl_id is not a dataset create property list ID") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Create the new dataset & get its ID */ + /* Create the dataset */ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") + + /* Get an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate2() */ /*------------------------------------------------------------------------- - * Function: H5Dcreate_anon + * Function: H5Dcreate_anon * - * Purpose: Creates a new dataset named NAME at LOC_ID, opens the - * dataset for access, and associates with that dataset constant - * and initial persistent properties including the type of each - * datapoint as stored in the file (TYPE_ID), the size of the - * dataset (SPACE_ID), and other initial miscellaneous - * properties (DCPL_ID). + * Purpose: Creates a new dataset named NAME at LOC_ID, opens the + * dataset for access, and associates with that dataset constant + * and initial persistent properties including the type of each + * datapoint as stored in the file (TYPE_ID), the size of the + * dataset (SPACE_ID), and other initial miscellaneous + * properties (DCPL_ID). * - * All arguments are copied into the dataset, so the caller is - * allowed to derive new types, dataspaces, and creation - * parameters from the old ones and reuse them in calls to - * create other datasets. + * All arguments are copied into the dataset, so the caller is + * allowed to derive new types, dataspaces, and creation + * parameters from the old ones and reuse them in calls to + * create other datasets. * * The resulting ID should be linked into the file with * H5Olink or it will be deleted when closed. * - * Return: Success: The object ID of the new dataset. At this - * point, the dataset is ready to receive its - * raw data. Attempting to read raw data from - * the dataset will probably return the fill - * value. The dataset should be linked into - * the group hierarchy before being closed or - * it will be deleted. The dataset should be - * closed when the caller is no longer interested - * in it. - * - * Failure: FAIL + * Return: Success: The object ID of the new dataset. At this + * point, the dataset is ready to receive its + * raw data. Attempting to read raw data from + * the dataset will probably return the fill + * value. The dataset should be linked into + * the group hierarchy before being closed or + * it will be deleted. The dataset should be + * closed when the caller is no longer interested + * in it. * - * Programmer: James Laird - * Tuesday, January 24, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -197,35 +197,35 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, H5G_loc_t loc; /* Object location to insert dataset into */ H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "iiiii", loc_id, type_id, space_id, dcpl_id, dapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID") if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID") if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID") if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* build and open the new dataset */ + /* Create the dataset */ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") - /* Register the new dataset to get an ID for it */ + /* Get an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: /* Release the dataset's object header, if it was created */ @@ -234,36 +234,34 @@ done: /* Get the new dataset's object location */ if(NULL == (oloc = H5D_oloc(dset))) - HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get object location of dataset") + HDONE_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get object location of dataset") /* Decrement refcount on dataset's object header in memory */ if(H5O_dec_rc_by_loc(oloc) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on newly created object") } /* end if */ /* Cleanup on failure */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate_anon() */ /*------------------------------------------------------------------------- - * Function: H5Dopen2 + * Function: H5Dopen2 * - * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns - * its ID. The dataset should be close when the caller is no - * longer interested in it. + * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns + * its ID. The dataset should be close when the caller is no + * longer interested in it. * * Takes a dataset access property list * - * Return: Success: A new dataset ID - * Failure: FAIL + * Return: Success: Object ID of the dataset * - * Programmer: James Laird - * Thursday, July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -272,16 +270,18 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, dapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0) @@ -289,17 +289,16 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) /* Open the dataset */ if(NULL == (dset = H5D__open_name(&loc, name, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Register an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") - + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -307,14 +306,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Dclose * - * Purpose: Closes access to a dataset (DATASET_ID) and releases - * resources used by it. It is illegal to subsequently use that - * same dataset ID in calls to other dataset functions. + * Purpose: Closes access to a dataset and releases resources used by + * it. It is illegal to subsequently use that same dataset + * ID in calls to other dataset functions. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -328,10 +324,9 @@ H5Dclose(hid_t dset_id) /* Check args */ if(NULL == H5I_object_verify(dset_id, H5I_DATASET)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID") - /* - * Decrement the counter on the dataset. It will be freed if the count + /* Decrement the counter on the dataset. It will be freed if the count * reaches zero. */ if(H5I_dec_app_ref_always_close(dset_id) < 0) @@ -343,36 +338,34 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_space - * - * Purpose: Returns a copy of the file dataspace for a dataset. + * Function: H5Dget_space * - * Return: Success: ID for a copy of the dataspace. The data - * space should be released by calling - * H5Sclose(). + * Purpose: Returns a copy of the file dataspace for a dataset. * - * Failure: FAIL + * Return: Success: ID for a copy of the dataspace. The data + * space should be released by calling + * H5Sclose(). * - * Programmer: Robb Matzke - * Wednesday, January 28, 1998 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Dget_space(hid_t dset_id) { - H5D_t *dset = NULL; - hid_t ret_value; + H5D_t *dset = NULL; /* Dataset structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Get the dataspace */ if((ret_value = H5D__get_space(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") done: FUNC_LEAVE_API(ret_value) @@ -380,35 +373,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_space_status - * - * Purpose: Returns the status of dataspace allocation. + * Function: H5Dget_space_status * - * Return: - * Success: Non-negative + * Purpose: Returns the status of dataspace allocation. * - * Failture: Negative - * - * Programmer: Raymond Lu + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) { - H5D_t *dset = NULL; - herr_t ret_value = SUCCEED; + H5D_t *dset = NULL; /* Dataset structure */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Ds", dset_id, allocation); - /* Check arguments */ + /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") - /* Read dataspace address and return */ + /* Get dataspace status */ if(H5D__get_space_status(dset, allocation) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") done: FUNC_LEAVE_API(ret_value) @@ -416,36 +404,34 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_type + * Function: H5Dget_type * - * Purpose: Returns a copy of the file datatype for a dataset. + * Purpose: Returns a copy of the file datatype for a dataset. * - * Return: Success: ID for a copy of the datatype. The data - * type should be released by calling - * H5Tclose(). + * Return: Success: ID for a copy of the datatype. The data + * type should be released by calling + * H5Tclose(). * - * Failure: FAIL - * - * Programmer: Robb Matzke - * Tuesday, February 3, 1998 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Dget_type(hid_t dset_id) { - H5D_t *dset; /* Dataset */ - hid_t ret_value; /* Return value */ + H5D_t *dset; /* Dataset structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* get the datatype */ if((ret_value = H5D__get_type(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: FUNC_LEAVE_API(ret_value) @@ -453,15 +439,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_create_plist + * Function: H5Dget_create_plist * - * Purpose: Returns a copy of the dataset creation property list. + * Purpose: Returns a copy of the dataset creation property list. * - * Return: Success: ID for a copy of the dataset creation - * property list. The template should be - * released by calling H5P_close(). + * Return: Success: ID for a copy of the dataset creation + * property list. The template should be + * released by calling H5P_close(). * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Tuesday, February 3, 1998 @@ -472,17 +458,18 @@ hid_t H5Dget_create_plist(hid_t dset_id) { H5D_t *dataset; /* Dataset structure */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Get the dataset creation property list */ if((ret_value = H5D_get_create_plist(dataset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") done: FUNC_LEAVE_API(ret_value) @@ -490,32 +477,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_access_plist + * Function: H5Dget_access_plist * - * Purpose: Returns a copy of the dataset creation property list. + * Purpose: Returns a copy of the dataset access property list. * * Description: H5Dget_access_plist returns the dataset access property - * list identifier of the specified dataset. + * list identifier of the specified dataset. * - * The chunk cache parameters in the returned property lists will be - * those used by the dataset. If the properties in the file access - * property list were used to determine the dataset’s chunk cache - * configuration, then those properties will be present in the - * returned dataset access property list. If the dataset does not - * use a chunked layout, then the chunk cache properties will be set - * to the default. The chunk cache properties in the returned list - * are considered to be “set”, and any use of this list will override - * the corresponding properties in the file’s file access property - * list. + * The chunk cache parameters in the returned property lists will be + * those used by the dataset. If the properties in the file access + * property list were used to determine the dataset’s chunk cache + * configuration, then those properties will be present in the + * returned dataset access property list. If the dataset does not + * use a chunked layout, then the chunk cache properties will be set + * to the default. The chunk cache properties in the returned list + * are considered to be “set”, and any use of this list will override + * the corresponding properties in the file’s file access property + * list. * - * All link access properties in the returned list will be set to the - * default values. + * All link access properties in the returned list will be set to the + * default values. * - * Return: Success: ID for a copy of the dataset access - * property list. The template should be - * released by calling H5Pclose(). + * Return: Success: ID for a copy of the dataset access + * property list. The template should be + * released by calling H5Pclose(). * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Neil Fortner * Wednesday, October 29, 2008 @@ -526,17 +513,18 @@ hid_t H5Dget_access_plist(hid_t dset_id) { H5D_t *dset; /* Dataset structure */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Get the dataset access property list */ if((ret_value = H5D_get_access_plist(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get access plist") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") done: FUNC_LEAVE_API(ret_value) @@ -544,39 +532,36 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_storage_size + * Function: H5Dget_storage_size * - * Purpose: Returns the amount of storage that is required for the - * dataset. For chunked datasets this is the number of allocated - * chunks times the chunk size. + * Purpose: Returns the amount of storage that is required for the + * dataset. For chunked datasets this is the number of allocated + * chunks times the chunk size. * - * Return: Success: The amount of storage space allocated for the - * dataset, not counting meta data. The return - * value may be zero if no data has been stored. + * Return: Success: The amount of storage space allocated for the + * dataset, not counting meta data. The return + * value may be zero if no data has been stored. * - * Failure: Zero - * - * Programmer: Robb Matzke - * Wednesday, April 21, 1999 + * Failure: Zero * *------------------------------------------------------------------------- */ hsize_t H5Dget_storage_size(hid_t dset_id) { - H5D_t *dset; /* Dataset to query */ - hsize_t ret_value; /* Return value */ + H5D_t *dset; /* Dataset for this operation */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_API(0) H5TRACE1("h", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") - /* Set return value */ + /* Get the storage size */ if(H5D__get_storage_size(dset, &ret_value) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataset's storage") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") done: FUNC_LEAVE_API(ret_value) @@ -584,33 +569,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dget_offset + * Function: H5Dget_offset * - * Purpose: Returns the address of dataset in file. + * Purpose: Returns the address of dataset in file. * - * Return: Success: the address of dataset + * Return: Success: The address of dataset * - * Failure: HADDR_UNDEF - * - * Programmer: Raymond Lu - * November 6, 2002 + * Failure: HADDR_UNDEF (can also be a valid return value!) * *------------------------------------------------------------------------- */ haddr_t H5Dget_offset(hid_t dset_id) { - H5D_t *dset; /* Dataset to query */ - haddr_t ret_value; /* Return value */ + H5D_t *dset; /* Dataset for this operation */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_API(HADDR_UNDEF) H5TRACE1("a", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") - /* Set return value */ + /* Get the offset */ ret_value = H5D__get_offset(dset); done: @@ -740,7 +722,7 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf) /* Check args */ if(H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") if(!(H5S_has_extent(space))) @@ -793,7 +775,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size) { H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0}; - H5D_t *dset; /* Dataset for operation */ + H5D_t *dset; /* Dataset for this operation */ H5S_t *fspace = NULL; /* Dataset's dataspace */ H5S_t *mspace = NULL; /* Memory dataspace */ char bogus; /* bogus value to pass to H5Diterate() */ @@ -810,7 +792,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, H5I_DATATYPE != H5I_get_type(type_id) || size == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") if(NULL == (dset = (H5D_t *)H5I_object(dataset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) @@ -820,16 +802,20 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, /* Save the dataset */ vlen_bufsize.dset = dset; + vlen_bufsize.fspace_id = H5I_INVALID_HID; + vlen_bufsize.mspace_id = H5I_INVALID_HID; /* Get a copy of the dataset's dataspace */ if(NULL == (fspace = H5S_copy(dset->shared->space, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to get dataspace") - vlen_bufsize.fspace = fspace; + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") + if((vlen_bufsize.fspace_id = H5I_register(H5I_DATASPACE, fspace, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file dataspace") /* Create a scalar for the memory dataspace */ if(NULL == (mspace = H5S_create(H5S_SCALAR))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") - vlen_bufsize.mspace = mspace; + if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register memory dataspace") /* Grab the temporary buffers required */ if(NULL == (vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1))) @@ -845,9 +831,9 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, vlen_bufsize.size = 0; /* Call H5S_select_iterate with args, etc. */ - dset_op.op_type = H5S_SEL_ITER_OP_APP; - dset_op.u.app_op.op = H5D__vlen_get_buf_size; - dset_op.u.app_op.type_id = type_id; + dset_op.op_type = H5S_SEL_ITER_OP_APP; + dset_op.u.app_op.op = H5D__vlen_get_buf_size; + dset_op.u.app_op.type_id = type_id; ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize); @@ -856,10 +842,17 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, *size = vlen_bufsize.size; done: - if(fspace && H5S_close(fspace) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - if(mspace && H5S_close(mspace) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + if(ret_value < 0) { + if(fspace && H5S_close(fspace) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release file dataspace") + if(mspace && H5S_close(mspace) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release memory dataspace") + } + + if(vlen_bufsize.fspace_id && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing file dataspace id") + if(vlen_bufsize.mspace_id && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing memory dataspace id") if(vlen_bufsize.fl_tbuf != NULL) vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); if(vlen_bufsize.vl_tbuf != NULL) @@ -870,40 +863,37 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dset_extent - * - * Purpose: Modifies the dimensions of a dataset. - * Can change to a smaller dimension. + * Function: H5Dset_extent * - * Return: Non-negative on success, negative on failure + * Purpose: Modifies the dimensions of a dataset. + * Can change to a smaller dimension. * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * April 9, 2002 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]) { - H5D_t *dset; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", dset_id, size); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") if(!size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size array cannot be NULL") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Private function */ + /* Set the extent */ if(H5D__set_extent(dset, size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extend dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") done: FUNC_LEAVE_API(ret_value) @@ -915,25 +905,22 @@ done: * * Purpose: Flushes all buffers associated with a dataset. * - * Return: Non-negative on success, negative on failure - * - * Programmer: Mike McGreevy - * May 19, 2010 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Dflush(hid_t dset_id) { - H5D_t *dset; /* Dataset for this operation */ - herr_t ret_value = SUCCEED; /* return value */ + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) @@ -941,7 +928,7 @@ H5Dflush(hid_t dset_id) /* Flush dataset information cached in memory */ if(H5D__flush(dset, dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush cached dataset info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") done: FUNC_LEAVE_API(ret_value) @@ -953,31 +940,28 @@ done: * * Purpose: Refreshes all buffers associated with a dataset. * - * Return: Non-negative on success, negative on failure - * - * Programmer: Mike McGreevy - * July 21, 2010 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Drefresh(hid_t dset_id) { - H5D_t *dset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ - + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call private function to refresh the dataset object */ + /* Refresh the dataset object */ if((H5D__refresh(dset_id, dset)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") @@ -990,12 +974,13 @@ done: * Function: H5Dformat_convert (Internal) * * Purpose: For chunked: - * Convert the chunk indexing type to version 1 B-tree if not - * For compact/contiguous: - * Downgrade layout version to 3 if greater than 3 - * For virtual: no conversion + * Convert the chunk indexing type to version 1 B-tree if not + * For compact/contiguous: + * Downgrade layout version to 3 if greater than 3 + * For virtual: + * No conversion * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi * Feb 2015 @@ -1005,15 +990,15 @@ done: herr_t H5Dformat_convert(hid_t dset_id) { - H5D_t *dset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) @@ -1065,17 +1050,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type) +H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type) { - H5D_t *dset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ - + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Dk", did, idx_type); + H5TRACE2("e", "i*Dk", dset_id, idx_type); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") + if(NULL == idx_type) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") /* Should be a chunked dataset */ if(dset->shared->layout.type != H5D_CHUNKED) @@ -1095,7 +1082,10 @@ done: * * Purpose: Returns the size of an allocated chunk. * - * Return: Non-negative on success, negative on failure + * Intended for use with the H5D(O)read_chunk API call so + * the caller can construct an appropriate buffer. + * + * Return: SUCCEED/FAIL * * Programmer: Matthew Strong (GE Healthcare) * 20 October 2016 @@ -1105,24 +1095,24 @@ done: herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes) { - H5D_t *dset = NULL; - herr_t ret_value = SUCCEED; + H5D_t *dset; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes); /* Check arguments */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - if( NULL == offset ) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") - if( NULL == chunk_nbytes ) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") + if(NULL == offset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset parameter cannot be NULL") + if(NULL == chunk_nbytes) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") if(H5D_CHUNKED != dset->shared->layout.type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") - /* Call private function */ + /* Get the dataset creation property list */ if(H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 8abfe27..b61aed4 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -685,13 +685,12 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key /* decode */ UINT32DECODE(raw, key->nbytes); UINT32DECODE(raw, key->filter_mask); - for(u = 0; u < layout->ndims; u++) - { - if (layout->dim[u] == 0) + for(u = 0; u < layout->ndims; u++) { + if(layout->dim[u] == 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) /* Retrieve coordinate offset */ - UINT64DECODE(raw, tmp_offset); + UINT64DECODE(raw, tmp_offset); HDassert(0 == (tmp_offset % layout->dim[u])); /* Convert to a scaled offset */ @@ -943,7 +942,7 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info) /* Create the v1 B-tree for the chunk index */ if(H5B_create(idx_info->f, H5B_BTREE, &udata, &(idx_info->storage->idx_addr)/*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index d60e79e..b32f395 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -1547,7 +1547,7 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") /* Close v2 B-tree */ - if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0) + if(H5B2_close(idx_info->storage->u.btree2.bt2) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree") idx_info->storage->u.btree2.bt2 = NULL; } /* end if */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 16d7530..30a9a3b 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -551,7 +551,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, /* Get the new file address / chunk size after flushing */ if(H5D__chunk_lookup(dset, scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") - } /* end if */ + } /* Make sure the address of the chunk is returned. */ if(!H5F_addr_defined(udata.chunk_block.offset)) @@ -648,8 +648,8 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage /* Get the new file address / chunk size after flushing */ if(H5D__chunk_lookup(dset, scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") - } /* end if */ - } /* end if */ + } + } /* Make sure the address of the chunk is returned. */ if(!H5F_addr_defined(udata.chunk_block.offset)) @@ -1300,11 +1300,9 @@ done: HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") if(file_type && (H5T_close_real(file_type) < 0)) HDONE_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Can't free temporary datatype") - if(file_space_normalized == TRUE) { - /* (Casting away const OK -QAK) */ - if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) + if(file_space_normalized == TRUE) + if(H5S_hyper_denormalize_offset((H5S_t *)file_space, old_offset) < 0) /* (Casting away const OK -QAK) */ HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection") - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_io_init() */ @@ -1503,7 +1501,8 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection") /* Move selection back to have correct offset in chunk */ - H5S_SELECT_ADJUST_U(fm->single_space, coords); + if(H5S_SELECT_ADJUST_U(fm->single_space, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection") #ifdef H5_HAVE_PARALLEL /* store chunk selection information */ @@ -1615,7 +1614,10 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t } /* end if */ /* Move selection back to have correct offset in chunk */ - H5S_SELECT_ADJUST_U(tmp_fchunk, coords); + if(H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0) { + (void)H5S_close(tmp_fchunk); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection") + } /* Add temporary chunk to the list of chunks */ @@ -1814,7 +1816,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) } /* end for */ /* Adjust the selection */ - if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0) /*lint !e772 The chunk_adjust array will always be initialized */ + if(H5S_hyper_adjust_s(chunk_info->mspace, chunk_adjust) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection") /* Get the next chunk node in the skip list */ @@ -3183,8 +3185,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, - hbool_t flush) +H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush) { H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); herr_t ret_value = SUCCEED; /* Return value */ @@ -4199,13 +4200,14 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ while(!carry) { hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ - /* Look up this chunk */ - if(H5D__chunk_lookup(dset, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + /* Look up this chunk */ + if(H5D__chunk_lookup(dset, scaled, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") #ifndef NDEBUG /* None of the chunks should be allocated */ - if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) - HDassert(!H5F_addr_defined(udata.chunk_block.offset)); + if(H5D_CHUNK_IDX_NONE != layout->storage.u.chunk.idx_type) { + HDassert(!H5F_addr_defined(udata.chunk_block.offset)); + } /* Make sure the chunk is really in the dataset and outside the * original dimensions */ @@ -4233,7 +4235,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ /* Check to make sure the buffer is large enough. It is * possible (though ill-advised) for the filter to shrink the - * buffer. */ + * buffer. + */ if(fb_info.fill_buf_size < orig_chunk_size) { if(NULL == (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for raw data chunk") @@ -4467,10 +4470,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) HGOTO_DONE(SUCCEED) } /* end if */ - /* - * Initialize structures needed to lock chunks into cache - */ - /* Set up chunked I/O info object, for operations on chunks (in callback). * Note that we only need to set chunk_offset once, as the array's address * will never change. */ @@ -6517,31 +6516,31 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded") } /* end block */ - if(old_chunk && H5F_addr_defined(old_chunk->offset)) { - /* Sanity check */ + if(old_chunk && H5F_addr_defined(old_chunk->offset)) { + /* Sanity check */ HDassert(!H5F_addr_defined(new_chunk->offset) || H5F_addr_eq(new_chunk->offset, old_chunk->offset)); /* Check for chunk being same size */ - if(new_chunk->length != old_chunk->length) { - /* Release previous chunk */ - /* Only free the old location if not doing SWMR writes - otherwise + if(new_chunk->length != old_chunk->length) { + /* Release previous chunk */ + /* Only free the old location if not doing SWMR writes - otherwise * we must keep the old chunk around in case a reader has an * outdated version of the B-tree node */ - if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) - if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") - alloc_chunk = TRUE; - } /* end if */ + if(!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) + if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + alloc_chunk = TRUE; + } /* end if */ else { - /* Don't need to reallocate chunk, but send its address back up */ + /* Don't need to reallocate chunk, but send its address back up */ if(!H5F_addr_defined(new_chunk->offset)) new_chunk->offset = old_chunk->offset; - } /* end else */ - } /* end if */ + } /* end else */ + } /* end if */ else { HDassert(!H5F_addr_defined(new_chunk->offset)); - alloc_chunk = TRUE; + alloc_chunk = TRUE; } /* end else */ } /* end if */ else { @@ -6646,7 +6645,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for raw data chunk") /* Read the non-filtered edge chunk */ - if(H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0) + if (H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk") /* Pass the chunk through the pipeline */ diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 347e34c..7220868 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -21,11 +21,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ /****************/ @@ -60,17 +60,12 @@ /*------------------------------------------------------------------------- - * Function: H5Ddebug + * Function: H5Ddebug * - * Purpose: Prints various information about a dataset. This function is - * not to be documented in the API at this time. + * Purpose: Prints various information about a dataset. This function is + * not to be documented in the API at this time. * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Wednesday, April 28, 1999 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -85,13 +80,13 @@ H5Ddebug(hid_t dset_id) /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") /* Print B-tree information */ if(H5D_CHUNKED == dset->shared->layout.type) - (void)H5D__chunk_dump_index(dset, stdout); + (void)H5D__chunk_dump_index(dset, stdout); else if(H5D_CONTIGUOUS == dset->shared->layout.type) - HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); + HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 0f1bfee..ed520c4 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -80,28 +80,28 @@ #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5Dcreate1 + * Function: H5Dcreate1 * - * Purpose: Creates a new dataset named NAME at LOC_ID, opens the - * dataset for access, and associates with that dataset constant - * and initial persistent properties including the type of each - * datapoint as stored in the file (TYPE_ID), the size of the - * dataset (SPACE_ID), and other initial miscellaneous - * properties (DCPL_ID). + * Purpose: Creates a new dataset named NAME at LOC_ID, opens the + * dataset for access, and associates with that dataset constant + * and initial persistent properties including the type of each + * datapoint as stored in the file (TYPE_ID), the size of the + * dataset (SPACE_ID), and other initial miscellaneous + * properties (DCPL_ID). * - * All arguments are copied into the dataset, so the caller is - * allowed to derive new types, dataspaces, and creation - * parameters from the old ones and reuse them in calls to - * create other datasets. + * All arguments are copied into the dataset, so the caller is + * allowed to derive new types, data spaces, and creation + * parameters from the old ones and reuse them in calls to + * create other datasets. * - * Return: Success: The object ID of the new dataset. At this - * point, the dataset is ready to receive its - * raw data. Attempting to read raw data from - * the dataset will probably return the fill - * value. The dataset should be closed when - * the caller is no longer interested in it. + * Return: Success: The object ID of the new dataset. At this + * point, the dataset is ready to receive its + * raw data. Attempting to read raw data from + * the dataset will probably return the fill + * value. The dataset should be closed when + * the caller is no longer interested in it. * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, December 3, 1997 @@ -112,29 +112,31 @@ hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) { - H5G_loc_t loc; /* Object location to insert dataset into */ - H5D_t *dset = NULL; /* New dataset's info */ - const H5S_t *space; /* Dataspace for dataset */ - hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */ - hid_t ret_value; /* Return value */ + H5G_loc_t loc; /* Object location to insert dataset into */ + H5D_t *dset = NULL; /* New dataset's info */ + const H5S_t *space; /* Dataspace for dataset */ + hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, dcpl_id); /* Check arguments */ + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID") if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID") if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID") if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) @@ -142,32 +144,32 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, /* Build and open the new dataset */ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") - /* Register the new dataset to get an ID for it */ + /* Get an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: - if(ret_value < 0) + if (H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate1() */ /*------------------------------------------------------------------------- - * Function: H5Dopen1 + * Function: H5Dopen1 * - * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns - * its ID. The dataset should be close when the caller is no - * longer interested in it. + * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns + * its ID. The dataset should be close when the caller is no + * longer interested in it. * - * Note: Deprecated in favor of H5Dopen2 + * Note: Deprecated in favor of H5Dopen2 * - * Return: Success: A new dataset ID - * Failure: FAIL + * Return: Success: A new dataset ID + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -179,44 +181,46 @@ H5Dopen1(hid_t loc_id, const char *name) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ + if (!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if (!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") /* Open the dataset */ if(NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") - /* Register an atom for the dataset */ + /* Get an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen1() */ /*------------------------------------------------------------------------- - * Function: H5Dextend + * Function: H5Dextend * - * Purpose: This function makes sure that the dataset is at least of size - * SIZE. The dimensionality of SIZE is the same as the data - * space of the dataset being changed. + * Purpose: This function makes sure that the dataset is at least of size + * SIZE. The dimensionality of SIZE is the same as the data + * space of the dataset being changed. * - * Note: Deprecated in favor of H5Dset_extent + * Note: Deprecated in favor of H5Dset_extent * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Friday, January 30, 1998 @@ -226,19 +230,19 @@ done: herr_t H5Dextend(hid_t dset_id, const hsize_t size[]) { - H5D_t *dset; /* Pointer to dataset to modify */ - hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset; /* Pointer to dataset to modify */ + hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", dset_id, size); /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(!size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* Make certain that the dataset dimensions don't decrease */ /* (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) */ @@ -254,7 +258,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) /* Increase size */ if(H5D__set_extent(dset, dset_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dfill.c b/src/H5Dfill.c index e42e551..619f699 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -174,7 +174,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, - const H5T_t *buf_type, const H5S_t *space) + const H5T_t *buf_type, const H5S_t *space) { H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */ hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 2d4985e..9af391e 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -22,8 +22,8 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ #include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FOprivate.h" /* File objects */ @@ -48,18 +48,17 @@ /* General stuff */ static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); -static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, - const H5T_t *type); +static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id); -static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, - const char *prefix_type, char **file_prefix); +static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, char **file_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); -static herr_t H5D__close_cb(H5D_t *dataset); +static herr_t H5D__close_cb(H5D_t *dset); + /*********************/ /* Package Variables */ @@ -281,6 +280,37 @@ H5D_term_package(void) /*------------------------------------------------------------------------- + * Function: H5D__close_cb + * + * Purpose: Called when the ref count reaches zero on the dataset's ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__close_cb(H5D_t *dset) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(dset); + HDassert(dset->oloc.file); + HDassert(dset->shared); + HDassert(dset->shared->fo_count > 0); + + /* Close the dataset */ + if(H5D_close(dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__close_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5D__create_named * * Purpose: Internal routine to create a new dataset. @@ -505,7 +535,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype") /* Convert a datatype (if committed) to a transient type if the committed datatype's file - location is different from the file location where the dataset will be created */ + * location is different from the file location where the dataset will be created. + */ if(H5T_convert_committed_datatype(dset->shared->type, file) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info") @@ -520,7 +551,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) /* Get a datatype ID for the dataset's datatype */ if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") - } /* end if */ + } /* Not a custom datatype, just use it directly */ else { if(H5I_inc_ref(type_id, FALSE) < 0) @@ -529,7 +560,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) /* Use existing datatype */ dset->shared->type_id = type_id; dset->shared->type = (H5T_t *)type; /* (Cast away const OK - QAK) */ - } /* end else */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -569,7 +600,7 @@ H5D__cache_dataspace_info(const H5D_t *dset) if( !(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u])) ) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") dset->shared->curr_power2up[u] = scaled_power2up; - } /* end for */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -685,7 +716,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type") fill_prop->fill_defined = TRUE; - } /* end if */ + } else if(fill_status == H5D_FILL_VALUE_UNDEFINED) fill_prop->fill_defined = FALSE; else @@ -848,7 +879,7 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type */ if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) prefix = HDgetenv("HDF5_VDS_PREFIX"); - else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) + else if(HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); else HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible") @@ -1300,7 +1331,7 @@ done: dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); - } /* end if */ + } H5O_loc_free(&(dataset->oloc)); H5G_name_free(&(dataset->path)); @@ -1561,36 +1592,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__close_cb - * - * Purpose: Callback routine for closing a dataset ID. Closes the dataset - * object that was attached to the ID. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__close_cb(H5D_t *dataset) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* check args */ - HDassert(dataset && dataset->oloc.file && dataset->shared); - HDassert(dataset->shared->fo_count > 0); - - /* Call actual dataset close routine */ - if(H5D_close(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__close_cb() */ - - -/*------------------------------------------------------------------------- * Function: H5D_close * * Purpose: Insures that all data has been saved to the file, closes the @@ -1726,8 +1727,7 @@ H5D_close(H5D_t *dataset) if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") - /* - * Release datatype, dataspace and creation property list -- there isn't + /* Release datatype, dataspace and creation property list -- there isn't * much we can do if one of these fails, so we just continue. */ free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) || @@ -1761,6 +1761,7 @@ H5D_close(H5D_t *dataset) */ dataset->oloc.file = NULL; dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); + } /* end if */ else { /* Decrement the ref. count for this object in the top file */ @@ -1798,7 +1799,7 @@ done: * Function: H5D_mult_refresh_close * * Purpose: Closing down the needed information when the dataset has - * multiple opens. (From H5O_refresh_metadata_close()) + * multiple opens. (From H5O__refresh_metadata_close()) * * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- @@ -2275,13 +2276,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_offset + * Function: H5D__get_offset + * + * Purpose: Private function for H5D__get_offset. Returns the address + * of dataset in file. * - * Purpose: Private function for H5D__get_offset. Returns the address - * of dataset in file. + * Return: Success: The address of dataset + * + * Failure: HADDR_UNDEF (but also a valid value) * - * Return: Success: the address of dataset - * Failure: HADDR_UNDEF *------------------------------------------------------------------------- */ haddr_t @@ -2301,7 +2304,8 @@ H5D__get_offset(const H5D_t *dset) case H5D_CONTIGUOUS: /* If dataspace hasn't been allocated or dataset is stored in - * an external file, the value will be HADDR_UNDEF. */ + * an external file, the value will be HADDR_UNDEF. + */ if(dset->shared->dcpl_cache.efl.nused == 0 || H5F_addr_defined(dset->shared->layout.storage.u.contig.addr)) /* Return the absolute dataset offset from the beginning of file. */ ret_value = dset->shared->layout.storage.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file); @@ -2311,7 +2315,7 @@ H5D__get_offset(const H5D_t *dset) case H5D_NLAYOUTS: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type") - } /*lint !e788 All appropriate cases are covered */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -2419,6 +2423,8 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, { H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)op_data; H5T_t *dt; /* Datatype for operation */ + H5S_t *mspace; /* Memory dataspace for operation */ + H5S_t *fspace; /* File dataspace for operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2434,12 +2440,18 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, if(NULL == (vlen_bufsize->fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf") + /* Get the memory dataspace from the ID */ + if(NULL == (mspace = (H5S_t *)H5I_object_verify(vlen_bufsize->mspace_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + /* Select point to read in */ - if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0) + if(NULL == (fspace = (H5S_t *)H5I_object_verify(vlen_bufsize->fspace_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(H5S_select_elements(fspace, H5S_SELECT_SET, (size_t)1, point) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ - if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->fl_tbuf) < 0) + if(H5D__read(vlen_bufsize->dset, type_id, mspace, fspace, vlen_bufsize->fl_tbuf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: @@ -2509,11 +2521,11 @@ done: herr_t H5D__set_extent(H5D_t *dset, const hsize_t *size) { - hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */ - htri_t changed; /* Whether the dataspace changed size */ - size_t u, v; /* Local index variable */ + hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */ + htri_t changed; /* Whether the dataspace changed size */ + size_t u, v; /* Local index variable */ unsigned dim_idx; /* Dimension index */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) @@ -2649,7 +2661,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage") - } /* end if */ + } /*------------------------------------------------------------------------- * Remove chunk information in the case of chunked datasets * This removal takes place only in case we are shrinking the dateset @@ -3255,7 +3267,7 @@ H5D_get_access_plist(const H5D_t *dset) if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy dataset access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy dataset access property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") diff --git a/src/H5Dio.c b/src/H5Dio.c index ed384ca..88a9e4b 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -21,14 +21,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Dataset functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Sprivate.h" /* Dataspace */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Sprivate.h" /* Dataspace */ #ifdef H5_HAVE_PARALLEL /* Remove this if H5R_DATASET_REGION is no longer used in this file */ @@ -50,8 +50,7 @@ /* Local Prototypes */ /********************/ -static herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, - hsize_t *offset_copy/*out*/); +/* Setup/teardown routines */ static herr_t H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info, H5D_storage_t *store, H5D_io_info_t *io_info); static herr_t H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, @@ -83,14 +82,17 @@ H5FL_DEFINE(H5D_chunk_map_t); /*------------------------------------------------------------------------- * Function: H5D__get_offset_copy * - * Purpose: Gets a copy of the user's offset array that is guaraneteed - * to be suitable for use by the library. + * Purpose: Copies an offset buffer and performs bounds checks on the + * values. + * + * This helper function ensures that the offset buffer given + * by the user is suitable for use with the rest of the library. * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy) { unsigned u; @@ -102,7 +104,6 @@ H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_c HDassert(offset); HDassert(offset_copy); - /* The library's chunking code requires the offset to terminate with a zero. * So transfer the offset array to an internal offset array that we * can properly terminate (handled via the calloc call). @@ -127,14 +128,13 @@ done: } /* end H5D__get_offset_copy() */ - /*------------------------------------------------------------------------- - * Function: H5Dread + * Function: H5Dread * * Purpose: Reads (part of) a DSET from the file into application * memory BUF. The part of the dataset to read is defined with - * MEM_SPACE_ID and FILE_SPACE_ID. The data points are + * MEM_SPACE_ID and FILE_SPACE_ID. The data points are * converted from their file type to the MEM_TYPE_ID specified. * Additional miscellaneous data transfer properties can be * passed to this function with the PLIST_ID argument. @@ -152,7 +152,7 @@ done: * The PLIST_ID can be the constant H5P_DEFAULT in which * case the default data transfer properties are used. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -194,7 +194,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Read raw data */ + /* Read the data */ if (H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") @@ -219,9 +219,9 @@ herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf) { - H5D_t *dset = NULL; + H5D_t *dset = NULL; hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf); @@ -289,7 +289,7 @@ done: * The PLIST_ID can be the constant H5P_DEFAULT in which * case the default data transfer properties are used. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Thursday, December 4, 1997 @@ -303,13 +303,13 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5D_t *dset = NULL; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); - /* Get dataset pointer and ensure it's associated with a file */ + /* Get dataset pointer */ if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") if (NULL == dset->oloc.file) @@ -356,10 +356,10 @@ herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size, const void *buf) { - H5D_t *dset = NULL; + H5D_t *dset = NULL; hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ - uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ - herr_t ret_value = SUCCEED; /* Return value */ + uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf); @@ -981,8 +981,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, type_info->dst_type_id = mem_type_id; } /* end else */ - /* - * Locate the type conversion function and dataspace conversion + /* Locate the type conversion function and dataspace conversion * functions, and set up the element numbering information. If a data * type conversion is necessary then register datatype atoms. Data type * conversion is necessary if the user has set the `need_bkg' to a high @@ -1249,7 +1248,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__ioinfo_adjust() */ -#endif /*H5_HAVE_PARALLEL*/ +#endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index c8afb8e..494d2c8 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -25,7 +25,6 @@ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5HLprivate.h" /* Local heaps */ -#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -506,7 +505,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") - } /* end if */ + } /* Update external storage message, if it's used */ if(dset->shared->dcpl_cache.efl.nused > 0) { @@ -557,6 +556,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message") } /* end if */ + /* Create layout message */ /* (Don't make layout message constant unless allocation time is early and non-filtered, since space may not be allocated) */ /* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */ if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index eb687d2..2c06800 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -479,8 +479,7 @@ H5D__mpio_array_gatherv(void *local_array, size_t local_array_num_entries, MPI_Comm_size(comm, &mpi_size); MPI_Comm_rank(comm, &mpi_rank); - /* - * Determine the size of the end result array by collecting the number + /* Determine the size of the end result array by collecting the number * of entries contributed by each processor into a single total. */ if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_array_num_entries, &gathered_array_num_entries, 1, MPI_INT, MPI_SUM, comm))) diff --git a/src/H5Doh.c b/src/H5Doh.c index f8ce69f..38d0914 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -189,15 +189,15 @@ H5O__dset_isa(const H5O_t *oh) /* Datatype */ if((exists = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") else if(!exists) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE) /* Layout */ if((exists = H5O_msg_exists_oh(oh, H5O_SDSPACE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") else if(!exists) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE) done: FUNC_LEAVE_NOAPI(ret_value) @@ -260,7 +260,7 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(dset && H5D_close(dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 1217c48..591fcb1 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -510,12 +510,12 @@ typedef struct H5D_fill_buf_info_t { /* Internal data structure for computing variable-length dataset's total size */ typedef struct { - H5D_t *dset; /* Dataset for operation */ - H5S_t *fspace; /* Dataset's dataspace for operation */ - H5S_t *mspace; /* Memory dataspace for operation */ - void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ - void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ - hsize_t size; /* Accumulated number of bytes for the selection */ + H5D_t *dset; /* Dataset for operation */ + hid_t fspace_id; /* File dataspace ID of the dataset we are working on */ + hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */ + void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ + void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ + hsize_t size; /* Accumulated number of bytes for the selection */ } H5D_vlen_bufsize_t; @@ -559,15 +559,12 @@ H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_ H5_DLL hid_t H5D__get_space(const H5D_t *dset); H5_DLL hid_t H5D__get_type(const H5D_t *dset); H5_DLL herr_t H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation); -H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, - hbool_t full_overwrite, hsize_t old_dim[]); +H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]); H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size); -H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, - hsize_t *storage_size); +H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size); H5_DLL haddr_t H5D__get_offset(const H5D_t *dset); H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info); -H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, - const hsize_t *point, void *op_data); +H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *op_data); H5_DLL herr_t H5D__check_filters(H5D_t *dataset); H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset); @@ -660,6 +657,7 @@ H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, hsize_t *btree_size); H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, FILE *stream); H5_DLL herr_t H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *store); +H5_DLL herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy); H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, uint32_t data_size, const void *buf); H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index 5856ede..266f5f5 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -559,11 +559,9 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform") - } /* end if */ + } - /* - * Scatter the data into memory. - */ + /* Scatter the data into memory */ if(H5D__scatter_mem(type_info->tconv_buf, mem_space, mem_iter, smine_nelmts, buf/*out*/) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed") } /* end else */ @@ -691,9 +689,9 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in if(H5CX_get_data_transform(&data_transform) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info") - if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform") - } /* end if */ + if(H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform") + } /* * Perform datatype conversion. diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c index 321d258..4510a03 100644 --- a/src/H5Dsingle.c +++ b/src/H5Dsingle.c @@ -244,10 +244,10 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata } /* end if */ if(dset) - if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0) - /* Mark the layout dirty so that the address of the single chunk will be flushed later */ - if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty") + if(dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0) + /* Mark the layout dirty so that the address of the single chunk will be flushed later */ + if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 7f1ac86..8867492 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2961,7 +2961,7 @@ done: static herr_t H5D__virtual_refresh_source_dset(H5D_t **dset) { - hid_t dset_id; /* Temporary dataset identifier */ + hid_t temp_id; /* Temporary dataset identifier */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2970,15 +2970,15 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) HDassert(dset && *dset); /* Get a temporary identifier for this source dataset */ - if((dset_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0) + if((temp_id = H5I_register(H5I_DATASET, *dset, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register source dataset ID") /* Refresh source dataset */ - if(H5D__refresh(dset_id, *dset) < 0) + if(H5D__refresh(temp_id, *dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset") /* Discard the identifier & replace the dataset */ - if(NULL == (*dset = (H5D_t *)H5I_remove(dset_id))) + if(NULL == (*dset = (H5D_t *)H5I_remove(temp_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID") done: diff --git a/src/H5F.c b/src/H5F.c index 68bdfd3..97330e5 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -55,6 +55,8 @@ /* Local Prototypes */ /********************/ +static herr_t H5F__close_cb(H5F_t *f); + /*********************/ /* Package Variables */ @@ -157,6 +159,66 @@ H5F_term_package(void) /*------------------------------------------------------------------------- + * Function: H5F__close_cb + * + * Purpose: Closes a file or causes the close operation to be pended. + * This function is called from the API and gets called + * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref() + * decrements the file ID reference count to zero. The file ID + * is removed from the H5I_FILE group by H5I_dec_ref() just + * before H5F__close_cb() is called. If there are open object + * headers then the close is pended by moving the file to the + * H5I_FILE_CLOSING ID group (the f->closing contains the ID + * assigned to file). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F__close_cb(H5F_t *f) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */ + + /* Perform checks for "semi" file close degree here, since closing the + * file is not allowed if there are objects still open. + */ + if(f->shared->fc_degree == H5F_CLOSE_SEMI) { + unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */ + unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */ + + /* Get the number of open objects and open files on this file/mount hierarchy */ + if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0) + HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy") + + /* If there are no other file IDs open on this file/mount hier., but + * there are still open objects, issue an error and bail out now, + * without decrementing the file ID's reference count and triggering + * a "real" attempt at closing the file. + */ + if(nopen_files == 1 && nopen_objs > 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open") + } /* end if */ + + /* Reset the file ID for this file */ + f->file_id = -1; + + /* Attempt to close the file/mount hierarchy */ + if(H5F_try_close(f, NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__close_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5Fget_create_plist * * Purpose: Get an atom for a copy of the file-creation property list for @@ -236,36 +298,105 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_obj_count + * Function: H5F__get_all_count_cb + * + * Purpose: Get counter of all object types currently open. * - * Purpose: Public function returning the number of opened object IDs - * (files, datasets, groups and datatypes) in the same file. + * Return: Success: H5_ITER_CONT or H5_ITER_STOP + * + * Failure: H5_ITER_ERROR + * + *------------------------------------------------------------------------- + */ +static int +H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) +{ + H5F_trav_obj_cnt_t *udata = (H5F_trav_obj_cnt_t *)key; + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + *(udata->obj_count) = *(udata->obj_count) + 1; + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F_get_all_count_cb */ + + +/*------------------------------------------------------------------------- + * Function: H5Fget_obj_count + * + * Purpose: Public function returning the number of opened object IDs + * (files, datasets, groups and datatypes) in the same file. + * + * Return: Success: The number of opened object IDs + * + * Failure: -1 * - * Return: Non-negative on success; negative on failure. *------------------------------------------------------------------------- */ ssize_t H5Fget_obj_count(hid_t file_id, unsigned types) { - H5F_t *f = NULL; /* File to query */ - size_t obj_count = 0; /* Number of opened objects */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = 0; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE2("Zs", "iIu", file_id, types); /* Check arguments */ - if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") if(0 == (types & H5F_OBJ_ALL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type") /* Perform the query */ - if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") - - /* Set the return value */ - ret_value = (ssize_t)obj_count; + /* If the 'special' ID wasn't passed in, just make a normal call to + * count the IDs in the file. + */ + if(file_id != (hid_t)H5F_OBJ_ALL) { + H5F_t *f = NULL; + size_t obj_count = 0; + + /* Get the file object */ + if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id") + + /* Get the count */ + if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)") + + /* Set the return value */ + ret_value = (ssize_t)obj_count; + } + /* If we passed in the 'special' ID, get the count for everything open in the + * library, iterating over all open files and getting the object count for each. + * + * XXX: Consider making this a helper function in H5I. + */ + else { + H5F_trav_obj_cnt_t udata; + + udata.obj_count = &ret_value; + udata.types = types | H5F_OBJ_LOCAL; + + if(types & H5F_OBJ_FILE) { + if(H5I_iterate(H5I_FILE, H5F__get_all_count_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed"); + } + if(types & H5F_OBJ_DATASET) { + if(H5I_iterate(H5I_DATASET, H5F__get_all_count_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed"); + } + if(types & H5F_OBJ_GROUP) { + if(H5I_iterate(H5I_GROUP, H5F__get_all_count_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed"); + } + if(types & H5F_OBJ_DATATYPE) { + if(H5I_iterate(H5I_DATATYPE, H5F__get_all_count_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed"); + } + if(types & H5F_OBJ_ATTR) { + if(H5I_iterate(H5I_ATTR, H5F__get_all_count_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed"); + } + } done: FUNC_LEAVE_API(ret_value) @@ -273,37 +404,118 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_object_ids + * Function: H5F__get_all_ids_cb + * + * Purpose: Get IDs of all currently open objects of a given type. + * + * Return: Success: H5_ITER_CONT or H5_ITER_STOP * - * Purpose: Public function to return a list of opened object IDs. + * Failure: H5_ITER_ERROR + * + *------------------------------------------------------------------------- + */ +static int +H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key) +{ + H5F_trav_obj_ids_t *udata = (H5F_trav_obj_ids_t *)key; + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + if(*udata->obj_count >= udata->max_objs) + HGOTO_DONE(H5_ITER_STOP); + + udata->oid_list[*udata->obj_count] = obj_id; + *(udata->obj_count) = *(udata->obj_count) + 1; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F__get_all_ids_cb */ + + +/*------------------------------------------------------------------------- + * Function: H5Fget_object_ids + * + * Purpose: Public function to return a list of opened object IDs. + * + * NOTE: Type mismatch - You can ask for more objects than can be + * returned. + * + * Return: Success: The number of IDs in oid_list + * + * Failure: -1 * - * Return: Non-negative on success; negative on failure. *------------------------------------------------------------------------- */ ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) { - H5F_t *f = NULL; /* File to query */ - size_t obj_id_count = 0; /* Number of open objects */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = 0; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "iIuz*i", file_id, types, max_objs, oid_list); /* Check arguments */ - if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") if(0 == (types & H5F_OBJ_ALL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type") if(!oid_list) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "object ID list is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "object ID list cannot be NULL") /* Perform the query */ - if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_id_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed") + /* If the 'special' ID wasn't passed in, just make a normal VOL call to + * get the IDs from the file. + */ + if(file_id != (hid_t)H5F_OBJ_ALL) { + H5F_t *file = NULL; + size_t obj_id_count = 0; - /* Set the return value */ - ret_value = (ssize_t)obj_id_count; + /* get the file object */ + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") + + /* Get the IDs */ + if(H5F_get_obj_ids(file, types, max_objs, oid_list, TRUE, &obj_id_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") + + /* Set the return value */ + ret_value = (ssize_t)obj_id_count; + } + /* If we passed in the 'special' ID, get the count for everything open in the + * library, iterating over all open files and getting the object count for each. + * + * XXX: Consider making this a helper function in H5I. + * XXX: Note that the RM states that passing in a negative value for max_objs + * gets you all the objects. This technically works, but is clearly wrong + * behavior since max_objs is an unsigned type. + */ + else { + H5F_trav_obj_ids_t udata; + + udata.max_objs = max_objs; + udata.oid_list = oid_list; + udata.obj_count = &ret_value; + + if(types & H5F_OBJ_FILE) { + if(H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed"); + } + if(types & H5F_OBJ_DATASET) { + if(H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed"); + } + if(types & H5F_OBJ_GROUP) { + if(H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed"); + } + if(types & H5F_OBJ_DATATYPE) { + if(H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed"); + } + if(types & H5F_OBJ_ATTR) { + if(H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed"); + } + } done: FUNC_LEAVE_API(ret_value) @@ -482,7 +694,7 @@ done: * * Return: Success: A file ID * - * Failure: FAIL + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -495,7 +707,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*sIui", filename, flags, fapl_id); - /* Check/fix arguments. */ + /* Check arguments */ if(!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") /* Reject undefined flags (~H5F_ACC_PUBLIC_FLAGS) and the H5F_ACC_TRUNC & H5F_ACC_EXCL flags */ @@ -533,13 +745,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fflush + * Function: H5Fflush + * + * Purpose: Flushes all outstanding buffers of a file to disk but does + * not remove them from the cache. The OBJECT_ID can be a file, + * dataset, group, attribute, or named data type. * - * Purpose: Flushes all outstanding buffers of a file to disk but does - * not remove them from the cache. The OBJECT_ID can be a file, - * dataset, group, attribute, or named data type. + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -547,7 +760,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) { H5F_t *f = NULL; /* File to flush */ H5O_loc_t *oloc = NULL; /* Object location for ID */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "iFs", object_id, scope); @@ -654,17 +867,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fclose + * Function: H5Fclose + * + * Purpose: This function closes the file specified by FILE_ID by + * flushing all data to storage, and terminating access to the + * file through FILE_ID. If objects (e.g., datasets, groups, + * etc.) are open in the file then the underlying storage is not + * closed until those objects are closed; however, all data for + * the file and the open objects is flushed. * - * Purpose: This function closes the file specified by FILE_ID by - * flushing all data to storage, and terminating access to the - * file through FILE_ID. If objects (e.g., datasets, groups, - * etc.) are open in the file then the underlying storage is not - * closed until those objects are closed; however, all data for - * the file and the open objects is flushed. + * Return: SUCCEED/FAIL * - * Return: Success: Non-negative - * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -677,7 +890,7 @@ H5Fclose(hid_t file_id) /* Check arguments */ if(H5I_FILE != H5I_get_type(file_id)) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") /* Close the file */ if(H5F__close(file_id) < 0) @@ -689,63 +902,62 @@ done: /*------------------------------------------------------------------------- - * Function: H5Freopen + * Function: H5Freopen * - * Purpose: Reopen a file. The new file handle which is returned points - * to the same file as the specified file handle. Both handles - * share caches and other information. The only difference - * between the handles is that the new handle is not mounted - * anywhere and no files are mounted on it. + * Purpose: Reopen a file. The new file handle which is returned points + * to the same file as the specified file handle. Both handles + * share caches and other information. The only difference + * between the handles is that the new handle is not mounted + * anywhere and no files are mounted on it. + * + * Return: Success: New file ID + * + * Failure: H5I_INVALID_HID * - * Return: Success: New file ID - * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5Freopen(hid_t file_id) { - H5F_t *old_file = NULL; - H5F_t *new_file = NULL; - hid_t ret_value; + H5F_t *old_file = NULL; + H5F_t *new_file = NULL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); - /* Check arguments */ + /* Get the file object */ if(NULL == (old_file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file") - /* Get a new "top level" file struct, sharing the same "low level" file struct */ - if(NULL == (new_file = H5F__new(old_file->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") - - /* Duplicate old file's names */ - new_file->open_name = H5MM_xstrdup(old_file->open_name); - new_file->actual_name = H5MM_xstrdup(old_file->actual_name); - new_file->extpath = H5MM_xstrdup(old_file->extpath); + /* Reopen the file */ + if(NULL == (new_file = H5F__reopen(old_file))) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") + /* Get an atom for the file */ if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") /* Keep this ID in file object structure */ new_file->file_id = ret_value; done: - if(ret_value < 0 && new_file) - if(H5F__dest(new_file, FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") + if(H5I_INVALID_HID == ret_value) + if(new_file && H5F__dest(new_file, FALSE) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "can't close file") FUNC_LEAVE_API(ret_value) } /* end H5Freopen() */ /*------------------------------------------------------------------------- - * Function: H5Fget_intent + * Function: H5Fget_intent * - * Purpose: Public API to retrieve the file's 'intent' flags passed - * during H5Fopen() + * Purpose: Public API to retrieve the file's 'intent' flags passed + * during H5Fopen() + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/negative on failure *------------------------------------------------------------------------- */ herr_t @@ -794,8 +1006,10 @@ done: * * Purpose: Retrieves the amount of free space in the file. * - * Return: Success: Amount of free space for type - * Failure: Negative + * Return: Success: Amount of free space for type + * + * Failure: -1 + * *------------------------------------------------------------------------- */ hssize_t @@ -805,16 +1019,16 @@ H5Fget_freespace(hid_t file_id) hsize_t tot_space; /* Amount of free space in the file */ hssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Hs", "i", file_id); - /* Check args */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") - /* Go get the actual amount of free space in the file */ + /* Get the amount of free space in the file */ if(H5MF_get_freespace(file, &tot_space, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") ret_value = (hssize_t)tot_space; @@ -828,10 +1042,10 @@ done: * * Purpose: Retrieves the file size of the HDF5 file. This function * is called after an existing file is opened in order - * to learn the true size of the underlying file. + * to learn the true size of the underlying file. + * + * Return: SUCCEED/FAIL * - * Return: Success: Non-negative - * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -840,23 +1054,26 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) H5F_t *file; /* File object for file ID */ haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */ haddr_t base_addr; /* Base address for the file */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", file_id, size); /* Check args */ + if(!size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size parameter cannot be NULL") if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Go get the actual file size */ + /* Get the actual file size */ if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") base_addr = H5FD_get_base_addr(file->shared->lf); + /* Convert relative base address for file to absolute address */ if(size) - *size = (hsize_t)(max_eof_eoa + base_addr); /* Convert relative base address for file to absolute address */ + *size = (hsize_t)(max_eof_eoa + base_addr); done: FUNC_LEAVE_API(ret_value) @@ -867,56 +1084,58 @@ done: * Function: H5Fget_file_image * * Purpose: If a buffer is provided (via the buf_ptr argument) and is - * big enough (size in buf_len argument), load *buf_ptr with - * an image of the open file whose ID is provided in the - * file_id parameter, and return the number of bytes copied - * to the buffer. + * big enough (size in buf_len argument), load *buf_ptr with + * an image of the open file whose ID is provided in the + * file_id parameter, and return the number of bytes copied + * to the buffer. * - * If the buffer exists, but is too small to contain an image - * of the indicated file, return a negative number. + * If the buffer exists, but is too small to contain an image + * of the indicated file, return a negative number. * - * Finally, if no buffer is provided, return the size of the - * buffer needed. This value is simply the eoa of the target - * file. + * Finally, if no buffer is provided, return the size of the + * buffer needed. This value is simply the eoa of the target + * file. * - * Note that any user block is skipped. + * Note that any user block is skipped. * - * Also note that the function may not be used on files - * opened with either the split/multi file driver or the - * family file driver. + * Also note that the function may not be used on files + * opened with either the split/multi file driver or the + * family file driver. * - * In the former case, the sparse address space makes the - * get file image operation impractical, due to the size of - * the image typically required. + * In the former case, the sparse address space makes the + * get file image operation impractical, due to the size of + * the image typically required. * - * In the case of the family file driver, the problem is - * the driver message in the super block, which will prevent - * the image being opened with any driver other than the - * family file driver -- which negates the purpose of the - * operation. This can be fixed, but no resources for - * this now. + * In the case of the family file driver, the problem is + * the driver message in the super block, which will prevent + * the image being opened with any driver other than the + * family file driver -- which negates the purpose of the + * operation. This can be fixed, but no resources for + * this now. + * + * Return: Success: Bytes copied / number of bytes needed + * + * Failure: -1 * - * Return: Success: Bytes copied / number of bytes needed. - * Failure: negative value *------------------------------------------------------------------------- */ ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) { - H5F_t *file; /* File object for file ID */ - ssize_t ret_value; /* Return value */ + H5F_t *file; /* File object for file ID */ + ssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len); /* Check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") - /* call private get_file_image function */ + /* Get the file image */ /* (Should not trigger raw data I/O - QAK, 2018/01/03) */ if((ret_value = H5F__get_file_image(file, buf_ptr, buf_len)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file image") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: FUNC_LEAVE_API(ret_value) @@ -924,17 +1143,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_mdc_config + * Function: H5Fget_mdc_config * - * Purpose: Retrieves the current automatic cache resize configuration - * from the metadata cache, and return it in *config_ptr. + * Purpose: Retrieves the current automatic cache resize configuration + * from the metadata cache, and return it in *config_ptr. * - * Note that the version field of *config_Ptr must be correctly - * filled in by the caller. This allows us to adapt for - * obsolete versions of the structure. + * Note that the version field of *config_Ptr must be correctly + * filled in by the caller. This allows us to adapt for + * obsolete versions of the structure. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -952,9 +1171,9 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) if((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") - /* Go get the resize configuration */ + /* Get the metadata cache configuration */ if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: FUNC_LEAVE_API(ret_value) @@ -965,11 +1184,11 @@ done: * Function: H5Fset_mdc_config * * Purpose: Sets the current metadata cache automatic resize - * configuration, using the contents of the instance of - * H5AC_cache_config_t pointed to by config_ptr. + * configuration, using the contents of the instance of + * H5AC_cache_config_t pointed to by config_ptr. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -981,13 +1200,13 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); - /* Check args */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - /* set the resize configuration */ + /* Set the metadata cache configuration */ if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") done: FUNC_LEAVE_API(ret_value) @@ -998,12 +1217,12 @@ done: * Function: H5Fget_mdc_hit_rate * * Purpose: Retrieves the current hit rate from the metadata cache. - * This rate is the overall hit rate since the last time - * the hit rate statistics were reset either manually or - * automatically. + * This rate is the overall hit rate since the last time + * the hit rate statistics were reset either manually or + * automatically. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -1022,9 +1241,9 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) if(NULL == hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") - /* Go get the current hit rate */ + /* Get the current hit rate */ if(H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: FUNC_LEAVE_API(ret_value) @@ -1035,13 +1254,13 @@ done: * Function: H5Fget_mdc_size * * Purpose: Retrieves the maximum size, minimum clean size, current - * size, and current number of entries from the metadata - * cache associated with the specified file. If any of - * the ptr parameters are NULL, the associated datum is - * not returned. + * size, and current number of entries from the metadata + * cache associated with the specified file. If any of + * the ptr parameters are NULL, the associated datum is + * not returned. + * + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -1060,10 +1279,10 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Go get the size data */ + /* Get the size data */ if(H5AC_get_cache_size(file->shared->cache, max_size_ptr, min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") if(cur_num_entries_ptr != NULL) *cur_num_entries_ptr = (int)cur_num_entries; @@ -1077,16 +1296,16 @@ done: * Function: H5Freset_mdc_hit_rate_stats * * Purpose: Reset the hit rate statistic whose current value can - * be obtained via the H5Fget_mdc_hit_rate() call. Note - * that this statistic will also be reset once per epoch - * by the automatic cache resize code if it is enabled. + * be obtained via the H5Fget_mdc_hit_rate() call. Note + * that this statistic will also be reset once per epoch + * by the automatic cache resize code if it is enabled. + * + * It is probably a bad idea to call this function unless + * you are controlling cache size from your program instead + * of using our cache size control code. * - * It is probably a bad idea to call this function unless - * you are controlling cache size from your program instead - * of using our cache size control code. + * Return: SUCCEED/FAIL * - * Return: Success: SUCCEED - * Failure: FAIL *------------------------------------------------------------------------- */ herr_t @@ -1098,13 +1317,13 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); - /* Check args */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ if(H5AC_reset_cache_hit_rate_stats(file->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") done: FUNC_LEAVE_API(ret_value) @@ -1115,18 +1334,21 @@ done: * Function: H5Fget_name * * Purpose: Gets the name of the file to which object OBJ_ID belongs. - * If `name' is non-NULL then write up to `size' bytes into that + * If 'name' is non-NULL then write up to 'size' bytes into that * buffer and always return the length of the entry name. - * Otherwise `size' is ignored and the function does not store the name, - * just returning the number of characters required to store the name. - * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL) - * is unchanged and the function returns a negative value. + * Otherwise `size' is ignored and the function does not store + * the name, just returning the number of characters required to + * store the name. If an error occurs then the buffer pointed to + * by 'name' (NULL or non-NULL) is unchanged and the function + * returns a negative value. * * Note: This routine returns the name that was used to open the file, * not the actual name after resolving symlinks, etc. * - * Return: Success: The length of the file name - * Failure: Negative + * Return: Success: The length of the file name + * + * Failure: -1 + * *------------------------------------------------------------------------- */ ssize_t @@ -1134,9 +1356,9 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) { H5F_t *f; /* Top file in mount hierarchy */ size_t len; - ssize_t ret_value; + ssize_t ret_value = -1; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", obj_id, name, size); /* For file IDs, get the file object directly */ @@ -1145,14 +1367,14 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) */ if(H5I_get_type(obj_id) == H5I_FILE ) { if(NULL == (f = (H5F_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file") } /* end if */ else { H5G_loc_t loc; /* Object location */ /* Get symbol table entry */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a valid object ID") f = loc.oloc->file; } /* end else */ @@ -1181,42 +1403,48 @@ done: * in the SOHM table if there is one. * 3. The amount of free space tracked in the file. * - * Return: Success: non-negative on success - * Failure: Negative + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) { H5F_t *f; /* Top file in mount hierarchy */ - herr_t ret_value = SUCCEED; /* Return value */ + H5I_type_t type; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", obj_id, finfo); /* Check args */ if(!finfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file info pointer can't be NULL") - /* For file IDs, get the file object directly */ - /* (This prevents the H5G_loc() call from returning the file pointer for - * the top file in a mount hierarchy) - */ - if(H5I_get_type(obj_id) == H5I_FILE ) { + /* Check the type */ + type = H5I_get_type(obj_id); + if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Get the file object */ + if(type == H5I_FILE ) { + /* For file IDs, get the file object directly */ + /* (This prevents the H5G_loc() call from returning the file pointer for + * the top file in a mount hierarchy) + */ if(NULL == (f = (H5F_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") } /* end if */ else { H5G_loc_t loc; /* Object location */ /* Get symbol table entry */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object identifier") f = loc.oloc->file; } /* end else */ - HDassert(f->shared); - /* Get the file info */ + /* Get the file information */ if(H5F__get_info(f, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") @@ -1228,17 +1456,18 @@ done: /*------------------------------------------------------------------------- * Function: H5Fget_metadata_read_retry_info * - * Purpose: To retrieve the collection of read retries for metadata items with checksum. + * Purpose: To retrieve the collection of read retries for metadata + * items with checksum. + * + * Return: SUCCEED/FAIL * - * Return: Success: non-negative on success - * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) { H5F_t *file; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, info); @@ -1252,7 +1481,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5F__get_metadata_read_retry_info(file, info) < 0) + if(H5F_get_metadata_read_retry_info(file, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") done: @@ -1261,36 +1490,38 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_free_sections + * Function: H5Fget_free_sections + * + * Purpose: To get free-space section information for free-space manager with + * TYPE that is associated with file FILE_ID. + * If SECT_INFO is null, this routine returns the total # of free-space + * sections. + * + * Return: Success: The total # of free space sections * - * Purpose: To get free-space section information for free-space manager with - * TYPE that is associated with file FILE_ID. - * If SECT_INFO is null, this routine returns the total # of free-space - * sections. + * Failure: -1 * - * Return: Success: non-negative, the total # of free space sections - * Failure: negative *------------------------------------------------------------------------- */ ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/) { - H5F_t *file; /* Top file in mount hierarchy */ - ssize_t ret_value; /* Return value */ + H5F_t *file; + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info); /* Check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") if(sect_info && nsects == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ if((ret_value = H5MF_get_free_sections(file, type, nsects, sect_info)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: FUNC_LEAVE_API(ret_value) @@ -1304,15 +1535,15 @@ done: * provided file, potentially closing any cached files * unless they are held open from somewhere\ else. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fclear_elink_file_cache(hid_t file_id) { - H5F_t *file; /* File */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1335,9 +1566,34 @@ done: /*------------------------------------------------------------------------- * Function: H5Fstart_swmr_write * - * Purpose: To enable SWMR writing mode for the file + * Purpose: To enable SWMR writing mode for the file + * + * 1) Refresh opened objects: part 1 + * 2) Flush & reset accumulator + * 3) Mark the file in SWMR writing mode + * 4) Set metadata read attempts and retries info + * 5) Disable accumulator + * 6) Evict all cache entries except the superblock + * 7) Refresh opened objects (part 2) + * 8) Unlock the file + * + * Pre-conditions: + * + * 1) The file being opened has v3 superblock + * 2) The file is opened with H5F_ACC_RDWR + * 3) The file is not already marked for SWMR writing + * 4) Current implementaion for opened objects: + * --only allow datasets and groups without attributes + * --disallow named datatype with/without attributes + * --disallow opened attributes attached to objects + * + * NOTE: Currently, only opened groups and datasets are allowed + * when enabling SWMR via H5Fstart_swmr_write(). + * Will later implement a different approach-- + * set up flush dependency/proxy even for file opened without + * SWMR to resolve issues with opened objects. * - * Return: Non-negative on success/negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1345,22 +1601,22 @@ herr_t H5Fstart_swmr_write(hid_t file_id) { H5F_t *file = NULL; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); - /* check args */ + /* Check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the internal routine */ + /* start SWMR writing */ if(H5F__start_swmr_write(file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format") + HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: FUNC_LEAVE_API(ret_value) @@ -1373,7 +1629,8 @@ done: * Purpose: Start metadata cache logging operations for a file. * - Logging must have been set up via the fapl. * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t @@ -1405,7 +1662,8 @@ done: * - Does not close the log file. * - Logging must have been set up via the fapl. * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t @@ -1437,7 +1695,8 @@ done: * set up via the fapl. is_currently_logging determines if * log messages are being recorded at this time. * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t @@ -1471,14 +1730,15 @@ done: * H5Fset_latest_format() starting release 1.10.2. * See explanation for H5Fset_latest_format() in H5Fdeprec.c. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) { - H5F_t *f; /* File */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *f; /* File */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "iFvFv", file_id, low, high); @@ -1501,38 +1761,40 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fformat_convert + * Function: H5Fformat_convert (Internal) + * + * Purpose: Downgrade the superblock version to v2 and + * downgrade persistent file space to non-persistent + * for 1.8 library. * - * Purpose: Downgrade the superblock version to v2 and - * downgrade persistent file space to non-persistent - * for 1.8 library. + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t -H5Fformat_convert(hid_t fid) +H5Fformat_convert(hid_t file_id) { - H5F_t *f; /* File to flush */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *f = NULL; /* File */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", fid); + H5TRACE1("e", "i", file_id); - if(H5I_FILE != H5I_get_type(fid)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + /* Check args */ + if(H5I_FILE != H5I_get_type(file_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier") /* Get file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + if(NULL == (f = (H5F_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set up collective metadata if appropriate */ - if(H5CX_set_loc(fid) < 0) + if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the internal routine */ + /* Convert the format */ if(H5F__format_convert(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format") + HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") done: FUNC_LEAVE_API(ret_value) @@ -1544,15 +1806,15 @@ done: * * Purpose: Resets statistics for the page buffer layer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Freset_page_buffering_stats(hid_t file_id) { - H5F_t *file; /* File to reset stats on */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File to reset stats on */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1565,7 +1827,7 @@ H5Freset_page_buffering_stats(hid_t file_id) /* Reset the statistics */ if(H5PB_reset_stats(file->shared->page_buf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") done: FUNC_LEAVE_API(ret_value) @@ -1577,15 +1839,15 @@ done: * * Purpose: Retrieves statistics for the page buffer layer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]) { - H5F_t *file; /* File object for file ID */ + H5F_t *file; /* File object */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1618,8 +1880,8 @@ done: * image_len: --size of the on disk metadata cache image * --zero if no cache image * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t @@ -1653,10 +1915,7 @@ done: * allocated memory in the file. * (See H5FDget_eoa() in H5FD.c) * - * Return: Success: First byte after allocated memory. - * Failure: HADDR_UNDEF - * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1695,7 +1954,7 @@ done: * * Purpose: Set the EOA for the file to the maximum of (EOA, EOF) + increment * - * Return: Non-negative on success/Negative on errors + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1729,3 +1988,4 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment) done: FUNC_LEAVE_API(ret_value) } /* H5Fincrement_filesize() */ + diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 6417956..c91d0ea 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -35,12 +35,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ -#include "H5Iprivate.h" /* IDs */ -#include "H5SMprivate.h" /* Shared object header messages */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ +#include "H5SMprivate.h" /* Shared object header messages */ /****************/ @@ -84,16 +84,12 @@ * Function: H5Fget_info1 * * Purpose: Gets general information about the file, including: - * 1. Get storage size for superblock extension if there is one. + * 1. Get storage size for superblock extension if there is one. * 2. Get the amount of btree and heap storage for entries * in the SOHM table if there is one. - * 3. The amount of free space tracked in the file. + * 3. The amount of free space tracked in the file. * - * Return: Success: non-negative on success - * Failure: Negative - * - * Programmer: Vailin Choi - * July 11, 2007 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -111,14 +107,15 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) if(!finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - /* For file IDs, get the file object directly */ - /* (This prevents the H5G_loc() call from returning the file pointer for + /* For file IDs, get the file object directly + * + * (This prevents the H5G_loc() call from returning the file pointer for * the top file in a mount hierarchy) */ if(H5I_get_type(obj_id) == H5I_FILE ) { if(NULL == (f = (H5F_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - } /* end if */ + } else { H5G_loc_t loc; /* Object location */ @@ -126,7 +123,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) if(H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") f = loc.oloc->file; - } /* end else */ + } HDassert(f->shared); /* Get the current file info */ @@ -193,7 +190,8 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") /* 'low' and 'high' are both initialized to LATEST. - If latest format is not expected, set 'low' to EARLIEST */ + * If latest format is not expected, set 'low' to EARLIEST + */ if(!latest_format) low = H5F_LIBVER_EARLIEST; diff --git a/src/H5Fint.c b/src/H5Fint.c index 432cd8e..39934d6 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -47,7 +47,7 @@ /* Local Typedefs */ /******************/ -/* Struct only used by functions H5F_get_objects and H5F_get_objects_cb */ +/* Struct only used by functions H5F__get_objects and H5F__get_objects_cb */ typedef struct H5F_olist_t { H5I_type_t obj_type; /* Type of object to look for */ hid_t *obj_id_list; /* Pointer to the list of open IDs to return */ @@ -73,10 +73,11 @@ typedef struct H5F_olist_t { /* Local Prototypes */ /********************/ -static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); +static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); +static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/); -static herr_t H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); +static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); static herr_t H5F__flush_phase1(H5F_t *f); static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); @@ -104,19 +105,19 @@ H5FL_DEFINE(H5F_file_t); /*------------------------------------------------------------------------- - * Function: H5F_get_access_plist + * Function: H5F_get_access_plist * - * Purpose: Returns a copy of the file access property list of the - * specified file. + * Purpose: Returns a copy of the file access property list of the + * specified file. * * NOTE: Make sure that, if you are going to overwrite * information in the copied property list that was * previously opened and assigned to the property list, then * you must close it before overwriting the values. * - * Return: Success: Object ID for a copy of the file access - * property list. - * Failure: FAIL + * Return: Success: Object ID for a copy of the file access + * property list. + * Failure: H5I_INVALID_HID *------------------------------------------------------------------------- */ hid_t @@ -127,71 +128,71 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */ unsigned efc_size = 0; - hid_t ret_value = SUCCEED; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check args */ HDassert(f); /* Make a copy of the default file access property list */ if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Copy properties of the file access property list */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(f->shared->rdcc_nslots)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size") if(H5P_set(new_plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks") if(H5P_set(new_plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment threshold") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold") if(H5P_set(new_plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment") if(H5P_set(new_plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference") if(H5P_set(new_plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size") if(H5P_set(new_plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size") if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size") if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions") if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions") if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'read attempts ' flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag") if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object flush callback") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback") if(f->shared->efc) efc_size = H5F__efc_max_nfiles(f->shared->efc); if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set elink file cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size") if(f->shared->page_buf != NULL) { if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set page buffer size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size") if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set minimum metadata fraction of page buffer") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer") if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set minimum raw data fraction of page buffer") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer") } /* end if */ #ifdef H5_HAVE_PARALLEL if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") #endif /* H5_HAVE_PARALLEL */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") /* Prepare the driver property */ driver_prop.driver_id = f->shared->lf->driver_id; @@ -200,18 +201,18 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) /* Set the driver property */ if(H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info") /* Set the file close degree appropriately */ if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") done: /* Release the copy of the driver info, if it was set up */ if(driver_prop_copied && H5FD_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close copy of driver info") FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_access_plist() */ @@ -237,8 +238,8 @@ H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_i HDassert(obj_id_count_ptr); /* Perform the query */ - if((ret_value = H5F_get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_objects failed") + if((ret_value = H5F__get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -264,8 +265,8 @@ H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list HDassert(obj_id_count_ptr); /* Perform the query */ - if((ret_value = H5F_get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_objects failed") + if((ret_value = H5F__get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -273,23 +274,23 @@ done: /*--------------------------------------------------------------------------- - * Function: H5F_get_objects + * Function: H5F__get_objects * - * Purpose: This function is called by H5F_get_obj_count or - * H5F_get_obj_ids to get number of object IDs and/or a - * list of opened object IDs (in return value). + * Purpose: This function is called by H5F_get_obj_count or + * H5F_get_obj_ids to get number of object IDs and/or a + * list of opened object IDs (in return value). * - * Return: Non-negative on success; Can't fail. + * Return: SUCCEED/FAIL *--------------------------------------------------------------------------- */ -herr_t -H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr) +static herr_t +H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr) { - size_t obj_id_count=0; /* Number of open IDs */ + size_t obj_id_count = 0; /* Number of open IDs */ H5F_olist_t olist; /* Structure to hold search results */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(obj_id_count_ptr); @@ -304,30 +305,30 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ if(types & H5F_OBJ_LOCAL) { olist.file_info.local = TRUE; olist.file_info.ptr.file = f; - } /* end if */ + } else { olist.file_info.local = FALSE; olist.file_info.ptr.shared = f ? f->shared : NULL; - } /* end else */ + } /* Iterate through file IDs to count the number, and put their * IDs on the object list. */ if(types & H5F_OBJ_FILE) { olist.obj_type = H5I_FILE; - if(H5I_iterate(H5I_FILE, H5F_get_objects_cb, &olist, app_ref) < 0) + if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)") - } /* end if */ + } /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, * search through dataset IDs to count number of datasets, and put their * IDs on the object list */ if(!olist.max_nobjs || (olist.max_nobjs && olist.list_indexfile_info.ptr.shared || (olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared)))) { add_obj = TRUE; - } /* end if */ - } /* end if */ - else { /* either count opened object IDs or put the IDs on the list */ + } + } + else { /* Either count opened object IDs or put the IDs on the list */ H5O_loc_t *oloc; /* Group entry info for object */ switch(olist->obj_type) { @@ -456,7 +457,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) (!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) || (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) { add_obj = TRUE; - } /* end if */ + } } /* end else */ if(add_obj) { @@ -464,7 +465,7 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) if(olist->obj_id_list) { olist->obj_id_list[olist->list_index] = obj_id; olist->list_index++; - } /* end if */ + } /* Increment the number of open objects */ if(olist->obj_id_count) @@ -473,14 +474,15 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) /* Check if we've filled up the array. Return H5_ITER_STOP only if * we have filled up the array. Otherwise return H5_ITER_CONT(RET_VALUE is * preset to H5_ITER_CONT) because H5I_iterate needs the return value of - * H5_ITER_CONT to continue the iteration. */ + * H5_ITER_CONT to continue the iteration. + */ if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs) HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */ - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_objects_cb() */ +} /* end H5F__get_objects_cb() */ /*-------------------------------------------------------------------------- @@ -489,7 +491,6 @@ done: * Purpose: Prepend PREFIX to FILE_NAME and store in FULL_NAME * * Return: SUCCEED/FAIL - * *--------------------------------------------------------------------------*/ static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/) @@ -517,14 +518,14 @@ done: /*-------------------------------------------------------------------------- - * Function: H5F__getenv_prefix_name + * Function: H5F__getenv_prefix_name * - * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, - * which is separated by the environment delimiter. - * env_prefix is modified to point to the remaining pathnames - * in the list. + * Purpose: Get the first pathname in the list of pathnames stored in env_prefix, + * which is separated by the environment delimiter. + * env_prefix is modified to point to the remaining pathnames + * in the list. * - * Return: A pointer to a pathname + * Return: A pointer to a pathname (can't fail but can return NULL) --------------------------------------------------------------------------*/ static char * H5F__getenv_prefix_name(char **env_prefix/*in,out*/) @@ -666,6 +667,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, /* Leave if file was opened */ else break; + H5E_clear_stack(NULL); } /* end if */ } /* end while */ @@ -776,28 +778,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__is_hdf5 + * Function: H5F__is_hdf5 * - * Purpose: Check the file signature to detect an HDF5 file. + * Purpose: Check the file signature to detect an HDF5 file. * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. * - * Return: Success: TRUE/FALSE - * * Failure: Negative + * Return: TRUE/FALSE/FAIL *------------------------------------------------------------------------- */ htri_t H5F__is_hdf5(const char *name) { - H5FD_t *file = NULL; /* Low-level file struct */ - haddr_t sig_addr; /* Addess of hdf5 file signature */ - htri_t ret_value = FAIL; /* Return value */ + H5FD_t *file = NULL; /* Low-level file struct */ + haddr_t sig_addr; /* Addess of hdf5 file signature */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE - /* Open the file at the virtual file layer */ + /* Open the file */ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") @@ -809,7 +810,7 @@ H5F__is_hdf5(const char *name) done: /* Close the file */ if(file) - if(H5FD_close(file) < 0 && ret_value >= 0) + if(H5FD_close(file) < 0 && TRUE == ret_value) HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") FUNC_LEAVE_NOAPI(ret_value) @@ -1045,7 +1046,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure") /* Add new "shared" struct to list of open files */ - if(H5F_sfile_add(f->shared) < 0) + if(H5F__sfile_add(f->shared) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to append to list of open files") } /* end else */ @@ -1079,14 +1080,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__dest + * Function: H5F__dest * - * Purpose: Destroys a file structure. This function flushes the cache - * but doesn't do any other cleanup other than freeing memory - * for the file struct. The shared info for the file is freed - * only when its reference count reaches zero. + * Purpose: Destroys a file structure. This function flushes the cache + * but doesn't do any other cleanup other than freeing memory + * for the file struct. The shared info for the file is freed + * only when its reference count reaches zero. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1240,7 +1241,7 @@ H5F__dest(H5F_t *f, hbool_t flush) HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); /* Remove shared file struct from list of open files */ - if(H5F_sfile_remove(f->shared) < 0) + if(H5F__sfile_remove(f->shared) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") @@ -1490,7 +1491,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } /* end if */ /* Is the file already open? */ - if((shared = H5F_sfile_search(lf)) != NULL) { + if((shared = H5F__sfile_search(lf)) != NULL) { /* * The file is already open, so use that one instead of the one we * just opened. We only one one H5FD_t* per file so one doesn't @@ -1622,7 +1623,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(H5G_mkroot(file, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group") } /* end if */ - else if (1 == shared->nrefs) { + else if(1 == shared->nrefs) { /* Read the superblock if it hasn't been read before. */ if(H5F__super_read(file, a_plist, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock") @@ -1687,7 +1688,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") /* Formulate the actual file name, after following symlinks, etc. */ - if(H5F_build_actual_name(file, a_plist, name, &file->actual_name) < 0) + if(H5F__build_actual_name(file, a_plist, name, &file->actual_name) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build actual name") if(set_flag) { @@ -1749,11 +1750,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_flush_phase1 + * Function: H5F_flush_phase1 * - * Purpose: First phase of flushing cached data. + * Purpose: First phase of flushing cached data. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t @@ -1786,11 +1788,12 @@ H5F__flush_phase1(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F__flush_phase2 + * Function: H5F__flush_phase2 * - * Purpose: Second phase of flushing cached data. + * Purpose: Second phase of flushing cached data. + * + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t @@ -1809,13 +1812,14 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { /* Since we just returned from a call to H5AC_flush(), we just * passed through a barrier. Hence we can skip the barrier on * entry to the mpio file driver truncate call below, and the first * barrier in the following call to flush the cache again. */ H5CX_set_mpi_file_flushing(TRUE); + } #endif /* H5_HAVE_PARALLEL */ /* Truncate the file to the current allocated size */ @@ -1854,11 +1858,12 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) /*------------------------------------------------------------------------- - * Function: H5F__flush + * Function: H5F__flush + * + * Purpose: Flushes cached data. * - * Purpose: Flushes cached data. + * Return: SUCCEED/FAIL * - * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -1890,10 +1895,7 @@ H5F__flush(H5F_t *f) * * Purpose: Internal routine to close a file. * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * December 16, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1933,72 +1935,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__close_cb - * - * Purpose: Closes a file or causes the close operation to be pended. - * This function is called from the API and gets called - * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref() - * decrements the file ID reference count to zero. The file ID - * is removed from the H5I_FILE group by H5I_dec_ref() just - * before H5F__close_cb() is called. If there are open object - * headers then the close is pended by moving the file to the - * H5I_FILE_CLOSING ID group (the f->closing contains the ID - * assigned to file). - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5F__close_cb(H5F_t *f) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(f); - HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */ - - /* Perform checks for "semi" file close degree here, since closing the - * file is not allowed if there are objects still open */ - if(f->shared->fc_degree == H5F_CLOSE_SEMI) { - unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */ - unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */ - - /* Get the number of open objects and open files on this file/mount hierarchy */ - if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0) - HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy") - - /* If there are no other file IDs open on this file/mount hier., but - * there are still open objects, issue an error and bail out now, - * without decrementing the file ID's reference count and triggering - * a "real" attempt at closing the file */ - if(nopen_files == 1 && nopen_objs > 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open") - } /* end if */ - - /* Reset the file ID for this file */ - f->file_id = -1; - - /* Attempt to close the file/mount hierarchy */ - if(H5F_try_close(f, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__close_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5F_try_close + * Function: H5F_try_close * - * Purpose: Attempts to close a file due to one of several actions: - * - The reference count on the file ID dropped to zero - * - The last open object was closed in the file - * - The file was unmounted + * Purpose: Attempts to close a file due to one of several actions: + * - The reference count on the file ID dropped to zero + * - The last open object was closed in the file + * - The file was unmounted * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -2029,7 +1973,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) if(was_closed) *was_closed = TRUE; HGOTO_DONE(SUCCEED) - } /* end if */ + } /* Get the number of open objects and open files on this file/mount hierarchy */ if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0) @@ -2063,7 +2007,8 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) HGOTO_DONE(SUCCEED) /* Sanity check: If close degree if "semi" and we have gotten this - * far and there are objects left open, bail out now */ + * far and there are objects left open, bail out now. + */ HDassert(nopen_files == 0 && nopen_objs == 0); /* If we've gotten this far (ie. there are no open objects in the file), fall through to flush & close */ @@ -2104,9 +2049,9 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) for(u = 0; u < obj_count; u++) if(H5I_dec_ref(objs[u]) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object") - } /* end while */ + } if(result < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)") /* Get the list of IDs of open named datatype objects */ /* (Do this separately from the dataset & attribute IDs, because @@ -2120,7 +2065,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) for(u = 0; u < obj_count; u++) if(H5I_dec_ref(objs[u]) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't close object") - } /* end while */ + } if(result < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(2)") } /* end if */ @@ -2139,17 +2084,18 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) /* If there is more than one reference to the shared file struct and the * file has an external file cache, we should see if it can be closed. This - * can happen if a cycle is formed with external file caches */ + * can happen if a cycle is formed with external file caches. + */ if(f->shared->efc && (f->shared->nrefs > 1)) if(H5F__efc_try_close(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't attempt to close EFC") /* Delay flush until the shared file struct is closed, in H5F__dest. If the * application called H5Fclose, it would have been flushed in that function - * (unless it will have been flushed in H5F_dest anyways). */ + * (unless it will have been flushed in H5F_dest anyways). + */ - /* - * Destroy the H5F_t struct and decrement the reference count for the + /* Destroy the H5F_t struct and decrement the reference count for the * shared H5F_file_t struct. If the reference count for the H5F_file_t * struct reaches zero then destroy it also. */ @@ -2163,14 +2109,53 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_try_close() */ + +/*------------------------------------------------------------------------- + * Function: H5F__reopen + * + * Purpose: Reopen a file. The new file handle which is returned points + * to the same file as the specified file handle. Both handles + * share caches and other information. The only difference + * between the handles is that the new handle is not mounted + * anywhere and no files are mounted on it. + * + * Return: Success: A pointer to a file struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5F_t * +H5F__reopen(H5F_t *f) +{ + H5F_t *ret_value = NULL; + + FUNC_ENTER_PACKAGE + + /* Get a new "top level" file struct, sharing the same "low level" file struct */ + if(NULL == (ret_value = H5F__new(f->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL))) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to reopen file") + + /* Duplicate old file's names */ + ret_value->open_name = H5MM_xstrdup(f->open_name); + ret_value->actual_name = H5MM_xstrdup(f->actual_name); + ret_value->extpath = H5MM_xstrdup(f->extpath); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__reopen() */ + /*------------------------------------------------------------------------- - * Function: H5F_get_id + * Function: H5F_get_id * - * Purpose: Get the file ID, incrementing it, or "resurrecting" it as - * appropriate. + * Purpose: Get the file ID, incrementing it, or "resurrecting" it as + * appropriate. + * + * Return: Success: An ID for a file + * + * Failure: H5I_INVALID_HID * - * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ hid_t @@ -2185,13 +2170,13 @@ H5F_get_id(H5F_t *file, hbool_t app_ref) if(file->file_id == -1) { /* Get an atom for the file */ if((file->file_id = H5I_register(H5I_FILE, file, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file") } else { - /* Increment reference count on atom. */ + /* Increment reference count on existing ID */ if(H5I_inc_ref(file->file_id, app_ref) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed") - } /* end else */ + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + } ret_value = file->file_id; @@ -2201,12 +2186,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_incr_nopen_objs + * Function: H5F_incr_nopen_objs * - * Purpose: Increment the number of open objects for a file. + * Purpose: Increment the number of open objects for a file. * - * Return: Success: The number of open objects, after the increment - * Failure: (can't happen) + * Return: Success: The number of open objects, after the increment + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -2222,12 +2207,12 @@ H5F_incr_nopen_objs(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_decr_nopen_objs + * Function: H5F_decr_nopen_objs * - * Purpose: Decrement the number of open objects for a file. + * Purpose: Decrement the number of open objects for a file. * - * Return: Success: The number of open objects, after the decrement - * Failure: (can't happen) + * Return: Success: The number of open objects, after the decrement + * Failure: (can't happen) *------------------------------------------------------------------------- */ unsigned @@ -2243,28 +2228,27 @@ H5F_decr_nopen_objs(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_build_actual_name + * Function: H5F__build_actual_name * - * Purpose: Retrieve the name of a file, after following symlinks, etc. + * Purpose: Retrieve the name of a file, after following symlinks, etc. * - * Note: Currently only working for "POSIX I/O compatible" VFDs + * Note: Currently only working for "POSIX I/O compatible" VFDs * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, +H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char **actual_name/*out*/) { - hid_t new_fapl_id = -1; /* ID for duplicated FAPL */ + hid_t new_fapl_id = H5I_INVALID_HID; /* ID for duplicated FAPL */ #ifdef H5_HAVE_SYMLINK /* This has to be declared here to avoid unfreed resources on errors */ char *realname = NULL; /* Fully resolved path name of file */ #endif /* H5_HAVE_SYMLINK */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -2361,17 +2345,17 @@ done: #endif /* H5_HAVE_SYMLINK */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_build_actual_name() */ +} /* H5F__build_actual_name() */ /*------------------------------------------------------------------------- - * Function: H5F_addr_encode_len + * Function: H5F_addr_encode_len * - * Purpose: Encodes an address into the buffer pointed to by *PP and - * then increments the pointer to the first byte after the - * address. An undefined value is stored as all 1's. + * Purpose: Encodes an address into the buffer pointed to by *PP and + * then increments the pointer to the first byte after the + * address. An undefined value is stored as all 1's. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2402,13 +2386,13 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5F_addr_encode + * Function: H5F_addr_encode * - * Purpose: Encodes an address into the buffer pointed to by *PP and - * then increments the pointer to the first byte after the - * address. An undefined value is stored as all 1's. + * Purpose: Encodes an address into the buffer pointed to by *PP and + * then increments the pointer to the first byte after the + * address. An undefined value is stored as all 1's. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2426,16 +2410,16 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5F_addr_decode_len + * Function: H5F_addr_decode_len * - * Purpose: Decodes an address from the buffer pointed to by *PP and - * updates the pointer to point to the next byte after the - * address. + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. * - * If the value read is all 1's then the address is returned - * with an undefined value. + * If the value read is all 1's then the address is returned + * with an undefined value. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2490,16 +2474,16 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr /*------------------------------------------------------------------------- - * Function: H5F_addr_decode + * Function: H5F_addr_decode * - * Purpose: Decodes an address from the buffer pointed to by *PP and - * updates the pointer to point to the next byte after the - * address. + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. * - * If the value read is all 1's then the address is returned - * with an undefined value. + * If the value read is all 1's then the address is returned + * with an undefined value. * - * Return: void + * Return: void *------------------------------------------------------------------------- */ void @@ -2521,8 +2505,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o * * Purpose: Set the grp_btree_shared field with a valid ref-count pointer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2547,8 +2530,7 @@ H5F_set_grp_btree_shared(H5F_t *f, H5UC_t *rc) * * Purpose: Set the sohm_addr field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2572,8 +2554,7 @@ H5F_set_sohm_addr(H5F_t *f, haddr_t addr) * * Purpose: Set the sohm_vers field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2597,8 +2578,7 @@ H5F_set_sohm_vers(H5F_t *f, unsigned vers) * * Purpose: Set the sohm_nindexes field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2622,8 +2602,7 @@ H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes) * * Purpose: Set the store_msg_crt_idx field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2643,14 +2622,14 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) /*------------------------------------------------------------------------- - * Function: H5F_set_libver_bounds() + * Function: H5F__set_libver_bounds() * * Purpose: Set the file's low and high bound to the input parameters * 'low' and 'high' respectively. * This is done only if the existing setting is different * from the inputs. * - * Return: SUCCEED on success, and FAIL on failure. + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi; December 2017 * @@ -2695,11 +2674,11 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) /* Set the new bounds */ f->shared->low_bound = low; f->shared->high_bound = high; - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_set_libver_bounds() */ +} /* H5F__set_libver_bounds() */ /*------------------------------------------------------------------------- @@ -2708,7 +2687,7 @@ done: * Purpose: Private version of H5Fget_file_image * * Return: Success: Bytes copied / number of bytes needed. - * Failure: negative value + * Failure: -1 *------------------------------------------------------------------------- */ ssize_t @@ -2722,10 +2701,10 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* Check args */ if(!file || !file->shared || !file->shared->lf) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file_id yields invalid file pointer") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "file_id yields invalid file pointer") fd_ptr = file->shared->lf; if(!fd_ptr->cls) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "fd_ptr yields invalid class pointer") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "fd_ptr yields invalid class pointer") /* the address space used by the split and multi file drivers is not * a good fit for this call. Since the plan is to depreciate these @@ -2746,7 +2725,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) * JRM -- 11/11/22 */ if(HDstrcmp(fd_ptr->cls->name, "multi") == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "Not supported for multi file driver.") /* While the family file driver is conceptually fully compatible * with the get file image operation, it sets a file driver message @@ -2768,11 +2747,11 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) * JRM -- 12/21/11 */ if(HDstrcmp(fd_ptr->cls->name, "family") == 0) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver.") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "Not supported for family file driver.") /* Go get the actual file size */ if(HADDR_UNDEF == (eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file size") /* set ret_value = to eoa -- will overwrite this if appropriate */ ret_value = (ssize_t)eoa; @@ -2785,14 +2764,14 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* Check for buffer too small */ if((haddr_t)buf_len < eoa) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "supplied buffer too small") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "supplied buffer too small") space_needed = (size_t)eoa; /* read in the file image */ /* (Note compensation for base address addition in internal routine) */ if(H5FD_read(fd_ptr, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed") + HGOTO_ERROR(H5E_FILE, H5E_READERROR, (-1), "file image read request failed") /* Offset to "status_flags" in the superblock */ tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers); @@ -2857,16 +2836,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_track_metadata_read_retries + * Function: H5F_track_metadata_read_retries * - * Purpose: To track the # of a "retries" (log10) for a metadata item. - * This routine should be used only when: - * "retries" > 0 - * f->shared->read_attempts > 1 (does not have retry when 1) - * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts) + * Purpose: To track the # of a "retries" (log10) for a metadata item. + * This routine should be used only when: + * "retries" > 0 + * f->shared->read_attempts > 1 (does not have retry when 1) + * f->shared->retries_nbins > 0 (calculated based on f->shared->read_attempts) * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -2905,14 +2883,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_set_retries + * Function: H5F_set_retries * - * Purpose: To initialize data structures for read retries: - * --zero out "retries" - * --set up "retries_nbins" based on read_attempts + * Purpose: To initialize data structures for read retries: + * --zero out "retries" + * --set up "retries_nbins" based on read_attempts * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -3053,11 +3030,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__get_max_eof_eoa + * Function: H5F__get_max_eof_eoa * - * Purpose: Determine the maximum of (EOA, EOF) for the file + * Purpose: Determine the maximum of (EOA, EOF) for the file * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -3096,8 +3073,7 @@ done: * * Purpose: Set the coll_md_read field with a new value. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ void @@ -3117,7 +3093,7 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) /*------------------------------------------------------------------------- - * Function: H5F__get_metadata_read_retry_info + * Function: H5F_get_metadata_read_retry_info * * Purpose: Private function to retrieve the collection of read retries * for metadata items with checksum. @@ -3127,13 +3103,13 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) *------------------------------------------------------------------------- */ herr_t -H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) +H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) { unsigned i, j; /* Local index variable */ size_t tot_size; /* Size of each retries[i] */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(file); @@ -3146,7 +3122,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) HDmemset(info->retries, 0, sizeof(info->retries)); /* Return if there are no bins -- no retries */ - if (!info->nbins) + if(!info->nbins) HGOTO_DONE(SUCCEED); /* Calculate size for each retries[i] */ @@ -3154,7 +3130,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) /* Map and copy information to info's retries for metadata items with tracking for read retries */ j = 0; - for (i = 0; i < H5AC_NTYPES; i++) { + for(i = 0; i < H5AC_NTYPES; i++) { switch (i) { case H5AC_OHDR_ID: case H5AC_OHDR_CHK_ID: @@ -3178,13 +3154,13 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) case H5AC_FARRAY_DBLK_PAGE_ID: case H5AC_SUPERBLOCK_ID: HDassert(j < H5F_NUM_METADATA_READ_RETRY_TYPES); - if (file->shared->retries[i] != NULL) { + if(file->shared->retries[i] != NULL) { /* Allocate memory for retries[i] * * This memory should be released by the user with * the H5free_memory() call. */ - if (NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size))) + if(NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Copy the information */ @@ -3202,8 +3178,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__get_metadata_read_retry_info() */ - +} /* end H5F_get_metadata_read_retry_info() */ /*------------------------------------------------------------------------- @@ -3230,14 +3205,14 @@ done: * --disallow named datatype with/without attributes * --disallow opened attributes attached to objects * - * Note: Currently, only opened groups and datasets are allowed + * NOTE: Currently, only opened groups and datasets are allowed * when enabling SWMR via H5Fstart_swmr_write(). * Will later implement a different approach-- * set up flush dependency/proxy even for file opened without * SWMR to resolve issues with opened objects. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ herr_t @@ -3289,17 +3264,17 @@ H5F__start_swmr_write(H5F_t *f) /* Flush data buffers */ if(H5F__flush(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush f's cached information") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Get the # of opened named datatypes and attributes */ if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") if(nt_attr_count) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file") /* Get the # of opened datasets and groups */ if(H5F_get_obj_count(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") if(grp_dset_count) { /* Allocate space for group and object locations */ @@ -3377,9 +3352,10 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict file's cached information") /* Refresh (reopen) the objects (groups & datasets) in the file */ - for(u = 0; u < grp_dset_count; u++) + for(u = 0; u < grp_dset_count; u++) { if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") + } /* Unlock the file */ if(H5FD_unlock(f->shared->lf) < 0) @@ -3387,7 +3363,6 @@ H5F__start_swmr_write(H5F_t *f) done: if(ret_value < 0 && setup) { - HDassert(f); /* Re-enable accumulator */ f->shared->feature_flags |= (unsigned)H5FD_FEAT_ACCUMULATE_METADATA; @@ -3402,7 +3377,7 @@ done: /* Un-set H5F_ACC_SWMR_WRITE in shared open flags */ f->shared->flags &= ~H5F_ACC_SWMR_WRITE; - /* Unmark the f: not in SWMR writing mode */ + /* Unmark the file: not in SWMR writing mode */ f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_SWMR_WRITE_ACCESS); /* Mark superblock as dirty */ @@ -3425,7 +3400,7 @@ done: H5MM_xfree(obj_paths); FUNC_LEAVE_NOAPI(ret_value) -} /* H5F__start_swmr_write() */ +} /* end H5F__start_swmr_write() */ /*------------------------------------------------------------------------- @@ -3451,39 +3426,40 @@ H5F__format_convert(H5F_t *f) /* Check if the superblock should be downgraded */ if(f->shared->sblock->super_vers > HDF5_SUPERBLOCK_VERSION_V18_LATEST) { - f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST; - mark_dirty = TRUE; - } /* end if */ + f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_V18_LATEST; + mark_dirty = TRUE; + } /* Check for persistent freespace manager, which needs to be downgraded */ if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF && f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF && f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF && f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) { - /* Check to remove free-space manager info message from superblock extension */ - if(H5F_addr_defined(f->shared->sblock->ext_addr)) - if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension") - - /* Close freespace manager */ - if(H5MF_try_close(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address") - - /* Set non-persistent freespace manager */ - f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF; - f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF; - f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF; - f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF; - - /* Indicate that the superblock should be marked dirty */ - mark_dirty = TRUE; + + /* Check to remove free-space manager info message from superblock extension */ + if(H5F_addr_defined(f->shared->sblock->ext_addr)) + if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in removing message from superblock extension") + + /* Close freespace manager */ + if(H5MF_try_close(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address") + + /* Set non-persistent freespace manager */ + f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF; + f->shared->fs_persist = H5F_FREE_SPACE_PERSIST_DEF; + f->shared->fs_threshold = H5F_FREE_SPACE_THRESHOLD_DEF; + f->shared->fs_page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF; + + /* Indicate that the superblock should be marked dirty */ + mark_dirty = TRUE; } /* end if */ /* Check if we should mark the superblock dirty */ if(mark_dirty) - /* Mark superblock as dirty */ - if(H5F_super_dirty(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + /* Mark superblock as dirty */ + if(H5F_super_dirty(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fio.c b/src/H5Fio.c index 830b7ee..69e6bb2 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -92,8 +92,7 @@ *------------------------------------------------------------------------- */ herr_t -H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - void *buf/*out*/) +H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ @@ -138,8 +137,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, - const void *buf) +H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fmount.c b/src/H5Fmount.c index b04bd3a..e6106a2 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -132,7 +132,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED */ if(child->parent) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted") - if(H5G_loc_find(loc, name, &mp_loc/*out*/) < 0) + if(H5G_loc_find(loc, name, &mp_loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") /* If the mount location is holding its file open, that file will close * and remove the mount as soon as we exit this function. Prevent the @@ -462,7 +462,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) plist_id = H5P_FILE_MOUNT_DEFAULT; else if(TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index f854d3b..7620d95 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -320,11 +320,11 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) attached to the loc_id */ if(H5I_INVALID_HID != loc_id) { H5G_loc_t loc; - H5F_t *f; + H5F_t *f = NULL; /* Retrieve the file structure */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") f = loc.oloc->file; HDassert(f); @@ -333,8 +333,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) /* retrieve the file communicator */ if(MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f))) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") - } /* end if */ - } /* end if */ + } + } /* otherwise, this is from H5Fopen or H5Fcreate and has to be collective */ else { H5P_genplist_t *plist; /* Property list pointer */ @@ -349,8 +349,8 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad VFL driver info") *mpi_comm = fa->comm; - } /* end if */ - } /* end else */ + } + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 3716c66..44344f0 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -325,7 +325,7 @@ struct H5F_file_t { /* been used accessed for either */ /* allocation or deallocation */ /* since file open. */ - haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ + haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ /* for self referential FSMs */ haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ /* for self referential FSMs */ @@ -377,6 +377,19 @@ struct H5F_t { #endif /* H5_HAVE_PARALLEL */ }; +/* User data for traversal routine to get ID counts */ +typedef struct { + ssize_t *obj_count; /* number of objects counted so far */ + unsigned types; /* types of objects to be counted */ +} H5F_trav_obj_cnt_t; + +/* User data for traversal routine to get ID lists */ +typedef struct { + size_t max_objs; + hid_t *oid_list; + ssize_t *obj_count; /* number of objects counted so far */ + unsigned types; /* types of objects to be counted */ +} H5F_trav_obj_ids_t; /*****************************/ /* Package Private Variables */ @@ -394,18 +407,16 @@ H5FL_EXTERN(H5F_file_t); /******************************/ /* General routines */ +H5_DLL H5F_t *H5F__reopen(H5F_t *f); H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); H5_DLL herr_t H5F__flush(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name); -H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); -H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); H5_DLL herr_t H5F__close(hid_t file_id); -H5_DLL herr_t H5F__close_cb(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); /* File mount related routines */ @@ -421,7 +432,7 @@ H5_DLL herr_t H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_ H5_DLL herr_t H5F__super_free(H5F_super_t *sblock); /* Superblock extension related routines */ -H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); +H5_DLL herr_t H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); H5_DLL herr_t H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, unsigned mesg_flags); H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id); H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created); @@ -434,9 +445,9 @@ H5_DLL herr_t H5F__accum_flush(H5F_t *f); H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush); /* Shared file list related routines */ -H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared); -H5_DLL H5F_file_t * H5F_sfile_search(H5FD_t *lf); -H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared); +H5_DLL herr_t H5F__sfile_add(H5F_file_t *shared); +H5_DLL H5F_file_t *H5F__sfile_search(H5FD_t *lf); +H5_DLL herr_t H5F__sfile_remove(H5F_file_t *shared); /* External file cache routines */ H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 979ba7d..1ce9374 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -715,7 +715,6 @@ typedef enum H5F_prefix_open_t { /* Private functions */ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); -H5_DLL herr_t H5F_start_swmr_write(H5F_t *file); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); @@ -763,7 +762,6 @@ H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f); H5_DLL double H5F_rdcc_w0(const H5F_t *f); H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f); H5_DLL unsigned H5F_gc_ref(const H5F_t *f); -H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl); H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f); H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag); H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f); @@ -799,7 +797,7 @@ H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t si /* Functions that flush or evict */ H5_DLL herr_t H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag); -H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t * f, haddr_t tag); +H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t *f, haddr_t tag); /* Functions that verify a piece of metadata with checksum */ H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s_chksum, uint32_t *c_chksum); @@ -807,6 +805,7 @@ H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s /* Routine to track the # of retries */ H5_DLL herr_t H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries); H5_DLL herr_t H5F_set_retries(H5F_t *f); +H5_DLL herr_t H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); /* Routine to invoke callback function upon object flush */ H5_DLL herr_t H5F_object_flush_cb(H5F_t *f, hid_t obj_id); diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index e0c830b..ebc2ab2 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -40,11 +40,11 @@ H5F_sfile_node_t *H5F_sfile_head_g = NULL; /*------------------------------------------------------------------------- - * Function: H5F_sfile_assert_num + * Function: H5F_sfile_assert_num * - * Purpose: Sanity checking that shared file list is empty + * Purpose: Sanity checking that shared file list is empty * - * Return: none (void) + * Return: void * * Programmer: Quincey Koziol * Monday, July 25, 2005 @@ -84,33 +84,31 @@ H5F_sfile_assert_num(unsigned n) /*------------------------------------------------------------------------- - * Function: H5F_sfile_add + * Function: H5F__sfile_add * - * Purpose: Add a "shared" file struct to the list of open files + * Purpose: Add a "shared" file struct to the list of open files * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, July 18, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5F_sfile_add(H5F_file_t *shared) +H5F__sfile_add(H5F_file_t *shared) { H5F_sfile_node_t *new_shared; /* New shared file node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(shared); /* Allocate new shared file node */ if (NULL == (new_shared = H5FL_CALLOC(H5F_sfile_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Set shared file value */ new_shared->shared = shared; @@ -121,31 +119,29 @@ H5F_sfile_add(H5F_file_t *shared) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_add() */ +} /* end H5F__sfile_add() */ /*------------------------------------------------------------------------- - * Function: H5F_sfile_search + * Function: H5F__sfile_search * - * Purpose: Search for a "shared" file with low-level file info that + * Purpose: Search for a "shared" file with low-level file info that * matches * - * Return: Non-NULL on success / NULL on failure + * Return: Non-NULL on success / NULL on failure * * Programmer: Quincey Koziol * Monday, July 18, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ H5F_file_t * -H5F_sfile_search(H5FD_t *lf) +H5F__sfile_search(H5FD_t *lf) { H5F_sfile_node_t *curr; /* Current shared file node */ H5F_file_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(lf); @@ -154,7 +150,7 @@ H5F_sfile_search(H5FD_t *lf) curr = H5F_sfile_head_g; while(curr) { /* Check for match */ - if(0==H5FD_cmp(curr->shared->lf, lf)) + if(0 == H5FD_cmp(curr->shared->lf, lf)) HGOTO_DONE(curr->shared) /* Advance to next shared file node */ @@ -163,31 +159,29 @@ H5F_sfile_search(H5FD_t *lf) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_search() */ +} /* end H5F__sfile_search() */ /*------------------------------------------------------------------------- - * Function: H5F_sfile_remove + * Function: H5F__sfile_remove * - * Purpose: Remove a "shared" file struct from the list of open files + * Purpose: Remove a "shared" file struct from the list of open files * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, July 18, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5F_sfile_remove(H5F_file_t *shared) +H5F__sfile_remove(H5F_file_t *shared) { H5F_sfile_node_t *curr; /* Current shared file node */ H5F_sfile_node_t *last; /* Last shared file node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(shared); @@ -203,7 +197,7 @@ H5F_sfile_remove(H5F_file_t *shared) /* Indicate error if the node wasn't found */ if(curr == NULL) - HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info") + HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info") /* Remove node found from list */ if(last != NULL) @@ -219,5 +213,5 @@ H5F_sfile_remove(H5F_file_t *shared) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_sfile_remove() */ +} /* end H5F__sfile_remove() */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 9339b3d..489cc21 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -134,7 +134,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_super_ext_open + * Function: H5F__super_ext_open * * Purpose: Open an existing superblock extension * @@ -146,11 +146,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) +H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -168,7 +168,7 @@ H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_super_ext_open() */ +} /* H5F__super_ext_open() */ /*------------------------------------------------------------------------- @@ -398,7 +398,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) } /* end if */ else { - /* Locate the signature as per per the serial library */ + /* Locate the signature as per per the serial library */ #endif /* H5_HAVE_PARALLEL */ if(H5FD_locate_signature(file, &super_addr) < 0) @@ -705,7 +705,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) } /* end if */ /* Open the superblock extension */ - if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0) + if(H5F__super_ext_open(f, sblock->ext_addr, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension") /* Check for the extension having a 'driver info' message */ @@ -836,7 +836,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(!skip_eof_check && !null_fsm_addr) { HDassert((!f->shared->fs_persist) || (f->shared->eoa_pre_fsm_fsalloc != HADDR_UNDEF)); HDassert(!f->shared->first_alloc_dealloc); - } /* end if */ + } /* As "eoa_pre_fsm_fsalloc" may be undefined for a crashed file * with persistent free space managers, therefore, set @@ -882,14 +882,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(null_fsm_addr) { if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension") - } /* end if */ + } else { if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "error in removing message from superblock extension") if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension") - } /* end else */ + } #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ f->shared->sblock = NULL; #endif /* JRM */ @@ -962,20 +962,20 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Write driver info information to the superblock extension */ #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ - /* KLUGE ALERT!! - * - * H5F__super_ext_write_msg() expects f->shared->sblock to - * be set -- verify that it is NULL, and then set it. - * Set it back to NULL when we are done. - */ - HDassert(f->shared->sblock == NULL); - f->shared->sblock = sblock; + /* KLUGE ALERT!! + * + * H5F__super_ext_write_msg() expects f->shared->sblock to + * be set -- verify that it is NULL, and then set it. + * Set it back to NULL when we are done. + */ + HDassert(f->shared->sblock == NULL); + f->shared->sblock = sblock; #endif /* JRM */ - if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) + if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ - f->shared->sblock = NULL; + f->shared->sblock = NULL; #endif /* JRM */ } /* end if */ @@ -1320,10 +1320,11 @@ H5F__super_init(H5F_t *f) /* Create the Shared Object Header Message table and register it with * the metadata cache, if this file supports shared messages. */ - if(f->shared->sohm_nindexes > 0) + if(f->shared->sohm_nindexes > 0) { /* Initialize the shared message code & write the SOHM message to the extension */ if(H5SM_init(f, plist, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create SOHM table") + } /* Check for non-default v1 B-tree 'K' values to store */ if(sblock->btree_k[H5B_SNODE_ID] != HDF5_BTREE_SNODE_IK_DEF || @@ -1503,9 +1504,10 @@ H5F_eoa_dirty(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo as dirty") } /* end if */ /* If the driver info is stored as a message, update that instead */ - else if(f->shared->drvinfo_sb_msg_exists) + else if(f->shared->drvinfo_sb_msg_exists) { if(H5F__update_super_ext_driver_msg(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo message as dirty") + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1676,13 +1678,13 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, /* Open/create the superblock extension object header */ if(H5F_addr_defined(f->shared->sblock->ext_addr)) { - if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) + if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension") } /* end if */ else { HDassert(may_create); - if(H5F__super_ext_create(f, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension") + if(H5F__super_ext_create(f, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension") ext_created = TRUE; } /* end else */ HDassert(H5F_addr_defined(ext_loc.addr)); @@ -1690,24 +1692,24 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, /* Check if message with ID does not exist in the object header */ if((status = H5O_msg_exists(&ext_loc, id)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists") /* Check for creating vs. writing */ if(may_create) { if(status) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist") - /* Create the message with ID in the superblock extension */ - if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header") + /* Create the message with ID in the superblock extension */ + if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header") } /* end if */ else { if(!status) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist") - /* Update the message with ID in the superblock extension */ - if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header") + /* Update the message with ID in the superblock extension */ + if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header") } /* end else */ done: @@ -1757,35 +1759,36 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id) H5AC_set_ring(H5AC_RING_SBE, &orig_ring); /* Open superblock extension object header */ - if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension") + if(H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension") ext_opened = TRUE; /* Check if message with ID exists in the object header */ if((status = H5O_msg_exists(&ext_loc, id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message") - else if(status) { /* message exists */ - H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */ - - /* Remove the message */ - if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message") - - /* Get info for the superblock extension's object header */ - if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") - - /* If the object header is an empty base chunk, remove superblock extension */ - if(hdr_info.nchunks == 1) { - if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") - else if((unsigned)null_count == hdr_info.nmesgs) { - HDassert(H5F_addr_defined(ext_loc.addr)); - if(H5O_delete(f, ext_loc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") - f->shared->sblock->ext_addr = HADDR_UNDEF; - } /* end if */ - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message") + else if(status) { + /* message exists */ + H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */ + + /* Remove the message */ + if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message") + + /* Get info for the superblock extension's object header */ + if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") + + /* If the object header is an empty base chunk, remove superblock extension */ + if(hdr_info.nchunks == 1) { + if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") + else if((unsigned)null_count == hdr_info.nmesgs) { + HDassert(H5F_addr_defined(ext_loc.addr)); + if(H5O_delete(f, ext_loc.addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") + f->shared->sblock->ext_addr = HADDR_UNDEF; + } /* end else-if */ + } /* end if */ } /* end if */ done: diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 76866db..361f8a1 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -42,7 +42,6 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ /****************/ diff --git a/src/H5G.c b/src/H5G.c index e54e5cd..361127f 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -128,10 +128,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Group ID class */ static const H5I_class_t H5I_GROUP_CLS[1] = {{ - H5I_GROUP, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5G__close_cb /* Callback routine for closing objects of this class */ + H5I_GROUP, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5G_close /* Callback routine for closing objects of this class */ }}; /* Flag indicating "top" of interface has been initialized */ @@ -255,9 +255,9 @@ H5G_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Gcreate2 + * Function: H5Gcreate2 * - * Purpose: Creates a new group relative to LOC_ID, giving it the + * Purpose: Creates a new group relative to LOC_ID, giving it the * specified creation property list GCPL_ID and access * property list GAPL_ID. The link to the new group is * created with the LCPL_ID. @@ -269,14 +269,11 @@ H5G_term_package(void) * hid_t gcpl_id; IN: Property list for group creation * hid_t gapl_id; IN: Property list for group access * - * Return: Success: The object ID of a new, empty group open for - * writing. Call H5Gclose() when finished with - * the group. + * Return: Success: The object ID of a new, empty group open for + * writing. Call H5Gclose() when finished with + * the group. * - * Failure: H5I_INVALID_HID - * - * Programmer: Quincey Koziol - * April 5, 2007 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -284,45 +281,49 @@ hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id) { - H5G_loc_t loc; /* Location to create group */ - H5G_t *grp = NULL; /* New group created */ - hid_t ret_value; /* Return value */ + H5G_t *grp = NULL; /* Structure for new group */ + H5G_loc_t loc; /* Location to create group */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, lcpl_id, gcpl_id, gapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") - /* Get correct property list */ + /* Check link creation property list */ if(H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a link creation property list") /* Check group creation property list */ if(H5P_DEFAULT == gcpl_id) gcpl_id = H5P_GROUP_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation property list") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Create the new group & get its ID */ + /* Create the group */ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + + /* Get an atom for the group */ if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") @@ -331,9 +332,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gcreate_anon + * Function: H5Gcreate_anon * - * Purpose: Creates a new group relative to LOC_ID, giving it the + * Purpose: Creates a new group relative to LOC_ID, giving it the * specified creation property list GCPL_ID and access * property list GAPL_ID. * @@ -349,36 +350,33 @@ done: * hid_t gcpl_id; IN: Property list for group creation * hid_t gapl_id; IN: Property list for group access * - * Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp" + * Example: To create missing groups "A" and "B01" along the given path "/A/B01/grp" * hid_t create_id = H5Pcreate(H5P_GROUP_CREATE); * int status = H5Pset_create_intermediate_group(create_id, TRUE); * hid_t gid = H5Gcreate_anon(file_id, "/A/B01/grp", create_id, H5P_DEFAULT); * - * Return: Success: The object ID of a new, empty group open for - * writing. Call H5Gclose() when finished with - * the group. - * - * Failure: H5I_INVALID_HID + * Return: Success: The object ID of a new, empty group open for + * writing. Call H5Gclose() when finished with + * the group. * - * Programmer: Peter Cao - * May 08, 2005 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) { - H5G_loc_t loc; - H5G_t *grp = NULL; - H5G_obj_create_t gcrt_info; /* Information for group creation */ - hid_t ret_value; + H5G_t *grp = NULL; /* Structure for new group */ + H5G_loc_t loc; + H5G_obj_create_t gcrt_info; /* Information for group creation */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iii", loc_id, gcpl_id, gapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") /* Check group creation property list */ if(H5P_DEFAULT == gcpl_id) @@ -396,9 +394,11 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) gcrt_info.cache_type = H5G_NOTHING_CACHED; HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); - /* Create the new group & get its ID */ + /* Create the group */ if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create group") + + /* Get an atom for the group */ if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") @@ -417,7 +417,7 @@ done: } /* end if */ /* Cleanup on failure */ - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") @@ -426,28 +426,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gopen2 + * Function: H5Gopen2 * - * Purpose: Opens an existing group for modification. When finished, - * call H5Gclose() to close it and release resources. + * Purpose: Opens an existing group for modification. When finished, + * call H5Gclose() to close it and release resources. * * This function allows the user the pass in a Group Access * Property List, which H5Gopen1() does not. * - * Return: Success: Object ID of the group. - * Failure: H5I_INVALID_HID + * Return: Success: Object ID of the group * - * Programmer: James Laird - * Thursday, July 27, 2006 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { - H5G_t *grp = NULL; /* Group opened */ + H5G_t *grp = NULL; /* Group opened */ H5G_loc_t loc; /* Location of parent for group */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, gapl_id); @@ -455,8 +453,10 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, FALSE) < 0) @@ -471,7 +471,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") @@ -480,18 +480,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_create_plist - * - * Purpose: Returns a copy of the group creation property list. + * Function: H5Gget_create_plist * - * Return: Success: ID for a copy of the group creation - * property list. The property list ID should be - * released by calling H5Pclose(). + * Purpose: Returns a copy of the group creation property list. * - * Failure: H5I_INVALID_HID + * Return: Success: ID for a copy of the group creation + * property list. The property list ID should be + * released by calling H5Pclose(). * - * Programmer: Quincey Koziol - * Tuesday, October 25, 2005 + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -506,9 +503,9 @@ H5Gget_create_plist(hid_t group_id) /* Check args */ if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID") - /* Retrieve the GCPL */ + /* Get the group creation property list for the group */ if((ret_value = H5G_get_create_plist(group)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") @@ -518,42 +515,38 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_info + * Function: H5Gget_info * - * Purpose: Retrieve information about a group. + * Purpose: Retrieve information about a group. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 27 2006 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5Gget_info(hid_t grp_id, H5G_info_t *grp_info) +H5Gget_info(hid_t loc_id, H5G_info_t *group_info) { H5I_type_t id_type; /* Type of ID */ H5G_loc_t loc; /* Location of group */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*x", grp_id, grp_info); + H5TRACE2("e", "i*x", loc_id, group_info); /* Check args */ - id_type = H5I_get_type(grp_id); + id_type = H5I_get_type(loc_id); if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") - if(!grp_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID") + if(!group_info) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL") /* Get group location */ - if(H5G_loc(grp_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the group's information */ - if(H5G__obj_info(loc.oloc, grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + if(H5G__obj_info(loc.oloc, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") done: FUNC_LEAVE_API(ret_value) @@ -561,42 +554,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_info_by_name + * Function: H5Gget_info_by_name * - * Purpose: Retrieve information about a group. + * Purpose: Retrieve information about a group, where the group is + * identified by name instead of ID. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 27 2006 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, +H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*s*xi", loc_id, name, grp_info, lapl_id); + H5TRACE4("e", "i*s*xi", loc_id, name, group_info, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(!grp_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + if(!group_info) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the group's information */ - if(H5G__get_info_by_name(&loc, name, grp_info/*out*/) < 0) + if(H5G__get_info_by_name(&loc, name, group_info/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -605,48 +597,46 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gget_info_by_idx + * Function: H5Gget_info_by_idx * - * Purpose: Retrieve information about a group, according to the order + * Purpose: Retrieve information about a group, according to the order * of an index. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 27 2006 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info, hid_t lapl_id) + H5_iter_order_t order, hsize_t n, H5G_info_t *group_info, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, grp_info, + H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, group_info, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(!group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + if(!*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(!grp_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!group_info) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the group's information */ - if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, grp_info/*out*/) < 0) + if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, group_info/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -655,15 +645,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Gclose - * - * Purpose: Closes the specified group. The group ID will no longer be - * valid for accessing the group. + * Function: H5Gclose * - * Return: Non-negative on success/Negative on failure + * Purpose: Closes the specified group. The group ID will no longer be + * valid for accessing the group. * - * Programmer: Robb Matzke - * Wednesday, December 31, 1997 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -679,8 +666,7 @@ H5Gclose(hid_t group_id) if(NULL == H5I_object_verify(group_id,H5I_GROUP)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") - /* - * Decrement the counter on the group atom. It will be freed if the count + /* Decrement the counter on the group atom. It will be freed if the count * reaches zero. */ if(H5I_dec_app_ref(group_id) < 0) @@ -714,7 +700,7 @@ H5Gflush(hid_t group_id) /* Check args */ if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(group_id) < 0) @@ -722,7 +708,7 @@ H5Gflush(hid_t group_id) /* Flush metadata to file */ if(H5O_flush_common(&grp->oloc, group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback") + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") done: FUNC_LEAVE_API(ret_value) @@ -752,13 +738,13 @@ H5Grefresh(hid_t group_id) /* Check args */ if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call private function to refresh group object */ + /* Refresh group's metadata */ if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index aae5496..b32ce39 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -59,19 +59,20 @@ typedef struct { /* Private macros */ /* PRIVATE PROTOTYPES */ -static herr_t H5G_compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata); +static herr_t H5G__compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata); static herr_t H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, H5G_link_table_t *ltable); +static herr_t H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata); /*------------------------------------------------------------------------- - * Function: H5G_compact_build_table_cb + * Function: H5G__compact_build_table_cb * - * Purpose: Callback routine for searching 'link' messages for a particular + * Purpose: Callback routine for searching 'link' messages for a particular * name. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -80,13 +81,13 @@ static herr_t H5G__compact_build_table(const H5O_loc_t *oloc, *------------------------------------------------------------------------- */ static herr_t -H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) +H5G__compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */ H5G_iter_bt_t *udata = (H5G_iter_bt_t *)_udata; /* 'User data' passed in */ herr_t ret_value=H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -102,7 +103,7 @@ H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_build_table_cb() */ +} /* end H5G__compact_build_table_cb() */ /*------------------------------------------------------------------------- @@ -151,7 +152,7 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, /* Iterate through the link messages, adding them to the table */ op.op_type = H5O_MESG_OP_APP; - op.u.app_op = H5G_compact_build_table_cb; + op.u.app_op = H5G__compact_build_table_cb; if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages") @@ -432,12 +433,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_compact_lookup_cb + * Function: H5G__compact_lookup_cb * - * Purpose: Callback routine for searching 'link' messages for a particular + * Purpose: Callback routine for searching 'link' messages for a particular * name & gettting object location for it * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -446,13 +447,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) +H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */ H5G_iter_lkp_t *udata = (H5G_iter_lkp_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -475,7 +476,7 @@ H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_uda done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_lookup_cb() */ +} /* end H5G__compact_lookup_cb() */ /*------------------------------------------------------------------------- @@ -511,7 +512,7 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk) /* Iterate through the link messages, adding them to the table */ op.op_type = H5O_MESG_OP_APP; - op.u.app_op = H5G_compact_lookup_cb; + op.u.app_op = H5G__compact_lookup_cb; if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages") @@ -604,7 +605,7 @@ H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo, /* Check for going out of bounds */ if(idx >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound") /* Determine type of object */ if(ltable.lnks[idx].type == H5L_TYPE_SOFT) diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 326561a..d2bcad1 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -416,7 +416,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst /* Create serialized form of link */ if(H5O_msg_encode(f, H5O_LINK_ID, FALSE, (unsigned char *)link_ptr, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link") + HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link") /* Open the fractal heap */ if(NULL == (fheap = H5HF_open(f, linfo->fheap_addr))) @@ -966,8 +966,7 @@ done: */ herr_t H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, - H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, - void *op_data) + H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) { H5HF_t *fheap = NULL; /* Fractal heap handle */ H5G_link_table_t ltable = {0, NULL}; /* Table of links */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 57bbcd9..f8f668c 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -164,7 +164,7 @@ H5G_map_obj_type(H5O_type_t obj_type) * writing. Call H5Gclose() when finished with * the group. * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, September 24, 1997 @@ -176,65 +176,67 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) { H5G_loc_t loc; /* Location to create group */ H5G_t *grp = NULL; /* New group created */ - hid_t tmp_gcpl = (-1); /* Temporary group creation property list */ - hid_t ret_value; /* Return value */ + hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*sz", loc_id, name, size_hint); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given") /* Check if we need to create a non-standard GCPL */ if(size_hint > 0) { - H5P_genplist_t *gc_plist; /* Property list created */ H5O_ginfo_t ginfo; /* Group info property */ + H5P_genplist_t *gc_plist; /* Property list created */ /* Get the default property list */ if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(H5P_GROUP_CREATE_DEFAULT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Make a copy of the default property list */ if((tmp_gcpl = H5P_copy_plist(gc_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to copy the creation property list") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") /* Get pointer to the copied property list */ if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(tmp_gcpl))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Get the group info property */ if(H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get group info") /* Set the non-default local heap size hint */ H5_CHECKED_ASSIGN(ginfo.lheap_size_hint, uint32_t, size_hint, size_t); if(H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info") - } /* end if */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info") + } else tmp_gcpl = H5P_GROUP_CREATE_DEFAULT; /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info") - /* Create the new group & get its ID */ + /* Create the group */ if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + + /* Get an atom for the group */ if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) + if(H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) if(H5I_dec_ref(tmp_gcpl) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate1() */ @@ -250,7 +252,7 @@ done: * * Return: Success: Object ID of the group. * - * Failure: FAIL + * Failure: H5I_INVALID_HID * * Programmer: Robb Matzke * Wednesday, December 31, 1997 @@ -260,31 +262,31 @@ done: hid_t H5Gopen1(hid_t loc_id, const char *name) { - H5G_t *grp = NULL; /* Group opened */ - H5G_loc_t loc; /* Location of parent for group */ - hid_t ret_value; /* Return value */ + H5G_t *grp = NULL; /* Group opened */ + H5G_loc_t loc; /* Location of parent for group */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") /* Open the group */ if(NULL == (grp = H5G__open_name(&loc, name))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") - /* Register an atom for the group */ + /* Get an atom for the group */ if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - if(ret_value < 0) + if(H5I_INVALID_HID == ret_value) if(grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gopen1() */ @@ -316,7 +318,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new if(H5CX_set_loc(cur_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine to create link */ + /* Create link */ if(H5G__link(cur_loc_id, cur_name, type, H5L_SAME_LOC, new_name, H5P_LINK_CREATE_DEFAULT) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link") @@ -352,7 +354,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, if(H5CX_set_loc(cur_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine to create link */ + /* Create link */ if(H5G__link(cur_loc_id, cur_name, type, new_loc_id, new_name, H5P_LINK_CREATE_DEFAULT) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link") @@ -408,7 +410,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the link */ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } /* end if */ + } else if(type == H5L_TYPE_SOFT) { /* Soft links only need one location, the new_loc_id, but it's possible * that new_loc_id is H5L_SAME_LOC @@ -423,9 +425,9 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the link */ if(H5L_create_soft(cur_name, &new_loc, new_name, lcpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } /* end else if */ + } else - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "Not a valid link type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type") done: FUNC_LEAVE_NOAPI(ret_value) @@ -451,9 +453,9 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) if(H5CX_set_loc(src_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call common routine to move the link */ + /* Move the link */ if(H5G__move(src_loc_id, src_name, H5L_SAME_LOC, dst_name, H5P_LINK_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") + HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: FUNC_LEAVE_API(ret_value) @@ -471,7 +473,7 @@ herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name); @@ -484,9 +486,9 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(H5CX_set_loc(dst_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call common routine to move the link */ + /* Move the link */ if(H5G__move(src_loc_id, src_name, dst_loc_id, dst_name, H5P_LINK_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") + HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) @@ -565,17 +567,17 @@ H5Gunlink(hid_t loc_id, const char *name) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call H5L routine... */ + /* Delete the link */ if(H5L_delete(&loc, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: FUNC_LEAVE_API(ret_value) @@ -609,9 +611,9 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the link routine which provides this capability */ + /* Get the link value */ if(H5L_get_val(&loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") done: FUNC_LEAVE_API(ret_value) @@ -638,7 +640,7 @@ done: herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { - H5G_loc_t loc; /* Group's location */ + H5G_loc_t loc; /* Group's location */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -653,7 +655,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the common routine which provides this capability */ + /* Set the comment */ if(H5G_loc_set_comment(&loc, name, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") @@ -705,7 +707,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the common routine which provides this capability */ + /* Get the comment */ if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") @@ -742,21 +744,24 @@ herr_t H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { + H5G_loc_t loc; /* Location of object */ H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_obj; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ + hsize_t idx; /* Internal location to hold index */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data); /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_p && *idx_p < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "invalid index specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") if(!op) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Set number of objects looked at to zero */ last_obj = 0; @@ -766,8 +771,8 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; - /* Call the common routine which provides this capability */ - if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) + /* Call private function */ + if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ @@ -798,23 +803,23 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5G_loc_t loc; /* Location of object */ - H5G_info_t grp_info; /* Group information */ - H5O_type_t obj_type; /* Type of object at location */ - herr_t ret_value = SUCCEED; + H5G_loc_t loc; /* Location of object */ + H5G_info_t grp_info; /* Group information */ + H5O_type_t obj_type; /* Type of object at location */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", loc_id, num_objs); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") if(H5O_obj_type(loc.oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") if(!num_objs) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") /* Retrieve information about the group */ if(H5G__obj_info(loc.oloc, &grp_info) < 0) @@ -849,17 +854,17 @@ herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/) { - H5G_loc_t loc; /* Group's location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Group's location */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf); /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Get info */ if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0) @@ -1054,13 +1059,13 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") if(H5O_obj_type(loc.oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") - /* Call common routine */ + /* Call internal function */ if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") @@ -1087,8 +1092,8 @@ done: H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) { - H5G_loc_t loc; /* Object location */ - H5G_obj_t ret_value; + H5G_loc_t loc; /* Object location */ + H5G_obj_t ret_value; FUNC_ENTER_API(H5G_UNKNOWN) H5TRACE2("Go", "ih", loc_id, idx); diff --git a/src/H5Gint.c b/src/H5Gint.c index 51d3b91..7e2f279 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -449,38 +449,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__close_cb - * - * Purpose: Closes the specified group. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Sunday, February 18, 2018 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__close_cb(H5G_t *grp) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check args */ - HDassert(grp && grp->shared); - HDassert(grp->shared->fo_count > 0); - - /* Call actual group close routine */ - if(H5G_close(grp) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "problem closing group") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__close_cb() */ - - -/*------------------------------------------------------------------------- * Function: H5G_close * * Purpose: Closes the specified group. @@ -817,30 +785,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_iterate(hid_t loc_id, const char *group_name, +H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, const H5G_link_iterate_t *lnk_op, void *op_data) { - H5G_loc_t loc; /* Location of parent for group */ - hid_t gid = -1; /* ID of group to iterate over */ - H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ - H5G_iter_appcall_ud_t udata; /* User data for callback */ - herr_t ret_value = FAIL; /* Return value */ + hid_t gid = H5I_INVALID_HID; /* ID of group to iterate over */ + H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ + H5G_iter_appcall_ud_t udata; /* User data for callback */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ + HDassert(loc); HDassert(group_name); HDassert(last_lnk); HDassert(lnk_op && lnk_op->op_func.op_new); - /* - * Open the group on which to operate. We also create a group ID which + /* Open the group on which to operate. We also create a group ID which * we can pass to the application-defined operator. */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(NULL == (grp = H5G__open_name(&loc, group_name))) + if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -856,7 +821,7 @@ H5G_iterate(hid_t loc_id, const char *group_name, done: /* Release the group opened */ - if(gid > 0) { + if(gid != H5I_INVALID_HID) { if(H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") } @@ -1078,15 +1043,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, +H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data) { H5G_iter_visit_ud_t udata; /* User data for callback */ H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ - hid_t gid = (-1); /* Group ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ H5G_t *grp = NULL; /* Group opened */ - H5G_loc_t loc; /* Location of group passed in */ H5G_loc_t start_loc; /* Location of starting group */ unsigned rc; /* Reference count of object */ herr_t ret_value = FAIL; /* Return value */ @@ -1097,11 +1061,11 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, FUNC_ENTER_NOAPI(FAIL) /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!loc) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc parameter cannot be NULL") /* Open the group to begin visiting within */ - if(NULL == (grp = H5G__open_name(&loc, group_name))) + if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the starting group */ @@ -1184,7 +1148,7 @@ done: H5SL_destroy(udata.visited, H5G_free_visit_visited, NULL); /* Release the group opened */ - if(gid > 0) { + if(gid != H5I_INVALID_HID) { if(H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") } @@ -1254,7 +1218,7 @@ H5G_get_create_plist(const H5G_t *grp) /* Check for the group having a link info message */ if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header") if(linfo_exists) { /* Set the link info for the property list */ if(H5P_set(new_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) diff --git a/src/H5Gname.c b/src/H5Gname.c index 8aa0b45..31ed0f1 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -1311,7 +1311,7 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, udata.path = NULL; /* Visit all the links in the file */ - if((status = H5G_visit(file, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0) + if((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name") else if(status > 0) found_obj = TRUE; diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index ae697ad..836213d 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -336,7 +336,6 @@ H5_DLL herr_t H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_info); H5_DLL herr_t H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info); -H5_DLL herr_t H5G__close_cb(H5G_t *grp); /* * Group hierarchy traversal routines diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 95dfef5..c56b1c8 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -209,10 +209,10 @@ H5_DLL char *H5G_normalize(const char *name); */ H5_DLL herr_t H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traverse_t op, void *op_data); -H5_DLL herr_t H5G_iterate(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, const H5G_link_iterate_t *lnk_op, void *op_data); -H5_DLL herr_t H5G_visit(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data); /* @@ -262,7 +262,7 @@ H5_DLL herr_t H5G_name_free(H5G_name_t *name); H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, hbool_t *cached); H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, const struct H5O_loc_t *loc, - char* name, size_t size); + char* name, size_t size); H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name); /* diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 37b6292..e412e7c 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -32,18 +32,17 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Ppublic.h" /* Property Lists */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Ppublic.h" /* Property Lists */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ @@ -324,7 +323,7 @@ H5G__traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, /* Traverse the link */ if(H5G__traverse_real(&tmp_grp_loc, lnk->u.soft.name, target, H5G__traverse_slink_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") /* Pass back information about whether the object exists */ *obj_exists = udata.exists; @@ -359,8 +358,7 @@ done: */ herr_t H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, - unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc, - hbool_t *obj_exists) + unsigned target, hbool_t last_comp, H5G_loc_t *obj_loc, hbool_t *obj_exists) { size_t nlinks; /* # of soft / UD links left to traverse */ herr_t ret_value = SUCCEED; /* Return value */ @@ -372,13 +370,13 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, HDassert(lnk); HDassert(obj_loc); - /* - * If we found a symbolic link then we should follow it. But if this + /* If we found a symbolic link then we should follow it. But if this * is the last component of the name and the H5G_TARGET_SLINK bit of * TARGET is set then we don't follow it. */ if(H5L_TYPE_SOFT == lnk->type && (0 == (target & H5G_TARGET_SLINK) || !last_comp)) { + /* Get the # of soft / UD links left to traverse */ if(H5CX_get_nlinks(&nlinks) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") @@ -403,6 +401,7 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, */ if(lnk->type >= H5L_TYPE_UD_MIN && (0 == (target & H5G_TARGET_UDLINK) || !last_comp) ) { + /* Get the # of soft / UD links left to traverse */ if(H5CX_get_nlinks(&nlinks) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") @@ -830,20 +829,21 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver if(!op) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no operation provided") - /* Retrieve the original # of soft / UD links that are able to be traversed */ - /* (So that multiple calls to H5G_traverse don't incorrectly look - * like they've traversed too many. Nested calls, like in H5L__move(), + /* Retrieve the original # of soft / UD links that are able to be traversed + * (So that multiple calls to H5G_traverse don't incorrectly look + * like they've traversed too many. Nested calls, like in H5L_move(), * may need their own mechanism to set & reset the # of links to traverse) */ if(H5CX_get_nlinks(&orig_nlinks) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") /* Set up invalid tag. This is a precautionary step only. Setting an invalid - tag here will ensure that no metadata accessed while doing the traversal - is given an improper tag, unless another one is specifically set up - first. This will ensure we're not accidentally tagging something we - shouldn't be during the traversal. Note that for best tagging assertion - coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. */ + * tag here will ensure that no metadata accessed while doing the traversal + * is given an improper tag, unless another one is specifically set up + * first. This will ensure we're not accidentally tagging something we + * shouldn't be during the traversal. Note that for best tagging assertion + * coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. + */ H5_BEGIN_TAG(H5AC__INVALID_TAG); /* Go perform "real" traversal */ diff --git a/src/H5L.c b/src/H5L.c index 6967812..b659d42 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -21,18 +21,18 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lpkg.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* File objects */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* File objects */ +#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ @@ -63,7 +63,7 @@ typedef struct { typedef struct { const char *dst_name; /* Destination name for moving object */ H5T_cset_t cset; /* Char set for new name */ - const H5G_loc_t *dst_loc; /* Destination location for moving object */ + const H5G_loc_t *dst_loc; /* Destination location for moving object */ unsigned dst_target_flags; /* Target flags for destination object */ hbool_t copy; /* TRUE if this is a copy operation */ size_t orig_nlinks; /* The original value for the # of soft / UD links that can be traversed */ @@ -109,17 +109,12 @@ static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - void *buf/*out*/, size_t size); static herr_t H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n); static herr_t H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -132,25 +127,15 @@ static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static htri_t H5L__exists(const H5G_loc_t *loc, const char *name); static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linfo /*out*/); static herr_t H5L__get_name_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - char *name /*out*/, size_t size); -static herr_t H5L__iterate(hid_t grp_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, - H5L_iterate_t op, void *op_data); /*********************/ /* Package Variables */ @@ -267,16 +252,16 @@ H5L_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Lmove + * Function: H5Lmove * - * Purpose: Renames an object within an HDF5 file and moves it to a new + * Purpose: Renames an object within an HDF5 file and moves it to a new * group. The original name SRC is unlinked from the group graph * and then inserted with the new name DST (which can specify a * new path for the object) as an atomic operation. The names - * are interpreted relative to SRC_LOC_ID and - * DST_LOC_ID, which are either file IDs or group ID. + * are interpreted relative to SRC_LOC_ID and DST_LOC_ID, + * which are either file IDs or group ID. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: James Laird * Wednesday, March 29, 2006 @@ -289,7 +274,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, @@ -332,13 +317,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcopy + * Function: H5Lcopy * - * Purpose: Creates an identical copy of a link with the same creation + * Purpose: Creates an identical copy of a link with the same creation * time and target. The new link can have a different name * and be in a different location than the original. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: James Laird * Wednesday, March 29, 2006 @@ -351,7 +336,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, @@ -386,7 +371,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Copy the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link") done: FUNC_LEAVE_API(ret_value) @@ -394,17 +379,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcreate_soft + * Function: H5Lcreate_soft * - * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET. + * Purpose: Creates a soft link from LINK_NAME to LINK_TARGET. * - * LINK_TARGET can be anything and is interpreted at lookup + * LINK_TARGET can be anything and is interpreted at lookup * time relative to the group which contains the final component * of LINK_NAME. For instance, if LINK_TARGET is `./foo' and * LINK_NAME is `./x/y/bar' and a request is made for `./x/y/bar' * then the actual object looked up is `./x/y/./foo'. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -416,7 +401,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; /* Group location for new link */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*si*sii", link_target, link_loc_id, link_name, lcpl_id, lapl_id); @@ -424,10 +409,14 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, /* Check arguments */ if(H5G_loc(link_loc_id, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!link_target || !*link_target) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no target specified") - if(!link_name || !*link_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + if(!link_target) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be NULL") + if(!*link_target) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be an empty string") + if(!link_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_name parameter cannot be NULL") + if(!*link_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_name parameter cannot be an empty string") if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") @@ -437,7 +426,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, /* Create the link */ if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") done: FUNC_LEAVE_API(ret_value) @@ -445,15 +434,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcreate_hard + * Function: H5Lcreate_hard * - * Purpose: Creates a hard link from NEW_NAME to CUR_NAME. + * Purpose: Creates a hard link from NEW_NAME to CUR_NAME. * - * CUR_NAME must name an existing object. CUR_NAME and + * CUR_NAME must name an existing object. CUR_NAME and * NEW_NAME are interpreted relative to CUR_LOC_ID and * NEW_LOC_ID, which are either file IDs or group IDs. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -466,7 +455,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, { H5G_loc_t cur_loc, *cur_loc_p; H5G_loc_t new_loc, *new_loc_p; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, @@ -476,13 +465,17 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC") if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!cur_name || !*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") - if(!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + if(!cur_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be NULL") + if(!*cur_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be an empty string") + if(!new_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be NULL") + if(!*new_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be an empty string") if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") @@ -496,13 +489,13 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(cur_loc_id == H5L_SAME_LOC) cur_loc_p = new_loc_p; else if(new_loc_id == H5L_SAME_LOC) - new_loc_p = cur_loc_p; + new_loc_p = cur_loc_p; else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") /* Create the link */ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link") done: FUNC_LEAVE_API(ret_value) @@ -510,23 +503,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lcreate_ud + * Function: H5Lcreate_ud * - * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME + * Purpose: Creates a user-defined link of type LINK_TYPE named LINK_NAME * with user-specified data UDATA. * - * The format of the information pointed to by UDATA is + * The format of the information pointed to by UDATA is * defined by the user. UDATA_SIZE holds the size of this buffer. * - * LINK_NAME is interpreted relative to LINK_LOC_ID. + * LINK_NAME is interpreted relative to LINK_LOC_ID. * - * The property list specified by LCPL_ID holds properties used + * The property list specified by LCPL_ID holds properties used * to create the link. * * The link class of the new link must already be registered * with the library. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: James Laird * Tuesday, December 13, 2005 @@ -538,7 +531,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata, @@ -548,7 +541,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, if(H5G_loc(link_loc_id, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!link_name || !*link_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") @@ -558,7 +551,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, /* Create external link */ if(H5L__create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -566,16 +559,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ldelete + * Function: H5Ldelete * - * Purpose: Removes the specified NAME from the group graph and - * decrements the link count for the object to which NAME - * points. If the link count reaches zero then all file-space - * associated with the object will be reclaimed (but if the - * object is open, then the reclamation of the file space is - * delayed until all handles to the object are closed). + * Purpose: Removes the specified NAME from the group graph and + * decrements the link count for the object to which NAME + * points. If the link count reaches zero then all file-space + * associated with the object will be reclaimed (but if the + * object is open, then the reclamation of the file space is + * delayed until all handles to the object are closed). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -593,9 +586,9 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) @@ -641,20 +634,20 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Delete the link */ - if(H5L__delete_by_idx(&loc, group_name, idx_type, order, n) < 0) + if(H5L_delete_by_idx(&loc, group_name, idx_type, order, n) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -695,7 +688,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, if(H5G_loc(loc_id, &loc)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) @@ -742,21 +735,21 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link value */ - if(H5L__get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for") + if(H5L_get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value") done: FUNC_LEAVE_API(ret_value) @@ -764,12 +757,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lexists + * Function: H5Lexists * - * Purpose: Checks if a link of a given name exists in a group + * Purpose: Checks if a link of a given name exists in a group * - * Return: Success: TRUE/FALSE - * Failure: Negative + * Return: Success: TRUE/FALSE/FAIL * * Programmer: Quincey Koziol * Friday, March 16, 2007 @@ -780,7 +772,7 @@ htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("t", "i*si", loc_id, name, lapl_id); @@ -788,15 +780,17 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) /* Check arguments */ if(H5G_loc(loc_id, &loc)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Check for the existence of the link */ - if((ret_value = H5L__exists(&loc, name)) < 0) + if((ret_value = H5L_exists(&loc, name)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -830,9 +824,9 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) @@ -875,20 +869,20 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link information */ - if(H5L__get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0) + if(H5L_get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -976,11 +970,11 @@ H5Lunregister(H5L_type_t id) /* Check args */ if(id < 0 || id > H5L_TYPE_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type") /* Do it */ if(H5L_unregister(id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type") + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type") done: FUNC_LEAVE_API(ret_value) @@ -988,14 +982,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lis_registered + * Function: H5Lis_registered * - * Purpose: Tests whether a user-defined link class has been registered + * Purpose: Tests whether a user-defined link class has been registered * or not. * - * Return: Positive if the link class has been registered - * Zero if it is unregistered - * Negative on error (if the class is not a valid UD class ID) + * Return: TRUE if the link class has been registered + * FALSE if it is unregistered + * FAIL on error (if the class is not a valid UD class ID) * * Programmer: James Laird * Monday, July 10, 2006 @@ -1017,7 +1011,7 @@ H5Lis_registered(H5L_type_t id) /* Is the link class already registered? */ for(i = 0; i < H5L_table_used_g; i++) - if(H5L_table_g[i].id == id) { + if(H5L_table_g[i].id == id) { ret_value = TRUE; break; } /* end if */ @@ -1028,16 +1022,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lget_name_by_idx + * Function: H5Lget_name_by_idx * - * Purpose: Gets name for a link, according to the order within an + * Purpose: Gets name for a link, according to the order within an * index. * * Same pattern of behavior as H5Iget_name. * - * Return: Success: Non-negative length of name, with information - * in NAME buffer - * Failure: Negative + * Return: Success: Non-negative length of name, with information + * in NAME buffer + * + * Failure: -1 * * Programmer: Quincey Koziol * Saturday, November 11, 2006 @@ -1050,29 +1045,29 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, char *name /*out*/, size_t size, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size, lapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list info") /* Get the link information */ - if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") + if((ret_value = H5L_get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name") done: FUNC_LEAVE_API(ret_value) @@ -1098,17 +1093,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, +H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) { - H5I_type_t id_type; /* Type of ID */ - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + H5I_type_t id_type; /* Type of ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "iIiIo*hx*x", grp_id, idx_type, order, idx_p, op, op_data); + H5TRACE6("e", "iIiIo*hx*x", group_id, idx_type, order, idx_p, op, op_data); /* Check arguments */ - id_type = H5I_get_type(grp_id); + if(H5G_loc(group_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + id_type = H5I_get_type(group_id); if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -1119,7 +1117,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Iterate over the links */ - if((ret_value = H5L__iterate(grp_id, ".", idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1128,20 +1126,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Literate_by_name + * Function: H5Literate_by_name * - * Purpose: Iterates over links in a group, with user callback routine, + * Purpose: Iterates over links in a group, with user callback routine, * according to the order within an index. * * Same pattern of behavior as H5Giterate. * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * * Programmer: Quincey Koziol @@ -1154,28 +1152,33 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, group_name, idx_type, order, idx_p, op, op_data, lapl_id); /* Check arguments */ - if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + if(!*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Iterate over the links */ - if((ret_value = H5L__iterate(loc_id, group_name, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5L_iterate(&loc, group_name, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1184,9 +1187,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lvisit + * Function: H5Lvisit * - * Purpose: Recursively visit all the links in a group and all + * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within * each group are visited according to the order within the * specified index (unless the specified index does not exist for @@ -1198,13 +1201,13 @@ done: * callback with more than one link that points to a particular * _object_. * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 24 2007 @@ -1212,28 +1215,31 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, +H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data) { - H5I_type_t id_type; /* Type of ID */ - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + H5I_type_t id_type; /* Type of ID */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "iIiIox*x", grp_id, idx_type, order, op, op_data); + H5TRACE5("e", "iIiIox*x", group_id, idx_type, order, op, op_data); /* Check args */ - id_type = H5I_get_type(grp_id); + if(H5G_loc(group_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + id_type = H5I_get_type(group_id); if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - /* Call internal routine */ - if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data)) < 0) + /* Iterate over the links */ + if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1242,9 +1248,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lvisit_by_name + * Function: H5Lvisit_by_name * - * Purpose: Recursively visit all the links in a group and all + * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within * each group are visited according to the order within the * specified index (unless the specified index does not exist for @@ -1256,13 +1262,13 @@ done: * callback with more than one link that points to a particular * _object_. * - * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 3 2007 @@ -1273,19 +1279,24 @@ herr_t H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sIiIox*xi", loc_id, group_name, idx_type, order, op, op_data, lapl_id); /* Check args */ - if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + if(!*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") @@ -1293,8 +1304,8 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal routine */ - if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data)) < 0) + /* Visit the links */ + if((ret_value = H5G_visit(&loc, group_name, idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1487,8 +1498,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, - hid_t lcpl_id) +H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id) { H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1880,11 +1890,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_create_soft + * Function: H5L_create_soft * - * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. + * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Monday, April 6, 1998 @@ -2175,27 +2185,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_val_by_idx + * Function: H5L_get_val_by_idx * * Purpose: Internal routine to query a link value according to the - * index within a group + * index within a group * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 27, 2017 * *------------------------------------------------------------------------- */ -static herr_t -H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +herr_t +H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size) { H5L_trav_gvbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(loc); @@ -2214,7 +2223,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_val_by_idx() */ +} /* end H5L_get_val_by_idx() */ /*------------------------------------------------------------------------- @@ -2255,7 +2264,7 @@ H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk /* Remove the link from the group */ if(H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group") done: /* Indicate that this callback didn't take ownership of the group * @@ -2347,29 +2356,28 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__delete_by_idx + * Function: H5L_delete_by_idx * * Purpose: Internal routine to delete a link according to its index - * within a group. + * within a group. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 27, 2017 * *------------------------------------------------------------------------- */ -static herr_t -H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +herr_t +H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n) { H5L_trav_rmbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) - /* Check arguments */ + /* Sanity check */ HDassert(loc); HDassert(name && *name); @@ -2384,7 +2392,7 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__delete_by_idx() */ +} /* end H5L_delete_by_idx() */ /*------------------------------------------------------------------------- @@ -2558,7 +2566,7 @@ H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, /* Insert the link into its new location */ if(H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, H5L__move_dest_cb, &udata_out) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") /* If this is a move and not a copy operation, change the object's name and remove the old link */ if(!udata->copy) { @@ -2686,7 +2694,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo /* Do the move */ if(H5G_traverse(src_loc, src_name, H5G_TARGET_MOUNT | H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__move_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2854,7 +2862,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__exists + * Function: H5L_exists * * Purpose: Returns whether a link exists in a group * @@ -2869,12 +2877,12 @@ done: *------------------------------------------------------------------------- */ htri_t -H5L__exists(const H5G_loc_t *loc, const char *name) +H5L_exists(const H5G_loc_t *loc, const char *name) { H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) /* A path of "/" will always exist in a file */ if(0 == HDstrcmp(name, "/")) @@ -2890,7 +2898,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5L__exists() */ +} /* H5L_exists() */ /*------------------------------------------------------------------------- @@ -3015,27 +3023,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_info_by_idx + * Function: H5L_get_info_by_idx * * Purpose: Internal routine to retrieve link info according to an * index's order. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static herr_t -H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +herr_t +H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5L_info_t *linfo /*out*/) { H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(loc); @@ -3054,7 +3058,7 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_info_by_idx() */ +} /* end H5L_get_info_by_idx() */ /*------------------------------------------------------------------------- @@ -3098,28 +3102,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_name_by_idx + * Function: H5L_get_name_by_idx * * Purpose: Internal routine to retrieve link name according to an * index's order. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static ssize_t -H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, +ssize_t +H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size) { H5L_trav_gnbi_t udata; /* User data for callback */ ssize_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(loc); @@ -3142,56 +3142,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__get_name_by_idx() */ - - -/*------------------------------------------------------------------------- - * Function: H5L__iterate - * - * Purpose: Internal routine to iterate over links - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) -{ - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_lnk; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check arguments */ - HDassert(group_name); - HDassert(op); - - /* Set up iteration beginning/end info */ - idx = (idx_p == NULL ? 0 : *idx_p); - last_lnk = 0; - - /* Build link operator info */ - lnk_op.op_type = H5G_LINK_OP_NEW; - lnk_op.op_func.op_new = op; - - /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") - - /* Set the index we stopped at */ - if(idx_p) - *idx_p = last_lnk; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L__iterate() */ +} /* end H5L_get_name_by_idx() */ /*------------------------------------------------------------------------- @@ -3324,3 +3275,49 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__link_copy_file() */ + +/*------------------------------------------------------------------------- + * Function: H5L_iterate + * + * Purpose: Iterates through links in a group + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) +{ + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_lnk; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + herr_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity checks */ + HDassert(loc); + HDassert(group_name); + HDassert(op); + + /* Set up iteration beginning/end info */ + idx = (idx_p == NULL ? 0 : *idx_p); + last_lnk = 0; + + /* Build link operator info */ + lnk_op.op_type = H5G_LINK_OP_NEW; + lnk_op.op_func.op_new = op; + + /* Iterate over the links */ + if((ret_value = H5G_iterate(loc, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + + /* Set the index we stopped at */ + if(idx_p) + *idx_p = last_lnk; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_iterate() */ + diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index 3bbb6b6..fa3c097 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -122,12 +122,27 @@ H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id); H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name); +H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linkbuf/*out*/); H5_DLL herr_t H5L_delete(const H5G_loc_t *loc, const char *name); +H5_DLL herr_t H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n); +H5_DLL herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + H5L_info_t *linfo /*out*/); +H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + char *name /*out*/, size_t size); H5_DLL herr_t H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size); +H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + void *buf/*out*/, size_t size); H5_DLL herr_t H5L_register_external(void); +H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, + H5L_iterate_t op, void *op_data); /* User-defined link functions */ H5_DLL herr_t H5L_register(const H5L_class_t *cls); diff --git a/src/H5O.c b/src/H5O.c index 25c3d83..b33e6e2 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -75,9 +75,9 @@ /*------------------------------------------------------------------------- - * Function: H5Oopen + * Function: H5Oopen * - * Purpose: Opens an object within an HDF5 file. + * Purpose: Opens an object within an HDF5 file. * * This function opens an object in the same way that H5Gopen2, * H5Topen2, and H5Dopen2 do. However, H5Oopen doesn't require @@ -88,8 +88,9 @@ * The opened object should be closed again with H5Oclose * or H5Gclose, H5Tclose, or H5Dclose. * - * Return: Success: An open object identifier - * Failure: Negative + * Return: Success: An open object identifier + * + * Failure: H5I_INVALID_HID * * Programmer: James Laird * July 14 2006 @@ -100,16 +101,18 @@ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) @@ -117,7 +120,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) /* Open the object */ if((ret_value = H5O_open_name(&loc, name, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: FUNC_LEAVE_API(ret_value) @@ -140,7 +143,7 @@ done: * or H5Gclose, H5Tclose, or H5Dclose. * * Return: Success: An open object identifier - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * November 20 2006 @@ -152,28 +155,28 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE6("i", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the object */ - if((ret_value = H5O__open_by_idx(&loc, group_name, idx_type, order, n)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") + if((ret_value = H5O_open_by_idx(&loc, group_name, idx_type, order, n)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: FUNC_LEAVE_API(ret_value) @@ -208,7 +211,7 @@ done: * map this to an address on disk for the filesystem. * * Return: Success: An open object identifier - * Failure: Negative + * Failure: H5I_INVALID_HID * * Programmer: James Laird * July 14 2006 @@ -221,7 +224,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) H5G_loc_t loc; /* Location within file */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "ia", loc_id, addr); /* Check args */ @@ -231,8 +234,8 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no address supplied") /* Open the object */ - if((ret_value = H5O__open_by_addr(&loc, addr)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") + if((ret_value = H5O_open_by_addr(&loc, addr)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: FUNC_LEAVE_API(ret_value) @@ -332,13 +335,13 @@ H5Oincr_refcount(hid_t object_id) /* Get the object's oloc so we can adjust its link count */ if((oloc = H5O_get_loc(object_id)) == NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Change the object's refcount */ + /* Change the object's reference count */ if(H5O_link(oloc, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -378,13 +381,13 @@ H5Odecr_refcount(hid_t object_id) /* Get the object's oloc so we can adjust its link count */ if((oloc = H5O_get_loc(object_id)) == NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Change the object's refcount */ + /* Change the object's reference count */ if(H5O_link(oloc, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -394,12 +397,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oexists_by_name + * Function: H5Oexists_by_name * - * Purpose: Determine if a linked-to object exists + * Purpose: Determine if a linked-to object exists * - * Return: Success: TRUE/FALSE - * Failure: Negative + * Return: Success: TRUE/FALSE + * Failure: FAIL * * Programmer: Quincey Koziol * February 2 2010 @@ -418,8 +421,10 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) @@ -441,8 +446,7 @@ done: * * NOTE: Add a parameter "fields" to indicate selection of object info. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * July 7 2010 @@ -462,12 +466,12 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") if(fields & ~H5O_INFO_ALL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Retrieve the object's information */ - if(H5G_loc_info(&loc, ".", oinfo/*out*/, fields) < 0) + if(H5G_loc_info(&loc, ".", oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -475,21 +479,20 @@ done: } /* end H5Oget_info2() */ - /*------------------------------------------------------------------------- - * Function: H5Oget_info_by_name2 - * - * Purpose: Retrieve information about an object. - * - * NOTE: Add a parameter "fields" to indicate selection of object info. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Neil Fortner - * July 7 2010 - * - *------------------------------------------------------------------------- - */ +/*------------------------------------------------------------------------- + * Function: H5Oget_info_by_name2 + * + * Purpose: Retrieve information about an object + * + * NOTE: Add a parameter "fields" to indicate selection of object info. + * + * Return: SUCCEED/FAIL + * + * Programmer: Neil Fortner + * July 7 2010 + * + *------------------------------------------------------------------------- + */ herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) @@ -503,10 +506,12 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") if(fields & ~H5O_INFO_ALL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") @@ -578,16 +583,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oset_comment + * Function: H5Oset_comment * * Purpose: Gives the specified object a comment. The COMMENT string - * should be a null terminated string. An object can have only - * one comment at a time. Passing NULL for the COMMENT argument - * will remove the comment property from the object. + * should be a null terminated string. An object can have only + * one comment at a time. Passing NULL for the COMMENT argument + * will remove the comment property from the object. * - * Note: Deprecated in favor of using attributes on objects + * Note: Deprecated in favor of using attributes on objects * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * August 30 2007 @@ -605,7 +610,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) /* Check args */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(obj_id) < 0) @@ -621,16 +626,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oset_comment_by_name + * Function: H5Oset_comment_by_name * * Purpose: Gives the specified object a comment. The COMMENT string - * should be a null terminated string. An object can have only - * one comment at a time. Passing NULL for the COMMENT argument - * will remove the comment property from the object. + * should be a null terminated string. An object can have only + * one comment at a time. Passing NULL for the COMMENT argument + * will remove the comment property from the object. * - * Note: Deprecated in favor of using attributes on objects + * Note: Deprecated in favor of using attributes on objects * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * August 30 2007 @@ -667,15 +672,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oget_comment + * Function: H5Oget_comment * - * Purpose: Retrieve comment for an object. + * Purpose: Retrieve comment for an object. * - * Return: Success: Number of bytes in the comment excluding the - * null terminator. Zero if the object has no - * comment. + * Return: Success: Number of bytes in the comment excluding the + * null terminator. Zero if the object has no + * comment. * - * Failure: Negative + * Failure: -1 * * Programmer: Quincey Koziol * August 30 2007 @@ -686,18 +691,18 @@ ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { H5G_loc_t loc; /* Location of group */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); /* Check args */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") /* Retrieve the object's comment */ if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: FUNC_LEAVE_API(ret_value) @@ -705,15 +710,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oget_comment_by_name + * Function: H5Oget_comment_by_name * - * Purpose: Retrieve comment for an object. + * Purpose: Retrieve comment for an object. * - * Return: Success: Number of bytes in the comment excluding the - * null terminator. Zero if the object has no - * comment. + * Return: Success: Number of bytes in the comment excluding the + * null terminator. Zero if the object has no + * comment. * - * Failure: Negative + * Failure: -1 * * Programmer: Quincey Koziol * August 30 2007 @@ -725,24 +730,24 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, (-1), "can't set access property list info") /* Retrieve the object's comment */ if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: FUNC_LEAVE_API(ret_value) @@ -750,9 +755,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ovisit2 + * Function: H5Ovisit2 * - * Purpose: Recursively visit an object and all the objects reachable + * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects * linked to from that group will be visited. Links within * each group are visited according to the order within the @@ -772,12 +777,12 @@ done: * object info to be retrieved to the callback "op". * * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 25 2007 @@ -788,12 +793,15 @@ herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields); /* Check args */ + if(H5G_loc(obj_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -803,9 +811,9 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, if(fields & ~H5O_INFO_ALL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, fields)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + /* Visit the objects */ + if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -813,7 +821,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ovisit_by_name2 + * Function: H5Ovisit_by_name2 * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -835,12 +843,12 @@ done: * object info to be retrieved to the callback "op". * * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 24 2007 @@ -851,15 +859,20 @@ herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIox*xIui", loc_id, obj_name, idx_type, order, op, op_data, fields, lapl_id); /* Check args */ - if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL") + if(!*obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -873,9 +886,9 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, fields)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + /* Visit the objects */ + if((ret_value = H5O__visit(&loc, obj_name, idx_type, order, op, op_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -883,17 +896,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oclose + * Function: H5Oclose * - * Purpose: Close an open file object. + * Purpose: Close an open file object. * * This is the companion to H5Oopen. It is used to close any * open object in an HDF5 file (but not IDs are that not file * objects, such as property lists and dataspaces). It has * the same effect as calling H5Gclose, H5Dclose, or H5Tclose. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: James Laird * July 14 2006 diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 570e16d..23dd928 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -57,9 +57,9 @@ /* Local Prototypes */ /********************/ -static herr_t H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, +static herr_t H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size); -static herr_t H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, +static herr_t H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *new_gap_loc, size_t new_gap_size); static herr_t H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new_type, void *new_native, size_t new_size); @@ -70,10 +70,10 @@ static herr_t H5O__alloc_find_best_nonnull(const H5F_t *f, const H5O_t *oh, size static herr_t H5O__alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t *new_idx); static herr_t H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx); -static htri_t H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u); -static htri_t H5O_move_msgs_forward(H5F_t *f, H5O_t *oh); -static htri_t H5O_merge_null(H5F_t *f, H5O_t *oh); -static htri_t H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh); +static htri_t H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u); +static htri_t H5O__move_msgs_forward(H5F_t *f, H5O_t *oh); +static htri_t H5O__merge_null(H5F_t *f, H5O_t *oh); +static htri_t H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh); static herr_t H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno); @@ -97,7 +97,7 @@ H5FL_EXTERN(H5O_cont_t); /*------------------------------------------------------------------------- - * Function: H5O_add_gap + * Function: H5O__add_gap * * Purpose: Add a gap to a chunk * @@ -110,14 +110,14 @@ H5FL_EXTERN(H5O_cont_t); *------------------------------------------------------------------------- */ static herr_t -H5O_add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, +H5O__add_gap(H5F_t *f, H5O_t *oh, unsigned chunkno, hbool_t *chk_dirtied, size_t idx, uint8_t *new_gap_loc, size_t new_gap_size) { hbool_t merged_with_null; /* Whether the gap was merged with a null message */ size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -150,7 +150,7 @@ if(chunkno > 0) { HDassert(oh->chunk[chunkno].gap == 0); /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0) + if(H5O__eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't eliminate gap in chunk") /* Set flag to indicate that the gap was handled */ @@ -178,7 +178,7 @@ if(chunkno > 0) { /* Check if we need to extend message table to hold the new null message */ if(oh->nmesgs >= oh->alloc_nmesgs) - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Increment new gap size */ @@ -212,11 +212,11 @@ if(chunkno > 0) { done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_add_gap() */ +} /* H5O__add_gap() */ /*------------------------------------------------------------------------- - * Function: H5O_eliminate_gap + * Function: H5O__eliminate_gap * * Purpose: Eliminate a gap in a chunk with a null message. * @@ -236,13 +236,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, +H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *gap_loc, size_t gap_size) { uint8_t *move_start, *move_end; /* Pointers to area of messages to move */ hbool_t null_before_gap; /* Flag whether the null message is before the gap or not */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(oh); @@ -319,7 +319,7 @@ H5O_eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, *chk_dirtied = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5O_eliminate_gap() */ +} /* H5O__eliminate_gap() */ /*------------------------------------------------------------------------- @@ -369,7 +369,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, alloc_msg->raw_size = new_size; /* Add the gap to the chunk */ - if(H5O_add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0) + if(H5O__add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") } /* end if */ else { @@ -378,7 +378,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, /* Check if we need to extend message table to hold the new null message */ if(oh->nmesgs >= oh->alloc_nmesgs) { - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* "Retarget" 'alloc_msg' pointer into newly re-allocated array of messages */ @@ -402,7 +402,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */ /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &chk_dirtied, null_msg, + if(H5O__eliminate_gap(oh, &chk_dirtied, null_msg, ((oh->chunk[null_chunkno].image + oh->chunk[null_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[null_chunkno].gap)), oh->chunk[null_chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") @@ -432,7 +432,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5O_alloc_msgs + * Function: H5O__alloc_msgs * * Purpose: Allocate more messages for a header * @@ -445,14 +445,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_alloc_msgs(H5O_t *oh, size_t min_alloc) +H5O__alloc_msgs(H5O_t *oh, size_t min_alloc) { size_t old_alloc; /* Old number of messages allocated */ size_t na; /* New number of messages allocated */ H5O_mesg_t *new_mesg; /* Pointer to new message array */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* check args */ HDassert(oh); @@ -474,7 +474,7 @@ H5O_alloc_msgs(H5O_t *oh, size_t min_alloc) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_alloc_msgs() */ +} /* H5O__alloc_msgs() */ /*------------------------------------------------------------------------- @@ -590,7 +590,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, /* Protect chunk */ if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") /* Determine whether the chunk can be extended */ was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, oh->chunk[chunkno].addr, (hsize_t)(oh->chunk[chunkno].size), (hsize_t)(delta + extra_prfx_size)); @@ -618,7 +618,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, else { /* Create a new null message */ if(oh->nmesgs >= oh->alloc_nmesgs) - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Set extension message */ @@ -690,7 +690,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, } /* end for */ /* Resize the chunk in the cache */ - if(H5O_chunk_resize(oh, chk_proxy) < 0) + if(H5O__chunk_resize(oh, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk") /* Set new message index */ @@ -958,7 +958,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, * that could be generated below. */ if(oh->nmesgs + 3 > oh->alloc_nmesgs) - if(H5O_alloc_msgs(oh, (size_t)3) < 0) + if(H5O__alloc_msgs(oh, (size_t)3) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Check if we need to move multiple messages, in order to make room for the new message */ @@ -1361,7 +1361,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5O_release_mesg + * Function: H5O__release_mesg * * Purpose: Convert a message into a null message * @@ -1374,13 +1374,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) +H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -1395,7 +1395,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) /* Protect chunk */ if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, mesg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") /* Free any native information */ H5O__msg_free_mesg(mesg); @@ -1415,7 +1415,7 @@ H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) /* Check if chunk has a gap currently */ if(oh->chunk[mesg->chunkno].gap) { /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &chk_dirtied, mesg, + if(H5O__eliminate_gap(oh, &chk_dirtied, mesg, ((oh->chunk[mesg->chunkno].image + oh->chunk[mesg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[mesg->chunkno].gap)), oh->chunk[mesg->chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") @@ -1427,11 +1427,11 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_release_mesg() */ +} /* H5O__release_mesg() */ /*------------------------------------------------------------------------- - * Function: H5O_move_cont + * Function: H5O__move_cont * * Purpose: Check and move message(s) forward into a continuation message * @@ -1444,7 +1444,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) +H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that continuation message is in */ H5O_mesg_t *cont_msg; /* Pointer to the continuation message */ @@ -1452,7 +1452,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) hbool_t chk_dirtied = FALSE; /* Flags for unprotecting chunk */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(f); @@ -1500,7 +1500,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) /* Convert continuation message into a null message. Do not delete * the target chunk yet, so we can still copy messages from it. */ - if(H5O_release_mesg(f, oh, cont_msg, FALSE) < 0) + if(H5O__release_mesg(f, oh, cont_msg, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message") /* Protect chunk */ @@ -1549,7 +1549,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) /* Check if there is space that should be a gap */ if(gap_size > 0) { /* Convert remnant into gap in chunk */ - if(H5O_add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0) + if(H5O__add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") } /* end if */ @@ -1594,12 +1594,12 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_move_cont() */ +} /* H5O__move_cont() */ /*------------------------------------------------------------------------- * - * Function: H5O_move_msgs_forward + * Function: H5O__move_msgs_forward * * Purpose: Move messages toward first chunk * @@ -1612,7 +1612,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) +H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) { H5O_chunk_proxy_t *null_chk_proxy = NULL; /* Chunk that null message is in */ H5O_chunk_proxy_t *curr_chk_proxy = NULL; /* Chunk that message is in */ @@ -1623,7 +1623,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) hbool_t did_packing = FALSE; /* Whether any messages were packed */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -1706,7 +1706,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) if(H5O_CONT_ID == curr_msg->type->id) { htri_t status; /* Status from moving messages */ - if((status = H5O_move_cont(f, oh, u)) < 0) + if((status = H5O__move_cont(f, oh, u)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message") else if(status > 0) { /* Message(s) got moved into "continuation" message */ packed_msg = TRUE; @@ -1818,7 +1818,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) /* Check for gap in null message's chunk */ if(oh->chunk[old_chunkno].gap > 0) { /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &null_chk_dirtied, null_msg, + if(H5O__eliminate_gap(oh, &null_chk_dirtied, null_msg, ((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)), oh->chunk[old_chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") @@ -1845,7 +1845,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) null_chk_dirtied = TRUE; /* Add the gap to the chunk */ - if(H5O_add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0) + if(H5O__add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") /* Re-use message # for new null message taking place of non-null message */ @@ -1862,7 +1862,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) /* Create new null message for previous location of non-null message */ if(oh->nmesgs >= oh->alloc_nmesgs) { - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* "Retarget" 'curr_msg' pointer into newly re-allocated array of messages */ @@ -1893,7 +1893,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) /* Check for gap in new null message's chunk */ if(oh->chunk[old_chunkno].gap > 0) { /* Eliminate the gap in the chunk */ - if(H5O_eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg], + if(H5O__eliminate_gap(oh, &curr_chk_dirtied, &oh->mesg[new_null_msg], ((oh->chunk[old_chunkno].image + oh->chunk[old_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)), oh->chunk[old_chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") @@ -1945,12 +1945,12 @@ done: HDassert(!null_chk_proxy && !curr_chk_proxy && !cont_targ_chk_proxy); FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_move_msgs_forward() */ +} /* H5O__move_msgs_forward() */ /*------------------------------------------------------------------------- * - * Function: H5O_merge_null + * Function: H5O__merge_null * * Purpose: Merge neighboring null messages in an object header * @@ -1963,13 +1963,13 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_merge_null(H5F_t *f, H5O_t *oh) +H5O__merge_null(H5F_t *f, H5O_t *oh) { hbool_t merged_msg; /* Flag to indicate that messages were merged */ hbool_t did_merging = FALSE; /* Whether any messages were merged */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh != NULL); @@ -2051,7 +2051,7 @@ H5O_merge_null(H5F_t *f, H5O_t *oh) oh->nmesgs--; /* The merge null message might span the entire chunk: scan for empty chunk to remove */ - if((result = H5O_remove_empty_chunks(f, oh)) < 0) + if((result = H5O__remove_empty_chunks(f, oh)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk") else if(result > 0) /* Get out of loop */ @@ -2084,12 +2084,12 @@ H5O_merge_null(H5F_t *f, H5O_t *oh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_merge_null() */ +} /* H5O__merge_null() */ /*------------------------------------------------------------------------- * - * Function: H5O_remove_empty_chunks + * Function: H5O__remove_empty_chunks * * Purpose: Attempt to eliminate empty chunks from object header. * @@ -2106,13 +2106,13 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh) +H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) { hbool_t deleted_chunk; /* Whether to a chunk was deleted */ hbool_t did_deleting = FALSE; /* Whether any chunks were deleted */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh != NULL); @@ -2173,7 +2173,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh) deleted_chunkno = null_msg->chunkno; /* Convert continuation message into a null message */ - if(H5O_release_mesg(f, oh, cont_msg, TRUE) < 0) + if(H5O__release_mesg(f, oh, cont_msg, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message") /* @@ -2273,12 +2273,12 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_remove_empty_chunks() */ +} /* H5O__remove_empty_chunks() */ /*------------------------------------------------------------------------- * - * Function: H5O_condense_header + * Function: H5O__condense_header * * Purpose: Attempt to eliminate empty chunks from object header. * @@ -2291,13 +2291,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_condense_header(H5F_t *f, H5O_t *oh) +H5O__condense_header(H5F_t *f, H5O_t *oh) { hbool_t rescan_header; /* Whether to rescan header */ htri_t result; /* Result from packing/merging/etc */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(oh != NULL); @@ -2308,33 +2308,33 @@ H5O_condense_header(H5F_t *f, H5O_t *oh) rescan_header = FALSE; /* Scan for messages that can be moved earlier in chunks */ - result = H5O_move_msgs_forward(f, oh); + result = H5O__move_msgs_forward(f, oh); if(result < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't move header messages forward") if(result > 0) rescan_header = TRUE; /* Scan for adjacent null messages & merge them */ - result = H5O_merge_null(f, oh); + result = H5O__merge_null(f, oh); if(result < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack null header messages") if(result > 0) rescan_header = TRUE; /* Scan for empty chunks to remove */ - result = H5O_remove_empty_chunks(f, oh); + result = H5O__remove_empty_chunks(f, oh); if(result < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk") if(result > 0) rescan_header = TRUE; } while(rescan_header); #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_condense_header() */ +} /* H5O__condense_header() */ /*------------------------------------------------------------------------- @@ -2523,7 +2523,7 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) HDassert(new_size <= old_size); /* Resize the chunk in the cache */ - if(H5O_chunk_resize(oh, chk_proxy) < 0) + if(H5O__chunk_resize(oh, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk") /* Free the unused space in the file */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index a62a3a3..c93bf32 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -44,48 +44,48 @@ static herr_t H5O__attr_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ -#define H5O_SHARED_TYPE H5O_MSG_ATTR -#define H5O_SHARED_DECODE H5O_attr_shared_decode -#define H5O_SHARED_DECODE_REAL H5O_attr_decode -#define H5O_SHARED_ENCODE H5O_attr_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_attr_encode -#define H5O_SHARED_SIZE H5O_attr_shared_size -#define H5O_SHARED_SIZE_REAL H5O_attr_size -#define H5O_SHARED_DELETE H5O__attr_shared_delete -#define H5O_SHARED_DELETE_REAL H5O__attr_delete -#define H5O_SHARED_LINK H5O__attr_shared_link -#define H5O_SHARED_LINK_REAL H5O__attr_link -#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file -#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file -#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file -#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file +#define H5O_SHARED_TYPE H5O_MSG_ATTR +#define H5O_SHARED_DECODE H5O_attr_shared_decode +#define H5O_SHARED_DECODE_REAL H5O_attr_decode +#define H5O_SHARED_ENCODE H5O_attr_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O_attr_encode +#define H5O_SHARED_SIZE H5O_attr_shared_size +#define H5O_SHARED_SIZE_REAL H5O_attr_size +#define H5O_SHARED_DELETE H5O__attr_shared_delete +#define H5O_SHARED_DELETE_REAL H5O__attr_delete +#define H5O_SHARED_LINK H5O__attr_shared_link +#define H5O_SHARED_LINK_REAL H5O__attr_link +#define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file +#define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_attr_shared_debug -#define H5O_SHARED_DEBUG_REAL H5O__attr_debug +#define H5O_SHARED_DEBUG H5O_attr_shared_debug +#define H5O_SHARED_DEBUG_REAL H5O__attr_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_ATTR[1] = {{ - H5O_ATTR_ID, /* message id number */ - "attribute", /* message name for debugging */ - sizeof(H5A_t), /* native message size */ - H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ - H5O_attr_shared_decode, /* decode message */ - H5O_attr_shared_encode, /* encode message */ - H5O_attr_copy, /* copy the native value */ - H5O_attr_shared_size, /* size of raw message */ - H5O__attr_reset, /* reset method */ - H5O__attr_free, /* free method */ - H5O__attr_shared_delete, /* file delete method */ - H5O__attr_shared_link, /* link method */ - NULL, /*set share method */ - NULL, /*can share method */ - H5O_attr_pre_copy_file, /* pre copy native value to file */ - H5O__attr_shared_copy_file, /* copy native value to file */ - H5O_attr_shared_post_copy_file, /* post copy native value to file */ - H5O_attr_get_crt_index, /* get creation index */ - H5O_attr_set_crt_index, /* set creation index */ - H5O_attr_shared_debug /* debug the message */ + H5O_ATTR_ID, /* message id number */ + "attribute", /* message name for debugging */ + sizeof(H5A_t), /* native message size */ + H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ + H5O_attr_shared_decode, /* decode message */ + H5O_attr_shared_encode, /* encode message */ + H5O_attr_copy, /* copy the native value */ + H5O_attr_shared_size, /* size of raw message */ + H5O__attr_reset, /* reset method */ + H5O__attr_free, /* free method */ + H5O__attr_shared_delete, /* file delete method */ + H5O__attr_shared_link, /* link method */ + NULL, /* set share method */ + NULL, /* can share method */ + H5O_attr_pre_copy_file, /* pre copy native value to file */ + H5O__attr_shared_copy_file, /* copy native value to file */ + H5O_attr_shared_post_copy_file, /* post copy native value to file */ + H5O_attr_get_crt_index, /* get creation index */ + H5O_attr_set_crt_index, /* set creation index */ + H5O_attr_shared_debug /* debug the message */ }}; /* Flags for attribute flag encoding */ @@ -474,7 +474,7 @@ H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) * Purpose: Frees resources within a attribute message, but doesn't free * the message itself. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Tuesday, December 9, 1997 @@ -491,11 +491,11 @@ H5O__attr_reset(void H5_ATTR_UNUSED *_mesg) /*------------------------------------------------------------------------- - * Function: H5O__attr_free + * Function: H5O__attr_free * - * Purpose: Frees the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, November 18, 2004 @@ -525,7 +525,7 @@ done: * * Purpose: Free file space referenced by message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -563,7 +563,7 @@ done: * Purpose: Increment reference count on any objects referenced by * message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -604,9 +604,7 @@ done: * Purpose: Perform any necessary actions before copying message between * files for attribute messages. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, June 26, 2006 @@ -628,7 +626,8 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, HDassert(cpy_info->file_dst); /* Check to ensure that the version of the message to be copied does not exceed - the message version allowed by the destination file's high bound */ + * the message version allowed by the destination file's high bound. + */ if(attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)]) HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds") @@ -649,7 +648,6 @@ done: * Purpose: Copies a message from _MESG to _DEST in file * * Return: Success: Ptr to _DEST - * * Failure: NULL * * Programmer: Quincey Koziol @@ -695,7 +693,7 @@ done: * an object may have a reference attribute that points to the * object itself. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * March 6, 2005 @@ -719,12 +717,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_get_crt_index + * Function: H5O_attr_get_crt_index * - * Purpose: Get creation index from the message + * Purpose: Get creation index from the message * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, January 18, 2007 @@ -749,12 +746,11 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) /*------------------------------------------------------------------------- - * Function: H5O_attr_set_crt_index + * Function: H5O_attr_set_crt_index * - * Purpose: Set creation index from the message + * Purpose: Set creation index from the message * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, January 18, 2007 diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 640d1c7..5183026 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Oattribute.c - * Dec 11 2006 - * Quincey Koziol + * Created: H5Oattribute.c * - * Purpose: Object header attribute routines. + * Purpose: Object header attribute routines. * *------------------------------------------------------------------------- */ @@ -26,21 +24,21 @@ /* Module Setup */ /****************/ -#define H5A_FRIEND /*suppress error about including H5Apkg */ +#define H5A_FRIEND /* Suppress error about including H5Apkg.h */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Fprivate.h" /* File */ +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Fprivate.h" /* File */ /****************/ @@ -129,8 +127,24 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ -static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, +static herr_t H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static htri_t H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open); +static herr_t H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence, + unsigned H5_ATTR_UNUSED *oh_modified, void *_udata); +static herr_t H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr); +static herr_t H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static herr_t H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata); +static herr_t H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static herr_t H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo); +static herr_t H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata); +static herr_t H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg, + unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata); /*********************/ /* Package Variables */ @@ -149,12 +163,12 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, /*------------------------------------------------------------------------- - * Function: H5O_attr_to_dense_cb + * Function: H5O__attr_to_dense_cb * - * Purpose: Object header iterator callback routine to convert compact + * Purpose: Object header iterator callback routine to convert compact * attributes to dense attributes * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -163,14 +177,14 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, *------------------------------------------------------------------------- */ static herr_t -H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_cvt_t *udata = (H5O_iter_cvt_t *)_udata; /* Operator user data */ H5A_t *attr = (H5A_t *)mesg->native; /* Pointer to attribute to insert */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -186,7 +200,7 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* Convert message into a null message in the header */ /* (don't delete attribute's space in the file though) */ - if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0) + if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message") /* Indicate that the object header was modified */ @@ -194,15 +208,15 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_to_dense_cb() */ +} /* end H5O__attr_to_dense_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_create + * Function: H5O__attr_create * - * Purpose: Create a new attribute in the object header. + * Purpose: Create a new attribute in the object header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, December 8, 2006 @@ -283,7 +297,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) /* Iterate over existing attributes, moving them to dense storage */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_to_dense_cb; + op.u.lib_op = H5O__attr_to_dense_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCONVERT, FAIL, "error converting attributes to dense storage") } /* end if */ @@ -337,7 +351,8 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) /* Increment reference count for shared attribute object for the * object handle created by the caller function H5A__create. The count * for the cached object header has been incremented in the step above - * (in H5O__msg_append_real). The dense storage doesn't need a count. */ + * (in H5O__msg_append_real). The dense storage doesn't need a count. + */ attr->shared->nrefs += 1; /* Was new attribute shared? */ @@ -392,12 +407,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_open_cb + * Function: H5O__attr_open_cb * - * Purpose: Object header iterator callback routine to open an + * Purpose: Object header iterator callback routine to open an * attribute stored compactly. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -406,13 +421,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, +H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) { H5O_iter_opn_t *udata = (H5O_iter_opn_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -437,15 +452,15 @@ H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_open_cb() */ +} /* end H5O__attr_open_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_open_by_name + * Function: H5O__attr_open_by_name * - * Purpose: Open an existing attribute in an object header. + * Purpose: Open an existing attribute in an object header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -470,7 +485,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) /* Protect the object header to iterate over */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -483,7 +498,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) /* If found the attribute is already opened, make a copy of it to share the * object information. If not, open attribute as a new object */ - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, name)) < 0) + if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") else if(found_open_attr == TRUE) { if(NULL == (opened_attr = H5A__copy(NULL, exist_attr))) @@ -506,7 +521,7 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) /* Iterate over attributes, to locate correct one to open */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_open_cb; + op.u.lib_op = H5O__attr_open_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "error updating attribute") @@ -541,12 +556,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_open_by_idx_cb + * Function: H5O__attr_open_by_idx_cb * - * Purpose: Callback routine opening an attribute by index + * Purpose: Callback routine opening an attribute by index * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -555,12 +569,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) +H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) { H5A_t **ret_attr = (H5A_t **)_ret_attr; /* 'User data' passed in */ herr_t ret_value = H5_ITER_STOP; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(attr); @@ -572,16 +586,16 @@ H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_open_by_idx_cb() */ +} /* end H5O__attr_open_by_idx_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_open_by_idx + * Function: H5O__attr_open_by_idx * - * Purpose: Open an existing attribute in an object header according to + * Purpose: Open an existing attribute in an object header according to * an index. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 18, 2006 @@ -605,7 +619,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_LIB; - attr_op.u.lib_op = H5O_attr_open_by_idx_cb; + attr_op.u.lib_op = H5O__attr_open_by_idx_cb; /* Iterate over attributes to locate correct one */ if(H5O_attr_iterate_real((hid_t)-1, loc, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0) @@ -615,7 +629,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, * and make a copy of the already opened object to share the object info. */ if(opened_attr) { - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0) + if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") /* If found that the attribute is already opened, make a copy of it @@ -647,12 +661,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_find_opened_attr + * Function: H5O__attr_find_opened_attr * - * Purpose: Find out whether an attribute has been opened by giving + * Purpose: Find out whether an attribute has been opened by giving * the name. Return the pointer to the object if found. * - * Return: TRUE: found the already opened object + * Return: TRUE: found the already opened object * FALSE: didn't find the opened object * FAIL: function failed. * @@ -662,14 +676,14 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open) +H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open) { hid_t *attr_id_list = NULL; /* List of IDs for opened attributes */ unsigned long loc_fnum; /* File serial # for object */ size_t num_open_attr; /* Number of opened attributes */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get file serial number for the location of attribute */ if(H5F_get_fileno(loc->file, &loc_fnum) < 0) @@ -691,8 +705,8 @@ H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_t /* Retrieve the IDs of all opened attributes */ if(H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE, &check_num_attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get IDs of opened attributes") - if(check_num_attr != num_open_attr) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "open attribute count mismatch") + if(check_num_attr != num_open_attr) + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "open attribute count mismatch") /* Iterate over the attributes */ for(u = 0; u < num_open_attr; u++) { @@ -724,15 +738,15 @@ done: H5MM_free(attr_id_list); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_find_opened_attr */ +} /* end H5O__attr_find_opened_attr() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_update_shared + * Function: H5O__attr_update_shared * - * Purpose: Update a shared attribute. + * Purpose: Update a shared attribute. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -802,25 +816,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_write_cb + * Function: H5O__attr_write_cb * - * Purpose: Object header iterator callback routine to update an + * Purpose: Object header iterator callback routine to update an * attribute stored compactly. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org * Dec 4 2006 * - * Modification:Raymond Lu - * 4 June 2008 - * Took out the data copying part because the attribute data - * is shared between attribute handle and object header. *------------------------------------------------------------------------- */ static herr_t -H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_wrt_t *udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */ @@ -828,7 +838,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -885,15 +895,15 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_write_cb() */ +} /* end H5O__attr_write_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_write + * Function: H5O__attr_write * - * Purpose: Write a new value to an attribute. + * Purpose: Write a new value to an attribute. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 4, 2006 @@ -915,7 +925,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr) /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -942,7 +952,7 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr) /* Iterate over attributes, to locate correct one to update */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_write_cb; + op.u.lib_op = H5O__attr_write_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") @@ -964,12 +974,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_rename_chk_cb + * Function: H5O__attr_rename_chk_cb * - * Purpose: Object header iterator callback routine to check for + * Purpose: Object header iterator callback routine to check for * duplicate name during rename * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -978,13 +988,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) { H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(oh); @@ -1001,21 +1011,21 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_rename_chk_cb() */ +} /* end H5O__attr_rename_chk_cb() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_rename_mod_cb + * Function: H5O__attr_rename_mod_cb * - * Purpose: Object header iterator callback routine to change name of + * Purpose: Object header iterator callback routine to change name of * attribute during rename * - * Note: This routine doesn't currently allow an attribute to change + * Note: This routine doesn't currently allow an attribute to change * its "shared" status, if the name change would cause a size * difference that would put it into a different category. * Something for later... * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1024,7 +1034,7 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, *------------------------------------------------------------------------- */ static herr_t -H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */ @@ -1032,7 +1042,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -1096,7 +1106,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* (doesn't decrement the link count on shared components because * the "native" pointer has been reset) */ - if(H5O_release_mesg(udata->f, oh, mesg, FALSE) < 0) + if(H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release previous attribute") *oh_modified = H5O_MODIFY_CONDENSE; @@ -1130,15 +1140,15 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_rename_mod_cb() */ +} /* end H5O__attr_rename_mod_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_rename + * Function: H5O__attr_rename * - * Purpose: Rename an attribute. + * Purpose: Rename an attribute. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -1162,7 +1172,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1190,7 +1200,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, /* Iterate over attributes, to check if "new name" exists already */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_rename_chk_cb; + op.u.lib_op = H5O__attr_rename_chk_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") @@ -1200,7 +1210,7 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, /* Iterate over attributes again, to actually rename attribute with old name */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_rename_mod_cb; + op.u.lib_op = H5O__attr_rename_mod_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") @@ -1218,15 +1228,15 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5O__attr_rename */ +} /* end H5O__attr_rename() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_iterate_real + * Function: H5O_attr_iterate_real * - * Purpose: Internal routine to iterate over attributes for an object. + * Purpose: Internal routine to iterate over attributes for an object. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -1309,11 +1319,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__attr_iterate + * Function: H5O__attr_iterate * - * Purpose: Iterate over attributes for an object. + * Purpose: Iterate over attributes for an object. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, December 5, 2006 @@ -1322,8 +1332,7 @@ done: */ herr_t H5O__attr_iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, - hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, - void *op_data) + hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data) { H5G_loc_t loc; /* Object location */ herr_t ret_value = FAIL; /* Return value */ @@ -1347,11 +1356,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_remove_update + * Function: H5O__attr_remove_update * - * Purpose: Check for reverting from dense to compact attribute storage + * Purpose: Check for reverting from dense to compact attribute storage * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, February 14, 2007 @@ -1367,12 +1376,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) +H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) { H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -1427,7 +1436,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) /* Insert attribute message into object header (Will increment reference count on shared attributes) */ /* Find out whether the attribute has been opened */ - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0) + if((found_open_attr = H5O__attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute") /* If found the attribute is already opened, use the opened message to insert. @@ -1450,7 +1459,8 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) /* Update the message after removing the attribute */ /* This is particularly needed when removing the last attribute that is - accessed via fractal heap/v2 B-tree (HDFFV-9277) */ + * accessed via fractal heap/v2 B-tree (HDFFV-9277) + */ if(H5O__msg_write_real(loc->file, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message") @@ -1468,16 +1478,16 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_remove_update() */ +} /* end H5O__attr_remove_update() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_remove_cb + * Function: H5O__attr_remove_cb * - * Purpose: Object header iterator callback routine to remove an + * Purpose: Object header iterator callback routine to remove an * attribute stored compactly. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1486,13 +1496,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) { H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(oh); @@ -1502,7 +1512,7 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* Check for correct attribute message to modify */ if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { /* Convert message into a null message (i.e. delete it) */ - if(H5O_release_mesg(udata->f, oh, mesg, TRUE) < 0) + if(H5O__release_mesg(udata->f, oh, mesg, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message") /* Indicate that the object header was modified */ @@ -1517,15 +1527,15 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_remove_cb() */ +} /* end H5O__attr_remove_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_remove + * Function: H5O__attr_remove * - * Purpose: Delete an attribute on an object. + * Purpose: Delete an attribute on an object. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -1548,7 +1558,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1575,7 +1585,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) /* Iterate over attributes, to locate correct one to delete */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_remove_cb; + op.u.lib_op = H5O__attr_remove_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute") @@ -1586,7 +1596,7 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) /* Update the attribute information after removing an attribute */ if(ainfo_exists) - if(H5O_attr_remove_update(loc, oh, &ainfo) < 0) + if(H5O__attr_remove_update(loc, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") /* Update the modification time, if any */ @@ -1602,12 +1612,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__attr_remove_by_idx + * Function: H5O__attr_remove_by_idx * - * Purpose: Delete an attribute on an object, according to an order within - * an index. + * Purpose: Delete an attribute on an object, according to an order within + * an index. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Wednesday, February 14, 2007 @@ -1631,7 +1641,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1666,7 +1676,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Iterate over attributes, to locate correct one to delete */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_remove_cb; + op.u.lib_op = H5O__attr_remove_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute") @@ -1677,7 +1687,7 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Update the attribute information after removing an attribute */ if(ainfo_exists) - if(H5O_attr_remove_update(loc, oh, &ainfo) < 0) + if(H5O__attr_remove_update(loc, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") /* Update the modification time, if any */ @@ -1695,11 +1705,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_attr_count_real + * Function: H5O__attr_count_real * - * Purpose: Determine the # of attributes on an object + * Purpose: Determine the # of attributes on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, March 9, 2007 @@ -1707,11 +1717,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) +H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_TAG(oh->cache_info.addr) + FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) /* Check arguments */ HDassert(f); @@ -1745,16 +1755,16 @@ H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) done: FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5O_attr_count_real */ +} /* end H5O__attr_count_real */ /*------------------------------------------------------------------------- - * Function: H5O_attr_exists_cb + * Function: H5O__attr_exists_cb * - * Purpose: Object header iterator callback routine to check for an + * Purpose: Object header iterator callback routine to check for an * attribute stored compactly, by name. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -1763,13 +1773,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, +H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) { H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(mesg); @@ -1785,15 +1795,15 @@ H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_exists_cb() */ +} /* end H5O__attr_exists_cb() */ /*------------------------------------------------------------------------- - * Function: H5O__attr_exists + * Function: H5O__attr_exists * - * Purpose: Determine if an attribute with a particular name exists on an object + * Purpose: Determine if an attribute with a particular name exists on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -1815,7 +1825,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name) /* Protect the object header to iterate over */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1842,7 +1852,7 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name) /* Iterate over existing attributes, checking for attribute with same name */ op.op_type = H5O_MESG_OP_LIB; - op.u.lib_op = H5O_attr_exists_cb; + op.u.lib_op = H5O__attr_exists_cb; if(H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute") @@ -1863,7 +1873,7 @@ done: * * Purpose: For 1.8 attribute, returns storage amount for btree and fractal heap * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi * June 19, 2007 @@ -1943,11 +1953,11 @@ done: #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- - * Function: H5O__attr_count + * Function: H5O__attr_count * - * Purpose: Determine the # of attributes on an object + * Purpose: Determine the # of attributes on an object * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Monday, December 11, 2006 @@ -1968,10 +1978,10 @@ H5O__attr_count(const H5O_loc_t *loc) /* Protect the object header to iterate over */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Retrieve # of attributes on object */ - if(H5O_attr_count_real(loc->file, oh, &nattrs) < 0) + if(H5O__attr_count_real(loc->file, oh, &nattrs) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Set return value */ diff --git a/src/H5Obogus.c b/src/H5Obogus.c index 92fd218..fbf04f2 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -75,7 +75,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{ 0, /*native message size */ 0, /* messages are sharable? */ H5O__bogus_decode, /*decode message */ - H5O__bogus_encode, /*encode message */ + H5O_bogus_encode, /*encode message */ NULL, /*copy the native value */ H5O_bogus_size, /*raw message size */ NULL, /*free internal memory */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 59e1705..e7cad83 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -437,7 +437,7 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) HDassert(oh->cache_info.type == H5AC_OHDR); HDassert(oh->chunk[0].size == len); #ifdef H5O_DEBUG - H5O_assert(oh); + H5O__assert(oh); #endif /* H5O_DEBUG */ /* Point to raw data 'image' for first chunk, which @@ -1430,9 +1430,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check for combining two adjacent 'null' messages */ if((udata->file_intent & H5F_ACC_RDWR) && - H5O_NULL_ID == id && oh->nmesgs > 0 && - H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id && - oh->mesg[oh->nmesgs - 1].chunkno == chunkno) { + H5O_NULL_ID == id && oh->nmesgs > 0 && + H5O_NULL_ID == oh->mesg[oh->nmesgs - 1].type->id && + oh->mesg[oh->nmesgs - 1].chunkno == chunkno) { size_t mesgno; /* Current message to operate on */ @@ -1448,7 +1448,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check if we need to extend message table to hold the new message */ if(oh->nmesgs >= oh->alloc_nmesgs) - if(H5O_alloc_msgs(oh, (size_t)1) < 0) + if(H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate more space for messages") /* Get pointer to message to set up */ @@ -1470,9 +1470,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* (Usually from future versions of the library) */ if(id >= H5O_UNKNOWN_ID || #ifdef H5O_ENABLE_BOGUS - id == H5O_BOGUS_VALID_ID || + id == H5O_BOGUS_VALID_ID || #endif - NULL == H5O_msg_class_g[id]) { + NULL == H5O_msg_class_g[id]) { H5O_unknown_t *unknown; /* Pointer to "unknown" message info */ @@ -1491,9 +1491,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Check for "fail if unknown" message flags */ if(((udata->file_intent & H5F_ACC_RDWR) && - (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE)) - || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS)) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found") + (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE)) + || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS)) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unknown message with 'fail if unknown' flag found") /* Check for "mark if unknown" message flag, etc. */ else if((flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) && !(flags & H5O_MSG_FLAG_WAS_UNKNOWN) && diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 205515a..94301b3 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -77,12 +77,11 @@ H5FL_DEFINE(H5O_chunk_proxy_t); /*------------------------------------------------------------------------- - * Function: H5O__chunk_add + * Function: H5O__chunk_add * - * Purpose: Add new chunk for object header to metadata cache + * Purpose: Add new chunk for object header to metadata cache * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -107,7 +106,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno) /* Allocate space for the object header data structure */ if(NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Increment reference count on object header */ if(H5O__inc_rc(oh) < 0) @@ -128,6 +127,7 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno) /* Insert the chunk proxy into the cache */ if(H5AC_insert_entry(f, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk") + chk_proxy = NULL; done: @@ -146,12 +146,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_protect + * Function: H5O_chunk_protect * - * Purpose: Protect an object header chunk for modifications + * Purpose: Protect an object header chunk for modifications * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -221,12 +220,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_unprotect + * Function: H5O__chunk_unprotect * - * Purpose: Unprotect an object header chunk after modifications + * Purpose: Unprotect an object header chunk after modifications * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -273,12 +271,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_chunk_resize + * Function: H5O__chunk_resize * - * Purpose: Resize an object header chunk + * Purpose: Resize an object header chunk * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -287,11 +284,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) +H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(oh); @@ -311,16 +308,15 @@ H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_chunk_resize() */ +} /* end H5O__chunk_resize() */ /*------------------------------------------------------------------------- - * Function: H5O__chunk_update_idx + * Function: H5O__chunk_update_idx * - * Purpose: Update the chunk index for a chunk proxy + * Purpose: Update the chunk index for a chunk proxy * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -367,12 +363,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_delete + * Function: H5O__chunk_delete * - * Purpose: Notify metadata cache that a chunk has been deleted + * Purpose: Notify metadata cache that a chunk has been deleted * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -413,12 +408,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__chunk_dest + * Function: H5O__chunk_dest * - * Purpose: Destroy a chunk proxy object + * Purpose: Destroy a chunk proxy object * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@hdfgroup.org diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 2eb27d6..ad54272 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -36,10 +36,10 @@ /* PRIVATE PROTOTYPES */ -static void *H5O_cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, +static void *H5O__cont_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static size_t H5O__cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__cont_free(void *mesg); static herr_t H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static herr_t H5O__cont_debug(H5F_t *f, const void *_mesg, FILE * stream, @@ -51,10 +51,10 @@ const H5O_msg_class_t H5O_MSG_CONT[1] = {{ "hdr continuation", /*message name for debugging */ sizeof(H5O_cont_t), /*native message size */ 0, /* messages are sharable? */ - H5O_cont_decode, /*decode message */ - H5O_cont_encode, /*encode message */ + H5O__cont_decode, /*decode message */ + H5O__cont_encode, /*encode message */ NULL, /*no copy method */ - H5O_cont_size, /*size of header continuation */ + H5O__cont_size, /*size of header continuation */ NULL, /*reset method */ H5O__cont_free, /* free method */ H5O__cont_delete, /* file delete method */ @@ -74,7 +74,7 @@ H5FL_DEFINE(H5O_cont_t); /*------------------------------------------------------------------------- - * Function: H5O_cont_decode + * Function: H5O__cont_decode * * Purpose: Decode the raw header continuation message. * @@ -89,14 +89,14 @@ H5FL_DEFINE(H5O_cont_t); *------------------------------------------------------------------------- */ static void * -H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, +H5O__cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_cont_t *cont = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -116,11 +116,11 @@ H5O_cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_cont_decode() */ +} /* end H5O__cont_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_cont_encode + * Function: H5O__cont_encode * * Purpose: Encodes a continuation message. * @@ -133,11 +133,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_cont_t *cont = (const H5O_cont_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -151,11 +151,11 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con H5F_ENCODE_LENGTH(f, p, cont->size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_cont_encode() */ +} /* end H5O__cont_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_cont_size + * Function: H5O__cont_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -172,18 +172,18 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con *------------------------------------------------------------------------- */ static size_t -H5O_cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) +H5O__cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = (size_t)(H5F_SIZEOF_ADDR(f) + /* Continuation header address */ H5F_SIZEOF_SIZE(f)); /* Continuation header length */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_cont_size() */ +} /* end H5O__cont_size() */ /*------------------------------------------------------------------------- @@ -256,8 +256,6 @@ done: * matzke@llnl.gov * Aug 6 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 8a44902..1ba4901 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Ocopy.c - * Nov 6 2006 - * Quincey Koziol + * Created: H5Ocopy.c * - * Purpose: Object copying routines. + * Purpose: Object copying routines. * *------------------------------------------------------------------------- */ @@ -32,19 +30,19 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Aprivate.h" /* Attributes */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5HGprivate.h" /* Global Heaps */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Lprivate.h" /* Links */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5HGprivate.h" /* Global Heaps */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Lprivate.h" /* Links */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ /****************/ @@ -79,8 +77,6 @@ typedef struct H5O_copy_search_comm_dt_ud_t { /* Local Prototypes */ /********************/ -static herr_t H5O__copy(const H5G_loc_t *loc, const char *src_name, - H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); static herr_t H5O__copy_free_addrmap_cb(void *item, void *key, void *op_data); static herr_t H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5O_copy_t *cpy_info, H5O_type_t *obj_type, void **udata); @@ -240,7 +236,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Copy the object */ - if(H5O__copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) + if(H5O_copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: @@ -249,7 +245,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__copy + * Function: H5O_copy * * Purpose: Private version of H5Ocopy * @@ -260,8 +256,8 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, +herr_t +H5O_copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id) { H5G_loc_t src_loc; /* Source object group location */ @@ -272,7 +268,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, hbool_t obj_open = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_NOAPI_NOINIT /* Check arguments */ HDassert(loc); @@ -312,7 +308,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__copy() */ +} /* end H5O_copy() */ /*------------------------------------------------------------------------- @@ -431,7 +427,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, } /* end if */ /* Flush any dirty messages in source object header to update the header chunks */ - if(H5O_flush_msgs(oloc_src->file, oh_src) < 0) + if(H5O__flush_msgs(oloc_src->file, oh_src) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object header messages") /* Allocate the destination object header and fill in header fields */ @@ -766,7 +762,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* Make sure we have enough space for new NULL message */ if(oh_dst->nmesgs + 1 > oh_dst->alloc_nmesgs) - if(H5O_alloc_msgs(oh_dst, (size_t)1) < 0) + if(H5O__alloc_msgs(oh_dst, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Create null message for [rest of] space in new chunk */ @@ -1215,7 +1211,7 @@ H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name, /* Insert the new object in the destination file's group */ if(H5L_link(dst_loc, dst_name, &new_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link") entry_inserted = TRUE; done: @@ -1898,7 +1894,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, /* Traverse the destination file, adding committed datatypes to the skip * list */ - if(H5G_visit(H5F_FILE_ID(oloc_dst->file), "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0) + if(H5G_visit(&dst_root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") cpy_info->dst_dt_list_complete = TRUE; } /* end if */ diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 1fc95dd..b8190ae 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -76,12 +76,12 @@ #ifdef H5O_DEBUG /*------------------------------------------------------------------------- - * Function: H5O_assert + * Function: H5O__assert * - * Purpose: Sanity check the information for an object header data + * Purpose: Sanity check the information for an object header data * structure. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED (Doesn't fail, just crashes) * * Programmer: Quincey Koziol * koziol@hdfgroup.org @@ -90,7 +90,7 @@ *------------------------------------------------------------------------- */ herr_t -H5O_assert(const H5O_t *oh) +H5O__assert(const H5O_t *oh) { H5O_mesg_t *curr_msg; /* Pointer to current message to examine */ H5O_mesg_t *tmp_msg; /* Pointer to temporary message to examine */ @@ -101,7 +101,7 @@ H5O_assert(const H5O_t *oh) size_t hdr_size; /* Size of header's chunks */ unsigned u, v; /* Local index variables */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Initialize the tracking variables */ hdr_size = 0; @@ -223,7 +223,7 @@ H5O_assert(const H5O_t *oh) HDassert(hdr_size == (free_space + meta_space + mesg_space)); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_assert() */ +} /* end H5O__assert() */ #endif /* H5O_DEBUG */ @@ -270,31 +270,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_debug_real + * Function: H5O__debug_real * - * Purpose: Prints debugging info about an object header. + * Purpose: Prints debugging info about an object header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * matzke@llnl.gov * Aug 6 1997 * - * Modifications: - * Feb. 2009: Vailin Choi - * Fixed bug in the accumulation of chunk_total - * Used the appropriate flag when printing creation order tracked/indexed *------------------------------------------------------------------------- */ herr_t -H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth) +H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth) { size_t mesg_total = 0, chunk_total = 0, gap_total = 0; unsigned *sequence = NULL; unsigned i; /* Local index variable */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -323,16 +319,16 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int /* Extra information for later versions */ if(oh->version > H5O_VERSION_1) { /* Display object's status flags */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute creation order tracked:", (oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? "Yes" : "No"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute creation order indexed:", (oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? "Yes" : "No"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute storage phase change values:", (oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) ? "Non-default" : "Default"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Timestamps:", (oh->flags & H5O_HDR_STORE_TIMES) ? "Enabled" : "Disabled"); if(oh->flags & ~H5O_HDR_ALL_FLAGS) @@ -385,14 +381,14 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int for(i = 0, chunk_total = 0; i < oh->nchunks; i++) { size_t chunk_size; - HDfprintf(stream, "%*sChunk %d...\n", indent, "", i); + HDfprintf(stream, "%*sChunk %d...\n", indent, "", i); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "Address:", oh->chunk[i].addr); /* Decrement chunk 0's size by the object header prefix size */ - if(0 == i) { + if(0 == i) { if(H5F_addr_ne(oh->chunk[i].addr, addr)) HDfprintf(stream, "*** WRONG ADDRESS FOR CHUNK #0!\n"); chunk_size = oh->chunk[i].size - (size_t)H5O_SIZEOF_HDR(oh); @@ -401,54 +397,53 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int chunk_size = oh->chunk[i].size; /* Accumulate chunk's size to total */ - chunk_total += chunk_size; - gap_total += oh->chunk[i].gap; + chunk_total += chunk_size; + gap_total += oh->chunk[i].gap; - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), "Size in bytes:", chunk_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), "Gap:", oh->chunk[i].gap); } /* end for */ /* debug each message */ if(NULL == (sequence = (unsigned *)H5MM_calloc(NELMTS(H5O_msg_class_g) * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") for(i = 0, mesg_total = 0; i < oh->nmesgs; i++) { const H5O_msg_class_t *debug_type; /* Type of message to use for callbacks */ unsigned chunkno; /* Chunk for message */ /* Accumulate message's size to total */ - mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size; + mesg_total += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + oh->mesg[i].raw_size; - /* For version 2 object header, add size of "OCHK" for continuation chunk */ - if (oh->mesg[i].type->id == H5O_CONT_ID) - mesg_total += H5O_SIZEOF_CHKHDR_OH(oh); + /* For version 2 object header, add size of "OCHK" for continuation chunk */ + if(oh->mesg[i].type->id == H5O_CONT_ID) + mesg_total += H5O_SIZEOF_CHKHDR_OH(oh); - HDfprintf(stream, "%*sMessage %d...\n", indent, "", i); + HDfprintf(stream, "%*sMessage %d...\n", indent, "", i); - /* check for bad message id */ - if(oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) { - HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n", - oh->mesg[i].type->id); - continue; - } /* end if */ + /* check for bad message id */ + if(oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) { + HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n", oh->mesg[i].type->id); + continue; + } /* end if */ - /* message name and size */ - HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n", + /* message name and size */ + HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n", indent + 3, "", MAX(0, fwidth - 3), "Message ID (sequence number):", (unsigned) (oh->mesg[i].type->id), oh->mesg[i].type->name, sequence[oh->mesg[i].type->id]++); - HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3), "Dirty:", oh->mesg[i].dirty); HDfprintf(stream, "%*s%-*s ", indent + 3, "", MAX (0, fwidth - 3), "Message flags:"); - if(oh->mesg[i].flags) { + if(oh->mesg[i].flags) { hbool_t flag_printed = FALSE; /* Sanity check that all flags in format are covered below */ @@ -497,39 +492,40 @@ H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int } /* end if */ else HDfprintf(stream, "\n"); - HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3), + + HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3), "Chunk number:", oh->mesg[i].chunkno); - chunkno = oh->mesg[i].chunkno; - if(chunkno >= oh->nchunks) - HDfprintf(stream, "*** BAD CHUNK NUMBER\n"); - HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3), + chunkno = oh->mesg[i].chunkno; + if(chunkno >= oh->nchunks) + HDfprintf(stream, "*** BAD CHUNK NUMBER\n"); + HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3), "Raw message data (offset, size) in chunk:", (size_t)(oh->mesg[i].raw - oh->chunk[chunkno].image), oh->mesg[i].raw_size); - /* check the size */ - if((oh->mesg[i].raw + oh->mesg[i].raw_size > + /* check the size */ + if((oh->mesg[i].raw + oh->mesg[i].raw_size > oh->chunk[chunkno].image + oh->chunk[chunkno].size) || (oh->mesg[i].raw < oh->chunk[chunkno].image)) - HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n"); + HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n"); - /* decode the message */ - debug_type = oh->mesg[i].type; - if(NULL == oh->mesg[i].native && debug_type->decode) + /* decode the message */ + debug_type = oh->mesg[i].type; + if(NULL == oh->mesg[i].native && debug_type->decode) H5O_LOAD_NATIVE(f, H5O_DECODEIO_NOCHANGE, oh, &oh->mesg[i], FAIL) - /* print the message */ - HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), + /* print the message */ + HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Message Information:"); - if(debug_type->debug && oh->mesg[i].native != NULL) - (debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6)); - else - HDfprintf(stream, "%*s\n", indent + 6, ""); + if(debug_type->debug && oh->mesg[i].native != NULL) + (debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6)); + else + HDfprintf(stream, "%*s\n", indent + 6, ""); } /* end for */ if((mesg_total + gap_total) != chunk_total) - HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); + HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); done: /* Release resources */ @@ -537,7 +533,7 @@ done: sequence = (unsigned *)H5MM_xfree(sequence); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_debug_real() */ +} /* end H5O__debug_real() */ /*------------------------------------------------------------------------- @@ -575,14 +571,15 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) loc.holding_file = FALSE; if(NULL == (oh = H5O_protect(&loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* debug */ - H5O_debug_real(f, oh, addr, stream, indent, fwidth); + if(H5O__debug_real(f, oh, addr, stream, indent, fwidth) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "debug dump call failed") done: if(oh && H5O_unprotect(&loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_debug() */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index c73529e..3441d8b 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -98,11 +98,11 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") /* Retrieve the object's information */ if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: FUNC_LEAVE_API(ret_value) @@ -131,12 +131,14 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") if(!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") - /* Verify access property list and set up collective metadata if appropriate */ + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") @@ -169,8 +171,6 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5G_loc_t loc; /* Location of group */ H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ @@ -243,12 +243,15 @@ herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data); /* Check args */ + if(H5G_loc(obj_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -256,8 +259,8 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + /* Visit the objects */ + if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: @@ -301,15 +304,20 @@ herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { - herr_t ret_value; /* Return value */ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data, lapl_id); /* Check args */ - if(!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL") + if(!*obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -321,8 +329,8 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal object visitation routine */ - if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + /* Visit the objects */ + if((ret_value = H5O__visit(&loc, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: diff --git a/src/H5Odtype.c b/src/H5Odtype.c index b8eb4a7..28970d1 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -15,13 +15,13 @@ #define H5T_FRIEND /*prevent warning from including H5Tpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Gprivate.h" /* Groups */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Gprivate.h" /* Groups */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5Tpkg.h" /* Datatypes */ #include "H5VMprivate.h" /* Vectors and arrays */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 8a6004d..c131c76 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -754,8 +754,8 @@ H5O_fill_reset_dyn(H5O_fill_t *fill) } /* end if */ fill->size = 0; if(fill->type) { - (void)H5T_close_real(fill->type); - fill->type = NULL; + (void)H5T_close_real(fill->type); + fill->type = NULL; } /* end if */ done: @@ -1008,7 +1008,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed) * Can we convert between source and destination data types? */ if(NULL == (tpath = H5T_path_find(fill->type, dset_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes") /* Don't bother doing anything if there will be no actual conversion */ if(!H5T_path_noop(tpath)) { diff --git a/src/H5Oflush.c b/src/H5Oflush.c index d8c9530..2302d4c 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -41,11 +41,9 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Objects */ - /********************/ /* Local Prototypes */ /********************/ -static herr_t H5O__flush(hid_t obj_id); static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag); static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc); @@ -58,11 +56,11 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, /*------------------------------------------------------------------------- - * Function: H5Oflush + * Function: H5Oflush * - * Purpose: Flushes all buffers associated with an object to disk. + * Purpose: Flushes all buffers associated with an object to disk. * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * * Programmer: Mike McGreevy * May 19, 2010 @@ -72,17 +70,22 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, herr_t H5Oflush(hid_t obj_id) { - herr_t ret_value = SUCCEED; /* Return value */ + H5O_loc_t *oloc; /* Object location */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", obj_id); + /* Check args */ + if(NULL == (oloc = H5O_get_loc(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Set up collective metadata if appropriate */ if(H5CX_set_loc(obj_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal routine */ - if(H5O__flush(obj_id) < 0) + /* Flush the object */ + if(H5O_flush(oloc, obj_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") done: @@ -91,88 +94,83 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_flush_common + * Function: H5O_flush * - * Purpose: Flushes the object's metadata - * Invokes the user-defined callback if there is one. + * Purpose: Internal routine to flush an object * - * Return: Non-negative on success, negative on failure + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi; Dec 2013 + * Programmer: Quincey Koziol + * December 29, 2017 * *------------------------------------------------------------------------- */ herr_t -H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id) +H5O_flush(H5O_loc_t *oloc, hid_t obj_id) { - haddr_t tag = 0; - herr_t ret_value = SUCCEED; /* Return value */ + void *obj_ptr; /* Pointer to object */ + const H5O_obj_class_t *obj_class; /* Class of object */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Retrieve tag for object */ - if(H5O__oh_tag(oloc, &tag) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object metadata") + /* Get the object pointer */ + if(NULL == (obj_ptr = H5I_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Flush metadata based on tag value of the object */ - if(H5F_flush_tagged_metadata(oloc->file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + /* Get the object class */ + if(NULL == (obj_class = H5O__obj_class(oloc))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class") - /* Check to invoke callback */ - if(H5F_object_flush_cb(oloc->file, obj_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback") + /* Flush the object of this class */ + if(obj_class->flush && obj_class->flush(obj_ptr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") + + /* Flush the object metadata and invoke flush callback */ + if(H5O_flush_common(oloc, obj_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_flush_common() */ +} /* end H5O_flush() */ /*------------------------------------------------------------------------- - * Function: H5O__flush + * Function: H5O_flush_common * - * Purpose: Internal routine to flush an object + * Purpose: Flushes the object's metadata + * Invokes the user-defined callback if there is one. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * December 29, 2017 + * Programmer: Vailin Choi; Dec 2013 * *------------------------------------------------------------------------- */ -static herr_t -H5O__flush(hid_t obj_id) +herr_t +H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id) { - H5O_loc_t *oloc; /* Object location */ - void *obj_ptr; /* Pointer to object */ - const H5O_obj_class_t *obj_class; /* Class of object */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check args */ - if(NULL == (oloc = H5O_get_loc(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") + haddr_t tag = 0; + herr_t ret_value = SUCCEED; /* Return value */ - /* Get the object pointer */ - if(NULL == (obj_ptr = H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + FUNC_ENTER_NOAPI(FAIL) - /* Get the object class */ - if(NULL == (obj_class = H5O__obj_class(oloc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class") + /* Retrieve tag for object */ + if(H5O__oh_tag(oloc, &tag) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object metadata") - /* Flush the object of this class */ - if(obj_class->flush && obj_class->flush(obj_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") + /* Flush metadata based on tag value of the object */ + if(H5F_flush_tagged_metadata(oloc->file, tag) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") - /* Flush the object metadata and invoke flush callback */ - if(H5O_flush_common(oloc, obj_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback") + /* Check to invoke callback */ + if(H5F_object_flush_cb(oloc->file, obj_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__flush() */ +} /* end H5O_flush_common() */ /*------------------------------------------------------------------------- @@ -219,9 +217,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Orefresh * - * Purpose: Refreshes all buffers associated with an object. + * Purpose: Refreshes all buffers associated with an object. * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * * Programmer: Mike McGreevy * July 28, 2010 @@ -239,13 +237,13 @@ H5Orefresh(hid_t oid) /* Check args */ if(NULL == (oloc = H5O_get_loc(oid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(oid) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Call internal routine */ + /* Refresh the object */ if(H5O_refresh_metadata(oid, *oloc) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") @@ -354,8 +352,8 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) /* Get object's type */ if(H5I_get_type(oid) == H5I_DATASET) - if(H5D_mult_refresh_close(oid) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") + if(H5D_mult_refresh_close(oid) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") /* Retrieve tag for object */ if(H5O__oh_tag(&oloc, &tag) < 0) @@ -379,8 +377,8 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) /* Re-cork object with tag */ if(corked) - if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object") + if(H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object") done: FUNC_LEAVE_NOAPI(ret_value); @@ -404,12 +402,15 @@ done: herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) { - void *object = NULL; /* Dataset for this operation */ + void *object = NULL; /* Object for this operation */ H5I_type_t type; /* Type of object for the ID */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ + HDassert(obj_loc); + /* Get object's type */ type = H5I_get_type(oid); @@ -455,7 +456,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) /* Re-register ID for the object */ if((H5I_register_with_id(type, object, TRUE, oid)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object atom") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh") done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index b75a9c5..4b34a52 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -113,7 +113,7 @@ H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Allocate space for message */ if(NULL == (ginfo = H5FL_CALLOC(H5O_ginfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Get the flags for the group */ flags = *p++; @@ -231,7 +231,7 @@ H5O_ginfo_copy(const void *_mesg, void *_dest) /* check args */ HDassert(ginfo); if(!dest && NULL == (dest = H5FL_MALLOC(H5O_ginfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* copy */ *dest = *ginfo; diff --git a/src/H5Oint.c b/src/H5Oint.c index 49d7835..44809e1 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -42,7 +42,6 @@ #include "H5MMprivate.h" /* Memory management */ #endif /* H5O_ENABLE_BOGUS */ #include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared object header messages */ /****************/ @@ -514,12 +513,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_open_name + * Function: H5O_open_name * - * Purpose: Opens an object within an HDF5 file. + * Purpose: Opens an object within an HDF5 file. * - * Return: Success: An open object identifier - * Failure: Negative + * Return: Success: Open object identifier + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * March 5 2007 @@ -552,7 +551,7 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref) loc_found = TRUE; /* Open the object */ - if((ret_value = H5O__open_by_loc(&obj_loc, app_ref)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, app_ref)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: @@ -565,12 +564,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__open_by_idx + * Function: H5O_open_by_idx * * Purpose: Internal routine to open an object by index within group * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Open object identifier + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * December 28, 2017 @@ -578,7 +577,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n) { H5G_loc_t obj_loc; /* Location used to open group */ @@ -587,7 +586,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check arguments */ HDassert(loc); @@ -603,7 +602,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, loc_found = TRUE; /* Open the object */ - if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: @@ -613,16 +612,16 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__open_by_idx() */ +} /* end H5O_open_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5O__open_by_addr + * Function: H5O_open_by_addr * * Purpose: Internal routine to open an object by its address * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Open object identifier + * Failure: H5I_INVALID_HID * * Programmer: Quincey Koziol * December 28, 2017 @@ -630,14 +629,14 @@ done: *------------------------------------------------------------------------- */ hid_t -H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) +H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check arguments */ HDassert(loc); @@ -651,21 +650,21 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */ /* Open the object */ - if((ret_value = H5O__open_by_loc(&obj_loc, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__open_by_addr() */ +} /* end H5O_open_by_addr() */ /*------------------------------------------------------------------------- - * Function: H5O__open_by_loc + * Function: H5O_open_by_loc * - * Purpose: Opens an object and returns an ID given its group loction. + * Purpose: Opens an object and returns an ID given its group loction. * - * Return: Success: Open object identifier - * Failure: Negative + * Return: Success: Open object identifier + * Failure: H5I_INVALID_HID * * Programmer: James Laird * July 25 2006 @@ -673,12 +672,12 @@ done: *------------------------------------------------------------------------- */ hid_t -H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref) +H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref) { const H5O_obj_class_t *obj_class; /* Class of object for location */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(H5I_INVALID_HID) HDassert(obj_loc); @@ -693,7 +692,7 @@ H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__open_by_loc() */ +} /* end H5O_open_by_loc() */ /*------------------------------------------------------------------------- @@ -735,10 +734,9 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) #ifdef H5O_DEBUG if(H5DEBUG(O)) { if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file)) - HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", - loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); - else - HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); + HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); + else + HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); } #endif @@ -761,14 +759,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__link_oh + * Function: H5O__link_oh * - * Purpose: Adjust the link count for an open object header by adding - * ADJUST to the link count. + * Purpose: Adjust the link count for an open object header by adding + * ADJUST to the link count. * - * Return: Success: New link count + * Return: Success: New link count * - * Failure: Negative + * Failure: -1 * * Programmer: Robb Matzke * matzke@llnl.gov @@ -794,14 +792,14 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if(adjust < 0) { /* Check for too large of an adjustment */ if((unsigned)(-adjust) > oh->nlink) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, (-1), "link count would be negative") /* Adjust the link count for the object header */ oh->nlink = (unsigned)((int)oh->nlink + adjust); /* Mark object header as dirty in cache */ if(H5AC_mark_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty") /* Check if the object should be deleted */ if(oh->nlink == 0) { @@ -809,7 +807,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if(H5FO_opened(f, addr) != NULL) { /* Flag the object to be deleted when it's closed */ if(H5FO_mark(f, addr, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion") } /* end if */ else { /* Mark the object header for deletion */ @@ -824,7 +822,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if(H5FO_marked(f, addr)) { /* Remove "delete me" flag on the object */ if(H5FO_mark(f, addr, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion") } /* end if */ } /* end if */ @@ -833,7 +831,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) /* Mark object header as dirty in cache */ if(H5AC_mark_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty") } /* end if */ /* Check for operations on refcount message */ @@ -843,7 +841,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) /* Check for removing refcount message */ if(oh->nlink <= 1) { if(H5O__msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete refcount message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "unable to delete refcount message") oh->has_refcount_msg = FALSE; } /* end if */ /* Update refcount message with new link count */ @@ -851,7 +849,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) H5O_refcount_t refcount = oh->nlink; if(H5O__msg_write_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update refcount message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, (-1), "unable to update refcount message") } /* end else */ } /* end if */ else { @@ -860,7 +858,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) H5O_refcount_t refcount = oh->nlink; if(H5O__msg_append_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to create new refcount message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, (-1), "unable to create new refcount message") oh->has_refcount_msg = TRUE; } /* end if */ } /* end else */ @@ -1061,7 +1059,7 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) } /* end if */ #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ /* Pin the other chunks also when requested, so that the object header @@ -1325,8 +1323,9 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) chk_dirtied = TRUE; } /* end if */ else { - /* XXX: For now, update access time & change fields in the object header */ - /* (will need to add some code to update modification time appropriately) */ + /* XXX: For now, update access time & change fields in the object header + * (will need to add some code to update modification time appropriately) + */ oh->atime = oh->ctime = now; /* Mark object header as dirty in cache */ @@ -1426,25 +1425,25 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) H5O_bogus_t *bogus; /* Pointer to the bogus information */ /* Allocate the native message in memory */ - if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message") + if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t)))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message") /* Update the native value */ bogus->u = H5O_BOGUS_VALUE; - if(bogus_id == H5O_BOGUS_VALID_ID) - type = H5O_MSG_BOGUS_VALID; - else if(bogus_id == H5O_BOGUS_INVALID_ID) - type = H5O_MSG_BOGUS_INVALID; - else - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message") + if(bogus_id == H5O_BOGUS_VALID_ID) + type = H5O_MSG_BOGUS_VALID; + else if(bogus_id == H5O_BOGUS_INVALID_ID) + type = H5O_MSG_BOGUS_INVALID; + else + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message") /* Allocate space in the object header for bogus message */ - if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") + if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") /* Point to "bogus" information (take it over) */ - oh->mesg[idx].native = bogus; + oh->mesg[idx].native = bogus; /* Set the appropriate flags for the message */ oh->mesg[idx].flags = mesg_flags; @@ -1634,23 +1633,23 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) /* Set type to "unknown" */ *obj_type = H5O_TYPE_UNKNOWN; - } /* end if */ + } else { /* Set object type */ *obj_type = obj_class->type; - } /* end else */ + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__obj_type_real() */ /*------------------------------------------------------------------------- - * Function: H5O__obj_class + * Function: H5O__obj_class * - * Purpose: Returns the class of object pointed to by `loc'. + * Purpose: Returns the class of object pointed to by 'loc'. * - * Return: Success: An object class - * Failure: NULL + * Return: Success: An object class + * Failure: NULL * * Programmer: Quincey Koziol * Monday, November 6, 2006 @@ -1663,7 +1662,7 @@ H5O__obj_class(const H5O_loc_t *loc) H5O_t *oh = NULL; /* Object header for location */ const H5O_obj_class_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_STATIC_TAG(loc->addr) + FUNC_ENTER_PACKAGE_TAG(loc->addr) /* Load the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) @@ -1675,7 +1674,7 @@ H5O__obj_class(const H5O_loc_t *loc) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__obj_class() */ @@ -1714,7 +1713,7 @@ H5O__obj_class_real(const H5O_t *oh) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") else if(isa) HGOTO_DONE(H5O_obj_class_g[i - 1]) - } /* end for */ + } if(0 == i) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") @@ -2164,7 +2163,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) /* Retrieve # of attributes */ if(fields & H5O_INFO_NUM_ATTRS) - if(H5O_attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0) + if(H5O__attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Get B-tree & heap metadata storage size, if requested */ @@ -2580,7 +2579,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__visit + * Function: H5O__visit * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -2601,12 +2600,12 @@ done: * Note: Add a parameter "fields" to indicate selection of object info. * * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * library, or the negative value returned by one + * of the operators. * * Programmer: Quincey Koziol * November 24 2007 @@ -2614,17 +2613,16 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, +H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { H5O_iter_visit_ud_t udata; /* User data for callback */ - H5G_loc_t loc; /* Location of reference object */ H5G_loc_t obj_loc; /* Location used to open object */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ H5O_info_t oinfo; /* Object info struct */ - hid_t obj_id = (-1); /* ID of object */ + hid_t obj_id = H5I_INVALID_HID; /* ID of object */ herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -2633,8 +2631,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HDmemset(&udata, 0, sizeof(udata)); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HDassert(loc); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2642,7 +2639,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/) < 0) + if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; @@ -2652,7 +2649,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Open the object */ /* (Takes ownership of the obj_loc information) */ - if((obj_id = H5O__open_by_loc(&obj_loc, TRUE)) < 0) + if((obj_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Make callback for starting object */ @@ -2698,20 +2695,21 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Add to list of visited objects */ if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list") - } /* end if */ + } /* Call internal group visitation routine */ - if((ret_value = H5G_visit(obj_id, ".", idx_type, order, H5O__visit_cb, &udata)) < 0) + if((ret_value = H5G_visit(&start_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") } /* end if */ done: - if(obj_id > 0) { + if(obj_id != H5I_INVALID_HID) { if(H5I_dec_app_ref(obj_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") - } /* end if */ + } else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + if(udata.visited) H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL); diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 4903d9f..9827b6a 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -44,13 +44,13 @@ static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void static herr_t H5O__linfo_free(void *_mesg); static herr_t H5O__linfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static void *H5O__linfo_copy_file(H5F_t *file_src, void *native_src, - H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, - H5O_copy_t *cpy_info, void *udata); + H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, + H5O_copy_t *cpy_info, void *udata); static herr_t H5O__linfo_post_copy_file(const H5O_loc_t *parent_src_oloc, - const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst, - unsigned *mesg_flags, H5O_copy_t *cpy_info); -static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg, - FILE * stream, int indent, int fwidth); + const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst, + unsigned *mesg_flags, H5O_copy_t *cpy_info); +static herr_t H5O__linfo_debug(H5F_t *f, const void *_mesg, FILE * stream, + int indent, int fwidth); /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_LINFO[1] = {{ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index e156dcd..d6e3dce 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -127,11 +127,11 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Go append message to object header */ if(H5O_msg_append_oh(loc->file, oh, type_id, mesg_flags, update_flags, mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header") done: if(oh && H5O_unpin(oh) < 0) @@ -225,7 +225,7 @@ H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, if(H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message") #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ done: @@ -276,7 +276,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Call the "real" modify routine */ if(H5O__msg_write_real(loc->file, oh, type, mesg_flags, update_flags, mesg) < 0) @@ -384,7 +384,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, /* Check for modifying a constant message */ if(!(update_flags & H5O_UPDATE_FORCE) && (idx_msg->flags & H5O_MSG_FLAG_CONSTANT)) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message") /* This message is shared, but it's being modified. */ else if((idx_msg->flags & H5O_MSG_FLAG_SHARED) || (idx_msg->flags & H5O_MSG_FLAG_SHAREABLE)) { htri_t status; /* Status of "try share" call */ @@ -427,7 +427,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, if(H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message") #ifdef H5O_DEBUG -H5O_assert(oh); +H5O__assert(oh); #endif /* H5O_DEBUG */ done: @@ -474,15 +474,15 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg) /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header") /* Call the "real" read routine */ if(NULL == (ret_value = H5O_msg_read_oh(loc->file, oh, type_id, mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message") + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message") done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_msg_read() */ @@ -616,12 +616,12 @@ H5O__msg_reset_real(const H5O_msg_class_t *type, void *native) HDassert(type); if(native) { - if(type->reset) { - if((type->reset)(native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed") - } /* end if */ + if(type->reset) { + if((type->reset)(native) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed") + } /* end if */ else - HDmemset(native, 0, type->native_size); + HDmemset(native, 0, type->native_size); } /* end if */ done: @@ -658,7 +658,7 @@ H5O_msg_free(unsigned type_id, void *mesg) HDassert(type); /* Call the "real" free routine */ - ret_value = H5O__msg_free_real(type, mesg); + ret_value = H5O_msg_free_real(type, mesg); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_free() */ @@ -667,7 +667,7 @@ H5O_msg_free(unsigned type_id, void *mesg) /*------------------------------------------------------------------------- * Function: H5O__msg_free_mesg * - * Purpose: Call H5O__msg_free_real() on a message. + * Purpose: Call H5O_msg_free_real() on a message. * * Return: Non-negative on success/Negative on failure * @@ -685,14 +685,14 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg) HDassert(mesg); /* Free any native information */ - mesg->native = H5O__msg_free_real(mesg->type, mesg->native); + mesg->native = H5O_msg_free_real(mesg->type, mesg->native); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__msg_free_mesg() */ /*------------------------------------------------------------------------- - * Function: H5O__msg_free_real + * Function: H5O_msg_free_real * * Purpose: Similar to H5O_msg_reset() except it also frees the message * pointer. @@ -706,9 +706,9 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg) *------------------------------------------------------------------------- */ void * -H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native) +H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) { - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ HDassert(type); @@ -722,7 +722,7 @@ H5O__msg_free_real(const H5O_msg_class_t *type, void *msg_native) } /* end if */ FUNC_LEAVE_NOAPI(NULL) -} /* end H5O__msg_free_real() */ +} /* end H5O_msg_free_real() */ /*------------------------------------------------------------------------- @@ -798,22 +798,22 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id) /* Load the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") /* Count the messages of the correct type */ - msg_count = H5O_msg_count_real(oh, type); + msg_count = H5O__msg_count_real(oh, type); H5_CHECKED_ASSIGN(ret_value, int, msg_count, unsigned); done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_count() */ /*------------------------------------------------------------------------- - * Function: H5O_msg_count_real + * Function: H5O__msg_count_real * * Purpose: Counts the number of messages in an object header which are a * certain type. @@ -828,12 +828,12 @@ done: *------------------------------------------------------------------------- */ unsigned -H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) +H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) { unsigned u; /* Local index variable */ unsigned ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(oh); @@ -841,11 +841,11 @@ H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) /* Loop over all messages, counting the ones of the type looked for */ for(u = ret_value = 0; u < oh->nmesgs; u++) - if(oh->mesg[u].type == type) + if(oh->mesg[u].type == type) ret_value++; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_count_real() */ +} /* end H5O__msg_count_real() */ /*------------------------------------------------------------------------- @@ -976,11 +976,11 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Call the "real" remove routine */ if((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") done: if(oh && H5O_unpin(oh) < 0) @@ -1028,11 +1028,11 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, /* Pin the object header */ if(NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Call the "real" remove routine */ if((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") done: if(oh && H5O_unpin(oh) < 0) @@ -1090,7 +1090,7 @@ H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, * (OK to remove constant messages - QAK) */ /* Convert message into a null message */ - if(H5O_release_mesg(udata->f, oh, mesg, udata->adj_link) < 0) + if(H5O__release_mesg(udata->f, oh, mesg, udata->adj_link) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release message") /* Indicate that the object header was modified */ @@ -1315,8 +1315,8 @@ done: * message removal) */ if(oh_modified & H5O_MODIFY_CONDENSE) - if(H5O_condense_header(f, oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header") + if(H5O__condense_header(f, oh) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header") /* Mark object header as changed */ if(H5O_touch_oh(f, oh, FALSE) < 0) @@ -1973,7 +1973,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, /* Protect chunk */ if(NULL == (chk_proxy = H5O__chunk_protect(f, oh, idx_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") /* Reset existing native information for the header's message */ H5O__msg_reset_real(type, idx_msg->native); @@ -1991,7 +1991,7 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, /* Release chunk */ if(H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") chk_proxy = NULL; /* Update the modification time, if requested */ @@ -2197,7 +2197,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_flush_msgs + * Function: H5O__flush_msgs * * Purpose: Flushes messages for object header. * @@ -2210,13 +2210,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_flush_msgs(H5F_t *f, H5O_t *oh) +H5O__flush_msgs(H5F_t *f, H5O_t *oh) { H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -2240,7 +2240,7 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_flush_msgs() */ +} /* end H5O__flush_msgs() */ /*------------------------------------------------------------------------- diff --git a/src/H5Omtime.c b/src/H5Omtime.c index db1d8d7..172f9ab 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -442,8 +442,6 @@ H5O__mtime_free(void *mesg) * matzke@llnl.gov * Jul 24 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -454,7 +452,7 @@ H5O__mtime_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, struct tm *tm; char buf[128]; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 059b46a..ea654d2 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -63,7 +63,7 @@ ) #define H5O_ALIGN_OH(O, X) \ H5O_ALIGN_VERS((O)->version, X) -#define H5O_ALIGN_F(F, X) \ +#define H5O_ALIGN_F(F, X) \ H5O_ALIGN_VERS(MAX(H5O_VERSION_1, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), X) /* Size of checksum (on disk) */ @@ -555,15 +555,11 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1]; H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; /* Package-local function prototypes */ -H5_DLL hid_t H5O__open_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n); -H5_DLL hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr); -H5_DLL hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref); H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc); H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted); H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields); -H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, +H5_DLL herr_t H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields); H5_DLL herr_t H5O__inc_rc(H5O_t *oh); H5_DLL herr_t H5O__dec_rc(H5O_t *oh); @@ -576,9 +572,8 @@ H5_DLL herr_t H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *t unsigned mesg_flags, unsigned update_flags, void *mesg); H5_DLL herr_t H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags, void *mesg); -H5_DLL void *H5O__msg_free_real(const H5O_msg_class_t *type, void *mesg); H5_DLL herr_t H5O__msg_free_mesg(H5O_mesg_t *mesg); -H5_DLL unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type); +H5_DLL unsigned H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type); H5_DLL herr_t H5O__msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link); H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, @@ -586,17 +581,15 @@ H5_DLL void *H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata); H5_DLL herr_t H5O__msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const H5O_mesg_operator_t *op, void *op_data); -H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg); -H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh); +H5_DLL herr_t H5O__flush_msgs(H5F_t *f, H5O_t *oh); H5_DLL herr_t H5O__delete_mesg(H5F_t *f, H5O_t *open_oh, H5O_mesg_t *mesg); /* Object header chunk routines */ H5_DLL herr_t H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno); H5_DLL H5O_chunk_proxy_t *H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx); -H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, - hbool_t chk_dirtied); +H5_DLL herr_t H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t chk_dirtied); H5_DLL herr_t H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx); -H5_DLL herr_t H5O_chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy); +H5_DLL herr_t H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy); H5_DLL herr_t H5O__chunk_delete(H5F_t *f, H5O_t *oh, unsigned idx); H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy); @@ -604,20 +597,20 @@ H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy); H5_DLL herr_t H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info); /* Object header allocation routines */ -H5_DLL herr_t H5O_alloc_msgs(H5O_t *oh, size_t min_alloc); +H5_DLL herr_t H5O__alloc_msgs(H5O_t *oh, size_t min_alloc); H5_DLL herr_t H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_msg_alloc_info_t *found_msg, size_t *new_idx); H5_DLL herr_t H5O__alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const void *mesg, size_t *mesg_idx); -H5_DLL herr_t H5O_condense_header(H5F_t *f, H5O_t *oh); -H5_DLL herr_t H5O_release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, +H5_DLL herr_t H5O__condense_header(H5F_t *f, H5O_t *oh); +H5_DLL herr_t H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link); /* Shared object operators */ -H5_DLL void * H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, +H5_DLL void * H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type); -H5_DLL herr_t H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg); -H5_DLL size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg); +H5_DLL herr_t H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg); +H5_DLL size_t H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg); H5_DLL herr_t H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *mesg_type, H5O_shared_t *sh_mesg); H5_DLL herr_t H5O__shared_link(H5F_t *f, H5O_t *open_oh, @@ -629,17 +622,18 @@ H5_DLL herr_t H5O__shared_copy_file(H5F_t *file_src, H5F_t *file_dst, H5_DLL herr_t H5O__shared_post_copy_file (H5F_t *f, const H5O_msg_class_t *mesg_type, const H5O_shared_t *shared_src, H5O_shared_t *shared_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info); -H5_DLL herr_t H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, +H5_DLL herr_t H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth); /* Attribute message operators */ H5_DLL herr_t H5O__attr_reset(void *_mesg); H5_DLL herr_t H5O__attr_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); H5_DLL herr_t H5O__attr_link(H5F_t *f, H5O_t *open_oh, void *_mesg); -H5_DLL herr_t H5O_attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs); +H5_DLL herr_t H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs); /* Arrays of versions for: - Object header, Attribute/Fill value/Filter pipeline messages */ + * Object header, Attribute/Fill value/Filter pipeline messages + */ /* Layout/Datatype/Dataspace arrays of versions are in H5Dpkg.h, H5Tpkg.h and H5Spkg.h */ H5_DLLVAR const unsigned H5O_obj_ver_bounds[H5F_LIBVER_NBOUNDS]; H5_DLLVAR const unsigned H5O_attr_ver_bounds[H5F_LIBVER_NBOUNDS]; @@ -661,10 +655,9 @@ H5_DLL herr_t H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type); /* Object header debugging routines */ #ifdef H5O_DEBUG -H5_DLL herr_t H5O_assert(const H5O_t *oh); +H5_DLL herr_t H5O__assert(const H5O_t *oh); #endif /* H5O_DEBUG */ -H5_DLL herr_t H5O_debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, - int indent, int fwidth); +H5_DLL herr_t H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int fwidth); #endif /* _H5Opkg_H */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 10063d5..4a401b5 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -866,10 +866,13 @@ H5_DLL herr_t H5O_init(void); H5_DLL herr_t H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id, H5O_loc_t *loc/*out*/); H5_DLL herr_t H5O_open(H5O_loc_t *loc); +H5_DLL hid_t H5O_open_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n); +H5_DLL hid_t H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr); +H5_DLL hid_t H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref); H5_DLL herr_t H5O_close(H5O_loc_t *loc, hbool_t *file_closed/*out*/); H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust); -H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, - hbool_t pin_all_chunks); +H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks); H5_DLL H5O_t *H5O_pin(const H5O_loc_t *loc); H5_DLL herr_t H5O_unpin(H5O_t *oh); H5_DLL herr_t H5O_dec_rc_by_loc(const H5O_loc_t *loc); @@ -900,10 +903,12 @@ H5_DLL herr_t H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, unsigned update_flags, void *mesg); H5_DLL herr_t H5O_msg_write_oh(H5F_t *f, H5O_t *oh, unsigned type_id, unsigned mesg_flags, unsigned update_flags, void *mesg); +H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg); H5_DLL void *H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg); H5_DLL void *H5O_msg_read_oh(H5F_t *f, H5O_t *oh, unsigned type_id, void *mesg); H5_DLL herr_t H5O_msg_reset(unsigned type_id, void *native); H5_DLL void *H5O_msg_free(unsigned type_id, void *mesg); +H5_DLL void *H5O_msg_free_real(const H5O_msg_class_t *type, void *mesg); H5_DLL void *H5O_msg_copy(unsigned type_id, const void *mesg, void *dst); H5_DLL int H5O_msg_count(const H5O_loc_t *loc, unsigned type_id); H5_DLL htri_t H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id); @@ -937,6 +942,7 @@ H5_DLL herr_t H5O_msg_delete(H5F_t *f, H5O_t *open_oh, unsigned type_id, H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t *flags); /* Object metadata flush/refresh routines */ +H5_DLL herr_t H5O_flush(H5O_loc_t *oloc, hid_t obj_id); H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id); H5_DLL herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc); H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr); @@ -948,6 +954,8 @@ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, H5F_t *file_dst, void *_dst_ref, size_t ref_count, H5R_type_t ref_type, H5O_copy_t *cpy_info); +H5_DLL herr_t H5O_copy(const H5G_loc_t *src_loc, const char *src_name, + H5G_loc_t *dst_loc, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); /* Debugging routines */ H5_DLL herr_t H5O_debug_id(unsigned type_id, H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidth); diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 328ba4b..4fc0488 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -69,6 +69,10 @@ /********************/ /* Local Prototypes */ /********************/ +static void *H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, + const H5O_shared_t *shared, const H5O_msg_class_t *type); +static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, + const H5O_msg_class_t *type, H5O_shared_t *shared, int adjust); /*********************/ @@ -88,14 +92,14 @@ /*------------------------------------------------------------------------- - * Function: H5O_shared_read + * Function: H5O__shared_read * - * Purpose: Reads a message referred to by a shared message. + * Purpose: Reads a message referred to by a shared message. * - * Return: Success: Ptr to message in native format. The message - * should be freed by calling H5O_msg_reset(). + * Return: Success: Ptr to message in native format. The message + * should be freed by calling H5O_msg_reset(). * - * Failure: NULL + * Failure: NULL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -104,7 +108,7 @@ *------------------------------------------------------------------------- */ static void * -H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, +H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t *shared, const H5O_msg_class_t *type) { H5HF_t *fheap = NULL; @@ -112,7 +116,7 @@ H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, uint8_t mesg_buf[H5O_MESG_BUF_SIZE]; /* Buffer for deserializing messages */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -194,13 +198,13 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shared_read() */ +} /* end H5O__shared_read() */ /*------------------------------------------------------------------------- - * Function: H5O__shared_link_adj + * Function: H5O__shared_link_adj * - * Purpose: Changes the link count for the object referenced by a shared + * Purpose: Changes the link count for the object referenced by a shared * message. * * This function changes the object header link count and is @@ -209,8 +213,7 @@ done: * reference count is stored in the file-wide shared message * index and is changed in a different place in the code. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -294,11 +297,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_shared_decode + * Function: H5O__shared_decode * - * Purpose: Decodes a shared object message + * Purpose: Decodes a shared object message * - * Return: Non-negative on success/Negative on failure + * Return: Success: A buffer containing the decoded shared object + * Failure: NULL * * Programmer: Quincey Koziol * Monday, January 22, 2007 @@ -306,14 +310,14 @@ done: *------------------------------------------------------------------------- */ void * -H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, +H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf, const H5O_msg_class_t *type) { H5O_shared_t sh_mesg; /* Shared message info */ unsigned version; /* Shared message version */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check args */ HDassert(f); @@ -373,20 +377,20 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu sh_mesg.msg_type_id = type->id; /* Retrieve actual message, through decoded shared message info */ - if(NULL == (ret_value = H5O_shared_read(f, open_oh, ioflags, &sh_mesg, type))) + if(NULL == (ret_value = H5O__shared_read(f, open_oh, ioflags, &sh_mesg, type))) HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shared_decode() */ +} /* end H5O__shared_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_shared_encode + * Function: H5O__shared_encode * - * Purpose: Encodes message _MESG into buffer BUF. + * Purpose: Encodes message _MESG into buffer BUF. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * Thursday, April 2, 1998 @@ -394,11 +398,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg) +H5O__shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_mesg) { unsigned version; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(f); @@ -427,15 +431,15 @@ H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_me H5F_addr_encode(f, &buf, sh_mesg->u.loc.oh_addr); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_shared_encode() */ +} /* end H5O__shared_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_set_shared + * Function: H5O_set_shared * - * Purpose: Sets the shared component for a message. + * Purpose: Sets the shared component for a message. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -460,12 +464,12 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src) /*------------------------------------------------------------------------- - * Function: H5O_shared_size + * Function: H5O__shared_size * - * Purpose: Returns the length of a shared object message. + * Purpose: Returns the length of a shared object message. * - * Return: Success: Length - * Failure: 0 + * Return: Success: Length + * Failure: 0 * * Programmer: Robb Matzke * Thursday, April 2, 1998 @@ -473,26 +477,26 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src) *------------------------------------------------------------------------- */ size_t -H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) +H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR if(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED) { - ret_value = (size_t)1 + /*version */ - (size_t)1 + /*the type field */ - (size_t)H5F_SIZEOF_ADDR(f); /*sharing by another obj hdr */ + ret_value = (size_t)1 + /* Version */ + (size_t)1 + /* Type field */ + (size_t)H5F_SIZEOF_ADDR(f); /* Sharing by another obj hdr */ } /* end if */ else { HDassert(sh_mesg->type == H5O_SHARE_TYPE_SOHM); - ret_value = 1 + /*version */ - 1 + /*the type field */ - H5O_FHEAP_ID_LEN; /* Shared in the heap */ + ret_value = 1 + /* Version */ + 1 + /* Type field */ + H5O_FHEAP_ID_LEN; /* Shared in the heap */ } /* end else */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shared_size() */ +} /* end H5O__shared_size() */ /*------------------------------------------------------------------------- @@ -500,7 +504,7 @@ H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) * * Purpose: Free file space referenced by message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -521,7 +525,7 @@ H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, /* * Committed datatypes increment the OH of the original message when they - * are written (in H5O__shared_link) and decrement it here. + * are written (in H5O_shared_link) and decrement it here. * SOHMs in the heap behave differently; their refcount is incremented * during H5SM_share when they are going to be written (in H5O_msg_append * or H5O_msg_write). Their refcount in the SOHM indexes still needs to @@ -543,7 +547,7 @@ done: * Purpose: Increment reference count on any objects referenced by * message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -558,7 +562,7 @@ H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, FUNC_ENTER_PACKAGE - /* check args */ + /* Check args */ HDassert(f); HDassert(sh_mesg); @@ -576,8 +580,7 @@ done: * * Purpose: Copies a message from _MESG to _DEST in file * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * January 22, 2007 @@ -647,7 +650,7 @@ done: * to complish that is to delete the old message and write the * new message with the correct values. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Peter Cao * xcao@hdfgroup.org @@ -696,7 +699,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_shared_debug + * Function: H5O__shared_debug * * Purpose: Prints debugging info for the message * @@ -708,9 +711,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth) +H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(mesg); @@ -756,5 +759,5 @@ H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth) } /* end switch */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_shared_debug() */ +} /* end H5O__shared_debug() */ diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 2960fef..8040a6a 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -66,7 +66,7 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, /* Check for shared message */ if(mesg_flags & H5O_MSG_FLAG_SHARED) { /* Retrieve native message info indirectly through shared message */ - if(NULL == (ret_value = H5O_shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE))) + if(NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE))) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message") /* We currently do not support automatically fixing shared messages */ @@ -129,13 +129,13 @@ H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mes /* Check for message stored elsewhere */ if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) { /* Encode shared message into buffer */ - if(H5O_shared_encode(f, p, sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message") + if(H5O__shared_encode(f, p, sh_mesg) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message") } /* end if */ else { /* Encode native message directly */ if(H5O_SHARED_ENCODE_REAL(f, p, _mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message") } /* end else */ done: @@ -181,13 +181,13 @@ H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg) /* Check for message stored elsewhere */ if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) { /* Retrieve encoded size of shared message */ - if(0 == (ret_value = H5O_shared_size(f, sh_mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message") + if(0 == (ret_value = H5O__shared_size(f, sh_mesg))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message") } /* end if */ else { /* Retrieve size of native message directly */ if(0 == (ret_value = H5O_SHARED_SIZE_REAL(f, _mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message") } /* end else */ done: @@ -232,13 +232,13 @@ H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg) if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) { /* Decrement the reference count on the shared message/object */ if(H5O__shared_delete(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message") } /* end if */ #ifdef H5O_SHARED_DELETE_REAL else { /* Decrement the reference count on the native message directly */ if(H5O_SHARED_DELETE_REAL(f, open_oh, _mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message") } /* end else */ #endif /* H5O_SHARED_DELETE_REAL */ @@ -284,13 +284,13 @@ H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg) if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) { /* Increment the reference count on the shared message/object */ if(H5O__shared_link(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message") } /* end if */ #ifdef H5O_SHARED_LINK_REAL else { /* Increment the reference count on the native message directly */ if(H5O_SHARED_LINK_REAL(f, open_oh, _mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message") } /* end else */ #endif /* H5O_SHARED_LINK_REAL */ @@ -473,7 +473,7 @@ H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent, /* Check for message stored elsewhere */ if(H5O_IS_STORED_SHARED(sh_mesg->type)) { /* Print shared message information */ - if(H5O_shared_debug(sh_mesg, stream, indent, fwidth) < 0) + if(H5O__shared_debug(sh_mesg, stream, indent, fwidth) < 0) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info") } /* end if */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 87fb771..0f14a4b 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -37,9 +37,9 @@ /* PRIVATE PROTOTYPES */ static void *H5O__stab_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_stab_copy(const void *_mesg, void *_dest); -static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__stab_copy(const void *_mesg, void *_dest); +static size_t H5O__stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__stab_free(void *_mesg); static herr_t H5O__stab_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static void *H5O__stab_copy_file(H5F_t *file_src, void *native_src, @@ -58,9 +58,9 @@ const H5O_msg_class_t H5O_MSG_STAB[1] = {{ sizeof(H5O_stab_t), /*native message size */ 0, /* messages are sharable? */ H5O__stab_decode, /*decode message */ - H5O_stab_encode, /*encode message */ - H5O_stab_copy, /*copy the native value */ - H5O_stab_size, /*size of symbol table entry */ + H5O__stab_encode, /*encode message */ + H5O__stab_copy, /*copy the native value */ + H5O__stab_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__stab_free, /* free method */ H5O__stab_delete, /* file delete method */ @@ -111,7 +111,7 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* decode */ if(NULL == (stab = H5FL_CALLOC(H5O_stab_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") H5F_addr_decode(f, &p, &(stab->btree_addr)); H5F_addr_decode(f, &p, &(stab->heap_addr)); @@ -129,7 +129,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_stab_encode + * Function: H5O__stab_encode * * Purpose: Encodes a symbol table message. * @@ -142,11 +142,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -158,11 +158,11 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con H5F_addr_encode(f, &p, stab->heap_addr); FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5O__stab_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_stab_copy + * Function: H5O__stab_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -178,18 +178,18 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con *------------------------------------------------------------------------- */ static void * -H5O_stab_copy(const void *_mesg, void *_dest) +H5O__stab_copy(const void *_mesg, void *_dest) { const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; H5O_stab_t *dest = (H5O_stab_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(stab); if(!dest && NULL == (dest = H5FL_MALLOC(H5O_stab_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ *dest = *stab; @@ -199,11 +199,11 @@ H5O_stab_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_stab_copy() */ +} /* end H5O__stab_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_stab_size + * Function: H5O__stab_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -220,17 +220,17 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) +H5O__stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = (size_t)(2 * H5F_SIZEOF_ADDR(f)); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_stab_size() */ +} /* end H5O__stab_size() */ /*------------------------------------------------------------------------- @@ -327,14 +327,14 @@ H5O__stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, /* Get the old local heap's size and use that as the hint for the new heap */ if(H5HL_get_size(file_src, stab_src->heap_addr, &size_hint) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size") + HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size") /* Set copy metadata tag */ H5_BEGIN_TAG(H5AC__COPIED_TAG); /* Create components of symbol table message */ if(H5G__stab_create_components(file_dst, stab_dst, size_hint) < 0) - HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components") + HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components") /* Reset metadata tag */ H5_END_TAG diff --git a/src/H5Otest.c b/src/H5Otest.c index 7cb7b3d..df08ff7 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -127,7 +127,7 @@ H5O__is_attr_dense_test(hid_t oid) /* Check if dense storage is being used */ if(H5F_addr_defined(ainfo.fheap_addr)) { /* Check for any messages in object header */ - HDassert(H5O_msg_count_real(oh, H5O_MSG_ATTR) == 0); + HDassert(H5O__msg_count_real(oh, H5O_MSG_ATTR) == 0); ret_value = TRUE; } /* end if */ @@ -197,7 +197,7 @@ H5O__is_attr_empty_test(hid_t oid) } /* end if */ /* Retrieve the number of attribute messages in header */ - nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR); + nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR); /* Check for later version of object header format & attribute info available */ if(oh->version > H5O_VERSION_1) { @@ -299,7 +299,7 @@ H5O__num_attrs_test(hid_t oid, hsize_t *nattrs) } /* end if */ /* Retrieve the number of attribute messages in header */ - obj_nattrs = H5O_msg_count_real(oh, H5O_MSG_ATTR); + obj_nattrs = H5O__msg_count_real(oh, H5O_MSG_ATTR); /* Check for later version of object header format */ if(oh->version > H5O_VERSION_1) { diff --git a/src/H5Ounknown.c b/src/H5Ounknown.c index dbab28c..89c00ad 100644 --- a/src/H5Ounknown.c +++ b/src/H5Ounknown.c @@ -63,11 +63,11 @@ H5FL_DEFINE(H5O_unknown_t); /*------------------------------------------------------------------------- - * Function: H5O__unknown_free + * Function: H5O__unknown_free * - * Purpose: Frees the message + * Purpose: Frees the message * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Tuesday, May 1, 2007 diff --git a/tools/test/h5dump/errfiles/tattr-3.err b/tools/test/h5dump/errfiles/tattr-3.err index 3a34314..a6aae76 100644 --- a/tools/test/h5dump/errfiles/tattr-3.err +++ b/tools/test/h5dump/errfiles/tattr-3.err @@ -1,5 +1,5 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Aopen(): unable to load attribute info from object header for attribute: 'attr' + #000: (file name) line (number) in H5Aopen(): unable to open attribute: 'attr' major: Attribute minor: Can't open object #001: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' diff --git a/tools/test/h5dump/errfiles/tqmarkfile.err b/tools/test/h5dump/errfiles/tqmarkfile.err index 06519fb..2c4f1ff 100644 --- a/tools/test/h5dump/errfiles/tqmarkfile.err +++ b/tools/test/h5dump/errfiles/tqmarkfile.err @@ -8,7 +8,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist @@ -24,7 +24,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist diff --git a/tools/testfiles/tstarfile.ddl b/tools/testfiles/tstarfile.ddl index 77b80e0..87c3f87 100644 --- a/tools/testfiles/tstarfile.ddl +++ b/tools/testfiles/tstarfile.ddl @@ -64,7 +64,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5G_loc_find_cb(): object 'Dataset1' doesn't exist @@ -80,7 +80,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist -- cgit v0.12 From 8d7bdb704163327cacf8be3a4e03f02fb88a957b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Sep 2018 14:38:46 -0500 Subject: CMake changes for SKIPPED and flush tests --- CMakeLists.txt | 3 ++ release_docs/INSTALL_CMake.txt | 1 + test/CMakeLists.txt | 2 +- test/CMakeTests.cmake | 66 ++++++++++++++++++++++++++++------- tools/src/h5dump/h5dump.c | 2 +- tools/test/h5copy/CMakeTests.cmake | 3 +- tools/test/h5dump/CMakeTests.cmake | 3 +- tools/test/h5dump/CMakeTestsXML.cmake | 3 +- tools/test/h5import/CMakeTests.cmake | 3 +- tools/test/h5repack/CMakeTests.cmake | 24 ++++++++----- 10 files changed, 84 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f87568..53cddf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,9 @@ endif () # dependencies of the HDF5 libs may be 'incomplete', add additional # dependencies to this variable so that external projects pick them up # +#option (HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." "") +set (HDF5_EXTERNAL_LIB_PREFIX "" CACHE STRING "Use prefix for custom library naming.") +mark_as_advanced (HDF5_EXTERNAL_LIB_PREFIX) # HDF5_EXTERNAL_LIB_PREFIX : # If the parent project needs to install hdf libraries, but avoid # name conflicts with system versions, then a prefix may be added diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 1d6797c..2aa1f17 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -591,6 +591,7 @@ HDF5_BUILD_TOOLS "Build HDF5 Tools" ON ---------------- HDF5 Advanced Options --------------------- ALLOW_UNSUPPORTED "Allow unsupported combinations of configure options" OFF +HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." "" HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 517a620..c8119fe 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -224,7 +224,7 @@ set (H5_TESTS ntypes dangle dtransform - reserved + # reserved disabled cross_read freespace mf diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index cc6ebb8..8838c34 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -439,14 +439,6 @@ set (test_CLEANFILES tvlstr.h5 tvlstr2.h5 twriteorder.dat - flush.h5 - flush-swmr.h5 - noflush.h5 - noflush-swmr.h5 - flush_extend.h5 - flush_extend-swmr.h5 - noflush_extend.h5 - noflush_extend-swmr.h5 enum1.h5 titerate.h5 ttsafe.h5 @@ -551,6 +543,8 @@ set (H5TEST_SEPARATE_TESTS testhdf5 cache cache_image + flush1 + flush2 ) foreach (test ${H5_TESTS}) if (NOT ${test} IN_LIST H5TEST_SEPARATE_TESTS) @@ -587,7 +581,6 @@ foreach (test ${H5_TESTS}) endif () endforeach () -set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT 1800) @@ -630,7 +623,6 @@ if (BUILD_SHARED_LIBS) endif () endforeach () - set_tests_properties (H5TEST-shared-flush2 PROPERTIES DEPENDS H5TEST-shared-flush1) set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT 1800) @@ -720,6 +712,54 @@ if (BUILD_SHARED_LIBS) endif () endif () +#-- Adding test for flush1/2 +add_test (NAME H5TEST-clear-flush-objects + COMMAND ${CMAKE_COMMAND} + -E remove + flush.h5 + flush-swmr.h5 + noflush.h5 + noflush-swmr.h5 + flush_extend.h5 + flush_extend-swmr.h5 + noflush_extend.h5 + noflush_extend-swmr.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-flush1 COMMAND $) +else () + add_test (NAME H5TEST-flush1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=flush1.txt" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (H5TEST-flush1 PROPERTIES + DEPENDS H5TEST-clear-flush-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-flush2 COMMAND $) +else () + add_test (NAME H5TEST-flush2 COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=flush2.txt" + -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) + #-- Adding test for tcheck_version add_test (NAME H5TEST-tcheck_version-major COMMAND $ "-tM") set_tests_properties (H5TEST-tcheck_version-major PROPERTIES @@ -826,9 +866,10 @@ add_test (NAME H5TEST-clear-error_test-objects set_tests_properties (H5TEST-clear-error_test-objects PROPERTIES FIXTURES_SETUP error_test_clear_objects) if (HDF5_USE_16_API_DEFAULT) add_test ( - NAME H5TEST-error_test-SKIPPED + NAME H5TEST-error_test COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" ) + set_property(TEST H5TEST-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" @@ -925,9 +966,10 @@ if (BUILD_SHARED_LIBS) set_tests_properties (H5TEST-shared-clear-error_test-objects PROPERTIES FIXTURES_SETUP shared_error_test_clear_objects) if (HDF5_USE_16_API_DEFAULT) add_test ( - NAME H5TEST-shared-error_test-SKIPPED + NAME H5TEST-shared-error_test COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" ) + set_property(TEST H5TEST-shared-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index a5f0369..b9e37e8 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -65,7 +65,7 @@ struct handler_t { * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -/* The following initialization makes use of C language cancatenating */ +/* The following initialization makes use of C language concatenating */ /* "xxx" "yyy" into "xxxyyy". */ static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:"; static struct long_options l_opts[] = { diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 1bdefa6..924ade1 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -128,9 +128,10 @@ macro (ADD_SKIP_H5_TEST testname skipresultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5COPY-${testname}-${skipresultfile}-SKIPPED + NAME H5COPY-${testname}-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname}-${skipresultfile} ${ARGN}" ) + set_property(TEST H5COPY-${testname}-${skipresultfile} PROPERTY DISABLED) endif () endmacro () diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 24588e9..eedb432 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -441,9 +441,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP-${skipresultfile}-SKIPPED + NAME H5DUMP-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile} ${ARGN}" ) + set_property(TEST H5DUMP-${skipresultfile} PROPERTY DISABLED) endif () else () ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index 9c68e5f..de87d2f 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -164,9 +164,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5DUMP_XML-${skipresultfile}-SKIPPED + NAME H5DUMP_XML-${skipresultfile} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile}.xml --xml ${ARGN}" ) + set_property(TEST H5DUMP_XML-${skipresultfile} PROPERTY DISABLED) endif () else () ADD_XML_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 3c65b0b..7d76fba 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -283,9 +283,10 @@ macro (ADD_H5_SKIP_DUMPTEST testname datasetname testfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5IMPORT-DUMP-${testname}-SKIPPED + NAME H5IMPORT-DUMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${testname} ${datasetname} ${testfile} --- DEFLATE filter not available" ) + set_property(TEST H5IMPORT-DUMP-${testname} PROPERTY DISABLED) endif () endmacro () diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index f40c0b1..a063e19 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -229,9 +229,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_OLD-${testname}-SKIPPED + NAME H5REPACK_OLD-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) + set_property(TEST H5REPACK_OLD-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -260,9 +261,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK-${testname}-SKIPPED + NAME H5REPACK-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) + set_property(TEST H5REPACK-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -291,9 +293,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_CMP-${testname}-SKIPPED + NAME H5REPACK_CMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_CMP-${testname} PROPERTY DISABLED) endif () else () # If using memchecker add tests without using scripts @@ -338,9 +341,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_MASK-${testname}-SKIPPED + NAME H5REPACK_MASK-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_MASK-${testname} PROPERTY DISABLED) endif () else () # If using memchecker add tests without using scripts @@ -385,9 +389,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_DMP-${testname}-SKIPPED + NAME H5REPACK_DMP-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_DMP-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -427,9 +432,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_STAT-${testname}-SKIPPED + NAME H5REPACK_STAT-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile}" ) + set_property(TEST H5REPACK_STAT-${testname} PROPERTY DISABLED) endif () else () add_test ( @@ -469,9 +475,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_VERIFY_LAYOUT-${testname}-SKIPPED + NAME H5REPACK_VERIFY_LAYOUT-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_VERIFY_LAYOUT-${testname} PROPERTY DISABLED) endif () else () if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -542,9 +549,10 @@ if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-SKIPPED + NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" ) + set_property(TEST H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTY DISABLED) endif () else () if (NOT HDF5_ENABLE_USING_MEMCHECKER) -- cgit v0.12 From a8f46df2c29f73947d1ab342d53c5f1e42fbbefe Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Sep 2018 15:29:26 -0500 Subject: Remove libsettings from pregenerated block --- src/CMakeLists.txt | 67 ++++++++++++++++++++++-------------------------------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e90e580..7bf976d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -907,46 +907,33 @@ else () endif () endif () -if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) - add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) - target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) - TARGET_C_PROPERTIES (H5make_libsettings STATIC) - target_link_libraries (H5make_libsettings - PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> - INTERFACE $<$:"-O0"> - ) - - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - if (BUILD_SHARED_LIBS) - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - else () - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) - endif () - endif () -else () - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) - if (BUILD_SHARED_LIBS) +add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) +target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) +TARGET_C_PROPERTIES (H5make_libsettings STATIC) +target_link_libraries (H5make_libsettings + PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> + INTERFACE $<$:"-O0"> +) + +add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_BINARY_DIR} +) +if (BUILD_SHARED_LIBS) + if (NOT EXISTS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c" - DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c + OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) + else () + set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () endif () @@ -957,7 +944,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- -set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) +set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIB_TARGET} @@ -985,7 +972,7 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) - set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) + set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIBSH_TARGET} -- cgit v0.12 From 9045cf049f74e017e20ed366d9a811a7902cf8ff Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Sep 2018 15:31:39 -0500 Subject: Remove extra unneeded --- src/CMakeLists.txt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7bf976d..d16adf8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -924,17 +924,13 @@ add_custom_command ( WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) if (BUILD_SHARED_LIBS) - if (NOT EXISTS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - COMMAND $ - ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_BINARY_DIR} - ) - else () - set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) - endif () + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + COMMAND $ + ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_BINARY_DIR} + ) endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -- cgit v0.12 From ed6cfe8ee6c09ac38cd6905a79cc9a5d36e779cd Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Sep 2018 16:18:26 -0500 Subject: HDFFV-10531 document option for external libs --- release_docs/INSTALL_CMake.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 2aa1f17..7352dae 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -275,9 +275,14 @@ IV. Further considerations packages there. Add the following CMake options: -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include + -DZLIB_USE_EXTERNAL:BOOL=OFF -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include + -DSZIP_USE_EXTERNAL:BOOL=OFF where "some_location" is the full path to the extlibs folder. + Also the appropriate environment variable must be set; + set(ENV{ZLIB_ROOT} "some_location") + set(ENV{SZIP_ROOT} "some_location") B. Use source packages from an GIT server by adding the following CMake options: -- cgit v0.12 From 01e40b31fe0b9fd318f5b6ceb00c6d46f7c91c9a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 26 Sep 2018 09:39:32 -0500 Subject: Use relative RPATH paths --- config/cmake_ext_mod/HDFMacros.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index aa18022..bd9d62e 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -358,6 +358,16 @@ macro (HDF_DIR_PATHS package_prefix) endif () endif () + set (CMAKE_SKIP_BUILD_RPATH FALSE) + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) + set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) + if (APPLE) + set (CMAKE_INSTALL_NAME_DIR "@rpath") + set (CMAKE_INSTALL_RPATH "@executable_path/../${${package_prefix}_INSTALL_LIB_DIR}") + else () + set (CMAKE_INSTALL_RPATH "\$ORIGIN/../${${package_prefix}_INSTALL_LIB_DIR}") + endif () + if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) endif () -- cgit v0.12 From 5527dbfac2d0e4b0bb48a3f479a1a9dfd5dddb79 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 26 Sep 2018 12:05:43 -0500 Subject: Add extra path option for build location --- config/cmake_ext_mod/HDFMacros.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index bd9d62e..bb16946 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -363,9 +363,9 @@ macro (HDF_DIR_PATHS package_prefix) set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) if (APPLE) set (CMAKE_INSTALL_NAME_DIR "@rpath") - set (CMAKE_INSTALL_RPATH "@executable_path/../${${package_prefix}_INSTALL_LIB_DIR}") + set (CMAKE_INSTALL_RPATH "@executable_path/../${${package_prefix}_INSTALL_LIB_DIR}:@executable_path/") else () - set (CMAKE_INSTALL_RPATH "\$ORIGIN/../${${package_prefix}_INSTALL_LIB_DIR}") + set (CMAKE_INSTALL_RPATH "\$ORIGIN/../${${package_prefix}_INSTALL_LIB_DIR}:\$ORIGIN/") endif () if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") -- cgit v0.12 From ebec5c6117375f616196ea0bc11419ce8414ba24 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 26 Sep 2018 12:25:02 -0500 Subject: HDFFV-10594 - Add rpath configuration note --- release_docs/RELEASE.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 393a9b2..3acc1ed 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,16 @@ New Features Configuration: ------------- + - Add default rpath to targets + + Default rpaths should be set in shared executables and + libraries to allow the use of loading dependent libraries + without requiring LD_LIBRARY_PATH to be set. The default + path should be relative using @rpath on osx and $ORIGIN + on linux. Windows is not affected. + + (ADB - 2018/09/26, HDFFV-10594) + - Add missing USE_110_API_DEFAULT option. Option USE_110_API_DEFAULT sets the default version of -- cgit v0.12 From d26bb4d26ce5a23804a80c16dcb53e5f3eb957e4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 26 Sep 2018 15:12:44 -0500 Subject: HDFFV-10594 - mac must be space separated --- config/cmake_ext_mod/HDFMacros.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index bb16946..147ae2f 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -363,7 +363,12 @@ macro (HDF_DIR_PATHS package_prefix) set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) if (APPLE) set (CMAKE_INSTALL_NAME_DIR "@rpath") - set (CMAKE_INSTALL_RPATH "@executable_path/../${${package_prefix}_INSTALL_LIB_DIR}:@executable_path/") + set (CMAKE_INSTALL_RPATH + "@executable_path/../${${package_prefix}_INSTALL_LIB_DIR}" + "@executable_path/" + "@loader_path/../${${package_prefix}_INSTALL_LIB_DIR}" + "@loader_path/" + ) else () set (CMAKE_INSTALL_RPATH "\$ORIGIN/../${${package_prefix}_INSTALL_LIB_DIR}:\$ORIGIN/") endif () -- cgit v0.12 From 8e48f6ec3a84b9c532bc3b26a21d85d86fa7ccc6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 27 Sep 2018 09:58:27 -0500 Subject: Remove obsolete comment --- testpar/t_pread.c | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/testpar/t_pread.c b/testpar/t_pread.c index 19ccf56..7fa9ab8 100644 --- a/testpar/t_pread.c +++ b/testpar/t_pread.c @@ -50,7 +50,7 @@ static int test_parallel_read(MPI_Comm comm, int mpi_rank, int group); static char *test_argv0 = NULL; - + /*------------------------------------------------------------------------- * Function: generate_test_file * @@ -104,7 +104,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) hid_t file_id = -1; hid_t memspace = -1; hid_t filespace = -1; - hid_t fctmpl = -1; + hid_t fctmpl = -1; hid_t fapl_id = -1; hid_t dxpl_id = -1; hid_t dset_id = -1; @@ -180,17 +180,17 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) } } - /* Initialize a file creation template */ - if (pass) { - if ((fctmpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - pass = FALSE; - failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n"; - } - else if (H5Pset_userblock(fctmpl, 512) != SUCCEED) { - pass = FALSE; - failure_mssg = "H5Pset_userblock(,size) failed.\n"; - } - } + /* Initialize a file creation template */ + if (pass) { + if ((fctmpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + pass = FALSE; + failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n"; + } + else if (H5Pset_userblock(fctmpl, 512) != SUCCEED) { + pass = FALSE; + failure_mssg = "H5Pset_userblock(,size) failed.\n"; + } + } /* setup FAPL */ if ( pass ) { if ( (fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0 ) { @@ -347,7 +347,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) bytes_to_write = HDstrlen(text_to_write); if (pass) { - if ((header = HDopen(data_filename, O_WRONLY)) < 0) { + if ((header = HDopen(data_filename, O_WRONLY)) < 0) { pass = FALSE; failure_mssg = "HDopen(data_filename, O_WRONLY) failed.\n"; } @@ -358,7 +358,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) if (HDwrite(header, text_to_write, bytes_to_write) < 0) { pass = FALSE; failure_mssg = "Unable to write user text into file.\n"; - } + } } if (pass || (header > 0)) { @@ -408,7 +408,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) } /* generate_test_file() */ - + /*------------------------------------------------------------------------- * Function: test_parallel_read * @@ -683,7 +683,7 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) } /* test_parallel_read() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -699,18 +699,11 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) * with the opening and validation of the data contained * therein. * - * WARNING: This test uses fork() and execve(), and - * therefore will not run on Windows. - * * Return: Success: 0 - * * Failure: 1 * * Programmer: Richard Warren * 10/1/17 - * - * Modifications: - * *------------------------------------------------------------------------- */ -- cgit v0.12 From a2da9930af38a86387466a2021b71a2cc7484f1b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 27 Sep 2018 11:50:22 -0500 Subject: replace page chars --- testpar/t_pread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testpar/t_pread.c b/testpar/t_pread.c index 7fa9ab8..807e092 100644 --- a/testpar/t_pread.c +++ b/testpar/t_pread.c @@ -50,7 +50,7 @@ static int test_parallel_read(MPI_Comm comm, int mpi_rank, int group); static char *test_argv0 = NULL; - + /*------------------------------------------------------------------------- * Function: generate_test_file * @@ -408,7 +408,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) } /* generate_test_file() */ - + /*------------------------------------------------------------------------- * Function: test_parallel_read * @@ -683,7 +683,7 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) } /* test_parallel_read() */ - + /*------------------------------------------------------------------------- * Function: main * -- cgit v0.12 From 3209d1278fd38121178892a9d0582c007399795f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 2 Oct 2018 18:13:21 -0500 Subject: TRILAB-21 Intel flags --- config/cmake/HDF5UseFortran.cmake | 72 +++++++++--------- config/cmake/HDFCompilerFlags.cmake | 77 +++++++++++++------- config/cmake_ext_mod/ConfigureChecks.cmake | 113 ++++++++++++++++------------- 3 files changed, 147 insertions(+), 115 deletions(-) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 1f66bad..1766ac8 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -31,10 +31,10 @@ endif () # The provided CMake Fortran macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- -macro (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) +macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN_VAR) # # if (NOT DEFINED ${RUN_RESULT_VAR}) - message (STATUS "Detecting Fortran ${FUNCTION}") + message (STATUS "Detecting Fortran ${FUNCTION_NAME}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") @@ -43,18 +43,18 @@ macro (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 - "${CODE}" + "${SOURCE_CODE}" ) TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - RUN_OUTPUT_VARIABLE OUTPUT + RUN_OUTPUT_VARIABLE OUTPUT_VAR ) - set(${RETURN} ${OUTPUT}) + set(${RETURN_VAR} ${OUTPUT_VAR}) - #message ( "Test result1 ${RETURN} ") + #message ( "Test result1 ${RETURN_VAR} ") #message ( "Test result3 ${RESULT} ") #message ( "Test result2 ${CMAKE_MATCH_0} ") #message ( "Test result4 ${CMAKE_MATCH_1} ") @@ -66,34 +66,34 @@ macro (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) if (${COMPILE_RESULT_VAR}) if (${RUN_RESULT_VAR} MATCHES 0) - message (STATUS "Testing Fortran ${FUNCTION} - OK") + message (STATUS "Testing Fortran ${FUNCTION_NAME} - OK") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" - "${OUTPUT}\n\n" + "Determining if the Fortran ${FUNCTION_NAME} exists passed with the following output:\n" + "${OUTPUT_VAR}\n\n" ) else () - message (STATUS "Testing Fortran ${FUNCTION} - Fail") + message (STATUS "Testing Fortran ${FUNCTION_NAME} - Fail") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" - "${OUTPUT}\n\n") + "Determining if the Fortran ${FUNCTION_NAME} exists failed with the following output:\n" + "${OUTPUT_VAR}\n\n") endif () endif () # endif () endmacro () # Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END" -macro (READ_SOURCE START END RETURN) - file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" CODE) - string (REGEX MATCH "${START}[\\\t\\\n\\\r[].+]*${END}" CODE ${CODE}) - set (RETURN "${CODE}") +macro (READ_SOURCE SOURCE_START SOURCE_END RETURN_VAR) + file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" SOURCE_CODE) + string (REGEX MATCH "${SOURCE_START}[\\\t\\\n\\\r[].+]*${SOURCE_END}" SOURCE_CODE ${SOURCE_CODE}) + set (RETURN_VAR "${SOURCE_CODE}") endmacro () #----------------------------------------------------------------------------- # Check to see C_LONG_DOUBLE is available -READ_SOURCE("PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" "END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" CODE) +READ_SOURCE("PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" "END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" SOURCE_CODE) CHECK_FORTRAN_FEATURE(c_long_double - "${CODE}" + "${SOURCE_CODE}" FORTRAN_HAVE_C_LONG_DOUBLE ) @@ -105,9 +105,9 @@ endif () # Check to see C_LONG_DOUBLE is different from C_DOUBLE -READ_SOURCE("MODULE type_mod" "END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE" CODE) +READ_SOURCE("MODULE type_mod" "END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE" SOURCE_CODE) CHECK_FORTRAN_FEATURE(c_long_double - "${CODE}" + "${SOURCE_CODE}" FORTRAN_C_LONG_DOUBLE_IS_UNIQUE ) if (${FORTRAN_C_LONG_DOUBLE_IS_UNIQUE}) @@ -133,9 +133,9 @@ endif () # Determine the available KINDs for REALs and INTEGERs #----------------------------------------------------------------------------- -READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" CODE) +READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE) FORTRAN_RUN ("REAL and INTEGER KINDs" - "${CODE}" + "${SOURCE_CODE}" XX YY PROG_OUTPUT @@ -372,8 +372,8 @@ ENABLE_LANGUAGE (C) # The provided CMake C macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- -macro (C_RUN FUNCTION CODE RETURN) - message (STATUS "Detecting C ${FUNCTION}") +macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) + message (STATUS "Detecting C ${FUNCTION_NAME}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") @@ -382,16 +382,16 @@ macro (C_RUN FUNCTION CODE RETURN) endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c - ${CODE} + ${SOURCE_CODE} ) TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - RUN_OUTPUT_VARIABLE OUTPUT + RUN_OUTPUT_VARIABLE OUTPUT_VAR ) - set (${RETURN} ${OUTPUT}) + set (${RETURN_VAR} ${OUTPUT_VAR}) #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") #message ( "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ") @@ -401,21 +401,21 @@ macro (C_RUN FUNCTION CODE RETURN) if (${COMPILE_RESULT_VAR}) if (${RUN_RESULT_VAR} MATCHES 1) - set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION}") - message (STATUS "Testing C ${FUNCTION} - OK") + set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") + message (STATUS "Testing C ${FUNCTION_NAME} - OK") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the C ${FUNCTION} exists passed with the following output:\n" - "${OUTPUT}\n\n" + "Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n" + "${OUTPUT_VAR}\n\n" ) else () - message (STATUS "Testing C ${FUNCTION} - Fail") - set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION}") + message (STATUS "Testing C ${FUNCTION_NAME} - Fail") + set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the C ${FUNCTION} exists failed with the following output:\n" - "${OUTPUT}\n\n") + "Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n" + "${OUTPUT_VAR}\n\n") endif () else () - message (FATAL_ERROR "Compilation of C ${FUNCTION} - Failed") + message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed") endif () endmacro () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index ec13272..93ebc3c 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -24,7 +24,7 @@ if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") endif () else () - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt") endif () endif () @@ -36,7 +36,7 @@ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") endif () else () - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt") endif () endif () @@ -94,16 +94,29 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) # warnings that are emitted. If you need it, add it at configure time. - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings") - # gcc automatically inlines based on the optimization level - # this is just a failsafe - set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") + if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcheck -Wall") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wreturn-type -Wstrict-prototypes -Wuninitialized") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunknown-pragmas -Wunused-function -Wunused-variable") + # this is just a failsafe + set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wsign-compare -Wtrigraphs -Wwrite-strings") + endif() + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings") + # gcc automatically inlines based on the optimization level + # this is just a failsafe + set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") + endif () endif () #----------------------------------------------------------------------------- @@ -113,28 +126,36 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF) if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn") + if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Wreorder -Wport -Wstrict-aliasing") + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn") + endif () else () - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn") + endif () endif () - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + # Append warning flags that only gcc 4.3+ knows about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla") - # Append more extra warning flags that only gcc 4.4+ know about - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + # Append more extra warning flags that only gcc 4.4+ know about + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + endif () # Append more extra warning flags that only gcc 4.5+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") endif () # Append more extra warning flags that only gcc 4.6+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdouble-promotion -Wtrampolines") if (HDF5_ENABLE_DEV_WARNINGS) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=const") @@ -144,7 +165,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () # Append more extra warning flags that only gcc 4.7+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance") if (HDF5_ENABLE_DEV_WARNINGS) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") @@ -154,7 +175,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () # Append more extra warning flags that only gcc 4.8+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) if (HDF5_ENABLE_DEV_WARNINGS) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=format") else () @@ -163,17 +184,17 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () # Append more extra warning flags that only gcc 4.9+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time") endif () # Append more extra warning flags that only gcc 5.1+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat") endif () # Append more extra warning flags that only gcc 6.x+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa") endif () diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 9be30f7..3ab47fc 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -279,36 +279,42 @@ if (NOT WINDOWS) option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) if (HDF_ENABLE_LARGE_FILE) set (msg "Performing TEST_LFS_WORKS") - TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS - OUTPUT_VARIABLE OUTPUT - ) + if (CMAKE_CROSSCOMPILING) + set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) + set (LARGEFILE 1) + set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) + message (STATUS "${msg} with presets... yes") + else () + TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_EXT_DIR}/HDFTests.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS + ) - # The LARGEFILE definitions were from the transition period - # and are probably no longer needed. The FILE_OFFSET_BITS - # check should be generalized for all POSIX systems as it - # is in the Autotools. - if (TEST_LFS_WORKS_COMPILE) - if (TEST_LFS_WORKS_RUN MATCHES 0) - set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) - set (LARGEFILE 1) - set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) - message (STATUS "${msg}... yes") + # The LARGEFILE definitions were from the transition period + # and are probably no longer needed. The FILE_OFFSET_BITS + # check should be generalized for all POSIX systems as it + # is in the Autotools. + if (TEST_LFS_WORKS_COMPILE) + if (TEST_LFS_WORKS_RUN MATCHES 0) + set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) + set (LARGEFILE 1) + set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) + message (STATUS "${msg}... yes") + else () + set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) + message (STATUS "${msg}... no") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Test TEST_LFS_WORKS Run failed with the following exit code:\n ${TEST_LFS_WORKS_RUN}\n" + ) + endif () else () set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n" + "Test TEST_LFS_WORKS Compile failed\n" ) endif () - else () - set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) - message (STATUS "${msg}... no") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n" - ) endif () endif () set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS}) @@ -641,37 +647,42 @@ endforeach () if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown") set (PRINT_LL_FOUND 0) message (STATUS "Checking for appropriate format for 64 bit long:") - set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") - if (${HDF_PREFIX}_SIZEOF_LONG_LONG) - set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") - endif () - TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} - OUTPUT_VARIABLE OUTPUT - ) - if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) - if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) - string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") - set (PRINT_LL_FOUND 1) - else () - message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") - endif () + if (CMAKE_CROSSCOMPILING) + set (${HDF_PREFIX}_PRINTF_LL_WIDTH ${PRESET_PRINTF_LL}) + message (STATUS "Checking for appropriate format for 64 bit long: force ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") else () - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed with the following output:\n ${OUTPUT}\n" + set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") + if (${HDF_PREFIX}_SIZEOF_LONG_LONG) + set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") + endif () + TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_EXT_DIR}/HDFTests.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} + RUN_OUTPUT_VARIABLE OUTPUT ) - endif () + if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) + if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) + string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") + set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") + set (PRINT_LL_FOUND 1) + else () + message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") + endif () + else () + file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n" + ) + endif () - if (PRINT_LL_FOUND) - message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") - else () - message (STATUS "Checking for appropriate format for 64 bit long: not found") - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL - "Width for printf for type `long long' or `__int64', us. `ll" - ) + if (PRINT_LL_FOUND) + message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") + else () + message (STATUS "Checking for appropriate format for 64 bit long: not found") + set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL + "Width for printf for type `long long' or `__int64', us. `ll" + ) + endif () endif () endif () -- cgit v0.12 From c5256dcd9d8a20f08e2e4a73f1c9b4be71abe0a9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 3 Oct 2018 16:24:46 -0500 Subject: Fix undef for Xl compilers --- fortran/src/H5config_f.inc.cmake | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index b8d5355..aa3d135 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -12,16 +12,19 @@ ! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure ! Define if we have parallel support -#cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ +#cmakedefine01 H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ +#if H5_HAVE_PARALLEL == 0 +#undef H5_HAVE_PARALLEL +#endif ! Define if the intrinsic function STORAGE_SIZE exists -#cmakedefine H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@ +#define H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@ ! Define if the intrinsic function SIZEOF exists -#cmakedefine H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@ +#define H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@ ! Define if the intrinsic function C_SIZEOF exists -#cmakedefine H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@ +#define H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@ ! Define if the intrinsic C_LONG_DOUBLE exists #define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ @@ -30,41 +33,40 @@ #define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ ! Define if the intrinsic module ISO_FORTRAN_ENV exists -#cmakedefine H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ - +#define H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ ! should this be ${HDF_PREFIX} instead of H5 MSB -#cmakedefine H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ +#define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ ! should this be ${HDF_PREFIX} instead of H5 MSB -#cmakedefine H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ +#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ ! Define the maximum decimal precision for reals -#cmakedefine H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ +#define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ ! If C has quad precision -#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ +#define H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ ! Define if INTEGER*16 is available #define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @H5_HAVE_Fortran_INTEGER_SIZEOF_16@ ! Maximum decimal precision for C -#cmakedefine H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ +#define H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ ! number of valid REAL KINDs -#cmakedefine H5_H5CONFIG_F_NUM_RKIND @H5_H5CONFIG_F_NUM_RKIND@ +#define H5_H5CONFIG_F_NUM_RKIND @H5_H5CONFIG_F_NUM_RKIND@ ! valid REAL KINDs (need to have a matching C counter-part) -#cmakedefine H5_H5CONFIG_F_RKIND @H5_H5CONFIG_F_RKIND@ +#define H5_H5CONFIG_F_RKIND @H5_H5CONFIG_F_RKIND@ ! valid REAL KINDs (need to have a matching C counter-part) -#cmakedefine H5_H5CONFIG_F_RKIND_SIZEOF @H5_H5CONFIG_F_RKIND_SIZEOF@ +#define H5_H5CONFIG_F_RKIND_SIZEOF @H5_H5CONFIG_F_RKIND_SIZEOF@ ! number of valid INTEGER KINDs -#cmakedefine H5_H5CONFIG_F_NUM_IKIND @H5_H5CONFIG_F_NUM_IKIND@ +#define H5_H5CONFIG_F_NUM_IKIND @H5_H5CONFIG_F_NUM_IKIND@ ! valid INTEGER KINDs (need to have a matching C counter-part) -#cmakedefine H5_H5CONFIG_F_IKIND @H5_H5CONFIG_F_IKIND@ +#define H5_H5CONFIG_F_IKIND @H5_H5CONFIG_F_IKIND@ ! Fortran compiler id -#cmakedefine H5_Fortran_COMPILER_ID @Fortran_COMPILER_ID@ +#define H5_Fortran_COMPILER_ID @CMAKE_Fortran_COMPILER_ID@ -- cgit v0.12 From 1cac34fc5bdae7f6cc265a4f94f82048642e5de7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 3 Oct 2018 16:39:35 -0500 Subject: Fix defines for XL compiler --- fortran/src/H5config_f.inc.cmake | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index b8d5355..aa3d135 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -12,16 +12,19 @@ ! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure ! Define if we have parallel support -#cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ +#cmakedefine01 H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ +#if H5_HAVE_PARALLEL == 0 +#undef H5_HAVE_PARALLEL +#endif ! Define if the intrinsic function STORAGE_SIZE exists -#cmakedefine H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@ +#define H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@ ! Define if the intrinsic function SIZEOF exists -#cmakedefine H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@ +#define H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@ ! Define if the intrinsic function C_SIZEOF exists -#cmakedefine H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@ +#define H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@ ! Define if the intrinsic C_LONG_DOUBLE exists #define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ @@ -30,41 +33,40 @@ #define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ ! Define if the intrinsic module ISO_FORTRAN_ENV exists -#cmakedefine H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ - +#define H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ ! should this be ${HDF_PREFIX} instead of H5 MSB -#cmakedefine H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ +#define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ ! should this be ${HDF_PREFIX} instead of H5 MSB -#cmakedefine H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ +#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ ! Define the maximum decimal precision for reals -#cmakedefine H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ +#define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ ! If C has quad precision -#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ +#define H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ ! Define if INTEGER*16 is available #define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @H5_HAVE_Fortran_INTEGER_SIZEOF_16@ ! Maximum decimal precision for C -#cmakedefine H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ +#define H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ ! number of valid REAL KINDs -#cmakedefine H5_H5CONFIG_F_NUM_RKIND @H5_H5CONFIG_F_NUM_RKIND@ +#define H5_H5CONFIG_F_NUM_RKIND @H5_H5CONFIG_F_NUM_RKIND@ ! valid REAL KINDs (need to have a matching C counter-part) -#cmakedefine H5_H5CONFIG_F_RKIND @H5_H5CONFIG_F_RKIND@ +#define H5_H5CONFIG_F_RKIND @H5_H5CONFIG_F_RKIND@ ! valid REAL KINDs (need to have a matching C counter-part) -#cmakedefine H5_H5CONFIG_F_RKIND_SIZEOF @H5_H5CONFIG_F_RKIND_SIZEOF@ +#define H5_H5CONFIG_F_RKIND_SIZEOF @H5_H5CONFIG_F_RKIND_SIZEOF@ ! number of valid INTEGER KINDs -#cmakedefine H5_H5CONFIG_F_NUM_IKIND @H5_H5CONFIG_F_NUM_IKIND@ +#define H5_H5CONFIG_F_NUM_IKIND @H5_H5CONFIG_F_NUM_IKIND@ ! valid INTEGER KINDs (need to have a matching C counter-part) -#cmakedefine H5_H5CONFIG_F_IKIND @H5_H5CONFIG_F_IKIND@ +#define H5_H5CONFIG_F_IKIND @H5_H5CONFIG_F_IKIND@ ! Fortran compiler id -#cmakedefine H5_Fortran_COMPILER_ID @Fortran_COMPILER_ID@ +#define H5_Fortran_COMPILER_ID @CMAKE_Fortran_COMPILER_ID@ -- cgit v0.12 From 284cb8ffc06e39d16fe0e436beff7587be54ed50 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Oct 2018 10:42:44 -0500 Subject: TRILABS-21 Add intel compiler support --- MANIFEST | 2 ++ config/cmake/HDF5UseFortran.cmake | 6 +++++- config/cmake_ext_mod/HDFLibMacros.cmake | 9 +++++++++ config/intel.cmake | 8 ++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 config/intel.cmake diff --git a/MANIFEST b/MANIFEST index 117c531..317e156 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3148,6 +3148,8 @@ ./java/lib/ext/slf4j-simple-1.7.25.jar # CMake-specific Files +./config/intel.cmake + ./config/cmake/cacheinit.cmake ./config/cmake/CMakeFindJavaCommon.cmake ./config/cmake/ConversionTests.c diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 1766ac8..e260f0c 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -33,7 +33,11 @@ endif () #----------------------------------------------------------------------------- macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN_VAR) # -# if (NOT DEFINED ${RUN_RESULT_VAR}) +# if (CMAKE_CROSSCOMPILING) +# set (${OUTPUT_VAR} ${PRESET_${FUNCTION_NAME}}) +# message (STATUS "Detecting Fortran ${FUNCTION_NAME}: force ${OUTPUT_VAR}") +# set(${RETURN_VAR} ${OUTPUT_VAR}) +# else () message (STATUS "Detecting Fortran ${FUNCTION_NAME}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index 54e408b..8a37af3 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -30,6 +30,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (JPEG @@ -47,6 +48,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (JPEG @@ -64,6 +66,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) endif () externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR) @@ -121,6 +124,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (SZIP @@ -139,6 +143,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (SZIP @@ -157,6 +162,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) endif () externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) @@ -213,6 +219,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (ZLIB @@ -230,6 +237,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (ZLIB @@ -247,6 +255,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) endif () externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR) diff --git a/config/intel.cmake b/config/intel.cmake new file mode 100644 index 0000000..ee16a0f --- /dev/null +++ b/config/intel.cmake @@ -0,0 +1,8 @@ +#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) + +set(PRESET_PRINTF_LL "ll") -- cgit v0.12 From 2a95ab5acbe032f58891b653f56b9db8a4938d95 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Oct 2018 11:40:33 -0500 Subject: TRILABS-21 add toolchain related info and files --- config/cmake/scripts/HDF5options.cmake | 5 +++++ config/intel.cmake | 6 ++++-- release_docs/INSTALL_CMake.txt | 28 ++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 3e6aad0..80a28d3 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -96,3 +96,8 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING 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") + +############################################################################################# diff --git a/config/intel.cmake b/config/intel.cmake index ee16a0f..5ef9282 100644 --- a/config/intel.cmake +++ b/config/intel.cmake @@ -1,8 +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) - -set(PRESET_PRINTF_LL "ll") + +# the following is used if cross-compiling +set(PRESET_PRINTF_LL "l") diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 7352dae..edd876a 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -324,6 +324,34 @@ IV. Further considerations -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING=Release .. + 6. CMake uses a toolchain of utilities to compile, link libraries and + create archives, and other tasks to drive the build. The toolchain + utilities available are determined by the languages enabled. In normal + builds, CMake automatically determines the toolchain for host builds + based on system introspection and defaults. In cross-compiling + scenarios, a toolchain file may be specified with information about + compiler and utility paths. + Variables and Properties + Several variables relate to the language components of a toolchain which + are enabled. CMAKE__COMPILER is the full path to the compiler used + for . CMAKE__COMPILER_ID is the identifier used by CMake for + the compiler and CMAKE__COMPILER_VERSION is the version of the compiler. + + The CMAKE__FLAGS variables and the configuration-specific equivalents + contain flags that will be added to the compile command when compiling a + file of a particular language. + + As the linker is invoked by the compiler driver, CMake needs a way to + determine which compiler to use to invoke the linker. This is calculated + by the LANGUAGE of source files in the target, and in the case of static + libraries, the language of the dependent libraries. The choice CMake makes + may be overridden with the LINKER_LANGUAGE target property. + + See the CMake help for more information on using toolchain files. + + To use a toolchain file with the supplied cmake scripts, see the + HDF5options.cmake file under the toolchain section. + Notes: CMake and HDF5 1. Using CMake for building and using HDF5 is under active development. -- cgit v0.12 From 9c39016e1d2253ee6a43f56d4aaab34314afb72b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Oct 2018 14:00:41 -0500 Subject: TRILABS-34 avoid try-run output capture --- config/cmake/HDF5UseFortran.cmake | 82 ++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index e260f0c..50e69d8 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -31,7 +31,7 @@ endif () # The provided CMake Fortran macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- -macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN_VAR) +macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 RETURN_VAR) # # if (CMAKE_CROSSCOMPILING) # set (${OUTPUT_VAR} ${PRESET_${FUNCTION_NAME}}) @@ -53,34 +53,27 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - RUN_OUTPUT_VARIABLE OUTPUT_VAR ) - set(${RETURN_VAR} ${OUTPUT_VAR}) - - #message ( "Test result1 ${RETURN_VAR} ") - #message ( "Test result3 ${RESULT} ") - #message ( "Test result2 ${CMAKE_MATCH_0} ") - #message ( "Test result4 ${CMAKE_MATCH_1} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - #message ( "Test result2 ${COMPILE_RESULT_VAR} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - #message ( "Test result1 ${RUN_RESULT_VAR} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - if (${COMPILE_RESULT_VAR}) + set(${RETURN_VAR} ${RUN_RESULT_VAR}) if (${RUN_RESULT_VAR} MATCHES 0) message (STATUS "Testing Fortran ${FUNCTION_NAME} - OK") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran ${FUNCTION_NAME} exists passed with the following output:\n" - "${OUTPUT_VAR}\n\n" + "Determining if the Fortran ${FUNCTION_NAME} exists passed\n" ) else () message (STATUS "Testing Fortran ${FUNCTION_NAME} - Fail") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran ${FUNCTION_NAME} exists failed with the following output:\n" - "${OUTPUT_VAR}\n\n") + "Determining if the Fortran ${FUNCTION_NAME} exists failed: ${RUN_RESULT_VAR}\n" + ) endif () + else () + message (STATUS "Compiling Fortran ${FUNCTION_NAME} - Fail") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran ${FUNCTION_NAME} compiles failed: ${COMPILE_RESULT_VAR}\n" + ) + set(${RETURN_VAR} ${COMPILE_RESULT_VAR}) endif () # endif () endmacro () @@ -139,10 +132,10 @@ endif () READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE) FORTRAN_RUN ("REAL and INTEGER KINDs" - "${SOURCE_CODE}" - XX - YY - PROG_OUTPUT + "${SOURCE_CODE}" + XX + YY + PROG_RESULT ) # dnl The output from the above program will be: # dnl -- LINE 1 -- valid integer kinds (comma seperated list) @@ -201,15 +194,18 @@ foreach (KIND ${VAR} ) USE ISO_C_BINDING IMPLICIT NONE INTEGER (KIND=${KIND}) a - WRITE(*,'(I0)') ${FC_SIZEOF_A} + OPEN(8,FILE='pac_validIntKinds.out',FORM='formatted') + WRITE(8,'(I0)') ${FC_SIZEOF_A} + CLOSE(8) END " ) FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC} - XX - YY - PROG_OUTPUT1 + XX + YY + PROG_RESULT1 ) + file (READ "${CMAKE_BINARY_DIR}/pac_validIntKinds.out" PROG_OUTPUT1) string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") endforeach () @@ -245,15 +241,18 @@ foreach (KIND ${VAR} ) USE ISO_C_BINDING IMPLICIT NONE REAL (KIND=${KIND}) a - WRITE(*,'(I0)') ${FC_SIZEOF_A} + OPEN(8,FILE='pac_validRealKinds.out',FORM='formatted') + WRITE(8,'(I0)') ${FC_SIZEOF_A} + CLOSE(8) END " ) FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC} - XX - YY - PROG_OUTPUT1 + XX + YY + PROG_RESULT1 ) + file (READ "${CMAKE_BINARY_DIR}/pac_validRealKinds.out" PROG_OUTPUT1) string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},") endforeach () @@ -292,18 +291,21 @@ FORTRAN_RUN ("SIZEOF NATIVE KINDs" INTEGER a REAL b DOUBLE PRECISION c - WRITE(*,*) ${FC_SIZEOF_A} - WRITE(*,*) kind(a) - WRITE(*,*) ${FC_SIZEOF_B} - WRITE(*,*) kind(b) - WRITE(*,*) ${FC_SIZEOF_C} - WRITE(*,*) kind(c) + OPEN(8,FILE='pac_sizeof_native_kinds.out',FORM='formatted') + WRITE(8,*) ${FC_SIZEOF_A} + WRITE(8,*) kind(a) + WRITE(8,*) ${FC_SIZEOF_B} + WRITE(8,*) kind(b) + WRITE(8,*) ${FC_SIZEOF_C} + WRITE(8,*) kind(c) + CLOSE(8) END " - XX - YY - PROG_OUTPUT -) + XX + YY + PROG_RESULT + ) + file (READ "${CMAKE_BINARY_DIR}/pac_sizeof_native_kinds.out" PROG_OUTPUT) # dnl The output from the above program will be: # dnl -- LINE 1 -- sizeof INTEGER # dnl -- LINE 2 -- kind of INTEGER -- cgit v0.12 From a5301ee6b832dc18f692b048102f183e3cef6d15 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Oct 2018 15:34:29 -0500 Subject: TRILABS-34 Cleanup try_run --- config/cmake/HDF5UseFortran.cmake | 8 +------- config/cmake_ext_mod/ConfigureChecks.cmake | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 50e69d8..f7f182f 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -39,12 +39,6 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 # set(${RETURN_VAR} ${OUTPUT_VAR}) # else () message (STATUS "Detecting Fortran ${FUNCTION_NAME}") - if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else () - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 "${SOURCE_CODE}" @@ -52,7 +46,7 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 - CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" + LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" ) if (${COMPILE_RESULT_VAR}) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 3ab47fc..475220f 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -648,7 +648,7 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES " set (PRINT_LL_FOUND 0) message (STATUS "Checking for appropriate format for 64 bit long:") if (CMAKE_CROSSCOMPILING) - set (${HDF_PREFIX}_PRINTF_LL_WIDTH ${PRESET_PRINTF_LL}) + set (${HDF_PREFIX}_PRINTF_LL_WIDTH "${PRESET_PRINTF_LL}") message (STATUS "Checking for appropriate format for 64 bit long: force ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") else () set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") -- cgit v0.12 From 4442b5b743aa3c7ee04b94c144be320d1a53591c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Oct 2018 16:06:31 -0500 Subject: TRILABS-34 improve cross compile with emulator --- config/cmake/HDF5UseFortran.cmake | 7 -- config/cmake_ext_mod/ConfigureChecks.cmake | 147 ++++++++++++----------------- config/intel.cmake | 2 +- src/CMakeLists.txt | 8 +- 4 files changed, 66 insertions(+), 98 deletions(-) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index f7f182f..157befd 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -32,12 +32,6 @@ endif () # so this one is used. #----------------------------------------------------------------------------- macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 RETURN_VAR) -# -# if (CMAKE_CROSSCOMPILING) -# set (${OUTPUT_VAR} ${PRESET_${FUNCTION_NAME}}) -# message (STATUS "Detecting Fortran ${FUNCTION_NAME}: force ${OUTPUT_VAR}") -# set(${RETURN_VAR} ${OUTPUT_VAR}) -# else () message (STATUS "Detecting Fortran ${FUNCTION_NAME}") file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 @@ -69,7 +63,6 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 ) set(${RETURN_VAR} ${COMPILE_RESULT_VAR}) endif () -# endif () endmacro () # Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END" diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 475220f..4204511 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -142,10 +142,6 @@ endif () macro (HDF_FUNCTION_TEST OTHER_TEST) if (NOT DEFINED ${HDF_PREFIX}_${OTHER_TEST}) set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") - set (OTHER_TEST_ADD_LIBRARIES) - if (CMAKE_REQUIRED_LIBRARIES) - set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif () foreach (def HAVE_SYS_TIME_H @@ -168,8 +164,8 @@ macro (HDF_FUNCTION_TEST OTHER_TEST) TRY_COMPILE (${OTHER_TEST} ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${OTHER_TEST_ADD_LIBRARIES}" + COMPILE_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS}" + LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" OUTPUT_VARIABLE OUTPUT ) if (${OTHER_TEST}) @@ -279,42 +275,35 @@ if (NOT WINDOWS) option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) if (HDF_ENABLE_LARGE_FILE) set (msg "Performing TEST_LFS_WORKS") - if (CMAKE_CROSSCOMPILING) - set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) - set (LARGEFILE 1) - set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) - message (STATUS "${msg} with presets... yes") - else () - TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS - ) + TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_EXT_DIR}/HDFTests.c + COMPILE_DEFINITIONS "-DTEST_LFS_WORKS" + ) - # The LARGEFILE definitions were from the transition period - # and are probably no longer needed. The FILE_OFFSET_BITS - # check should be generalized for all POSIX systems as it - # is in the Autotools. - if (TEST_LFS_WORKS_COMPILE) - if (TEST_LFS_WORKS_RUN MATCHES 0) - set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) - set (LARGEFILE 1) - set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) - message (STATUS "${msg}... yes") - else () - set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) - message (STATUS "${msg}... no") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Test TEST_LFS_WORKS Run failed with the following exit code:\n ${TEST_LFS_WORKS_RUN}\n" - ) - endif () + # The LARGEFILE definitions were from the transition period + # and are probably no longer needed. The FILE_OFFSET_BITS + # check should be generalized for all POSIX systems as it + # is in the Autotools. + if (TEST_LFS_WORKS_COMPILE) + if (TEST_LFS_WORKS_RUN MATCHES 0) + set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) + set (LARGEFILE 1) + set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) + message (STATUS "${msg}... yes") else () set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Test TEST_LFS_WORKS Compile failed\n" + "Test TEST_LFS_WORKS Run failed with the following exit code:\n ${TEST_LFS_WORKS_RUN}\n" ) endif () + else () + set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) + message (STATUS "${msg}... no") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Test TEST_LFS_WORKS Compile failed\n" + ) endif () endif () set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS}) @@ -580,30 +569,21 @@ if (WINDOWS) "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ) endif () - set (MACRO_CHECK_FUNCTION_DEFINITIONS - "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") - if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else () - set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - endif () + set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") if (CMAKE_REQUIRED_INCLUDES) - set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") else () set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) endif () TRY_RUN(HAVE_IOEO_EXITCODE HAVE_IOEO_COMPILED - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} - "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" - "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" - COMPILE_OUTPUT_VARIABLE OUTPUT) + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_EXT_DIR}/HDFTests.c + COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${MACRO_CHECK_FUNCTION_DEFINITIONS}" + LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" + CMAKE_FLAGS "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}" + COMPILE_OUTPUT_VARIABLE OUTPUT + ) # if it did not compile make the return value fail code of 1 if (NOT HAVE_IOEO_COMPILED) set (HAVE_IOEO_EXITCODE 1) @@ -647,42 +627,37 @@ endforeach () if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown") set (PRINT_LL_FOUND 0) message (STATUS "Checking for appropriate format for 64 bit long:") - if (CMAKE_CROSSCOMPILING) - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "${PRESET_PRINTF_LL}") - message (STATUS "Checking for appropriate format for 64 bit long: force ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") - else () - set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") - if (${HDF_PREFIX}_SIZEOF_LONG_LONG) - set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") - endif () - TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} - RUN_OUTPUT_VARIABLE OUTPUT - ) - if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) - if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) - string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") - set (PRINT_LL_FOUND 1) - else () - message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") - endif () + set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") + if (${HDF_PREFIX}_SIZEOF_LONG_LONG) + set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") + endif () + TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_EXT_DIR}/HDFTests.c + COMPILE_DEFINITIONS "${CURRENT_TEST_DEFINITIONS}" + RUN_OUTPUT_VARIABLE OUTPUT + ) + if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) + if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) + string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") + set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") + set (PRINT_LL_FOUND 1) else () - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n" - ) + message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") endif () + else () + file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n" + ) + endif () - if (PRINT_LL_FOUND) - message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") - else () - message (STATUS "Checking for appropriate format for 64 bit long: not found") - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL - "Width for printf for type `long long' or `__int64', us. `ll" - ) - endif () + if (PRINT_LL_FOUND) + message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") + else () + message (STATUS "Checking for appropriate format for 64 bit long: not found") + set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL + "Width for printf for type `long long' or `__int64', us. `ll" + ) endif () endif () diff --git a/config/intel.cmake b/config/intel.cmake index 5ef9282..f1a5734 100644 --- a/config/intel.cmake +++ b/config/intel.cmake @@ -7,4 +7,4 @@ set(CMAKE_CXX_COMPILER icpc) set(CMAKE_Fortran_COMPILER ifort) # the following is used if cross-compiling -set(PRESET_PRINTF_LL "l") +set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d16adf8..3370c99 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -876,7 +876,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} @@ -885,7 +885,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared @@ -918,7 +918,7 @@ target_link_libraries (H5make_libsettings add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} @@ -926,7 +926,7 @@ add_custom_command ( if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} -- cgit v0.12 From 1fc646e52bbcf6d443455e4ea02d2db7c31c4c50 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Oct 2018 16:48:34 -0500 Subject: Reconciled docs with 1.10 branch --- release_docs/INSTALL_Cygwin.txt | 12 +++--- release_docs/RELEASE.txt | 84 +++++++++++++++++++++++++---------------- 2 files changed, 58 insertions(+), 38 deletions(-) diff --git a/release_docs/INSTALL_Cygwin.txt b/release_docs/INSTALL_Cygwin.txt index ddffcf1..74f494c 100644 --- a/release_docs/INSTALL_Cygwin.txt +++ b/release_docs/INSTALL_Cygwin.txt @@ -66,12 +66,11 @@ Preconditions: 2.2.2 Szip The HDF5 library has a predefined compression filter that uses the extended-Rice lossless compression algorithm for chunked - datatsets. For more information about Szip compression and - license terms see - http://hdfgroup.org/HDF5/doc_resource/SZIP/index.html. + datatsets. For more information on Szip compression, license terms, + and obtaining the Szip source code, see: + + https://portal.hdfgroup.org/display/HDF5/Szip+Compression+in+HDF+Products - The latest supported public release of SZIP is available from - ftp://ftp.hdfgroup.org/lib-external/szip/2.1. 2.3 Additional Utilities @@ -266,4 +265,5 @@ Build, Test and Install HDF5 on Cygwin ----------------------------------------------------------------------- -Need Further assistance, email help@hdfgroup.org + HDF Forum: https://forum.hdfgroup.org/ + HDF Helpdesk: https://portal.hdfgroup.org/display/support/The+HDF+Help+Desk diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 3acc1ed..f21d844 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,24 @@ New Features Configuration: ------------- + - Add toolchain and cross-compile support + + Added info on using a toolchain file to INSTALL_CMAKE.txt. A + toolchain file is also used in cross-compiling, which requires + CMAKE_CROSSCOMPILING_EMULATOR to be set. To help with cross-compiling + the fortran configure process, the HDF5UseFortran.cmake file macros + were improved. Fixed a Fortran configure file issue that incorrectly + used #cmakdefine instead of #define. + + (ADB - 2018/10/04, HDFFV-10594) + + - Add warning flags for Intel compilers + + Identified Intel compiler specific warnings flags that should be used + instead of GNU flags. + + (ADB - 2018/10/04, TRILABS-21) + - Add default rpath to targets Default rpaths should be set in shared executables and @@ -162,38 +180,6 @@ New Features Java Library: ---------------- - - JNI native library dependencies - - The build for the hdf5_java native library used the wrong - hdf5 target library for CMake builds. Correcting the hdf5_java - library to build with the shared hdf5 library required testing - paths to change also. - - (ADB - 2018/08/31, HDFFV-10568) - - - Java iterator callbacks - - Change global callback object to a small stack structure in order - to fix a runtime crash. This crash was discovered when iterating - through a file with nested group members. The global variable - visit_callback is overwritten when recursion starts. When recursion - completes, visit_callback will be pointing to the wrong callback method. - - (ADB - 2018/08/15, HDFFV-10536) - - - Java HDFLibraryException class - - Change parent class from Exception to RuntimeException. - - (ADB - 2018/07/30, HDFFV-10534) - - - JNI Read and Write - - Refactored variable-length functions, H5DreadVL and H5AreadVL, - to correct dataset and attribute reads. New write functions, - H5DwriteVL and H5AwriteVL, are under construction. - - (ADB - 2018/06/02, HDFFV-10519) Tools: ------ @@ -251,6 +237,40 @@ Bug Fixes since HDF5-1.10.3 release (JTH - 2018/08/25, HDFFV-10501) + Java Library: + ---------------- + - JNI native library dependencies + + The build for the hdf5_java native library used the wrong + hdf5 target library for CMake builds. Correcting the hdf5_java + library to build with the shared hdf5 library required testing + paths to change also. + + (ADB - 2018/08/31, HDFFV-10568) + - Java iterator callbacks + + Change global callback object to a small stack structure in order + to fix a runtime crash. This crash was discovered when iterating + through a file with nested group members. The global variable + visit_callback is overwritten when recursion starts. When recursion + completes, visit_callback will be pointing to the wrong callback method. + + (ADB - 2018/08/15, HDFFV-10536) + + - Java HDFLibraryException class + + Change parent class from Exception to RuntimeException. + + (ADB - 2018/07/30, HDFFV-10534) + + - JNI Read and Write + + Refactored variable-length functions, H5DreadVL and H5AreadVL, + to correct dataset and attribute reads. New write functions, + H5DwriteVL and H5AwriteVL, are under construction. + + (ADB - 2018/06/02, HDFFV-10519) + Configuration ------------- - -- cgit v0.12 From 7d5ced1d23713282c4b122f8927b25f10e3d5de6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Oct 2018 16:56:44 -0500 Subject: Fix typo --- release_docs/RELEASE.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index f21d844..4ae69f0 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -55,7 +55,7 @@ New Features CMAKE_CROSSCOMPILING_EMULATOR to be set. To help with cross-compiling the fortran configure process, the HDF5UseFortran.cmake file macros were improved. Fixed a Fortran configure file issue that incorrectly - used #cmakdefine instead of #define. + used #cmakedefine instead of #define. (ADB - 2018/10/04, HDFFV-10594) @@ -240,7 +240,7 @@ Bug Fixes since HDF5-1.10.3 release Java Library: ---------------- - JNI native library dependencies - + The build for the hdf5_java native library used the wrong hdf5 target library for CMake builds. Correcting the hdf5_java library to build with the shared hdf5 library required testing -- cgit v0.12 From 299852b6b565c906938ffaad5bb8e841b82118ab Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Oct 2018 16:59:22 -0500 Subject: Update examples version --- config/cmake/HDF518_Examples.cmake.in | 2 +- config/cmake/HDF5_Examples.cmake.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index 1f4f479..ba79ef2 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -48,7 +48,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${ ################################################################## if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") + set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") endif() if(NOT DEFINED CTEST_SOURCE_NAME) diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index bbe632c..d30f2ab 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -70,7 +70,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.5-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.10-Source") #endif() ############################################################################################################### -- cgit v0.12 From 1b2c820b4bdb0a176cba20ccdb87b07f7ab5eede Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 5 Oct 2018 21:47:51 -0700 Subject: The H5I debug ID dump function is now always available instead of hidden behind an H5_DEBUG_OUTPUT ifdef. --- src/H5I.c | 41 +++++++++++++++-------------------------- src/H5Iprivate.h | 3 +++ 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/H5I.c b/src/H5I.c index 293a0ea..61b2783 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -26,28 +26,22 @@ */ #include "H5Imodule.h" /* This source code file is part of the H5I module */ +#define H5T_FRIEND /* Suppress error about including H5Tpkg */ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ +#include "H5Gprivate.h" /* Groups */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ #include "H5SLprivate.h" /* Skip Lists */ +#include "H5Tpkg.h" /* Datatypes */ -/* Define this to compile in support for dumping ID information */ -/* #define H5I_DEBUG_OUTPUT */ -#ifndef H5I_DEBUG_OUTPUT -#include "H5Gprivate.h" /* Groups */ -#else /* H5I_DEBUG_OUTPUT */ -#define H5G_FRIEND /* Suppress error about including H5Gpkg */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Tprivate.h" /* Datatypes */ -#endif /* H5I_DEBUG_OUTPUT */ /* Local Macros */ @@ -129,10 +123,7 @@ static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); static hid_t H5I__get_file_id(hid_t obj_id, H5I_type_t id_type); -#ifdef H5I_DEBUG_OUTPUT -static int H5I__debug_cb(void *_item, void *_key, void *_udata); -static herr_t H5I__debug(H5I_type_t type); -#endif /* H5I_DEBUG_OUTPUT */ +static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); /*------------------------------------------------------------------------- @@ -2110,10 +2101,9 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__get_file_id() */ -#ifdef H5I_DEBUG_OUTPUT /*------------------------------------------------------------------------- - * Function: H5I__debug_cb + * Function: H5I__id_dump_cb * * Purpose: Dump the contents of an ID to stderr for debugging. * @@ -2122,7 +2112,7 @@ done: *------------------------------------------------------------------------- */ static int -H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) +H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ @@ -2176,11 +2166,11 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) } FUNC_LEAVE_NOAPI(H5_ITER_CONT) -} /* end H5I__debug_cb() */ +} /* end H5I__id_dump_cb() */ /*------------------------------------------------------------------------- - * Function: H5I__debug + * Function: H5I_dump_ids_for_type * * Purpose: Dump the contents of a type to stderr for debugging. * @@ -2188,12 +2178,12 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) * *------------------------------------------------------------------------- */ -static herr_t -H5I__debug(H5I_type_t type) +herr_t +H5I_dump_ids_for_type(H5I_type_t type) { - H5I_id_type_t *type_ptr; + H5I_id_type_t *type_ptr = NULL; - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_NOAPI_NOERR HDfprintf(stderr, "Dumping ID type %d\n", (int)type); type_ptr = H5I_id_type_list_g[type]; @@ -2206,9 +2196,8 @@ H5I__debug(H5I_type_t type) /* List */ HDfprintf(stderr, " List:\n"); - H5SL_iterate(type_ptr->ids, H5I__debug_cb, &type); + H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5I__debug() */ -#endif /* H5I_DEBUG_OUTPUT */ +} /* end H5I_dump_ids_for_type() */ diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index a10147d..6a0fc01 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -81,5 +81,8 @@ H5_DLL int H5I_dec_app_ref(hid_t id); H5_DLL int H5I_dec_app_ref_always_close(hid_t id); H5_DLL int H5I_dec_type_ref(H5I_type_t type); +/* Debugging functions */ +H5_DLL herr_t H5I_dump_ids_for_type(H5I_type_t type); + #endif /* _H5Iprivate_H */ -- cgit v0.12 From 75b84b09bd249b36a063fd51ecd3383801b0118b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 5 Oct 2018 22:16:51 -0700 Subject: Updated the H5I debug dump to not segfault when types are not initialized or contain zero IDs in the skip list. --- src/H5I.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/H5I.c b/src/H5I.c index 61b2783..34874c7 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2188,15 +2188,22 @@ H5I_dump_ids_for_type(H5I_type_t type) HDfprintf(stderr, "Dumping ID type %d\n", (int)type); type_ptr = H5I_id_type_list_g[type]; - /* Header */ - HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); - HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); - HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); - HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); - - /* List */ - HDfprintf(stderr, " List:\n"); - H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type); + if(type_ptr) { + + /* Header */ + HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); + HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); + HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); + HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); + + /* List */ + if(type_ptr->id_count > 0) { + HDfprintf(stderr, " List:\n"); + H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type); + } + } + else + HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n"); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5I_dump_ids_for_type() */ -- cgit v0.12 From e962df1591bc6eaee5b9e318de83b9c6698bc7b6 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 10 Oct 2018 08:10:15 -0700 Subject: VOL FEATURE --- MANIFEST | 12 + bin/trace | 20 + c++/src/H5File.cpp | 49 +- c++/src/H5File.h | 4 + c++/src/H5IdComponent.cpp | 2 + c++/src/H5PropList.cpp | 1 + config/cmake/scripts/HDF5config.cmake | 366 +- examples/CMakeLists.txt | 1 + examples/Makefile.am | 29 +- examples/h5_vol_external_log_native.c | 530 +++ fortran/src/H5Ff.c | 46 - fortran/src/H5Fff.F90 | 100 +- fortran/src/H5f90proto.h | 1 - fortran/src/hdf5_fortrandll.def.in | 1 + fortran/test/tH5F.F90 | 19 +- java/src/hdf/hdf5lib/HDF5Constants.java | 6 + java/src/jni/h5Constants.c | 4 + java/test/TestH5E.java | 14 +- java/test/TestH5Edefault.java | 22 +- java/test/testfiles/JUnit-TestH5Edefault.txt | 50 +- src/CMakeLists.txt | 24 + src/H5.c | 4 + src/H5A.c | 479 ++- src/H5Adeprec.c | 164 +- src/H5Aint.c | 136 +- src/H5Apkg.h | 7 +- src/H5Atest.c | 5 +- src/H5CX.c | 4 + src/H5Ctest.c | 3 +- src/H5D.c | 276 +- src/H5Ddbg.c | 3 +- src/H5Ddeprec.c | 122 +- src/H5Dint.c | 61 +- src/H5Dio.c | 84 +- src/H5Doh.c | 31 +- src/H5Dpkg.h | 11 +- src/H5Dtest.c | 13 +- src/H5Dvirtual.c | 24 +- src/H5ESpublic.h | 53 + src/H5F.c | 633 ++-- src/H5Fdeprec.c | 51 +- src/H5Fint.c | 124 +- src/H5Fmount.c | 25 +- src/H5Fmpi.c | 4 +- src/H5Fpkg.h | 36 +- src/H5Fprivate.h | 7 +- src/H5Fpublic.h | 3 +- src/H5Fquery.c | 14 +- src/H5Ftest.c | 9 +- src/H5G.c | 218 +- src/H5Gdeprec.c | 383 ++- src/H5Gint.c | 5 +- src/H5Gloc.c | 64 +- src/H5Gname.c | 1 + src/H5Goh.c | 29 +- src/H5Gprivate.h | 1 + src/H5Gtest.c | 19 +- src/H5Gtraverse.c | 3 +- src/H5I.c | 305 +- src/H5Iprivate.h | 4 +- src/H5Ipublic.h | 5 + src/H5L.c | 474 ++- src/H5Lexternal.c | 54 +- src/H5O.c | 336 +- src/H5Oattribute.c | 2 +- src/H5Ocopy.c | 31 +- src/H5Odeprec.c | 97 +- src/H5Ofill.c | 2 +- src/H5Oflush.c | 67 +- src/H5Oint.c | 107 +- src/H5Opkg.h | 8 +- src/H5Oprivate.h | 13 +- src/H5PLint.c | 21 + src/H5PLprivate.h | 1 + src/H5PLpublic.h | 4 +- src/H5Pacpl.c | 50 +- src/H5Pdcpl.c | 18 + src/H5Pfapl.c | 523 +++ src/H5Pgcpl.c | 6 + src/H5Pint.c | 19 + src/H5Plcpl.c | 55 + src/H5Pprivate.h | 4 + src/H5Ppublic.h | 2 + src/H5R.c | 107 +- src/H5Rdeprec.c | 43 +- src/H5Rint.c | 3 +- src/H5Rpkg.h | 2 +- src/H5Spublic.h | 1 + src/H5Sselect.c | 46 + src/H5T.c | 55 +- src/H5Tcommit.c | 302 +- src/H5Tconv.c | 6 +- src/H5Tdeprec.c | 64 +- src/H5Toh.c | 29 +- src/H5Torder.c | 2 + src/H5Tpkg.h | 1 + src/H5Tprecis.c | 2 + src/H5Tprivate.h | 8 +- src/H5VL.c | 2296 +++++++++++++ src/H5VLint.c | 2192 ++++++++++++ src/H5VLmodule.h | 31 + src/H5VLnative.c | 3533 ++++++++++++++++++++ src/H5VLnative.h | 44 + src/H5VLpkg.h | 48 + src/H5VLprivate.h | 132 + src/H5VLpublic.h | 498 +++ src/H5err.txt | 7 +- src/H5private.h | 10 + src/H5trace.c | 474 +++ src/Makefile.am | 5 +- src/hdf5.h | 1 + test/CMakeLists.txt | 33 + test/CMakeTests.cmake | 15 +- test/Makefile.am | 13 +- test/accum.c | 5 +- test/accum_swmr_reader.c | 3 +- test/btree2.c | 32 +- test/cache_api.c | 4 +- test/cache_common.c | 10 +- test/cache_common.h | 1 + test/cache_image.c | 8 +- test/cache_tagging.c | 14 +- test/dsets.c | 4 +- test/earray.c | 9 +- test/echo_vol.c | 116 + test/enc_dec_plist_cross_platform.c | 4 +- test/evict_on_close.c | 11 +- test/farray.c | 157 +- test/fheap.c | 148 +- test/flushrefresh.c | 4 +- test/freespace.c | 33 +- test/gheap.c | 13 +- test/h5test.c | 43 + test/h5test.h | 1 + test/lheap.c | 5 +- test/links.c | 2 + test/mf.c | 175 +- test/objcopy.c | 3 +- test/ohdr.c | 31 +- test/page_buffer.c | 17 +- test/swmr.c | 21 +- test/testfiles/err_compat_1 | 20 +- test/testfiles/error_test_1 | 16 +- test/tfile.c | 158 +- test/tmisc.c | 42 +- test/ttsafe_error.c | 28 +- test/vds_swmr_reader.c | 1 - test/vol.c | 956 ++++++ testpar/t_cache.c | 2 +- testpar/t_cache_image.c | 2 +- testpar/t_pread.c | 28 +- tools/src/h5format_convert/CMakeLists.txt | 2 +- tools/src/h5jam/h5jam.c | 4 +- tools/src/h5jam/h5unjam.c | 2 +- tools/src/h5stat/h5stat.c | 68 +- tools/test/h5dump/errfiles/filter_fail.err | 16 +- tools/test/h5dump/errfiles/tall-1.err | 24 +- tools/test/h5dump/errfiles/tall-2A.err | 24 +- tools/test/h5dump/errfiles/tall-2A0.err | 24 +- tools/test/h5dump/errfiles/tall-2B.err | 24 +- tools/test/h5dump/errfiles/tarray1_big.err | 24 +- tools/test/h5dump/errfiles/tattr-3.err | 10 +- tools/test/h5dump/errfiles/tattrregR.err | 16 +- tools/test/h5dump/errfiles/tcomp-3.err | 16 +- tools/test/h5dump/errfiles/tdataregR.err | 16 +- tools/test/h5dump/errfiles/tdset-2.err | 30 +- tools/test/h5dump/errfiles/textlink.err | 48 +- tools/test/h5dump/errfiles/textlinkfar.err | 36 +- tools/test/h5dump/errfiles/textlinksrc.err | 36 +- tools/test/h5dump/errfiles/tgroup-2.err | 16 +- tools/test/h5dump/errfiles/torderlinks1.err | 24 +- tools/test/h5dump/errfiles/torderlinks2.err | 24 +- tools/test/h5dump/errfiles/tperror.err | 30 +- tools/test/h5dump/errfiles/tslink-D.err | 22 +- tools/test/h5dump/h5dumpgentest.c | 2 +- tools/test/h5jam/tellub.c | 2 +- ...h5repack_layout.h5-dset2_chunk_20x10-errstk.tst | 26 +- 177 files changed, 16628 insertions(+), 2686 deletions(-) create mode 100644 examples/h5_vol_external_log_native.c create mode 100644 src/H5ESpublic.h create mode 100644 src/H5VL.c create mode 100644 src/H5VLint.c create mode 100644 src/H5VLmodule.h create mode 100644 src/H5VLnative.c create mode 100644 src/H5VLnative.h create mode 100644 src/H5VLpkg.h create mode 100644 src/H5VLprivate.h create mode 100644 src/H5VLpublic.h create mode 100644 test/echo_vol.c create mode 100644 test/vol.c diff --git a/MANIFEST b/MANIFEST index 317e156..b820622 100644 --- a/MANIFEST +++ b/MANIFEST @@ -164,6 +164,7 @@ ./examples/h5_vds-percival.c ./examples/h5_vds-percival-unlim.c ./examples/h5_vds-percival-unlim-maxmin.c +./examples/h5_vol_external_log_native.c ./examples/testh5cc.sh.in ./examples/README @@ -576,6 +577,7 @@ ./src/H5EAsblock.c ./src/H5EAstat.c ./src/H5EAtest.c +./src/H5ESpublic.h ./src/H5F.c ./src/H5Faccum.c ./src/H5Fcwfs.c @@ -886,6 +888,14 @@ ./src/H5Tvlen.c ./src/H5TS.c ./src/H5TSprivate.h +./src/H5VL.c +./src/H5VLint.c +./src/H5VLmodule.h +./src/H5VLnative.c +./src/H5VLnative.h +./src/H5VLpkg.h +./src/H5VLprivate.h +./src/H5VLpublic.h ./src/H5VM.c ./src/H5VMprivate.h ./src/H5WB.c @@ -951,6 +961,7 @@ ./test/dtypes.c ./test/dtransform.c ./test/earray.c +./test/echo_vol.c ./test/efc.c ./test/enc_dec_plist.c ./test/enc_dec_plist_cross_platform.c @@ -1129,6 +1140,7 @@ ./test/use_disable_mdc_flushes.c ./test/use.h ./test/vfd.c +./test/vol.c ./test/test_filters_le.h5 ./test/test_filters_be.h5 ./test/gen_filters.c diff --git a/bin/trace b/bin/trace index cf41238..1ed1678 100755 --- a/bin/trace +++ b/bin/trace @@ -46,6 +46,7 @@ $Source = ""; "H5E_direction_t" => "Ed", "H5E_error_t" => "Ee", "H5E_type_t" => "Et", + "H5ES_status_t" => "Es", "H5F_close_degree_t" => "Fd", "H5F_fspace_strategy_t" => "Ff", "H5F_file_space_type_t" => "Ff", @@ -95,6 +96,21 @@ $Source = ""; "H5T_str_t" => "Tz", "unsigned long" => "Ul", "unsigned long long" => "UL", + "H5VL_attr_get_t" => "Va", + "H5VL_attr_specific_t" => "Vb", + "H5VL_dataset_get_t" => "Vc", + "H5VL_dataset_specific_t" => "Vd", + "H5VL_datatype_get_t" => "Ve", + "H5VL_datatype_specific_t" => "Vf", + "H5VL_file_get_t" => "Vg", + "H5VL_file_specific_t" => "Vh", + "H5VL_group_get_t" => "Vi", + "H5VL_group_specific_t" => "Vj", + "H5VL_link_create_type_t" => "Vk", + "H5VL_link_get_t" => "Vl", + "H5VL_link_specific_t" => "Vm", + "H5VL_object_get_t" => "Vn", + "H5VL_object_specific_t" => "Vo", "void" => "x", "FILE" => "x", "H5A_operator_t" => "x", @@ -124,6 +140,7 @@ $Source = ""; "H5G_iterate_t" => "x", "H5G_info_t" => "x", "H5I_free_t" => "x", + "H5I_iterate_func_t" => "x", "H5I_search_func_t" => "x", "H5L_class_t" => "x", "H5L_elink_traverse_t" => "x", @@ -147,6 +164,9 @@ $Source = ""; "H5T_cdata_t" => "x", "H5T_conv_t" => "x", "H5T_conv_except_func_t" => "x", + "H5VL_t" => "x", + "H5VL_class_t" => "x", + "H5VL_loc_params_t" => "x", "H5Z_func_t" => "x", "H5Z_filter_func_t" => "x", "va_list" => "x", diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 07d7e84..719c1ba 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -192,16 +192,17 @@ H5File::H5File(const H5File& original) : Group() //-------------------------------------------------------------------------- bool H5File::isHdf5(const char* name) { - // Calls C routine H5Fis_hdf5 to determine whether the file is in + // Calls C routine H5Fis_accessible to determine whether the file is in // HDF5 format. It returns positive value, 0, or negative value - htri_t ret_value = H5Fis_hdf5(name); + htri_t ret_value = H5Fis_accessible(name, H5P_DEFAULT); + if (ret_value > 0) return true; else if (ret_value == 0) return false; - else // Raise exception when H5Fis_hdf5 returns a negative value + else // Raise exception when H5Fis_accessible returns a negative value { - throw FileIException("H5File::isHdf5", "H5Fis_hdf5 returned negative value"); + throw FileIException("H5File::isHdf5", "H5Fis_accessible returned negative value"); } } @@ -218,6 +219,46 @@ bool H5File::isHdf5(const H5std_string& name) } //-------------------------------------------------------------------------- +// Function: H5File::isAccessible (static) +///\brief Determines whether a file can be accessed as HDF5. (Static) +///\param name - IN: Name of the file +///\param access_plist - IN: File access property list. Default to +/// FileAccPropList::DEFAULT +///\return true if the file can be accessed as HDF5, and false, otherwise +///\exception H5::FileIException +// September 2018 +//-------------------------------------------------------------------------- +bool H5File::isAccessible(const char* name, const FileAccPropList& access_plist) +{ + // Calls C routine H5Fis_accessible to determine whether the file is in + // HDF5 format. It returns positive value, 0, or negative value + hid_t access_plist_id = access_plist.getId(); + htri_t ret_value = H5Fis_accessible(name, access_plist_id); + if (ret_value > 0) + return true; + else if (ret_value == 0) + return false; + else // Raise exception when H5Fis_accessible returns a negative value + { + throw FileIException("H5File::isAccessible", "H5Fis_accessible returned negative value"); + } +} + +//-------------------------------------------------------------------------- +// Function: H5File::isAccessible (static) +///\brief This is an overloaded member function, provided for convenience. +/// It takes an \c H5std_string for \a name. (Static) +///\param name - IN: Name of the file - \c H5std_string +///\param access_plist - IN: File access property list. Default to +/// FileAccPropList::DEFAULT +// September 2018 +//-------------------------------------------------------------------------- +bool H5File::isAccessible(const H5std_string& name, const FileAccPropList& access_plist) +{ + return(isAccessible(name.c_str(), access_plist)); +} + +//-------------------------------------------------------------------------- // Function: openFile ///\brief Opens an HDF5 file ///\param name - IN: Name of the file diff --git a/c++/src/H5File.h b/c++/src/H5File.h index 473428a..332685e 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -73,6 +73,10 @@ class H5_DLLCPP H5File : public Group { static bool isHdf5(const char* name); static bool isHdf5(const H5std_string& name); + // Determines if a file, specified by its name, can be accessed as HDF5 + static bool isAccessible(const char* name, const FileAccPropList& access_plist = FileAccPropList::DEFAULT); + static bool isAccessible(const H5std_string& name, const FileAccPropList& access_plist = FileAccPropList::DEFAULT); + // Reopens this file. void reOpen(); // added for better name diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index a041273..20a0a99 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -176,6 +176,7 @@ H5I_type_t IdComponent::getHDFObjType() const /// \li \c H5I_ATTR /// \li \c H5I_REFERENCE (DEPRECATED) /// \li \c H5I_VFL +/// \li \c H5I_VOL /// \li \c H5I_GENPROP_CLS /// \li \c H5I_GENPROP_LST /// \li \c H5I_ERROR_CLASS @@ -229,6 +230,7 @@ bool IdComponent::isValid(hid_t an_id) /// \li \c H5I_ATTR /// \li \c H5I_REFERENCE (DEPRECATED) /// \li \c H5I_VFL +/// \li \c H5I_VOL /// \li \c H5I_GENPROP_CLS /// \li \c H5I_GENPROP_LST /// \li \c H5I_ERROR_CLASS diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 1918d27..99f722c 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -151,6 +151,7 @@ PropList::PropList(const hid_t plist_id) : IdComponent() case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index d1c3a9f..69760e1 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -9,92 +9,92 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -############################################################################################# -### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ### -### BUILD_GENERATOR required [Unix, VS2017, VS201764, VS2015, VS201564, VS2013, VS201364] ### -### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ### -############################################################################################# - -cmake_minimum_required (VERSION 3.10) -############################################################################ -# Usage: -# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log -# where valid options for OPTION are: -# BUILD_GENERATOR - The cmake build generator: -# Unix * Unix Makefiles +############################################################################################# +### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ### +### BUILD_GENERATOR required [Unix, VS2017, VS201764, VS2015, VS201564, VS2013, VS201364] ### +### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ### +############################################################################################# + +cmake_minimum_required (VERSION 3.10) +############################################################################ +# Usage: +# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log +# where valid options for OPTION are: +# BUILD_GENERATOR - The cmake build generator: +# Unix * Unix Makefiles # VS2017 * Visual Studio 15 2017 # VS201764 * Visual Studio 15 2017 Win64 -# VS2015 * Visual Studio 14 2015 -# VS201564 * Visual Studio 14 2015 Win64 -# VS2013 * Visual Studio 12 2013 -# VS201364 * Visual Studio 12 2013 Win64 -# -# INSTALLDIR - root folder where hdf5 is installed -# CTEST_CONFIGURATION_TYPE - Release, Debug, etc -# CTEST_SOURCE_NAME - source folder -############################################################################## - -set (CTEST_SOURCE_VERSION "1.11.3") -set (CTEST_SOURCE_VERSEXT "") - -############################################################################## -# handle input parameters to script. -#BUILD_GENERATOR - which CMake generator to use, required -#INSTALLDIR - HDF5-1.10.0 root folder -#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo -#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 -if (DEFINED CTEST_SCRIPT_ARG) - # transform ctest script arguments of the form - # script.ctest,var1=value1,var2=value2 - # to variables with the respective names set to the respective values - string (REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") - foreach (current_var ${script_args}) - if ("${current_var}" MATCHES "^([^=]+)=(.+)$") - set ("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") - endif () - endforeach () -endif () - -# build generator must be defined -if (NOT DEFINED BUILD_GENERATOR) - message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364") -endif () - -################################################################### -### Following Line is one of [Release, RelWithDebInfo, Debug] ##### +# VS2015 * Visual Studio 14 2015 +# VS201564 * Visual Studio 14 2015 Win64 +# VS2013 * Visual Studio 12 2013 +# VS201364 * Visual Studio 12 2013 Win64 +# +# INSTALLDIR - root folder where hdf5 is installed +# CTEST_CONFIGURATION_TYPE - Release, Debug, etc +# CTEST_SOURCE_NAME - source folder +############################################################################## + +set (CTEST_SOURCE_VERSION "1.11.3") +set (CTEST_SOURCE_VERSEXT "") + +############################################################################## +# handle input parameters to script. +#BUILD_GENERATOR - which CMake generator to use, required +#INSTALLDIR - HDF5-1.10.0 root folder +#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo +#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 +if (DEFINED CTEST_SCRIPT_ARG) + # transform ctest script arguments of the form + # script.ctest,var1=value1,var2=value2 + # to variables with the respective names set to the respective values + string (REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}") + foreach (current_var ${script_args}) + if ("${current_var}" MATCHES "^([^=]+)=(.+)$") + set ("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") + endif () + endforeach () +endif () + +# build generator must be defined +if (NOT DEFINED BUILD_GENERATOR) + message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364") +endif () + +################################################################### +### Following Line is one of [Release, RelWithDebInfo, Debug] ##### ### (default use command line -C value) -set (CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") -################################################################### - -if (NOT DEFINED INSTALLDIR) - if (WIN32) - set (INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") - else () - set (INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") - endif () -endif () -if (NOT DEFINED CTEST_CONFIGURATION_TYPE) - set (CTEST_CONFIGURATION_TYPE "Release") -endif () -if (NOT DEFINED CTEST_SOURCE_NAME) - set (CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") -endif () - -set (CTEST_BINARY_NAME "build") -set (CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}") -if (WIN32) - set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") - set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") -else () - set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") - set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") -endif () - -################################################################### -######### Following describes compiler ############ -if (WIN32) - set (SITE_OS_NAME "Windows") - set (SITE_OS_VERSION "WIN7") +set (CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") +################################################################### + +if (NOT DEFINED INSTALLDIR) + if (WIN32) + set (INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") + else () + set (INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}") + endif () +endif () +if (NOT DEFINED CTEST_CONFIGURATION_TYPE) + set (CTEST_CONFIGURATION_TYPE "Release") +endif () +if (NOT DEFINED CTEST_SOURCE_NAME) + set (CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") +endif () + +set (CTEST_BINARY_NAME "build") +set (CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}") +if (WIN32) + set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") + set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") +else () + set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") + set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") +endif () + +################################################################### +######### Following describes compiler ############ +if (WIN32) + set (SITE_OS_NAME "Windows") + set (SITE_OS_VERSION "WIN7") if (${BUILD_GENERATOR} STREQUAL "VS201764") set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017 Win64") set (SITE_OS_BITS "64") @@ -138,103 +138,103 @@ if (WIN32) else () message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364") endif () -## Set the following to unique id your computer ## - set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") -else () - set (CTEST_CMAKE_GENERATOR "Unix Makefiles") -## Set the following to unique id your computer ## - if (APPLE) - set (CTEST_SITE "MAC.XXXX") - else () - set (CTEST_SITE "LINUX.XXXX") - endif () - if (APPLE) - execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set (ENV{CC} "${XCODE_CC}") - set (ENV{CXX} "${XCODE_CXX}") - set (CTEST_USE_LAUNCHERS 1) - set (RR_WARNINGS_COMMON "-Wno-format-nonliteral -Wno-cast-align -Wno-unused -Wno-unused-variable -Wno-unused-function -Wno-self-assign -Wno-unused-parameter -Wno-sign-compare") - set (RR_WARNINGS_C "${RR_WARNINGS_COMMON} -Wno-deprecated-declarations -Wno-uninitialized") - set (RR_WARNINGS_CXX "${RR_WARNINGS_COMMON} -Woverloaded-virtual -Wshadow -Wwrite-strings -Wc++11-compat") - set (RR_FLAGS_COMMON "-g -O0 -fstack-protector-all -D_FORTIFY_SOURCE=2") - set (RR_FLAGS_C "${RR_FLAGS_COMMON}") - set (RR_FLAGS_CXX "${RR_FLAGS_COMMON}") - set (ENV{CFLAGS} "${RR_WARNINGS_C} ${RR_FLAGS_C}") - set (ENV{CXXFLAGS} "${RR_WARNINGS_CXX} ${RR_FLAGS_CXX}") - endif () -endif () -################################################################### - -################################################################### -######### Following is for submission to CDash ############ -################################################################### -set (MODEL "Experimental") -################################################################### - -################################################################### -##### Following controls CDash submission ##### -#set (LOCAL_SUBMIT "TRUE") -##### Following controls test process ##### -#set (LOCAL_SKIP_TEST "TRUE") -#set (LOCAL_MEMCHECK_TEST "TRUE") -#set (LOCAL_COVERAGE_TEST "TRUE") -##### Following controls cpack command ##### -#set (LOCAL_NO_PACKAGE "TRUE") -##### Following controls source update ##### -#set (LOCAL_UPDATE "TRUE") -set (REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git") -set (REPOSITORY_BRANCH "develop") - -#uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows -#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}") -################################################################### - - -################################################################### - -if (WIN32) - set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}") - include (${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake) - include (${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) - if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe") - file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif () - if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi") - file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif () - if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip") - file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif () -else () - set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") - include (${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake) - include (${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) - if (APPLE) - if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg") - file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif () - if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz") - file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif () - if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh") - file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif () - else () - if (CYGWIN) - if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh") - file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif () - if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz") - file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif () - else () - if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh") - file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif () - if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz") - file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) - endif () - endif () - endif () -endif () +## Set the following to unique id your computer ## + set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX") +else () + set (CTEST_CMAKE_GENERATOR "Unix Makefiles") +## Set the following to unique id your computer ## + if (APPLE) + set (CTEST_SITE "MAC.XXXX") + else () + set (CTEST_SITE "LINUX.XXXX") + endif () + if (APPLE) + execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set (ENV{CC} "${XCODE_CC}") + set (ENV{CXX} "${XCODE_CXX}") + set (CTEST_USE_LAUNCHERS 1) + set (RR_WARNINGS_COMMON "-Wno-format-nonliteral -Wno-cast-align -Wno-unused -Wno-unused-variable -Wno-unused-function -Wno-self-assign -Wno-unused-parameter -Wno-sign-compare") + set (RR_WARNINGS_C "${RR_WARNINGS_COMMON} -Wno-deprecated-declarations -Wno-uninitialized") + set (RR_WARNINGS_CXX "${RR_WARNINGS_COMMON} -Woverloaded-virtual -Wshadow -Wwrite-strings -Wc++11-compat") + set (RR_FLAGS_COMMON "-g -O0 -fstack-protector-all -D_FORTIFY_SOURCE=2") + set (RR_FLAGS_C "${RR_FLAGS_COMMON}") + set (RR_FLAGS_CXX "${RR_FLAGS_COMMON}") + set (ENV{CFLAGS} "${RR_WARNINGS_C} ${RR_FLAGS_C}") + set (ENV{CXXFLAGS} "${RR_WARNINGS_CXX} ${RR_FLAGS_CXX}") + endif () +endif () +################################################################### + +################################################################### +######### Following is for submission to CDash ############ +################################################################### +set (MODEL "Experimental") +################################################################### + +################################################################### +##### Following controls CDash submission ##### +#set (LOCAL_SUBMIT "TRUE") +##### Following controls test process ##### +#set (LOCAL_SKIP_TEST "TRUE") +#set (LOCAL_MEMCHECK_TEST "TRUE") +#set (LOCAL_COVERAGE_TEST "TRUE") +##### Following controls cpack command ##### +#set (LOCAL_NO_PACKAGE "TRUE") +##### Following controls source update ##### +#set (LOCAL_UPDATE "TRUE") +set (REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git") +set (REPOSITORY_BRANCH "develop") + +#uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows +#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}") +################################################################### + + +################################################################### + +if (WIN32) + set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}") + include (${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake) + include (${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) + if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe") + file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi") + file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip") + file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () +else () + set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") + include (${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake) + include (${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) + if (APPLE) + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + else () + if (CYGWIN) + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + else () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz") + file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY}) + endif () + endif () + endif () +endif () diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 2239d64..9956b06 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -37,6 +37,7 @@ set (examples h5_vds-percival h5_vds-percival-unlim h5_vds-percival-unlim-maxmin + h5_vol_external_log_native ) foreach (example ${examples}) diff --git a/examples/Makefile.am b/examples/Makefile.am index 8c6540f..ae6c092 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -32,25 +32,27 @@ INSTALL_TOP_FILES = README # it would try to compile them instead of using the h5cc script. # Use the boilerplate in config/examples.am instead. EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ - h5_crtgrpd h5_subset h5_cmprss h5_rdwt h5_crtgrpar h5_extend \ - h5_crtatt h5_crtgrp h5_crtdat \ - h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \ - h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg h5_vds h5_vds-exc \ - h5_vds-exclim h5_vds-eiger h5_vds-simpleIO h5_vds-percival \ - h5_vds-percival-unlim h5_vds-percival-unlim-maxmin + h5_crtgrpd h5_subset h5_cmprss h5_rdwt h5_crtgrpar h5_extend \ + h5_crtatt h5_crtgrp h5_crtdat \ + h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \ + h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg h5_vds h5_vds-exc \ + h5_vds-exclim h5_vds-eiger h5_vds-simpleIO h5_vds-percival \ + h5_vds-percival-unlim h5_vds-percival-unlim-maxmin \ + h5_vol_external_log_native TEST_SCRIPT=testh5cc.sh TEST_EXAMPLES_SCRIPT=$(INSTALL_SCRIPT_FILES) # Install files # List all file that should be installed in examples directory INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ - h5_crtgrpd.c h5_subset.c h5_cmprss.c h5_rdwt.c h5_crtgrpar.c \ - h5_extend.c h5_crtatt.c h5_crtgrp.c h5_crtdat.c \ - h5_compound.c h5_group.c h5_select.c h5_attribute.c h5_mount.c \ - h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \ - h5_ref2reg.c h5_shared_mesg.c ph5example.c h5_vds.c h5_vds-exc.c \ - h5_vds-exclim.c h5_vds-eiger.c h5_vds-simpleIO.c h5_vds-percival.c \ - h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c + h5_crtgrpd.c h5_subset.c h5_cmprss.c h5_rdwt.c h5_crtgrpar.c \ + h5_extend.c h5_crtatt.c h5_crtgrp.c h5_crtdat.c \ + h5_compound.c h5_group.c h5_select.c h5_attribute.c h5_mount.c \ + h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \ + h5_ref2reg.c h5_shared_mesg.c ph5example.c h5_vds.c h5_vds-exc.c \ + h5_vds-exclim.c h5_vds-eiger.c h5_vds-simpleIO.c h5_vds-percival.c \ + h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c \ + h5_vol_external_log_native.c @@ -127,6 +129,7 @@ h5_vds-simpleIO: $(srcdir)/h5_vds-simpleIO.c h5_vds-percival: $(srcdir)/h5_vds-percival.c h5_vds-percival-unlim: $(srcdir)/h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin: $(srcdir)/h5_vds-percival-unlim-maxmin.c +h5_vol_external_log_native: $(srcdir)/h5_vol_external_log_native.c if BUILD_SHARED_SZIP_CONDITIONAL LD_LIBRARY_PATH=$(LL_PATH) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c new file mode 100644 index 0000000..945588a --- /dev/null +++ b/examples/h5_vol_external_log_native.c @@ -0,0 +1,530 @@ + +#include +#include +#include +#include "hdf5.h" + +#define LOG 502 + +static herr_t H5VL_log_init(hid_t vipl_id); +static herr_t H5VL_log_term(hid_t vtpl_id); + +/* Datatype callbacks */ +static void *H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req); + +/* Dataset callbacks */ +static void *H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL_log_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_log_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req); +static herr_t H5VL_log_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +static herr_t H5VL_log_dataset_close(void *dset, hid_t dxpl_id, void **req); + +/* File callbacks */ +static void *H5VL_log_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void *H5VL_log_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_log_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_log_file_close(void *file, hid_t dxpl_id, void **req); + +/* Group callbacks */ +static void *H5VL_log_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req); + +/* Link callbacks */ + +/* Object callbacks */ +static void *H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); + +hid_t native_driver_id = -1; + +static const H5VL_class_t H5VL_log_g = { + 0, + LOG, + "log", /* name */ + H5VL_log_init, /* initialize */ + H5VL_log_term, /* terminate */ + sizeof(hid_t), + NULL, + NULL, + { /* attribute_cls */ + NULL, //H5VL_log_attr_create, /* create */ + NULL, //H5VL_log_attr_open, /* open */ + NULL, //H5VL_log_attr_read, /* read */ + NULL, //H5VL_log_attr_write, /* write */ + NULL, //H5VL_log_attr_get, /* get */ + NULL, //H5VL_log_attr_specific, /* specific */ + NULL, //H5VL_log_attr_optional, /* optional */ + NULL //H5VL_log_attr_close /* close */ + }, + { /* dataset_cls */ + H5VL_log_dataset_create, /* create */ + H5VL_log_dataset_open, /* open */ + H5VL_log_dataset_read, /* read */ + H5VL_log_dataset_write, /* write */ + NULL, //H5VL_log_dataset_get, /* get */ + NULL, //H5VL_log_dataset_specific, /* specific */ + NULL, //H5VL_log_dataset_optional, /* optional */ + H5VL_log_dataset_close /* close */ + }, + { /* datatype_cls */ + H5VL_log_datatype_commit, /* commit */ + H5VL_log_datatype_open, /* open */ + H5VL_log_datatype_get, /* get_size */ + NULL, //H5VL_log_datatype_specific, /* specific */ + NULL, //H5VL_log_datatype_optional, /* optional */ + H5VL_log_datatype_close /* close */ + }, + { /* file_cls */ + H5VL_log_file_create, /* create */ + H5VL_log_file_open, /* open */ + H5VL_log_file_get, /* get */ + NULL, //H5VL_log_file_specific, /* specific */ + NULL, //H5VL_log_file_optional, /* optional */ + H5VL_log_file_close /* close */ + }, + { /* group_cls */ + H5VL_log_group_create, /* create */ + NULL, //H5VL_log_group_open, /* open */ + NULL, //H5VL_log_group_get, /* get */ + NULL, //H5VL_log_group_specific, /* specific */ + NULL, //H5VL_log_group_optional, /* optional */ + H5VL_log_group_close /* close */ + }, + { /* link_cls */ + NULL, //H5VL_log_link_create, /* create */ + NULL, //H5VL_log_link_copy, /* copy */ + NULL, //H5VL_log_link_move, /* move */ + NULL, //H5VL_log_link_get, /* get */ + NULL, //H5VL_log_link_specific, /* specific */ + NULL, //H5VL_log_link_optional, /* optional */ + }, + { /* object_cls */ + H5VL_log_object_open, /* open */ + NULL, //H5VL_log_object_copy, /* copy */ + NULL, //H5VL_log_object_get, /* get */ + H5VL_log_object_specific, /* specific */ + NULL, //H5VL_log_object_optional, /* optional */ + }, + { + NULL, + NULL, + NULL + }, + NULL +}; + +typedef struct H5VL_log_t { + void *under_object; +} H5VL_log_t; + +static herr_t +visit_cb(hid_t oid, const char *name, + const H5O_info_t *oinfo, void *udata) +{ + ssize_t len; + char n[25]; + + if(H5Iget_type(oid) == H5I_GROUP) { + len = H5VLget_driver_name(oid, n, 50); + printf ("Visiting GROUP VOL name = %s %d\n", n, len); + } + if(H5Iget_type(oid) == H5I_DATASET) + printf("visiting dataset\n"); + if(H5Iget_type(oid) == H5I_DATATYPE) + printf("visiting datatype\n"); + + return 1; +} /* end h5_verify_cached_stabs_cb() */ + +int main(int argc, char **argv) { + 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;iunder_object = H5VLfile_create(name, flags, fcpl_id, under_fapl, dxpl_id, req); + + printf("------- LOG H5Fcreate\n"); + return (void *)file; +} + +static void * +H5VL_log_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) +{ + hid_t under_fapl; + H5VL_log_t *file; + + file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); + + under_fapl = *((hid_t *)H5Pget_vol_info(fapl_id)); + file->under_object = H5VLfile_open(name, flags, under_fapl, dxpl_id, req); + + printf("------- LOG H5Fopen\n"); + return (void *)file; +} + +static herr_t +H5VL_log_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_log_t *f = (H5VL_log_t *)file; + + H5VLfile_get(f->under_object, native_driver_id, get_type, dxpl_id, req, arguments); + + printf("------- LOG H5Fget %d\n", get_type); + return 1; +} +static herr_t +H5VL_log_file_close(void *file, hid_t dxpl_id, void **req) +{ + H5VL_log_t *f = (H5VL_log_t *)file; + + H5VLfile_close(f->under_object, native_driver_id, dxpl_id, req); + free(f); + + printf("------- LOG H5Fclose\n"); + return 1; +} + +static void * +H5VL_log_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_log_t *group; + H5VL_log_t *o = (H5VL_log_t *)obj; + + group = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); + + group->under_object = H5VLgroup_create(o->under_object, loc_params, native_driver_id, name, gcpl_id, gapl_id, dxpl_id, req); + + printf("------- LOG H5Gcreate\n"); + return (void *)group; +} + +static herr_t +H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req) +{ + H5VL_log_t *g = (H5VL_log_t *)grp; + + H5VLgroup_close(g->under_object, native_driver_id, dxpl_id, req); + free(g); + + printf("------- LOG H5Gclose\n"); + return 1; +} + +static void * +H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_log_t *dt; + H5VL_log_t *o = (H5VL_log_t *)obj; + + dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); + + dt->under_object = H5VLdatatype_commit(o->under_object, loc_params, native_driver_id, name, + type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); + + printf("------- LOG H5Tcommit\n"); + return dt; +} +static void * +H5VL_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_log_t *dt; + H5VL_log_t *o = (H5VL_log_t *)obj; + + dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); + + dt->under_object = H5VLdatatype_open(o->under_object, loc_params, native_driver_id, name, tapl_id, dxpl_id, req); + + printf("------- LOG H5Topen\n"); + return (void *)dt; +} + +static herr_t +H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_log_t *o = (H5VL_log_t *)dt; + herr_t ret_value; + + ret_value = H5VLdatatype_get(o->under_object, native_driver_id, get_type, dxpl_id, req, arguments); + + printf("------- LOG datatype get\n"); + return ret_value; +} + +static herr_t +H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req) +{ + H5VL_log_t *type = (H5VL_log_t *)dt; + + assert(type->under_object); + + H5VLdatatype_close(type->under_object, native_driver_id, dxpl_id, req); + free(type); + + printf("------- LOG H5Tclose\n"); + return 1; +} + +static void * +H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req) +{ + H5VL_log_t *new_obj; + H5VL_log_t *o = (H5VL_log_t *)obj; + + new_obj = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); + + new_obj->under_object = H5VLobject_open(o->under_object, loc_params, native_driver_id, opened_type, dxpl_id, req); + + printf("------- LOG H5Oopen\n"); + return (void *)new_obj; +} + +static herr_t +H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_log_t *o = (H5VL_log_t *)obj; + + H5VLobject_specific(o->under_object, loc_params, native_driver_id, specific_type, dxpl_id, req, arguments); + + printf("------- LOG Object specific\n"); + return 1; +} + +static void * +H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_log_t *dset; + H5VL_log_t *o = (H5VL_log_t *)obj; + + dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); + + dset->under_object = H5VLdataset_create(o->under_object, loc_params, native_driver_id, name, dcpl_id, dapl_id, dxpl_id, req); + + printf("------- LOG H5Dcreate\n"); + return (void *)dset; +} + +static void * +H5VL_log_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_log_t *dset; + H5VL_log_t *o = (H5VL_log_t *)obj; + + dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); + + dset->under_object = H5VLdataset_open(o->under_object, loc_params, native_driver_id, name, dapl_id, dxpl_id, req); + + printf("------- LOG H5Dopen\n"); + return (void *)dset; +} + +static herr_t +H5VL_log_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req) +{ + H5VL_log_t *d = (H5VL_log_t *)dset; + + H5VLdataset_read(d->under_object, native_driver_id, mem_type_id, mem_space_id, file_space_id, + plist_id, buf, req); + + printf("------- LOG H5Dread\n"); + return 1; +} +static herr_t +H5VL_log_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + H5VL_log_t *d = (H5VL_log_t *)dset; + + H5VLdataset_write(d->under_object, native_driver_id, mem_type_id, mem_space_id, file_space_id, + plist_id, buf, req); + + printf("------- LOG H5Dwrite\n"); + return 1; +} +static herr_t +H5VL_log_dataset_close(void *dset, hid_t dxpl_id, void **req) +{ + H5VL_log_t *d = (H5VL_log_t *)dset; + + H5VLdataset_close(d->under_object, native_driver_id, dxpl_id, req); + free(d); + + printf("------- LOG H5Dclose\n"); + return 1; +} + +#if 0 +static void *H5VL_log_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req){ +static herr_t H5VL_log_attr_close(void *attr, hid_t dxpl_id, void **req){ + +/* Datatype callbacks */ + + +/* Dataset callbacks */ +static void *H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req){ +static herr_t H5VL_log_dataset_close(void *dset, hid_t dxpl_id, void **req){ + +/* File callbacks */ + + +static void *H5VL_log_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req){ + + +/* Group callbacks */ + +static void *H5VL_log_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req){ +static herr_t H5VL_log_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments){ + + +/* Link callbacks */ + +/* Object callbacks */ + + +#endif diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index 2d5f6ed..a4e786e 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -402,52 +402,6 @@ h5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id) return ret_value; } -/****if* H5Ff/h5fis_hdf5_c - * NAME - * h5fis_hdf5_c - * PURPOSE - * Call H5Fis_hdf5 to determone if the file is an HDF5 file - * INPUTS - * name - name of the file - * namelen - name length - * OUTPUTS - * flag - 0 if file is not HDF5 file , positive if a file - * is an HDF5 file, and negative on failure. - * RETURNS - * 0 on success, -1 on failure - * AUTHOR - * Elena Pourmal - * Tuesday, August 3, 1999 - * HISTORY - * - * SOURCE -*/ -int_f -h5fis_hdf5_c (_fcd name, int_f *namelen, int_f *flag) -/******/ -{ - int ret_value = -1; - char *c_name; - int_f c_namelen; - htri_t status; - - /* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, (size_t)c_namelen); - if (c_name == NULL) return ret_value; - - /* - * Call H5Fopen function. - */ - status = H5Fis_hdf5(c_name); - *flag = (int_f)status; - if (status >= 0) ret_value = 0; - - HDfree(c_name); - return ret_value; -} /****if* H5Ff/h5fclose_c * NAME * h5fclose_c diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index 358e421..9c8b941 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -45,6 +45,18 @@ MODULE H5F ! Number of objects opened in H5open_f INTEGER(SIZE_T) :: H5OPEN_NUM_OBJ + INTERFACE + INTEGER(C_INT) FUNCTION h5fis_accessible(name, & + access_prp_default) BIND(C,NAME='H5Fis_accessible') + IMPORT :: C_CHAR + IMPORT :: HID_T + IMPORT :: C_INT + IMPLICIT NONE + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(IN), VALUE :: access_prp_default + END FUNCTION h5fis_accessible + END INTERFACE + CONTAINS !****s* H5F/h5fcreate_f ! @@ -486,6 +498,63 @@ CONTAINS END SUBROUTINE h5fget_access_plist_f +!****s* H5F/h5fis_accessible_f +! +! NAME +! h5fis_accessible_f +! +! PURPOSE +! Determines whether a file can be accessed as HDF5. +! +! INPUTS +! name - name of the file to check +! OUTPUTS +! status - indicates if file is and HDF5 file +! hdferr - Returns 0 if successful and -1 if fails +! OPTIONAL PARAMETERS +! access_prp - file access property list identifier +! AUTHOR +! Dana Robinson +! September 2018 +! +! HISTORY +! Explicit Fortran interfaces were added for +! called C functions (it is needed for Windows +! port). February 28, 2001 +! +! SOURCE + SUBROUTINE h5fis_accessible_f(name, status, hdferr, access_prp) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the file + LOGICAL, INTENT(OUT) :: status ! Indicates if file + ! is an HDF5 file + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp + ! File access property list + ! identifier +!***** + INTEGER(HID_T) :: access_prp_default + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTEGER(C_INT) :: flag ! "TRUE/FALSE/ERROR" flag from C routine + + access_prp_default = H5P_DEFAULT_F + IF (PRESENT(access_prp)) access_prp_default = access_prp + + c_name = TRIM(name)//C_NULL_CHAR + + flag = H5Fis_accessible(c_name, access_prp_default) + + hdferr = 0 + IF(flag.LT.0) hdferr = -1 + + status = .TRUE. + IF (flag .EQ. 0) status = .FALSE. + + END SUBROUTINE h5fis_accessible_f + +! XXX (VOL_MERGE): This function should probably be marked as +! deprecated since H5Fis_hdf5() is deprecated. + !****s* H5F/h5fis_hdf5_f ! ! NAME @@ -503,6 +572,12 @@ CONTAINS ! Elena Pourmal ! August 12, 1999 ! +! NOTES +! The underlying HDF5 C API call (H5Fis_hdf5) has been deprecated +! in favor of the VOL-capable H5Fis_accessible(). New code should +! use h5fis_accessible_f() instead of this function in case this +! function is deprecated in the future. +! ! HISTORY ! Explicit Fortran interfaces were added for ! called C functions (it is needed for Windows @@ -516,26 +591,23 @@ CONTAINS ! is an HDF5 file INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: namelen ! Length of the name character string - INTEGER :: flag ! "TRUE/FALSE" flag from C routine - ! to define status value. + INTEGER(HID_T) :: access_prp_default + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTEGER(C_INT) :: flag ! "TRUE/FALSE/ERROR" flag from C routine + ! to define status value. - INTERFACE - INTEGER FUNCTION h5fis_hdf5_c(name, namelen, flag) BIND(C,NAME='h5fis_hdf5_c') - IMPORT :: C_CHAR - IMPLICIT NONE - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name - INTEGER :: namelen - INTEGER :: flag - END FUNCTION h5fis_hdf5_c - END INTERFACE + c_name = TRIM(name)//C_NULL_CHAR + + flag = H5Fis_accessible(c_name, H5P_DEFAULT_F) + + hdferr = 0 + IF(flag.LT.0) hdferr = -1 - namelen = LEN_TRIM(name) - hdferr = h5fis_hdf5_c(name, namelen, flag) status = .TRUE. IF (flag .EQ. 0) status = .FALSE. END SUBROUTINE h5fis_hdf5_f + !****s* H5F/h5fclose_f ! ! NAME diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 46ef8ef..0884eb6 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -78,7 +78,6 @@ typedef struct H5O_info_t_f { */ H5_FCDLL int_f h5fcreate_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *crt_prp, hid_t_f *acc_prp, hid_t_f *file_id); H5_FCDLL int_f h5fopen_c(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id); -H5_FCDLL int_f h5fis_hdf5_c(_fcd name, int_f *namelen, int_f *flag); H5_FCDLL int_f h5fclose_c(hid_t_f *file_id); H5_FCDLL int_f h5fmount_c(hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hid_t_f *acc_prp); H5_FCDLL int_f h5funmount_c(hid_t_f *loc_id, _fcd dsetname, int_f *namelen); diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 3a5a91f..2edba5a 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -94,6 +94,7 @@ H5F_mp_H5FOPEN_F H5F_mp_H5FREOPEN_F H5F_mp_H5FGET_CREATE_PLIST_F H5F_mp_H5FGET_ACCESS_PLIST_F +H5F_mp_H5FIS_ACCESSIBLE_F H5F_mp_H5FIS_HDF5_F H5F_mp_H5FGET_NAME_F H5F_mp_H5FGET_FILESIZE_F diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index ee386dd..d51803b 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -232,7 +232,24 @@ CONTAINS CALL check("h5fclose_f",error,total_error) ! - !test whether files are in hdf5 format + !test whether files are accessible as HDF5 (new, VOL-safe, way) + ! + CALL h5fis_accessible_f(fix_filename1, status, error) + CALL check("h5fis_accessible_f",error,total_error) + IF ( .NOT. status ) THEN + write(*,*) "File ", fix_filename1, " is not accessible as hdf5" + stop + END IF + + CALL h5fis_accessible_f(fix_filename2, status, error) + CALL check("h5fis_accessible_f",error,total_error) + IF ( .NOT. status ) THEN + write(*,*) "File ", fix_filename2, " is not accessible as hdf5" + stop + END IF + + ! + !test whether files are in hdf5 format (old way) ! CALL h5fis_hdf5_f(fix_filename1, status, error) CALL check("h5fis_hdf5_f",error,total_error) diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 7eddac0..b530f4b 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -190,6 +190,7 @@ public class HDF5Constants { public static final long H5E_UNSUPPORTED = H5E_UNSUPPORTED(); public static final long H5E_VERSION = H5E_VERSION(); public static final long H5E_VFL = H5E_VFL(); + public static final long H5E_VOL = H5E_VOL(); public static final long H5E_WALK_DOWNWARD = H5E_WALK_DOWNWARD(); public static final long H5E_WALK_UPWARD = H5E_WALK_UPWARD(); public static final long H5E_WRITEERROR = H5E_WRITEERROR(); @@ -317,6 +318,7 @@ public class HDF5Constants { public static final int H5I_REFERENCE = H5I_REFERENCE(); public static final int H5I_UNINIT = H5I_UNINIT(); public static final int H5I_VFL = H5I_VFL(); + public static final int H5I_VOL = H5I_VOL(); public static final int H5L_TYPE_ERROR = H5L_TYPE_ERROR(); public static final int H5L_TYPE_HARD = H5L_TYPE_HARD(); @@ -980,6 +982,8 @@ public class HDF5Constants { private static native final long H5E_VFL(); + private static native final long H5E_VOL(); + private static native final long H5E_WALK_DOWNWARD(); private static native final long H5E_WALK_UPWARD(); @@ -1224,6 +1228,8 @@ public class HDF5Constants { private static native final int H5I_VFL(); + private static native final int H5I_VOL(); + private static native final int H5L_TYPE_ERROR(); private static native final int H5L_TYPE_HARD(); diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index c99745d..fdec61a 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -344,6 +344,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1VERSION(JNIEnv *env, jclass cls) { return H5 JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1VFL(JNIEnv *env, jclass cls) { return H5E_VFL; } JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5E_1VOL(JNIEnv *env, jclass cls) { return H5E_VOL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1DOWNWARD(JNIEnv *env, jclass cls) { return H5E_WALK_DOWNWARD; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls) { return H5E_WALK_UPWARD; } @@ -605,6 +607,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5I_1REFERENCE(JNIEnv *env, jclass cls) { return JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls) { return H5I_VFL; } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5I_1VOL(JNIEnv *env, jclass cls) { return H5I_VOL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1INVALID_1HID(JNIEnv *env, jclass cls) { return H5I_INVALID_HID; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1CLS(JNIEnv *env, jclass cls) { return H5I_GENPROP_CLS; } diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 1f4e658..542a092 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -38,7 +38,7 @@ import org.junit.rules.TestName; public class TestH5E { @Rule public TestName testname = new TestName(); - public static final int ERRSTACK_CNT = 3; + public static final int ERRSTACK_CNT = 6; public static final int ERRSTACK_MTY_CNT = 0; long hdf_java_classid = -1; @@ -79,7 +79,7 @@ public class TestH5E { public void testH5Eget_msg_major() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (HDF5LibraryException hdferr) { long errnum = hdferr.getMajorErrorNumber(); @@ -93,7 +93,7 @@ public class TestH5E { fail("H5.H5Eget_msg(Throwable): " + err); } assertNotNull("H5.H5Eget_msg: " + msg, msg); - assertEquals("H5.H5Eget_msg: ", "Object atom", msg); + assertEquals("H5.H5Eget_msg: ", "File accessibility", msg); assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, error_msg_type[0]); } catch (Throwable err) { @@ -105,7 +105,7 @@ public class TestH5E { @Test public void testH5Eget_msg_minor() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (HDF5LibraryException hdferr) { long errnum = hdferr.getMinorErrorNumber(); @@ -119,7 +119,7 @@ public class TestH5E { fail("H5.H5Eget_msg: " + err); } assertNotNull("H5.H5Eget_msg: " + msg, msg); - assertEquals("H5.H5Eget_msg: ", "Unable to find atom information (already closed?)", msg); + assertEquals("H5.H5Eget_msg: ", "Unable to open file", msg); assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, error_msg_type[0]); } catch (Throwable err) { @@ -139,7 +139,7 @@ public class TestH5E { } try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -297,7 +297,7 @@ public class TestH5E { fail("testH5Ewalk:H5Eset_current_stack " + err); } try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index b510936..4676205 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -29,7 +29,7 @@ import org.junit.rules.TestName; public class TestH5Edefault { @Rule public TestName testname = new TestName(); - public static final int ERRSTACK_CNT = 3; + public static final int ERRSTACK_CNT = 6; public static final int ERRSTACK_MTY_CNT = 0; @Before @@ -59,7 +59,7 @@ public class TestH5Edefault { @Test public void testH5Eprint() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -79,7 +79,7 @@ public class TestH5Edefault { long stack_id = -1; long stack_id_default = HDF5Constants.H5E_DEFAULT; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //default stack id will be different after exception @@ -142,7 +142,7 @@ public class TestH5Edefault { long num_msg_default = -1; long stack_id = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack @@ -191,7 +191,7 @@ public class TestH5Edefault { //Generate errors on default stack try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack @@ -282,7 +282,7 @@ public class TestH5Edefault { long num_msg = -1; long stack_id = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack @@ -321,7 +321,7 @@ public class TestH5Edefault { //Generate errors on default stack try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack @@ -378,7 +378,7 @@ public class TestH5Edefault { public void testH5Epop() throws Throwable { long num_msg = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -419,7 +419,7 @@ public class TestH5Edefault { @Test public void testH5EprintInt() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -463,7 +463,7 @@ public class TestH5Edefault { public void testH5Eclear2_with_msg() { long num_msg = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -526,7 +526,7 @@ public class TestH5Edefault { public void testH5Eget_num_with_msg() { long num_msg = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index b39dbef..71d1431 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -34,21 +34,39 @@ OK (28 tests) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file - major: File accessibilty - minor: Unable to open file - #001: (file name) line (number) in H5F_open(): unable to retrieve VFL class - major: File accessibilty - minor: Can't get value - #002: (file name) line (number) in H5FD_get_class(): can't find object for ID - major: Object atom - minor: Unable to find atom information (already closed?) + major: File accessibility + minor: Unable to open file + #001: (file name) line (number) in H5VL_file_open(): open failed + major: Virtual Object Layer + minor: Unable to initialize object + #002: (file name) line (number) in H5VL_native_file_open(): unable to open file + major: File accessibility + minor: Unable to open file + #003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 + major: File accessibility + minor: Unable to open file + #004: (file name) line (number) in H5FD_open(): open failed + major: Virtual File Layer + minor: Unable to initialize object + #005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 + major: File accessibility + minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file - major: File accessibilty - minor: Unable to open file - #001: (file name) line (number) in H5F_open(): unable to retrieve VFL class - major: File accessibilty - minor: Can't get value - #002: (file name) line (number) in H5FD_get_class(): can't find object for ID - major: Object atom - minor: Unable to find atom information (already closed?) + major: File accessibility + minor: Unable to open file + #001: (file name) line (number) in H5VL_file_open(): open failed + major: Virtual Object Layer + minor: Unable to initialize object + #002: (file name) line (number) in H5VL_native_file_open(): unable to open file + major: File accessibility + minor: Unable to open file + #003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 + major: File accessibility + minor: Unable to open file + #004: (file name) line (number) in H5FD_open(): open failed + major: Virtual File Layer + minor: Unable to initialize object + #005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 + major: File accessibility + minor: Unable to open file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3370c99..7045012 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -184,6 +184,14 @@ set (H5EA_HDRS IDE_GENERATED_PROPERTIES ("H5EA" "${H5EA_HDRS}" "${H5EA_SOURCES}" ) +set (H5ES_SOURCES +) +set (H5ES_HDRS + ${HDF5_SRC_DIR}/H5ESpublic.h +) +IDE_GENERATED_PROPERTIES ("H5ES" "${H5ES_HDRS}" "${H5ES_SOURCES}" ) + + set (H5F_SOURCES ${HDF5_SRC_DIR}/H5F.c ${HDF5_SRC_DIR}/H5Faccum.c @@ -652,6 +660,18 @@ set (H5UC_HDRS IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SOURCES}" ) +set (H5VL_SOURCES + ${HDF5_SRC_DIR}/H5VL.c + ${HDF5_SRC_DIR}/H5VLint.c + ${HDF5_SRC_DIR}/H5VLnative.c +) +set (H5VL_HDRS + ${HDF5_SRC_DIR}/H5VLpkg.h + ${HDF5_SRC_DIR}/H5VLnative.h + ${HDF5_SRC_DIR}/H5VLpublic.h +) +IDE_GENERATED_PROPERTIES ("H5VL" "${H5VL_HDRS}" "${H5VL_SOURCES}" ) + set (H5VM_SOURCES ${HDF5_SRC_DIR}/H5VM.c ) @@ -731,6 +751,7 @@ set (common_SRCS ${H5ST_SOURCES} ${H5T_SOURCES} ${H5TS_SOURCES} + ${H5VL_SOURCES} ${H5VM_SOURCES} ${H5WB_SOURCES} ${H5Z_SOURCES} @@ -746,6 +767,7 @@ set (H5_PUBLIC_HEADERS ${H5D_HDRS} ${H5E_HDRS} ${H5EA_HDRS} + ${H5ES_HDRS} ${H5F_HDRS} ${H5FA_HDRS} ${H5FD_HDRS} @@ -767,6 +789,7 @@ set (H5_PUBLIC_HEADERS ${H5S_HDRS} ${H5SM_HDRS} ${H5T_HDRS} + ${H5VL_HDRS} ${H5Z_HDRS} ) @@ -812,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}/H5VLprivate.h ${HDF5_SRC_DIR}/H5VMprivate.h ${HDF5_SRC_DIR}/H5WBprivate.h ${HDF5_SRC_DIR}/H5Zprivate.h diff --git a/src/H5.c b/src/H5.c index 32af55b..d1967e6 100644 --- a/src/H5.c +++ b/src/H5.c @@ -173,6 +173,7 @@ H5_init_library(void) H5_debug_g.pkg[H5_PKG_S].name = "s"; H5_debug_g.pkg[H5_PKG_T].name = "t"; H5_debug_g.pkg[H5_PKG_V].name = "v"; + H5_debug_g.pkg[H5_PKG_VL].name = "vl"; H5_debug_g.pkg[H5_PKG_Z].name = "z"; /* @@ -213,6 +214,8 @@ H5_init_library(void) */ if(H5E_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface") + if(H5VL_init() < 0) + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize vol interface") if(H5P_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface") if(H5T_init() < 0) @@ -344,6 +347,7 @@ H5_term_library(void) pending += DOWN(AC); pending += DOWN(Z); pending += DOWN(FD); + pending += DOWN(VL); pending += DOWN(PL); /* Don't shut down the error code until other APIs which use it are shut down */ if(pending == 0) diff --git a/src/H5A.c b/src/H5A.c index 6f810be..3ac7ca2 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -31,6 +31,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5Sprivate.h" /* Dataspace functions */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -251,10 +252,10 @@ hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id) { - H5A_t *attr = NULL; /* Attribute created */ - H5G_loc_t loc; /* Object location */ - H5T_t *type; /* Datatype to use for attribute */ - H5S_t *space; /* Dataspace to use for attribute */ + void *attr = NULL; /* Attribute created */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -263,35 +264,50 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file") if(!attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be NULL") if(!*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be an empty string") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a type") - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") + + /* Get correct property list */ + if(H5P_DEFAULT == acpl_id) + acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT; /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Get the property list structure for the acpl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + /* Create the attribute */ - if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) + if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name, + acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5A__close(attr) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -333,10 +349,10 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id) { - H5A_t *attr = NULL; /* Attribute created */ - H5G_loc_t loc; /* Object location */ - H5T_t *type; /* Datatype to use for attribute */ - H5S_t *space; /* Dataspace to use for attribute */ + void *attr = NULL; /* attr token from VOL plugin */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -346,18 +362,14 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a type") - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") + + /* Get correct property list */ + if(H5P_DEFAULT == acpl_id) + acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT; /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) @@ -369,18 +381,39 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5CX_set_lapl(lapl_id); } + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + + /* Set up location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = obj_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))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Create the attribute */ - if(NULL == (attr = H5A__create_by_name(&loc, obj_name, attr_name, type, space, acpl_id))) + if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name, + acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5A__close(attr) < 0) + if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -409,8 +442,9 @@ done: hid_t H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute opened */ + void *attr = NULL; /* attr token from VOL driver */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) @@ -419,8 +453,6 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") if(!*attr_name) @@ -430,18 +462,27 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Open the attribute */ - if(NULL == (attr = H5A__open(&loc, attr_name))) + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5A__close(attr) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -473,8 +514,9 @@ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute opened */ + void *attr = NULL; /* attr token from VOL driver */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) @@ -483,8 +525,6 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(!attr_name || !*attr_name) @@ -500,19 +540,32 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); } + else + lapl_id = H5P_LINK_ACCESS_DEFAULT; + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if (NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5A__open_by_name(&loc, obj_name, attr_name))) + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5A__close(attr) < 0) + if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -547,8 +600,9 @@ hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id) { - H5A_t *attr = NULL; /* Attribute opened */ - H5G_loc_t loc; /* Object location */ + void *attr = NULL; /* Attribute opened */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -558,8 +612,6 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -577,19 +629,35 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") H5CX_set_lapl(lapl_id); } + else + lapl_id = H5P_LINK_ACCESS_DEFAULT; + + /* Fill in location struct parameters */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = obj_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n))) + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5A__close(attr) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -615,17 +683,16 @@ done: herr_t H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) { - H5A_t *attr; /* Attribute object for ID */ - H5T_t *mem_type; /* Memory datatype */ + H5VL_object_t *vol_obj; /* Attribute object for ID */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") - if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) + if(H5I_DATATYPE != H5I_get_type(dtype_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") @@ -635,7 +702,8 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Write the attribute data */ - if((ret_value = H5A__write(attr, mem_type, buf)) < 0) + if((ret_value = H5VL_attr_write(vol_obj->data, vol_obj->driver->cls, + dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: @@ -662,23 +730,23 @@ done: herr_t H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) { - H5A_t *attr; /* Attribute object for ID */ - H5T_t *mem_type; /* Memory datatype */ + H5VL_object_t *vol_obj; /* Attribute object for ID */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") - if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) + if(H5I_DATATYPE != H5I_get_type(dtype_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") /* Read the attribute data */ - if((ret_value = H5A__read(attr, mem_type, buf)) < 0) + if((ret_value = H5VL_attr_read(vol_obj->data, vol_obj->driver->cls, + dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: @@ -705,18 +773,19 @@ done: hid_t H5Aget_space(hid_t attr_id) { - H5A_t *attr = NULL; /* Attribute object for ID */ + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the dataspace */ - if((ret_value = H5A_get_space(attr)) < 0) + if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_SPACE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute") done: @@ -743,18 +812,19 @@ done: hid_t H5Aget_type(hid_t attr_id) { - H5A_t *attr = NULL; /* Attribute object for ID */ + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the datatype */ - if((ret_value = H5A__get_type(attr)) < 0) + if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_TYPE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute") done: @@ -784,7 +854,7 @@ done: hid_t H5Aget_create_plist(hid_t attr_id) { - H5A_t *attr = NULL; /* Attribute object for ID */ + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -793,11 +863,12 @@ H5Aget_create_plist(hid_t attr_id) HDassert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1); /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the acpl */ - if((ret_value = H5A__get_create_plist(attr)) < 0) + if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_ACPL, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute") done: @@ -829,20 +900,27 @@ done: ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) { - H5A_t *attr = NULL; /* Attribute object for ID */ + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ + H5VL_loc_params_t loc_params; ssize_t ret_value = -1; FUNC_ENTER_API((-1)) H5TRACE3("Zs", "iz*s", attr_id, buf_size, buf); /* check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an attribute") if(!buf && buf_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero") + /* Set location struct parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(attr_id); + /* Get the attribute name */ - if((ret_value = H5A__get_name(attr, buf_size, buf)) < 0) + if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + loc_params, buf_size, buf, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") done: @@ -872,8 +950,8 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute object for name */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -883,8 +961,6 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Check args */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -896,25 +972,24 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + /* Get the object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Get the length of the name */ - ret_value = (ssize_t)HDstrlen(attr->shared->name); + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = obj_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); - /* Get the name and store in the user's buffer */ - if(name) { - HDstrncpy(name, attr->shared->name, MIN((size_t)(ret_value + 1), size)); - if((size_t)ret_value >= size) - name[size - 1]='\0'; - } + /* Get the name */ + if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name") done: - /* Release resources */ - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") - FUNC_LEAVE_API(ret_value) } /* end H5Aget_name_by_idx() */ @@ -939,18 +1014,20 @@ done: hsize_t H5Aget_storage_size(hid_t attr_id) { - H5A_t *attr; /* Attribute object for ID */ + H5VL_object_t *vol_obj; hsize_t ret_value; /* Return value */ FUNC_ENTER_API(0) H5TRACE1("h", "i", attr_id); /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") /* Get the storage size */ - ret_value = attr->shared->data_size; + if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_STORAGE_SIZE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl") done: FUNC_LEAVE_API(ret_value) @@ -973,18 +1050,23 @@ done: herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) { - H5A_t *attr; /* Attribute object for name */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", attr_id, ainfo); /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(attr_id); + /* Get the attribute information */ - if(H5A__get_info(attr, ainfo) < 0) + if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1009,8 +1091,8 @@ herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5A_info_t *ainfo, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute object for name */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1019,8 +1101,6 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Check args */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) @@ -1032,19 +1112,21 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_name(&loc, obj_name, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5A__get_info(attr, ainfo) < 0) + if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: - /* Release resources */ - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") - FUNC_LEAVE_API(ret_value) } /* end H5Aget_info_by_name() */ @@ -1067,8 +1149,8 @@ herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5A_info_t *ainfo, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute object for name */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1078,8 +1160,6 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Check args */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -1093,19 +1173,24 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = obj_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5A__get_info(attr, ainfo) < 0) + if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: - /* Release resources */ - if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") - FUNC_LEAVE_API(ret_value) } /* end H5Aget_info_by_idx() */ @@ -1138,9 +1223,14 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_name, new_name)) { - H5G_loc_t loc; /* Object location */ - - if(H5G_loc(loc_id, &loc) < 0) + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; + + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ @@ -1148,7 +1238,8 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Rename the attribute */ - if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } @@ -1191,18 +1282,25 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Get the location object */ - if(H5G_loc(loc_id, &loc) < 0) + if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Rename the attribute */ - if(H5A__rename_by_name(loc, obj_name, old_attr_name, new_attr_name) < 0) + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } @@ -1256,6 +1354,8 @@ herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data) { + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1269,9 +1369,18 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the loc object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Iterate over attributes */ - if((ret_value = H5A__iterate(loc_id, idx_type, order, idx, op, op_data)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + idx_type, order, idx, op, op_data)) < 0) + HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: FUNC_LEAVE_API(ret_value) @@ -1326,7 +1435,8 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1336,8 +1446,6 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -1349,9 +1457,20 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* get the loc object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Iterate over attributes */ - if((ret_value = H5A__iterate_by_name(&loc, obj_name, idx_type, order, idx, op, op_data)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed"); + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + idx_type, order, idx, op, op_data)) < 0) + HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -1375,7 +1494,8 @@ done: herr_t H5Adelete(hid_t loc_id, const char *name) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj = NULL; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1384,8 +1504,6 @@ H5Adelete(hid_t loc_id, const char *name) /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") if(!*name) @@ -1395,8 +1513,17 @@ H5Adelete(hid_t loc_id, const char *name) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Delete the attribute */ - if(H5O__attr_remove(loc.oloc, name) < 0) + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1424,7 +1551,8 @@ herr_t H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1433,8 +1561,6 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) @@ -1444,8 +1570,19 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Delete the attribute */ - if(H5A__delete_by_name(&loc, obj_name, attr_name) < 0) + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1481,7 +1618,8 @@ herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1490,8 +1628,6 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -1503,8 +1639,21 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Delete the attribute from the location */ - if(H5A__delete_by_idx(&loc, obj_name, idx_type, order, n) < 0) + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = obj_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Delete the attribute through the VOL */ + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1561,7 +1710,8 @@ done: htri_t H5Aexists(hid_t obj_id, const char *attr_name) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1570,13 +1720,19 @@ H5Aexists(hid_t obj_id, const char *attr_name) /* Check arguments */ if(H5I_ATTR == H5I_get_type(obj_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + /* get the object */ + if(NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + /* Check if the attribute exists */ - if((ret_value = H5O__attr_exists(loc.oloc, attr_name)) < 0) + if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -1601,7 +1757,8 @@ htri_t H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1610,8 +1767,6 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) @@ -1621,8 +1776,18 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* get the object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Check existence of attribute */ - if((ret_value = H5A__exists_by_name(loc, obj_name, attr_name)) < 0) + if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index e88c8c3..47983ea 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -43,6 +43,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ +#include "H5VLprivate.h" /* Virtual object layer */ /****************/ @@ -113,10 +114,10 @@ hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id) { - H5A_t *attr = NULL; /* Attribute created */ - H5G_loc_t loc; /* Object location */ - H5T_t *type; /* Datatype to use for attribute */ - H5S_t *space; /* Dataspace to use for attribute */ + void *attr = NULL; /* attr token from VOL plugin */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -125,33 +126,48 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, H5I_INVALID_HID, "no write intent on file") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a type") - if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read") + /* Get correct property list */ + if(H5P_DEFAULT == acpl_id) + acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT; + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Create the attribute */ - if(NULL == (attr = H5A__create(&loc, name, type, space, acpl_id))) + if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, + acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5A__close(attr) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -183,8 +199,9 @@ done: hid_t H5Aopen_name(hid_t loc_id, const char *name) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute opened */ + void *attr = NULL; /* attr token from VOL plugin */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -193,23 +210,30 @@ H5Aopen_name(hid_t loc_id, const char *name) /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if (NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Open the attribute */ - if(NULL == (attr = H5A__open_by_name(&loc, ".", name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute: '%s'", name) + if (NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") + if ((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5A__close(attr) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -241,8 +265,9 @@ done: hid_t H5Aopen_idx(hid_t loc_id, unsigned idx) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute opened */ + void *attr = NULL; /* attr token from VOL plugin */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -250,22 +275,34 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) /* Check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = "."; + loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_CRT_ORDER; + loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; + loc_params.loc_data.loc_by_idx.n = (hsize_t)idx; + loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5A__open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx))) + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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 = H5I_register(H5I_ATTR, attr, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5A__close(attr) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -293,56 +330,27 @@ done: int H5Aget_num_attrs(hid_t loc_id) { - H5O_loc_t *loc; /* Object location for attribute */ - void *obj; + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; + H5O_info_t oinfo; int ret_value = -1; FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", loc_id); - if(H5I_BADID == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "bad location ID") - if(H5I_FILE == H5I_get_type(loc_id) || H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "location is not valid for an attribute") - if(NULL == (obj = H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADATOM, (-1), "illegal object atom") - - switch(H5I_get_type (loc_id)) { - case H5I_DATASET: - if(NULL == (loc = H5D_oloc((H5D_t*)obj))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "can't get location for object") - break; - - case H5I_DATATYPE: - if(NULL == (loc = H5T_oloc((H5T_t*)obj))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "target datatype is not committed") - break; - - case H5I_GROUP: - if(NULL == (loc = H5G_oloc((H5G_t*)obj))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "can't get location for object") - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_ATTR: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "inappropriate attribute target") - } - - /* Look up the # of attributes for the object */ - if((ret_value = H5O__attr_count(loc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, (-1), "can't get attribute count for object") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + + /* Get the number of attributes for the object */ + if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object") + + H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Aint.c b/src/H5Aint.c index 8268a01..80a3e98 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -42,6 +42,8 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative.h" /* Native VOL driver */ /****************/ @@ -404,11 +406,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__open + * Function: H5A__open * - * Purpose: Open an attribute in an object header + * Purpose: Open an attribute in an object header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 9, 2017 @@ -917,8 +919,18 @@ H5A__get_type(H5A_t *attr) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to lock transient datatype") /* Atomize */ - if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") + if (H5T_is_named(dt)) { + /* If this is a committed datatype, we need to recreate the + * two level IDs, where the VOL object is a copy of the + * returned datatype + */ + if ((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + } + else { + if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") + } done: if(H5I_INVALID_HID == ret_value) @@ -1134,20 +1146,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5A__close_cb(H5A_t *attr) +H5A__close_cb(H5VL_object_t *attr_vol_obj) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(attr); - HDassert(attr->shared); + HDassert(attr_vol_obj); /* Close the attribute */ - if(H5A__close(attr) < 0) + if((ret_value = H5VL_attr_close(attr_vol_obj->data, attr_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute") + /* Free the VOL object */ + if(H5VL_free_object(attr_vol_obj) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__close_cb() */ @@ -2339,7 +2354,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, HDassert(file_src); HDassert(file_dst); - if(H5T_is_named(attr_src->shared->dt)) { + if (H5T_is_named(attr_src->shared->dt)) { H5O_loc_t *src_oloc_dt; /* Pointer to source datatype's object location */ H5O_loc_t *dst_oloc_dt; /* Pointer to dest. datatype's object location */ @@ -2596,16 +2611,20 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 6, 2017 - * *------------------------------------------------------------------------- */ herr_t -H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, +H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data) { + H5G_loc_t obj_loc; /* Location used to open group */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ + hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t obj_loc_id = (-1); /* ID for object located */ H5A_attr_iter_op_t attr_op; /* Attribute operator */ + void *temp_obj = NULL; + H5I_type_t obj_type; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2614,11 +2633,37 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, attr_op.op_type = H5A_ATTR_OP_APP2; attr_op.u.app_op2 = op; + /* Set up opened group location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object's location */ + if(H5G_loc_find(loc, obj_name, &obj_loc) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found"); + loc_found = TRUE; + + /* Open the object */ + if(NULL == (temp_obj = H5O_open_by_loc(&obj_loc, &obj_type))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object"); + + /* Get an ID for the object */ + if((obj_loc_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype"); + /* Call internal attribute iteration routine */ - if((ret_value = H5A__iterate_common(loc_id, idx_type, order, idx, &attr_op, op_data)) < 0) + if((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") done: + /* Release resources */ + if(obj_loc_id != H5I_INVALID_HID) { + if(H5I_dec_app_ref(obj_loc_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object"); + } + else if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location"); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__iterate() */ @@ -2668,67 +2713,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__iterate_by_name - * - * Purpose: Private version of H5Aiterate_by_name - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, - void *op_data) -{ - H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ - hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - hid_t obj_loc_id = (-1); /* ID for object located */ - H5A_attr_iter_op_t attr_op; /* Attribute operator */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); - - /* Find the object's location */ - if(H5G_loc_find(loc, obj_name, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") - loc_found = TRUE; - - /* Open the object */ - if((obj_loc_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object") - - /* Build attribute operator info */ - attr_op.op_type = H5A_ATTR_OP_APP2; - attr_op.u.app_op2 = op; - - /* Call attribute iteration routine */ - if((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") - -done: - /* Release resources */ - if(obj_loc_id > 0) { - if(H5I_dec_app_ref(obj_loc_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - } - else if(loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5A__iterate_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5A__delete_by_name * * Purpose: Private version of H5Adelete_by_name diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 85f0254..91061cd 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -198,16 +198,13 @@ H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo); H5_DLL hid_t H5A__get_create_plist(H5A_t* attr); H5_DLL herr_t H5A__free(H5A_t *attr); H5_DLL herr_t H5A__close(H5A_t *attr); -H5_DLL herr_t H5A__close_cb(H5A_t *attr); +H5_DLL herr_t H5A__close_cb(H5VL_object_t *attr_vol_obj); H5_DLL htri_t H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo); H5_DLL herr_t H5A__set_version(const H5F_t *f, H5A_t *attr); H5_DLL herr_t H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name, const char *new_attr_name); -H5_DLL herr_t H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, +H5_DLL herr_t H5A__iterate(const H5G_loc_t *loc, const char *obj_name,H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data); -H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, - void *op_data); #ifndef H5_NO_DEPRECATED_SYMBOLS H5_DLL herr_t H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data); diff --git a/src/H5Atest.c b/src/H5Atest.c index 36c3d35..6fc1cbf 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -38,6 +38,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5SMprivate.h" /* Shared object header messages */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -96,7 +97,7 @@ H5A__is_shared_test(hid_t attr_id) FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* Check if attribute is shared */ @@ -129,7 +130,7 @@ H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count) FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if(NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* Push API context */ diff --git a/src/H5CX.c b/src/H5CX.c index faf0b24..e08ca2f 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -2472,7 +2472,11 @@ H5CX__pop_common(void) H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ H5CX_node_t *ret_value = NULL; /* Return value */ +#ifdef H5_HAVE_PARALLEL FUNC_ENTER_STATIC +#else + FUNC_ENTER_STATIC_NOERR +#endif /* Sanity check */ HDassert(head && *head); diff --git a/src/H5Ctest.c b/src/H5Ctest.c index 9da6350..340071a 100644 --- a/src/H5Ctest.c +++ b/src/H5Ctest.c @@ -40,6 +40,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -142,7 +143,7 @@ H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status) FUNC_ENTER_PACKAGE /* Get file pointer */ - if(NULL == (f = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) + if(NULL == (f = (H5F_t *)H5VL_object_verify(fid, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Get cache pointer */ diff --git a/src/H5D.c b/src/H5D.c index af99a1f..9f56197 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -27,6 +27,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -102,9 +103,10 @@ hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id) { - H5D_t *dset = NULL; /* New dataset's info */ - H5G_loc_t loc; /* Object location to insert dataset into */ - const H5S_t *space; /* Dataspace for dataset */ + void *dset = NULL; /* New dataset's info */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist = NULL; /* Property list pointer */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -112,16 +114,10 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, dapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") if(!*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") - if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID") - if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID") /* Get link creation property list */ if(H5P_DEFAULT == lcpl_id) @@ -141,17 +137,38 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Get the property list structure for the dcpl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + /* Create the dataset */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id))) + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, + name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: if(H5I_INVALID_HID == ret_value) - if(dset && H5D_close(dset) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -194,21 +211,16 @@ hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id) { - H5G_loc_t loc; /* Object location to insert dataset into */ - H5D_t *dset = NULL; /* New dataset's info */ - const H5S_t *space; /* Dataspace for dataset */ + void *dset = NULL; /* dset token from VOL plugin */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "iiiii", loc_id, type_id, space_id, dcpl_id, dapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID") - if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID") - if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID") if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else @@ -219,31 +231,38 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + /* Create the dataset */ - if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, + NULL, dcpl_id, dapl_id, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: - /* Release the dataset's object header, if it was created */ - if(dset) { - H5O_loc_t *oloc; /* Object location for dataset */ - - /* Get the new dataset's object location */ - if(NULL == (oloc = H5D_oloc(dset))) - HDONE_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get object location of dataset") - - /* Decrement refcount on dataset's object header in memory */ - if(H5O_dec_rc_by_loc(oloc) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on newly created object") - } /* end if */ - /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(dset && H5D_close(dset) < 0) + if(dset && H5VL_dataset_close (dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -268,16 +287,15 @@ done: hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { - H5D_t *dset = NULL; - H5G_loc_t loc; /* Object location of group */ + void *dset = NULL; /* dset token from VOL plugin */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, dapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") if(!*name) @@ -287,17 +305,26 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set the location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + /* Open the dataset */ - if(NULL == (dset = H5D__open_name(&loc, name, dapl_id))) + if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, + dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Register an atom for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: if(H5I_INVALID_HID == ret_value) - if(dset && H5D_close(dset) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -323,7 +350,7 @@ H5Dclose(hid_t dset_id) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == H5I_object_verify(dset_id, H5I_DATASET)) + if(H5I_DATASET != H5I_get_type(dset_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID") /* Decrement the counter on the dataset. It will be freed if the count @@ -353,18 +380,19 @@ done: hid_t H5Dget_space(hid_t dset_id) { - H5D_t *dset = NULL; /* Dataset structure */ + H5VL_object_t *vol_obj = NULL; /* Dataset structure */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataspace */ - if((ret_value = H5D__get_space(dset)) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") done: @@ -384,18 +412,19 @@ done: herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) { - H5D_t *dset = NULL; /* Dataset structure */ + H5VL_object_t *vol_obj = NULL; /* Dataset structure */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Ds", dset_id, allocation); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Get dataspace status */ - if(H5D__get_space_status(dset, allocation) < 0) + if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE_STATUS, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") done: @@ -419,18 +448,19 @@ done: hid_t H5Dget_type(hid_t dset_id) { - H5D_t *dset; /* Dataset structure */ + H5VL_object_t *vol_obj; /* Dataset structure */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* get the datatype */ - if((ret_value = H5D__get_type(dset)) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_TYPE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: @@ -457,18 +487,19 @@ done: hid_t H5Dget_create_plist(hid_t dset_id) { - H5D_t *dataset; /* Dataset structure */ + H5VL_object_t *vol_obj; /* Dataset structure */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ - if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset creation property list */ - if((ret_value = H5D_get_create_plist(dataset)) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DCPL, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") done: @@ -512,18 +543,19 @@ done: hid_t H5Dget_access_plist(hid_t dset_id) { - H5D_t *dset; /* Dataset structure */ + H5VL_object_t *vol_obj; /* Dataset structure */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset access property list */ - if((ret_value = H5D_get_access_plist(dset)) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DAPL, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") done: @@ -549,18 +581,19 @@ done: hsize_t H5Dget_storage_size(hid_t dset_id) { - H5D_t *dset; /* Dataset for this operation */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_API(0) H5TRACE1("h", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") /* Get the storage size */ - if(H5D__get_storage_size(dset, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_STORAGE_SIZE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") done: @@ -582,18 +615,20 @@ done: haddr_t H5Dget_offset(hid_t dset_id) { - H5D_t *dset; /* Dataset for this operation */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_API(HADDR_UNDEF) H5TRACE1("a", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") /* Get the offset */ - ret_value = H5D__get_offset(dset); + if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_OFFSET, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") done: FUNC_LEAVE_API(ret_value) @@ -775,8 +810,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size) { H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0}; - H5D_t *dset; /* Dataset for this operation */ - H5S_t *fspace = NULL; /* Dataset's dataspace */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ H5S_t *mspace = NULL; /* Memory dataspace */ char bogus; /* bogus value to pass to H5Diterate() */ H5S_t *space; /* Dataspace for iteration */ @@ -791,7 +825,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, if(H5I_DATASET != H5I_get_type(dataset_id) || H5I_DATATYPE != H5I_get_type(type_id) || size == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") - if(NULL == (dset = (H5D_t *)H5I_object(dataset_id))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(dataset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") @@ -801,21 +835,20 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") /* Save the dataset */ - vlen_bufsize.dset = dset; + vlen_bufsize.dset_vol_obj = vol_obj; vlen_bufsize.fspace_id = H5I_INVALID_HID; vlen_bufsize.mspace_id = H5I_INVALID_HID; /* Get a copy of the dataset's dataspace */ - if(NULL == (fspace = H5S_copy(dset->shared->space, FALSE, TRUE))) + if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") - if((vlen_bufsize.fspace_id = H5I_register(H5I_DATASPACE, fspace, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register file dataspace") /* Create a scalar for the memory dataspace */ if(NULL == (mspace = H5S_create(H5S_SCALAR))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register memory dataspace") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") /* Grab the temporary buffers required */ if(NULL == (vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1))) @@ -842,17 +875,14 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, *size = vlen_bufsize.size; done: - if(ret_value < 0) { - if(fspace && H5S_close(fspace) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release file dataspace") + if(ret_value < 0) if(mspace && H5S_close(mspace) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release memory dataspace") - } + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") if(vlen_bufsize.fspace_id && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing file dataspace id") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") if(vlen_bufsize.mspace_id && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing memory dataspace id") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") if(vlen_bufsize.fl_tbuf != NULL) vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); if(vlen_bufsize.vl_tbuf != NULL) @@ -875,14 +905,14 @@ done: herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]) { - H5D_t *dset; /* Dataset for this operation */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", dset_id, size); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") if(!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size array cannot be NULL") @@ -892,7 +922,8 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set the extent */ - if(H5D__set_extent(dset, size) < 0) + if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") done: @@ -912,22 +943,26 @@ done: herr_t H5Dflush(hid_t dset_id) { - H5D_t *dset; /* Dataset for this operation */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Flush dataset information cached in memory */ - if(H5D__flush(dset, dset_id) < 0) + /* Flush dataset information cached in memory + * XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t + * callback needs it and that's in the public API. + */ + if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_FLUSH, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") done: @@ -947,14 +982,14 @@ done: herr_t H5Drefresh(hid_t dset_id) { - H5D_t *dset; /* Dataset for this operation */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") /* Set up collective metadata if appropriate */ @@ -962,7 +997,8 @@ H5Drefresh(hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Refresh the dataset object */ - if((H5D__refresh(dset_id, dset)) < 0) + if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_REFRESH, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") done: @@ -990,47 +1026,24 @@ done: herr_t H5Dformat_convert(hid_t dset_id) { - H5D_t *dset; /* Dataset for this operation */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") - switch(dset->shared->layout.type) { - case H5D_CHUNKED: - /* Convert the chunk indexing type to version 1 B-tree if not */ - if(dset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE) - if((H5D__format_convert(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade chunk indexing type for dataset") - break; - - case H5D_CONTIGUOUS: - case H5D_COMPACT: - /* Downgrade the layout version to 3 if greater than 3 */ - if(dset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT) - if((H5D__format_convert(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade layout version for dataset") - break; - - case H5D_VIRTUAL: - /* Nothing to do even though layout is version 4 */ - break; - - case H5D_LAYOUT_ERROR: - case H5D_NLAYOUTS: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") - - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") - } /* end switch */ + /* Convert the dataset */ + if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") done: FUNC_LEAVE_API(ret_value) @@ -1052,25 +1065,22 @@ done: herr_t H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type) { - H5D_t *dset; /* Dataset for this operation */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Dk", dset_id, idx_type); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") if(NULL == idx_type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") - /* Should be a chunked dataset */ - if(dset->shared->layout.type != H5D_CHUNKED) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked") - /* Get the chunk indexing type */ - if(idx_type) - *idx_type = dset->shared->layout.u.chunk.idx_type; + if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") done: FUNC_LEAVE_API(ret_value) @@ -1095,25 +1105,23 @@ done: herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes) { - H5D_t *dset; /* Dataset for this operation */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes); /* Check arguments */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") if(NULL == offset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset parameter cannot be NULL") if(NULL == chunk_nbytes) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") - if(H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") - /* Get the dataset creation property list */ - if(H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0) + if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") done: diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 7220868..d11a5d8 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -26,6 +26,7 @@ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -79,7 +80,7 @@ H5Ddebug(hid_t dset_id) H5TRACE1("e", "i", dset_id); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") /* Print B-tree information */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index ed520c4..4abba93 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -40,6 +40,7 @@ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* VOL plugins */ /****************/ @@ -112,9 +113,11 @@ hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) { - H5G_loc_t loc; /* Object location to insert dataset into */ - H5D_t *dset = NULL; /* New dataset's info */ - const H5S_t *space; /* Dataspace for dataset */ + void *dset = NULL; /* dset token from VOL plugin */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -126,12 +129,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") if(!*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location ID") - if(H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype ID") - if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace ID") + if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else @@ -142,17 +140,38 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Build and open the new dataset */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, dapl_id))) + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for datatype id") + if(H5P_set(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id") + if(H5P_set(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for lcpl id") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Create the dataset through the VOL */ + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, dcpl_id, + H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: if (H5I_INVALID_HID == ret_value) - if(dset && H5D_close(dset) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -179,8 +198,9 @@ done: hid_t H5Dopen1(hid_t loc_id, const char *name) { - H5D_t *dset = NULL; - H5G_loc_t loc; /* Object location of group */ + void *dset = NULL; /* dset token from VOL plugin */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -191,20 +211,27 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") if (!*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the dataset */ - if(NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT))) + if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, + H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Get an atom for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: if(H5I_INVALID_HID == ret_value) - if(dset && H5D_close(dset) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -230,37 +257,64 @@ done: herr_t H5Dextend(hid_t dset_id, const hsize_t size[]) { - H5D_t *dset; /* Pointer to dataset to modify */ - hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Dataset structure */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + H5S_t *ds = NULL; /* Dataspace struct */ + int ndims; /* Dataset/space rank */ + hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ + int i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", dset_id, size); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") if(!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") - /* Make certain that the dataset dimensions don't decrease */ - /* (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) */ - if(H5S_get_simple_extent_dims(dset->shared->space, dset_dims, NULL) < 0) + /* Get the dataspace pointer for the dataset */ + if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace") + if(H5I_INVALID_HID == sid) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset") + if(NULL == (ds = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get dataspace structure from ID") + + /* Get the dataset's current extent */ + if(H5S_get_simple_extent_dims(ds, dset_dims, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") - for(u = 0; u < dset->shared->ndims; u++) - if(size[u] > dset_dims[u]) - dset_dims[u] = size[u]; + + /* Get the dataset dimensions */ + ndims = H5S_GET_EXTENT_NDIMS(ds); + + /* Make certain that the dataset dimensions don't decrease in any dimension. + * + * (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) + * + * XXX (VOL_MERGE): I feel like we should fail here instead of just silently + * not doing what we're supposed to do. + */ + for(i = 0; i < ndims; i++) + if(size[i] > dset_dims[i]) + dset_dims[i] = size[i]; /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Increase size */ - if(H5D__set_extent(dset, dset_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset") + if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset") done: + /* Close the dataspace */ + if(sid != H5I_INVALID_HID && H5I_dec_app_ref(sid) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close dataspace") + FUNC_LEAVE_API(ret_value) } /* end H5Dextend() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 9af391e..3436105 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -30,6 +30,8 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative.h" /* Native VOL driver */ /****************/ @@ -57,7 +59,7 @@ static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); -static herr_t H5D__close_cb(H5D_t *dset); +static herr_t H5D__close_cb(H5VL_object_t *dset_vol_obj); /*********************/ @@ -289,23 +291,29 @@ H5D_term_package(void) *------------------------------------------------------------------------- */ static herr_t -H5D__close_cb(H5D_t *dset) +H5D__close_cb(H5VL_object_t *dset_vol_obj) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Sanity check */ - HDassert(dset); - HDassert(dset->oloc.file); - HDassert(dset->shared); - HDassert(dset->shared->fo_count > 0); + HDassert(dset_vol_obj); /* Close the dataset */ - if(H5D_close(dset) < 0) + if(H5VL_dataset_close(dset_vol_obj->data, dset_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset"); done: + /* XXX: (MSC) Weird thing for datasets and filters: + * Always decrement the ref count on the VOL for datasets, since + * the ID is removed even if the close fails. + */ + + /* Free the VOL object */ + if(H5VL_free_object(dset_vol_obj) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object"); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__close_cb() */ @@ -943,7 +951,8 @@ H5D_t * H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id) { - const H5T_t *type; /* Datatype for dataset */ + const H5T_t *type = NULL; /* Datatype for dataset (VOL pointer) */ + H5T_t *dt = NULL; /* Datatype for dataset (non-VOL pointer) */ H5D_t *new_dset = NULL; H5P_genplist_t *dc_plist = NULL; /* New Property list */ hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */ @@ -964,8 +973,10 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); /* Get the dataset's datatype */ - if(NULL == (type = (const H5T_t *)H5I_object(type_id))) + if(NULL == (dt = (const H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + /* If this is a named datatype, get the pointer via the VOL driver */ + type = (const H5T_t *)H5T_get_actual_type(dt); /* Check if the datatype is "sensible" for use in a dataset */ if(H5T_is_sensible(type) != TRUE) @@ -1812,11 +1823,13 @@ H5D_mult_refresh_close(hid_t dset_id) FUNC_ENTER_NOAPI(FAIL) - if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if(NULL == (dataset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") /* check args */ - HDassert(dataset && dataset->oloc.file && dataset->shared); + HDassert(dataset); + HDassert(dataset->oloc.file); + HDassert(dataset->shared); HDassert(dataset->shared->fo_count > 0); if(dataset->shared->fo_count > 1) { @@ -2422,8 +2435,8 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data) { H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)op_data; + H5VL_object_t *vol_obj = vlen_bufsize->dset_vol_obj; H5T_t *dt; /* Datatype for operation */ - H5S_t *mspace; /* Memory dataspace for operation */ H5S_t *fspace; /* File dataspace for operation */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2440,10 +2453,6 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, if(NULL == (vlen_bufsize->fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf") - /* Get the memory dataspace from the ID */ - if(NULL == (mspace = (H5S_t *)H5I_object_verify(vlen_bufsize->mspace_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - /* Select point to read in */ if(NULL == (fspace = (H5S_t *)H5I_object_verify(vlen_bufsize->fspace_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") @@ -2451,7 +2460,10 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ - if(H5D__read(vlen_bufsize->dset, type_id, mspace, fspace, vlen_bufsize->fl_tbuf) < 0) + if(H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls, + type_id, vlen_bufsize->mspace_id, + vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, + vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: @@ -3384,8 +3396,19 @@ H5D__get_type(const H5D_t *dset) if(H5T_lock(dt, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to lock transient datatype") - if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") + /* Create an atom */ + if(H5T_is_named(dt)) { + /* If this is a committed datatype, we need to recreate the + * two-level IDs, where the VOL object is a copy of the + * returned datatype. + */ + if((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") + } + else { + if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") + } done: if(ret_value < 0) diff --git a/src/H5Dio.c b/src/H5Dio.c index 88a9e4b..b6d4f1b 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -163,26 +163,22 @@ herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf/*out*/) { - H5D_t *dset = NULL; - const H5S_t *mem_space = NULL; - const H5S_t *file_space = NULL; + H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); + /* Check arguments */ + if (mem_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid memory dataspace ID") + if (file_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file dataspace ID") + /* Get dataset pointer */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") - if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - - /* Get validated dataspace pointers */ - if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") - if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) @@ -195,7 +191,8 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Read the data */ - if (H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0) + if ((ret_value = H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id, + file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") done: @@ -219,20 +216,15 @@ herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf) { - H5D_t *dset = NULL; - hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ + H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf); /* Check arguments */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") - if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL") if (!offset) @@ -250,14 +242,9 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Copy the user's offset array so we can be sure it's terminated properly. - * (we don't want to mess with the user's buffer). - */ - if (H5D__get_offset_copy(dset, offset, offset_copy) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") - /* Read the raw chunk */ - if (H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0) + if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id, + H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") done: @@ -298,28 +285,24 @@ done: */ herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t dxpl_id, const void *buf) + hid_t file_space_id, hid_t dxpl_id, const void *buf) { - H5D_t *dset = NULL; - const H5S_t *mem_space = NULL; - const H5S_t *file_space = NULL; + H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); + /* Check arguments */ + if (mem_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid memory dataspace ID") + if (file_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file dataspace ID") + /* Get dataset pointer */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") - if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - - /* Get validated dataspace pointers */ - if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") - if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) @@ -332,7 +315,8 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Write the data */ - if (H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0) + if ((ret_value = H5VL_dataset_write(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id, + file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") done: @@ -356,8 +340,7 @@ herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size, const void *buf) { - H5D_t *dset = NULL; - hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ + H5VL_object_t *vol_obj = NULL; uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ herr_t ret_value = SUCCEED; /* Return value */ @@ -365,12 +348,8 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf); /* Check arguments */ - if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID") - if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL") if (!offset) @@ -393,14 +372,9 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Copy the user's offset array so we can be sure it's terminated properly. - * (we don't want to mess with the user's buffer). - */ - if (H5D__get_offset_copy(dset, offset, offset_copy) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") - /* Write chunk */ - if (H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0) + if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id, + H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: diff --git a/src/H5Doh.c b/src/H5Doh.c index 38d0914..017bab7 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -29,6 +29,7 @@ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -47,7 +48,7 @@ static void *H5O__dset_get_copy_file_udata(void); static void H5O__dset_free_copy_file_udata(void *); static htri_t H5O__dset_isa(const H5O_t *loc); -static hid_t H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref); +static void *H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type); static void *H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc); static H5O_loc_t *H5O__dset_get_oloc(hid_t obj_id); static herr_t H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh, @@ -217,17 +218,19 @@ done: * *------------------------------------------------------------------------- */ -static hid_t -H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref) +static void * +H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) { - H5D_t *dset = NULL; /* Dataset opened */ - hid_t dapl_id; /* dapl to use to open this dataset */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5D_t *dset = NULL; /* Dataset opened */ + hid_t dapl_id; /* dapl to use to open this dataset */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC HDassert(obj_loc); + *opened_type = H5I_DATASET; + /* Get the LAPL (which is a superclass of DAPLs) from the API context, but * if it's the default link access property list or a custom link access * property list but not a dataset access property list, use the default @@ -242,9 +245,9 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref) /* Check class of LAPL from API context */ if((is_lapl = H5P_isa_class(dapl_id, H5P_LINK_ACCESS)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get LAPL status") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get LAPL status") if((is_dapl = H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get DAPL status") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get DAPL status") /* Switch to default DAPL if not an actual DAPL in the API context */ if(!is_dapl && is_lapl) @@ -253,16 +256,14 @@ H5O__dset_open(const H5G_loc_t *obj_loc, hbool_t app_ref) /* Open the dataset */ if(NULL == (dset = H5D_open(obj_loc, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset") - /* Register an ID for the dataset */ - if((ret_value = H5I_register(H5I_DATASET, dset, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") + ret_value = (void *)dset; done: - if(H5I_INVALID_HID == ret_value) + if(NULL == ret_value) if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataset") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dset_open() */ @@ -339,7 +340,7 @@ H5O__dset_get_oloc(hid_t obj_id) FUNC_ENTER_STATIC /* Get the dataset */ - if(NULL == (dset = (H5D_t *)H5I_object(obj_id))) + if(NULL == (dset = (H5D_t *)H5VL_object(obj_id))) HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") /* Get the dataset's object header location */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 591fcb1..c84c245 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -110,6 +110,15 @@ typedef struct H5D_type_info_t { hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */ } H5D_type_info_t; +/* types for dataset optional VOL operations */ +typedef enum H5VL_dataset_optional_t { + H5VL_DATASET_FORMAT_CONVERT, /* H5Dformat_convert (internal) */ + H5VL_DATASET_GET_CHUNK_INDEX_TYPE, /* H5Dget_chunk_index_type */ + H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, /* H5Dget_chunk_storage_size */ + H5VL_DATASET_CHUNK_READ, /* H5Dchunk_read */ + H5VL_DATASET_CHUNK_WRITE, /* H5Dchunk_write */ +} H5VL_dataset_optional_t; + /* Forward declaration of structs used below */ struct H5D_io_info_t; struct H5D_chunk_map_t; @@ -510,7 +519,7 @@ typedef struct H5D_fill_buf_info_t { /* Internal data structure for computing variable-length dataset's total size */ typedef struct { - H5D_t *dset; /* Dataset for operation */ + H5VL_object_t *dset_vol_obj; /* VOL object for the dataset */ hid_t fspace_id; /* File dataspace ID of the dataset we are working on */ hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */ void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ diff --git a/src/H5Dtest.c b/src/H5Dtest.c index ac1d05a..916ec72 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -32,6 +32,7 @@ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -88,7 +89,7 @@ H5D__layout_version_test(hid_t did, unsigned *version) FUNC_ENTER_PACKAGE /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") if(version) @@ -127,7 +128,7 @@ H5D__layout_contig_size_test(hid_t did, hsize_t *size) FUNC_ENTER_PACKAGE /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") if(size) { @@ -168,7 +169,7 @@ H5D__layout_compact_dirty_test(hid_t did, hbool_t *dirty) FUNC_ENTER_PACKAGE /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") if(dirty) { @@ -211,7 +212,7 @@ H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type) HDassert(layout_type); /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(layout_type) @@ -250,7 +251,7 @@ H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type) FUNC_ENTER_PACKAGE /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(dset->shared->layout.type != H5D_CHUNKED) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked") @@ -291,7 +292,7 @@ H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused) FUNC_ENTER_PACKAGE /* Check args */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") if(nbytes_used) { diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 8867492..89974b2 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -58,7 +58,8 @@ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property Lists */ #include "H5Sprivate.h" /* Dataspaces */ - +#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ @@ -2961,27 +2962,38 @@ done: static herr_t H5D__virtual_refresh_source_dset(H5D_t **dset) { - hid_t temp_id; /* Temporary dataset identifier */ - herr_t ret_value = SUCCEED; /* Return value */ + hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */ + hid_t native_vol_id = H5I_INVALID_HID; /* ID for the native VOL driver */ + H5VL_object_t *vol_obj = NULL; /* VOL object stored with the ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Sanity check */ HDassert(dset && *dset); + /* Get the native VOL driver's ID */ + if((native_vol_id = H5VL_native_get_driver_id()) < 0) + 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 = H5I_register(H5I_DATASET, *dset, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register source dataset ID") + if((temp_id = H5VL_object_register(*dset, H5I_DATASET, native_vol_id, FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID") /* Refresh source dataset */ if(H5D__refresh(temp_id, *dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset") /* Discard the identifier & replace the dataset */ - if(NULL == (*dset = (H5D_t *)H5I_remove(temp_id))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID") + *dset = (H5D_t *)(vol_obj->data); + vol_obj->data = NULL; done: + if(vol_obj && H5VL_free_object(vol_obj) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_refresh_source_dsets() */ diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h new file mode 100644 index 0000000..cb8eebf --- /dev/null +++ b/src/H5ESpublic.h @@ -0,0 +1,53 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5ESpublic_H +#define _H5ESpublic_H + +/* Public headers needed by this file */ +#include "H5public.h" /* Generic Functions */ + +/*****************/ +/* Public Macros */ +/*****************/ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* Asynchronous operation status */ +typedef enum H5ES_status_t { + H5ES_STATUS_IN_PROGRESS, /* Operation has not yet completed */ + H5ES_STATUS_SUCCEED, /* Operation has completed, successfully */ + H5ES_STATUS_FAIL, /* Operation has completed, but failed */ + H5ES_STATUS_CANCEL /* Operation has not completed and has been cancelled */ +} H5ES_status_t; + + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _H5ESpublic_H */ + diff --git a/src/H5F.c b/src/H5F.c index 97330e5..9258830 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -29,12 +29,14 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ +#include "H5FLprivate.h" /* Free lists */ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5Tprivate.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -55,7 +57,13 @@ /* Local Prototypes */ /********************/ -static herr_t H5F__close_cb(H5F_t *f); +static herr_t H5F__close_cb(H5VL_object_t *file_vol_obj); + +/* Callback for getting object counts in a file */ +static int H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key); + +/* Callback for getting IDs for open objects in a file */ +static int H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key); /*********************/ @@ -75,6 +83,11 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Local Variables */ /*******************/ +/* Declare a free list to manage the H5VL_t struct */ +H5FL_EXTERN(H5VL_t); + +/* Declare a free list to manage the H5VL_object_t struct */ +H5FL_EXTERN(H5VL_object_t); /* File ID class */ static const H5I_class_t H5I_FILE_CLS[1] = {{ @@ -176,42 +189,22 @@ H5F_term_package(void) *------------------------------------------------------------------------- */ static herr_t -H5F__close_cb(H5F_t *f) +H5F__close_cb(H5VL_object_t *file_vol_obj) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Sanity check */ - HDassert(f); - HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */ - - /* Perform checks for "semi" file close degree here, since closing the - * file is not allowed if there are objects still open. - */ - if(f->shared->fc_degree == H5F_CLOSE_SEMI) { - unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */ - unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */ - - /* Get the number of open objects and open files on this file/mount hierarchy */ - if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0) - HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy") - - /* If there are no other file IDs open on this file/mount hier., but - * there are still open objects, issue an error and bail out now, - * without decrementing the file ID's reference count and triggering - * a "real" attempt at closing the file. - */ - if(nopen_files == 1 && nopen_objs > 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open") - } /* end if */ + HDassert(file_vol_obj); - /* Reset the file ID for this file */ - f->file_id = -1; + /* Close the file */ + if(H5VL_file_close(file_vol_obj->data, file_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); - /* Attempt to close the file/mount hierarchy */ - if(H5F_try_close(f, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + /* Free the VOL object */ + if(H5VL_free_object(file_vol_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -235,21 +228,19 @@ done: hid_t H5Fget_create_plist(hid_t file_id) { - H5F_t *file; /* File info */ - H5P_genplist_t *plist; /* Property list */ + H5VL_object_t *vol_obj; /* File info */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") - if(NULL == (plist = (H5P_genplist_t *)H5I_object(file->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Retrieve the file creation property list */ - if((ret_value = H5P_copy_plist(plist, TRUE)) < 0) + if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FCPL, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") done: @@ -278,18 +269,19 @@ done: hid_t H5Fget_access_plist(hid_t file_id) { - H5F_t *file; /* File info */ + H5VL_object_t *vol_obj; /* File info */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ - if((ret_value = H5F_get_access_plist(file, TRUE)) < 0) + if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FAPL, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") done: @@ -351,19 +343,16 @@ H5Fget_obj_count(hid_t file_id, unsigned types) * count the IDs in the file. */ if(file_id != (hid_t)H5F_OBJ_ALL) { - H5F_t *f = NULL; - size_t obj_count = 0; + H5VL_object_t *vol_obj; /* Get the file object */ - if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id") /* Get the count */ - if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0) + if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_COUNT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)") - - /* Set the return value */ - ret_value = (ssize_t)obj_count; } /* If we passed in the 'special' ID, get the count for everything open in the * library, iterating over all open files and getting the object count for each. @@ -466,19 +455,16 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) * get the IDs from the file. */ if(file_id != (hid_t)H5F_OBJ_ALL) { - H5F_t *file = NULL; - size_t obj_id_count = 0; + H5VL_object_t *vol_obj; /* get the file object */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the IDs */ - if(H5F_get_obj_ids(file, types, max_objs, oid_list, TRUE, &obj_id_count) < 0) + if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_IDS, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") - - /* Set the return value */ - ret_value = (ssize_t)obj_id_count; } /* If we passed in the 'special' ID, get the count for everything open in the * library, iterating over all open files and getting the object count for each. @@ -491,6 +477,8 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) else { H5F_trav_obj_ids_t udata; + /* XXX (VOL MERGE): Unclear why this is commented out */ + //udata.types = types | H5F_OBJ_LOCAL; udata.max_objs = max_objs; udata.oid_list = oid_list; udata.obj_count = &ret_value; @@ -535,7 +523,7 @@ done: herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) { - H5F_t *file; /* File info */ + H5VL_object_t *vol_obj; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -546,11 +534,12 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer") /* Get the file object */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5F_get_vfd_handle(file, fapl_id, file_handle) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: @@ -559,38 +548,41 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fis_hdf5 + * Function: H5Fis_accessible * - * Purpose: Check the file signature to detect an HDF5 file. - * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. + * Purpose: Check if the file can be opened with the given fapl. * * Return: TRUE/FALSE/FAIL * *------------------------------------------------------------------------- */ htri_t -H5Fis_hdf5(const char *name) +H5Fis_accessible(const char *name, hid_t fapl_id) { htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE1("t", "*s", name); + H5TRACE2("t", "*si", name, fapl_id); /* Check args */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") - /* call the private is_HDF5 function */ - /* (Should not trigger raw data I/O - QAK, 2018/01/03) */ - if((ret_value = H5F__is_hdf5(name)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable open file") + /* Check the file access property list */ + if(H5P_DEFAULT == fapl_id) + fapl_id = H5P_FILE_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + + /* Check if file is accessible */ + if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") done: FUNC_LEAVE_API(ret_value) -} /* end H5Fis_hdf5() */ +} /* end H5Fis_accessible() */ /*------------------------------------------------------------------------- @@ -621,7 +613,12 @@ done: hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5F_t *new_file = NULL; /* file struct for new file */ + void *new_file = NULL; /* file struct for new file */ + + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */ + H5VL_t *driver = NULL; /* VOL driver struct */ + H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -652,6 +649,14 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get vol driver info") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID") + /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for * reading and writing. @@ -660,21 +665,24 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) flags |= H5F_ACC_EXCL; /*default*/ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; - /* Create a new file or truncate an existing file. */ - if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id))) + /* Create a new file or truncate an existing file through the VOL */ + if(NULL == (new_file = H5VL_file_create(cls, filename, flags, fcpl_id, fapl_id, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") - /* Get an atom for the file */ - if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file") + /* Setup VOL driver struct */ + if(NULL == (driver = H5FL_CALLOC(H5VL_t))) + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct") + driver->cls = cls; + driver->id = driver_prop.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") - /* Keep this ID in file object structure */ - new_file->file_id = ret_value; + /* Get an atom for the file */ + if((ret_value = H5VL_register_id(H5I_FILE, new_file, driver, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: - if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file") - FUNC_LEAVE_API(ret_value) } /* end H5Fcreate() */ @@ -701,8 +709,12 @@ done: hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - H5F_t *new_file = NULL; /* file struct for new file */ - hid_t ret_value; /* return value */ + void *new_file = NULL; /* file struct for new file */ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_class_t *cls = NULL; /* VOL class structure for callback info */ + H5VL_t *driver = NULL; /* VOL driver struct */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -714,6 +726,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if((flags & ~H5F_ACC_PUBLIC_FLAGS) || (flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags") + /* XXX (VOL MERGE): Might want to move SWMR flag checks to H5F_open() */ /* Asking for SWMR write access on a read-only file is invalid */ if((flags & H5F_ACC_SWMR_WRITE) && 0 == (flags & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "SWMR write access on a file open for read-only access is not allowed") @@ -725,21 +738,31 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Open the file */ - if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) + /* Get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL driver info") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL driver ID") + + /* Open the file through the VOL layer */ + if(NULL == (new_file = H5VL_file_open(cls, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Get an atom for the file */ - if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + /* Setup VOL driver struct */ + if(NULL == (driver = H5FL_CALLOC(H5VL_t))) + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct") + driver->cls = cls; + driver->id = driver_prop.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") - /* Keep this ID in file object structure */ - new_file->file_id = ret_value; + /* Get an ID for the file */ + if((ret_value = H5VL_register_id(H5I_FILE, new_file, driver, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: - if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file") - FUNC_LEAVE_API(ret_value) } /* end H5Fopen() */ @@ -758,108 +781,28 @@ done: herr_t H5Fflush(hid_t object_id, H5F_scope_t scope) { - H5F_t *f = NULL; /* File to flush */ - H5O_loc_t *oloc = NULL; /* Object location for ID */ + H5VL_object_t *vol_obj = NULL; /* Object info */ + H5I_type_t obj_type; /* Type of object */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "iFs", object_id, scope); - switch(H5I_get_type(object_id)) { - case H5I_FILE: - if(NULL == (f = (H5F_t *)H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - break; - - case H5I_GROUP: - { - H5G_t *grp; - - if(NULL == (grp = (H5G_t *)H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") - oloc = H5G_oloc(grp); - } - break; - - case H5I_DATATYPE: - { - H5T_t *type; - - if(NULL == (type = (H5T_t *)H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid type identifier") - oloc = H5T_oloc(type); - } - break; - - case H5I_DATASET: - { - H5D_t *dset; - - if(NULL == (dset = (H5D_t *)H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") - oloc = H5D_oloc(dset); - } - break; - - case H5I_ATTR: - { - H5A_t *attr; - - if(NULL == (attr = (H5A_t *)H5I_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") - oloc = H5A_oloc(attr); - } - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_DATASPACE: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - } /* end switch */ - - if(!f) { - if(!oloc) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not assocated with a file") - f = oloc->file; - } /* end if */ - if(!f) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not associated with a file") + /* Get the type of object we're flushing + sanity check */ + obj_type = H5I_get_type(object_id); + if(H5I_FILE != obj_type && H5I_GROUP != obj_type && H5I_DATATYPE != obj_type && + H5I_DATASET != obj_type && H5I_ATTR != obj_type) { + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + } - /* Flush the file */ - /* - * Nothing to do if the file is read only. This determination is - * made at the shared open(2) flags level, implying that opening a - * file twice, once for read-only and once for read-write, and then - * calling H5Fflush() with the read-only handle, still causes data - * to be flushed. - */ - if(H5F_ACC_RDWR & H5F_INTENT(f)) { - hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */ - - /* Verify access property list and set up collective metadata if appropriate */ - if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, object_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info") - - /* Flush other files, depending on scope */ - if(H5F_SCOPE_GLOBAL == scope) { - /* Call the flush routine for mounted file hierarchies */ - if(H5F_flush_mounts(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") - } /* end if */ - else - /* Call the flush routine, for this file */ - if(H5F__flush(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") - } /* end if */ + /* get the file object */ + if(NULL == (vol_obj = H5VL_get_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Flush the object */ + if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_FLUSH, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") done: FUNC_LEAVE_API(ret_value) @@ -892,9 +835,11 @@ H5Fclose(hid_t file_id) if(H5I_FILE != H5I_get_type(file_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") - /* Close the file */ - if(H5F__close(file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "closing file ID failed") + /* Decrement reference count on atom. When it reaches zero the file will + * be closed. + */ + if(H5I_dec_app_ref(file_id) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed") done: FUNC_LEAVE_API(ret_value) @@ -919,33 +864,32 @@ done: hid_t H5Freopen(hid_t file_id) { - H5F_t *old_file = NULL; - H5F_t *new_file = NULL; + H5VL_object_t *vol_obj = NULL; + void *file; /* File token from VOL driver */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* Get the file object */ - if(NULL == (old_file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Reopen the file */ - if(NULL == (new_file = H5F__reopen(old_file))) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_REOPEN, &file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL driver") + + /* Make sure that worked */ + if(NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") /* Get an atom for the file */ - if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_FILE, file, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") - /* Keep this ID in file object structure */ - new_file->file_id = ret_value; - done: - if(H5I_INVALID_HID == ret_value) - if(new_file && H5F__dest(new_file, FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "can't close file") - + /* XXX (VOL MERGE): If registration fails, file will not be closed */ FUNC_LEAVE_API(ret_value) } /* end H5Freopen() */ @@ -970,31 +914,17 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) /* If no intent flags were passed in, exit quietly */ if(intent_flags) { - H5F_t *file; /* Pointer to file structure */ + H5VL_object_t *vol_obj; /* File info */ /* Get the internal file structure */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - - /* HDF5 uses some flags internally that users don't know about. - * Simplify things for them so that they only get either H5F_ACC_RDWR - * or H5F_ACC_RDONLY. - */ - if(H5F_INTENT(file) & H5F_ACC_RDWR) { - *intent_flags = H5F_ACC_RDWR; - - /* Check for SWMR write access on the file */ - if(H5F_INTENT(file) & H5F_ACC_SWMR_WRITE) - *intent_flags |= H5F_ACC_SWMR_WRITE; - } /* end if */ - else { - *intent_flags = H5F_ACC_RDONLY; + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - /* Check for SWMR read access on the file */ - if(H5F_INTENT(file) & H5F_ACC_SWMR_READ) - *intent_flags |= H5F_ACC_SWMR_READ; - } /* end else */ - } /* end if */ + /* Get the flags */ + if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_INTENT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags") + } done: FUNC_LEAVE_API(ret_value) @@ -1015,23 +945,21 @@ done: hssize_t H5Fget_freespace(hid_t file_id) { - H5F_t *file; /* File object for file ID */ - hsize_t tot_space; /* Amount of free space in the file */ + H5VL_object_t *vol_obj = NULL; hssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Hs", "i", file_id); /* Get the file object */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the amount of free space in the file */ - if(H5MF_get_freespace(file, &tot_space, NULL) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") - ret_value = (hssize_t)tot_space; - done: FUNC_LEAVE_API(ret_value) } /* end H5Fget_freespace() */ @@ -1051,9 +979,7 @@ done: herr_t H5Fget_filesize(hid_t file_id, hsize_t *size) { - H5F_t *file; /* File object for file ID */ - haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */ - haddr_t base_addr; /* Base address for the file */ + H5VL_object_t *vol_obj; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1062,18 +988,13 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) /* Check args */ if(!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size parameter cannot be NULL") - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Get the actual file size */ - if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") - - base_addr = H5FD_get_base_addr(file->shared->lf); - - /* Convert relative base address for file to absolute address */ - if(size) - *size = (hsize_t)(max_eof_eoa + base_addr); + /* Get the file size */ + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") done: FUNC_LEAVE_API(ret_value) @@ -1122,19 +1043,19 @@ done: ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj; /* File object for file ID */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") /* Get the file image */ - /* (Should not trigger raw data I/O - QAK, 2018/01/03) */ - if((ret_value = H5F__get_file_image(file, buf_ptr, buf_len)) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: @@ -1159,20 +1080,23 @@ done: herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") if((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + /* Get the metadata cache configuration */ - if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: @@ -1194,18 +1118,19 @@ done: herr_t H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); /* Get the file object */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set the metadata cache configuration */ - if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") done: @@ -1228,21 +1153,21 @@ done: herr_t H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*d", file_id, hit_rate_ptr); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(NULL == hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the current hit rate */ - if(H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: @@ -1267,8 +1192,7 @@ herr_t H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, int *cur_num_entries_ptr) { - H5F_t *file; /* File object for file ID */ - uint32_t cur_num_entries; + H5VL_object_t *vol_obj; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1276,17 +1200,15 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the size data */ - if(H5AC_get_cache_size(file->shared->cache, max_size_ptr, - min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, + max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") - if(cur_num_entries_ptr != NULL) - *cur_num_entries_ptr = (int)cur_num_entries; - done: FUNC_LEAVE_API(ret_value) } /* H5Fget_mdc_size() */ @@ -1311,18 +1233,19 @@ done: herr_t H5Freset_mdc_hit_rate_stats(hid_t file_id) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Get the file object */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ - if(H5AC_reset_cache_hit_rate_stats(file->shared->cache) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") done: @@ -1354,40 +1277,26 @@ done: ssize_t H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) { - H5F_t *f; /* Top file in mount hierarchy */ - size_t len; + H5VL_object_t *vol_obj = NULL; + H5I_type_t type; ssize_t ret_value = -1; FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", obj_id, name, size); - /* For file IDs, get the file object directly */ - /* (This prevents the H5G_loc() call from returning the file pointer for - * the top file in a mount hierarchy) - */ - if(H5I_get_type(obj_id) == H5I_FILE ) { - if(NULL == (f = (H5F_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file") - } /* end if */ - else { - H5G_loc_t loc; /* Object location */ - - /* Get symbol table entry */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a valid object ID") - f = loc.oloc->file; - } /* end else */ - - len = HDstrlen(H5F_OPEN_NAME(f)); + /* Check the type */ + type = H5I_get_type(obj_id); + if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file or file object") - if(name) { - HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size)); - if(len >= size) - name[size-1]='\0'; - } /* end if */ + /* Get the file object */ + if(NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") - /* Set return value */ - ret_value = (ssize_t)len; + /* Get the filename via the VOL */ + if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_NAME, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name") done: FUNC_LEAVE_API(ret_value) @@ -1410,7 +1319,7 @@ done: herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) { - H5F_t *f; /* Top file in mount hierarchy */ + H5VL_object_t *vol_obj = NULL; H5I_type_t type; herr_t ret_value = SUCCEED; /* Return value */ @@ -1427,25 +1336,12 @@ 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(type == H5I_FILE ) { - /* For file IDs, get the file object directly */ - /* (This prevents the H5G_loc() call from returning the file pointer for - * the top file in a mount hierarchy) - */ - if(NULL == (f = (H5F_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - } /* end if */ - else { - H5G_loc_t loc; /* Object location */ - - /* Get symbol table entry */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object identifier") - f = loc.oloc->file; - } /* end else */ + if(NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5F__get_info(f, finfo) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") done: @@ -1466,7 +1362,7 @@ done: herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj = NULL; /* File object for file ID */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1477,11 +1373,12 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Get the file pointer */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5F_get_metadata_read_retry_info(file, info) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") done: @@ -1507,20 +1404,21 @@ ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/) { - H5F_t *file; + H5VL_object_t *vol_obj = NULL; ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") if(sect_info && nsects == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ - if((ret_value = H5MF_get_free_sections(file, type, nsects, sect_info)) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: @@ -1542,21 +1440,20 @@ done: herr_t H5Fclear_elink_file_cache(hid_t file_id) { - H5F_t *file; /* File */ + H5VL_object_t *vol_obj; /* File */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* See if there's an EFC */ - if(file->shared->efc) - /* Release the EFC */ - if(H5F__efc_release(file->shared->efc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") + /* Release the EFC */ + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") done: FUNC_LEAVE_API(ret_value) @@ -1600,14 +1497,14 @@ done: herr_t H5Fstart_swmr_write(hid_t file_id) { - H5F_t *file = NULL; /* File info */ + H5VL_object_t *vol_obj = NULL; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Set up collective metadata if appropriate */ @@ -1615,7 +1512,8 @@ H5Fstart_swmr_write(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* start SWMR writing */ - if(H5F__start_swmr_write(file) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: @@ -1636,18 +1534,19 @@ done: herr_t H5Fstart_mdc_logging(hid_t file_id) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Sanity check */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5C_start_logging(file->shared->cache) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") done: @@ -1669,18 +1568,19 @@ done: herr_t H5Fstop_mdc_logging(hid_t file_id) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Sanity check */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5C_stop_logging(file->shared->cache) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") done: @@ -1703,18 +1603,19 @@ herr_t H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hbool_t *is_currently_logging) { - H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*b*b", file_id, is_enabled, is_currently_logging); /* Sanity check */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5C_get_logging_status(file->shared->cache, is_enabled, is_currently_logging) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") done: @@ -1734,9 +1635,12 @@ done: * *------------------------------------------------------------------------- */ +/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional' + */ herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) { + H5VL_object_t *vol_obj; /* File as VOL object */ H5F_t *f; /* File */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1744,8 +1648,9 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) H5TRACE3("e", "iFvFv", file_id, low, high); /* Check args */ - if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") + f = (H5F_t *)(vol_obj->data); /* Set up collective metadata if appropriate */ if(H5CX_set_loc(file_id) < 0) @@ -1774,26 +1679,23 @@ done: herr_t H5Fformat_convert(hid_t file_id) { - H5F_t *f = NULL; /* File */ + H5VL_object_t *vol_obj = NULL; /* File */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Check args */ - if(H5I_FILE != H5I_get_type(file_id)) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier") - /* Get file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - /* Set up collective metadata if appropriate */ if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the format */ - if(H5F__format_convert(f) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") done: @@ -1813,20 +1715,19 @@ done: herr_t H5Freset_page_buffering_stats(hid_t file_id) { - H5F_t *file; /* File to reset stats on */ + H5VL_object_t *vol_obj; /* File to reset stats on */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object(file_id))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(NULL == file->shared->page_buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "page buffering not enabled on file") /* Reset the statistics */ - if(H5PB_reset_stats(file->shared->page_buf) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") done: @@ -1847,23 +1748,23 @@ herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]) { - H5F_t *file; /* File object */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File object */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*Iu*Iu*Iu*Iu*Iu", file_id, accesses, hits, misses, evictions, bypasses); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(NULL == file->shared->page_buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "page buffering not enabled on file") if(NULL == accesses || NULL == hits || NULL == misses || NULL == evictions || NULL == bypasses) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats") /* Get the statistics */ - if(H5PB_get_stats(file->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, + accesses, hits, misses, evictions, bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") done: @@ -1894,7 +1795,7 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len) H5TRACE3("e", "i*a*h", file_id, image_addr, image_len); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") if(NULL == image_addr || NULL == image_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL image addr or image len") @@ -1929,7 +1830,7 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa) H5TRACE2("e", "i*a", file_id, eoa); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* This public routine will work only for drivers with this feature enabled.*/ @@ -1968,7 +1869,7 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment) H5TRACE2("e", "ih", file_id, increment); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* This public routine will work only for drivers with this feature enabled.*/ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index c91d0ea..6fee596 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -113,7 +113,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) * the top file in a mount hierarchy) */ if(H5I_get_type(obj_id) == H5I_FILE ) { - if(NULL == (f = (H5F_t *)H5I_object(obj_id))) + if(NULL == (f = (H5F_t *)H5VL_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") } else { @@ -141,6 +141,41 @@ done: /*------------------------------------------------------------------------- + * Function: H5Fis_hdf5 + * + * Purpose: Check the file signature to detect an HDF5 file. + * + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. + * + * Return: TRUE/FALSE/FAIL + * + *------------------------------------------------------------------------- + */ +htri_t +H5Fis_hdf5(const char *name) +{ + htri_t ret_value; /* Return value */ + + FUNC_ENTER_API((-1)) + H5TRACE1("t", "*s", name); + + /* Check args and all the boring stuff. */ + if(!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified") + + /* call the private is_HDF5 function */ + if((ret_value = H5F__is_hdf5(name, H5P_FILE_ACCESS_DEFAULT)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable open file") + +done: + + FUNC_LEAVE_API(ret_value) +} /* end H5Fis_hdf5() */ + + +/*------------------------------------------------------------------------- * Function: H5Fset_latest_format * * Purpose: Enable switching between latest or non-latest format while @@ -174,20 +209,24 @@ done: * *------------------------------------------------------------------------- */ +/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional'. + */ herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format) { - H5F_t *f; /* File */ - H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */ - H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File as VOL object */ + H5F_t *f; /* File */ + H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */ + H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ib", file_id, latest_format); /* Check args */ - if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") + f = (H5F_t *)(vol_obj->data); /* 'low' and 'high' are both initialized to LATEST. * If latest format is not expected, set 'low' to EARLIEST diff --git a/src/H5Fint.c b/src/H5Fint.c index 39934d6..230a744 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -37,6 +37,9 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ +#include "H5VLprivate.h" /* VOL drivers */ + +#include "H5VLnative.h" /* Native VOL driver */ /****************/ @@ -438,6 +441,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_DATASPACE: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -782,15 +786,11 @@ done: * * Purpose: Check the file signature to detect an HDF5 file. * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. - * * Return: TRUE/FALSE/FAIL *------------------------------------------------------------------------- */ htri_t -H5F__is_hdf5(const char *name) +H5F__is_hdf5(const char *name, hid_t fapl_id) { H5FD_t *file = NULL; /* Low-level file struct */ haddr_t sig_addr; /* Addess of hdf5 file signature */ @@ -799,7 +799,10 @@ H5F__is_hdf5(const char *name) FUNC_ENTER_PACKAGE /* Open the file */ - if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) + /* NOTE: This now uses the fapl_id that was passed in, so H5Fis_accessible() + * should work with arbitrary VFDs, unlike H5Fis_hdf5(). + */ + if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") /* The file is an hdf5 file if the hdf5 file signature can be found */ @@ -843,7 +846,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ if(NULL == (f = H5FL_CALLOC(H5F_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") - f->file_id = H5I_INVALID_HID; + f->id_exists = FALSE; if(shared) { HDassert(lf == NULL); @@ -1468,26 +1471,12 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) tent_flags = flags; if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) { - if(tent_flags == flags) { -#ifndef H5_USING_MEMCHECKER - time_t mytime = HDtime(NULL); - - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', tent_flags = %x", HDctime(&mytime), name, tent_flags) -#else /* H5_USING_MEMCHECKER */ + if(tent_flags == flags) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags) -#endif /* H5_USING_MEMCHECKER */ - } /* end if */ H5E_clear_stack(NULL); tent_flags = flags; - if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) { -#ifndef H5_USING_MEMCHECKER - time_t mytime = HDtime(NULL); - - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: time = %s, name = '%s', tent_flags = %x", HDctime(&mytime), name, tent_flags) -#else /* H5_USING_MEMCHECKER */ + if(NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", name, tent_flags) -#endif /* H5_USING_MEMCHECKER */ - } /* end if */ } /* end if */ /* Is the file already open? */ @@ -1893,41 +1882,60 @@ H5F__flush(H5F_t *f) /*------------------------------------------------------------------------- * Function: H5F__close * - * Purpose: Internal routine to close a file. + * Purpose: Closes a file or causes the close operation to be pended. + * This function is called two ways: from the API it gets called + * by H5Fclose->H5I_dec_ref->H5F__close when H5I_dec_ref() + * decrements the file ID reference count to zero. The file ID + * is removed from the H5I_FILE group by H5I_dec_ref() just + * before H5F__close() is called. If there are open object + * headers then the close is pended by moving the file to the + * H5I_FILE_CLOSING ID group (the f->closing contains the ID + * assigned to file). + * + * This function is also called directly from H5O_close() when + * the last object header is closed for the file and the file + * has a pending close. * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5F__close(hid_t file_id) +H5F__close(H5F_t *f) { - H5F_t *f; /* File pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - /* Flush file if this is the last reference to this id and we have write - * intent, unless it will be flushed by the "shared" file being closed. - * This is only necessary to replicate previous behaviour, and could be - * disabled by an option/property to improve performance. + /* Sanity check */ + HDassert(f); + + /* Perform checks for "semi" file close degree here, since closing the + * file is not allowed if there are objects still open. */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid file identifier") - if((f->shared->nrefs > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { - int nref; /* Number of references to file ID */ - - if((nref = H5I_get_ref(file_id, FALSE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get ID ref count") - if(nref == 1) - if(H5F__flush(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache") - } /* end if */ + if(f->shared->fc_degree == H5F_CLOSE_SEMI) { + unsigned nopen_files = 0; /* Number of open files in file/mount hierarchy */ + unsigned nopen_objs = 0; /* Number of open objects in file/mount hierarchy */ + + /* Get the number of open objects and open files on this file/mount hierarchy */ + if(H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0) + HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy") + + /* If there are no other file IDs open on this file/mount hier., but + * there are still open objects, issue an error and bail out now, + * without decrementing the file ID's reference count and triggering + * a "real" attempt at closing the file. + */ + if(nopen_files == 1 && nopen_objs > 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open") + } + + /* Reset the file ID for this file */ + f->id_exists = FALSE; - /* Decrement reference count on file ID */ - /* (When it reaches zero the file will be closed) */ - if(H5I_dec_app_ref(file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "decrementing file ID failed") + /* Attempt to close the file/mount hierarchy */ + if(H5F_try_close(f, NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2167,19 +2175,18 @@ H5F_get_id(H5F_t *file, hbool_t app_ref) HDassert(file); - if(file->file_id == -1) { - /* Get an atom for the file */ - if((file->file_id = H5I_register(H5I_FILE, file, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file") + if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) { + /* resurrect the ID - Register an ID with the native driver */ + if((ret_value = H5VL_native_register(H5I_FILE, file, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + file->id_exists = TRUE; } else { /* Increment reference count on existing ID */ - if(H5I_inc_ref(file->file_id, app_ref) < 0) + if(H5I_inc_ref(ret_value, app_ref) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") } - ret_value = file->file_id; - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_id() */ @@ -3228,6 +3235,7 @@ H5F__start_swmr_write(H5F_t *f) H5G_name_t *obj_paths = NULL; /* Group hierarchy path */ size_t u; /* Local index variable */ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ + H5VL_t *vol_driver = NULL; /* VOL driver for the file */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -3291,6 +3299,16 @@ H5F__start_swmr_write(H5F_t *f) if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") + /* Save the VOL driver for the refresh step */ + if(grp_dset_count > 0) { + H5VL_object_t *vol_obj = NULL; + + if(NULL == (vol_obj = H5VL_get_object(obj_ids[0]))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + vol_driver = vol_obj->driver; + } + /* Refresh opened objects (groups, datasets) in the file */ for(u = 0; u < grp_dset_count; u++) { H5O_loc_t *oloc; /* object location */ @@ -3353,7 +3371,7 @@ H5F__start_swmr_write(H5F_t *f) /* Refresh (reopen) the objects (groups & datasets) in the file */ for(u = 0; u < grp_dset_count; u++) { - if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], TRUE) < 0) + if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_driver, TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") } diff --git a/src/H5Fmount.c b/src/H5Fmount.c index e6106a2..310edd4 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -24,6 +24,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* PRIVATE PROTOTYPES */ static void H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); @@ -438,8 +439,8 @@ H5F_is_mount(const H5F_t *file) herr_t H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) { - H5G_loc_t loc; /* Parent location */ - H5F_t *child = NULL; /* Child object */ + H5VL_object_t *loc_vol_obj = NULL; /* Parent object */ + H5VL_object_t *child_vol_obj = NULL; /* Child object */ H5I_type_t loc_type; /* ID type of location */ H5I_type_t child_type; /* ID type of child */ herr_t ret_value = SUCCEED; /* Return value */ @@ -469,15 +470,20 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Get the location object */ - if(H5G_loc(loc_id, &loc) < 0) + if(NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") /* Get the child object */ - if(NULL == (child = (H5F_t *)H5I_object_verify(child_id, H5I_FILE))) + if(NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object") + /* Check if both objects are associated with the same VOL plugin */ + if(loc_vol_obj->driver->cls->value != child_vol_obj->driver->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL driver") + /* Perform the mount operation */ - if(H5F__mount(&loc, name, child, plist_id) < 0) + if(H5VL_file_specific(loc_vol_obj->data, loc_vol_obj->driver->cls, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") done: @@ -504,7 +510,7 @@ done: herr_t H5Funmount(hid_t loc_id, const char *name) { - H5G_loc_t loc; /* Parent location */ + H5VL_object_t *vol_obj = NULL; /* Parent object */ H5I_type_t loc_type; /* ID type of location */ herr_t ret_value = SUCCEED; /* Return value */ @@ -525,11 +531,12 @@ H5Funmount(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Get the location object */ - if(H5G_loc(loc_id, &loc) < 0) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") /* Perform the unmount operation */ - if(H5F__unmount(&loc, name) < 0) + if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_UNMOUNT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") done: @@ -563,7 +570,7 @@ H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_ob HDassert(nopen_objs); /* If this file is still open, increment number of file IDs open */ - if(f->file_id > 0) + if(H5F_ID_EXISTS(f)) *nopen_files += 1; /* Increment number of open objects in file diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 7620d95..6ddbfbb 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -231,7 +231,7 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag) H5TRACE2("e", "ib", file_id, flag); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Check VFD */ @@ -271,7 +271,7 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) H5TRACE2("e", "i*b", file_id, flag); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Check VFD */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 44344f0..f8ab5a9 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -31,6 +31,7 @@ /* Other public headers needed by this file */ #include "H5Bpublic.h" /* B-tree header (for H5B_NUM_BTREE_ID) */ +#include "H5VLpublic.h" /* Virtual Object Layer */ /* Other private headers needed by this file */ #include "H5private.h" /* Generic Functions */ @@ -367,7 +368,7 @@ struct H5F_t { H5F_file_t *shared; /* The shared file info */ unsigned nopen_objs; /* Number of open object headers */ H5FO_t *obj_count; /* # of time each object is opened through top file structure */ - hid_t file_id; /* ID of this file */ + hbool_t id_exists; /* Whether an ID for this struct exists */ hbool_t closing; /* File is in the process of being closed */ struct H5F_t *parent; /* Parent file that this file is mounted to */ unsigned nmounts; /* Number of children mounted to this file */ @@ -377,6 +378,34 @@ struct H5F_t { #endif /* H5_HAVE_PARALLEL */ }; +/* types for file optional VOL operations */ +typedef enum H5VL_file_optional_t { + H5VL_FILE_CLEAR_ELINK_CACHE, /* Clear external link cache */ + H5VL_FILE_GET_FILE_IMAGE, /* file image */ + H5VL_FILE_GET_FREE_SECTIONS, /* file free selections */ + H5VL_FILE_GET_FREE_SPACE, /* file freespace */ + H5VL_FILE_GET_INFO, /* file info */ + H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */ + H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */ + H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */ + H5VL_FILE_GET_SIZE, /* file size */ + H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */ + H5VL_FILE_REOPEN, /* reopen the file */ + H5VL_FILE_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */ + H5VL_FILE_SET_MDC_CONFIG, /* set metadata cache configuration */ + H5VL_FILE_GET_METADATA_READ_RETRY_INFO, + H5VL_FILE_START_SWMR_WRITE, + H5VL_FILE_START_MDC_LOGGING, + H5VL_FILE_STOP_MDC_LOGGING, + H5VL_FILE_GET_MDC_LOGGING_STATUS, + H5VL_FILE_SET_LATEST_FORMAT, + H5VL_FILE_FORMAT_CONVERT, + H5VL_FILE_RESET_PAGE_BUFFERING_STATS, + H5VL_FILE_GET_PAGE_BUFFERING_STATS, + H5VL_FILE_GET_MDC_IMAGE_INFO + +} H5VL_file_optional_t; + /* User data for traversal routine to get ID counts */ typedef struct { ssize_t *obj_count; /* number of objects counted so far */ @@ -384,6 +413,7 @@ typedef struct { } H5F_trav_obj_cnt_t; /* User data for traversal routine to get ID lists */ +/* XXX (VOL MERGE): Should the type of obj_count and max_objs be identical? */ typedef struct { size_t max_objs; hid_t *oid_list; @@ -411,12 +441,12 @@ H5_DLL H5F_t *H5F__reopen(H5F_t *f); H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); H5_DLL herr_t H5F__flush(H5F_t *f); -H5_DLL htri_t H5F__is_hdf5(const char *name); +H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id); H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); -H5_DLL herr_t H5F__close(hid_t file_id); +H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); /* File mount related routines */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 1ce9374..6595677 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -286,7 +286,7 @@ typedef struct H5F_t H5F_t; #define H5F_NOPEN_OBJS(F) ((F)->nopen_objs) #define H5F_INCR_NOPEN_OBJS(F) ((F)->nopen_objs++) #define H5F_DECR_NOPEN_OBJS(F) ((F)->nopen_objs--) -#define H5F_FILE_ID(F) ((F)->file_id) +#define H5F_ID_EXISTS(F) ((F)->id_exists) #define H5F_PARENT(F) ((F)->parent) #define H5F_NMOUNTS(F) ((F)->nmounts) #define H5F_GET_READ_ATTEMPTS(F) ((F)->shared->read_attempts) @@ -343,7 +343,7 @@ typedef struct H5F_t H5F_t; #define H5F_NOPEN_OBJS(F) (H5F_get_nopen_objs(F)) #define H5F_INCR_NOPEN_OBJS(F) (H5F_incr_nopen_objs(F)) #define H5F_DECR_NOPEN_OBJS(F) (H5F_decr_nopen_objs(F)) -#define H5F_FILE_ID(F) (H5F_get_file_id(F)) +#define H5F_ID_EXISTS(F) (H5F_file_id_exists(F)) #define H5F_PARENT(F) (H5F_get_parent(F)) #define H5F_NMOUNTS(F) (H5F_get_nmounts(F)) #define H5F_GET_READ_ATTEMPTS(F) (H5F_get_read_attempts(F)) @@ -479,6 +479,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */ #define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */ #define H5F_ACS_FILE_DRV_NAME "vfd_info" /* File driver ID & info */ +#define H5F_ACS_VOL_DRV_NAME "vol_driver_info" /* VOL driver ID & info */ #define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ #define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */ @@ -728,7 +729,7 @@ H5_DLL hbool_t H5F_same_shared(const H5F_t *f1, const H5F_t *f2); H5_DLL unsigned H5F_get_nopen_objs(const H5F_t *f); H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f); H5_DLL unsigned H5F_decr_nopen_objs(H5F_t *f); -H5_DLL hid_t H5F_get_file_id(const H5F_t *f); +H5_DLL hbool_t H5F_file_id_exists(const H5F_t *f); H5_DLL H5F_t *H5F_get_parent(const H5F_t *f); H5_DLL unsigned H5F_get_nmounts(const H5F_t *f); H5_DLL unsigned H5F_get_read_attempts(const H5F_t *f); diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 73c59f5..8e54e7f 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -223,7 +223,7 @@ extern "C" { #endif /* Functions in H5F.c */ -H5_DLL htri_t H5Fis_hdf5(const char *filename); +H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id); H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist); H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, @@ -303,6 +303,7 @@ typedef struct H5F_info1_t { /* Function prototypes */ H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo); H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format); +H5_DLL htri_t H5Fis_hdf5(const char *filename); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 2500ea8..b036974 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -277,23 +277,23 @@ H5F_get_nopen_objs(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_get_file_id + * Function: H5F_file_id_exists * - * Purpose: Retrieve the file's 'file_id' value + * Purpose: Determines if a file ID exists for this file struct * - * Return: 'file_id' on success/abort on failure (shouldn't fail) + * Return: TRUE/FALSE *------------------------------------------------------------------------- */ -hid_t -H5F_get_file_id(const H5F_t *f) +hbool_t +H5F_file_id_exists(const H5F_t *f) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(f); - FUNC_LEAVE_NOAPI(f->file_id) -} /* end H5F_get_file_id() */ + FUNC_LEAVE_NOAPI(f->id_exists) +} /* end H5F_file_id_exists() */ /*------------------------------------------------------------------------- diff --git a/src/H5Ftest.c b/src/H5Ftest.c index df9c933..1183284 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -44,6 +44,7 @@ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5SMpkg.h" /* Shared object header messages */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -103,7 +104,7 @@ H5F__get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_coun FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Push API context */ @@ -148,7 +149,7 @@ H5F__check_cached_stab_test(hid_t file_id) FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Push API context */ @@ -189,7 +190,7 @@ H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr) FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Retrieve maxaddr for file */ @@ -222,7 +223,7 @@ H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr) FUNC_ENTER_PACKAGE /* Check arguments */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Retrieve maxaddr for file */ diff --git a/src/H5G.c b/src/H5G.c index 361127f..772d567 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -87,6 +87,7 @@ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -108,6 +109,9 @@ /* Local Prototypes */ /********************/ +/* Group close callback */ +static herr_t H5G__close_cb(H5VL_object_t *grp_vol_obj); + /*********************/ /* Package Variables */ @@ -131,7 +135,7 @@ static const H5I_class_t H5I_GROUP_CLS[1] = {{ H5I_GROUP, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5G_close /* Callback routine for closing objects of this class */ + (H5I_free_t)H5G__close_cb /* Callback routine for closing objects of this class */ }}; /* Flag indicating "top" of interface has been initialized */ @@ -255,6 +259,38 @@ H5G_term_package(void) /*------------------------------------------------------------------------- + * Function: H5G__close_cb + * + * Purpose: Called when the ref count reaches zero on the group's ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G__close_cb(H5VL_object_t *grp_vol_obj) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(grp_vol_obj); + + /* Close the group */ + if(H5VL_group_close(grp_vol_obj->data, grp_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") + + /* Free the VOL object */ + if(H5VL_free_object(grp_vol_obj) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to free VOL object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__close_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5Gcreate2 * * Purpose: Creates a new group relative to LOC_ID, giving it the @@ -281,16 +317,16 @@ hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id) { - H5G_t *grp = NULL; /* Structure for new group */ - H5G_loc_t loc; /* Location to create group */ + void *grp = NULL; /* Structure for new group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "i*siii", loc_id, name, lcpl_id, gcpl_id, gapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") if(!*name) @@ -314,17 +350,32 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Get the gcpl structure and set the link properties on it */ + if (NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + if (H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set property value for lcpl id") + + /* get the location object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set the location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + /* Create the group */ - if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) + if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, + gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: if(H5I_INVALID_HID == ret_value) - if(grp && H5G_close(grp) < 0) + if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -366,18 +417,14 @@ done: hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) { - H5G_t *grp = NULL; /* Structure for new group */ - H5G_loc_t loc; - H5G_obj_create_t gcrt_info; /* Information for group creation */ + void *grp = NULL; /* Structure for new group */ + H5VL_object_t *vol_obj = NULL; /* Object token for loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iii", loc_id, gcpl_id, gapl_id); - /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - /* Check group creation property list */ if(H5P_DEFAULT == gcpl_id) gcpl_id = H5P_GROUP_CREATE_DEFAULT; @@ -389,36 +436,27 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Set up group creation info */ - gcrt_info.gcpl_id = gcpl_id; - gcrt_info.cache_type = H5G_NOTHING_CACHED; - HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create group") + if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, NULL, + gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: - /* Release the group's object header, if it was created */ - if(grp) { - H5O_loc_t *oloc; /* Object location for group */ - - /* Get the new group's object location */ - if(NULL == (oloc = H5G_oloc(grp))) - HDONE_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to get object location of group") - - /* Decrement refcount on group's object header in memory */ - if(H5O_dec_rc_by_loc(oloc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on newly created object") - } /* end if */ - /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(grp && H5G_close(grp) < 0) + if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -443,16 +481,15 @@ done: hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { - H5G_t *grp = NULL; /* Group opened */ - H5G_loc_t loc; /* Location of parent for group */ + void *grp = NULL; /* Group opened */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, gapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") if(!*name) @@ -462,17 +499,24 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Open the group */ - if(NULL == (grp = H5G__open_name(&loc, name))) + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, + name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Register an ID for the group */ - if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: if(H5I_INVALID_HID == ret_value) - if(grp && H5G_close(grp) < 0) + if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -495,18 +539,19 @@ done: hid_t H5Gget_create_plist(hid_t group_id) { - H5G_t *group = NULL; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5VL_object_t *vol_obj = NULL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", group_id); /* Check args */ - if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID") /* Get the group creation property list for the group */ - if((ret_value = H5G_get_create_plist(group)) < 0) + if(H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_GCPL, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") done: @@ -526,8 +571,9 @@ done: herr_t H5Gget_info(hid_t loc_id, H5G_info_t *group_info) { - H5I_type_t id_type; /* Type of ID */ - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj; + H5I_type_t id_type; /* Type of ID */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -541,11 +587,14 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL") /* Get group location */ - if(H5G_loc(loc_id, &loc) < 0) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the group's information */ - if(H5G__obj_info(loc.oloc, group_info) < 0) + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = id_type; + if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -567,15 +616,14 @@ herr_t H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*s*xi", loc_id, name, group_info, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") if(!*name) @@ -587,8 +635,19 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") + /* Get the location object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set up location parameters */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Retrieve the group's information */ - if(H5G__get_info_by_name(&loc, name, group_info/*out*/) < 0) + if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -610,7 +669,8 @@ herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *group_info, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj; + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -618,8 +678,6 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") if(!*group_name) @@ -635,8 +693,22 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Retrieve the group's information */ - if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, group_info/*out*/) < 0) + if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -663,7 +735,7 @@ H5Gclose(hid_t group_id) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == H5I_object_verify(group_id,H5I_GROUP)) + if(NULL == H5I_object_verify(group_id, H5I_GROUP)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Decrement the counter on the group atom. It will be freed if the count @@ -692,22 +764,23 @@ done: herr_t H5Gflush(hid_t group_id) { - H5G_t *grp; /* Group for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Group for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Flush metadata to file */ - if(H5O_flush_common(&grp->oloc, group_id) < 0) + /* Flush group's metadata to file */ + if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_FLUSH, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") done: @@ -730,14 +803,14 @@ done: herr_t H5Grefresh(hid_t group_id) { - H5G_t *grp; /* Group for this operation */ - herr_t ret_value = SUCCEED; /* Return value */ - + H5VL_object_t *vol_obj; /* Group for this operation */ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") /* Set up collective metadata if appropriate */ @@ -745,7 +818,8 @@ H5Grefresh(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Refresh group's metadata */ - if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) + if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_REFRESH, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index f8f668c..ab73e7e 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -43,6 +43,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* VOL plugins */ /****************/ @@ -72,10 +73,6 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, - hid_t new_loc_id, const char *new_name, hid_t lcpl_id); -static herr_t H5G__move(hid_t src_loc_id, const char *src_name, - hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id); static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -174,17 +171,18 @@ H5G_map_obj_type(H5O_type_t obj_type) hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) { - H5G_loc_t loc; /* Location to create group */ - H5G_t *grp = NULL; /* New group created */ + void *grp = NULL; /* New group created */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */ + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*sz", loc_id, name, size_hint); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given") @@ -221,12 +219,28 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info") + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(tmp_gcpl))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") + + /* get creation properties */ + if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get property value for lcpl id") + + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Create the group */ - if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl))) + if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, tmp_gcpl, + H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: @@ -235,7 +249,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") if(H5I_INVALID_HID == ret_value) - if(grp && H5G_close(grp) < 0) + if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -262,30 +276,38 @@ done: hid_t H5Gopen1(hid_t loc_id, const char *name) { - H5G_t *grp = NULL; /* Group opened */ - H5G_loc_t loc; /* Location of parent for group */ + void *grp = NULL; /* Group opened */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Open the group */ - if(NULL == (grp = H5G__open_name(&loc, name))) + if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, H5P_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Get an atom for the group */ - if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: if(H5I_INVALID_HID == ret_value) - if(grp && H5G_close(grp) < 0) + if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -303,6 +325,8 @@ done: herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name) { + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; + H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -318,9 +342,64 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new if(H5CX_set_loc(cur_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + /* Create link */ - if(H5G__link(cur_loc_id, cur_name, type, H5L_SAME_LOC, new_name, H5P_LINK_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link") + if(type == H5L_TYPE_HARD) { + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params1; + H5VL_loc_params_t loc_params2; + + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(cur_loc_id); + loc_params1.loc_data.loc_by_name.name = cur_name; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = new_name; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj->data) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target") + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params") + + /* Create the link through the VOL */ + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->driver->cls, + lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + } + else if(type == H5L_TYPE_SOFT) { + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = new_name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params.obj_type = H5I_get_type(cur_loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &cur_name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") + + /* Create the link through the VOL */ + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls, + lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + } + else + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type") done: FUNC_LEAVE_API(ret_value) @@ -339,6 +418,8 @@ herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name) { + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; + H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -354,84 +435,77 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, if(H5CX_set_loc(cur_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Create link */ - if(H5G__link(cur_loc_id, cur_name, type, new_loc_id, new_name, H5P_LINK_CREATE_DEFAULT) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Glink2() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__link - * - * Purpose: Internal routine to create a new link. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, December 18, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, - hid_t new_loc_id, const char *new_name, hid_t lcpl_id) -{ - H5G_loc_t new_loc; /* Information about new link's group */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Create the appropriate kind of link */ if(type == H5L_TYPE_HARD) { - H5G_loc_t cur_loc, *cur_loc_p; /* Information about current link's group */ - H5G_loc_t *new_loc_p; /* Information about new link's group */ - - /* Finish checking arguments */ - if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC") - if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") - if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") - - /* Set up current & new location pointers */ - cur_loc_p = &cur_loc; - new_loc_p = &new_loc; - if(cur_loc_id == H5L_SAME_LOC) - cur_loc_p = new_loc_p; - else if(new_loc_id == H5L_SAME_LOC) - new_loc_p = cur_loc_p; - else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") - - /* Create the link */ - if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) + H5VL_object_t *vol_obj1 = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj2 = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params1; + H5VL_loc_params_t loc_params2; + + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(cur_loc_id); + loc_params1.loc_data.loc_by_name.name = cur_name; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.obj_type = H5I_get_type(new_loc_id); + loc_params2.loc_data.loc_by_name.name = new_name; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + /* get the location object */ + if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(new_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name") + + /* Create the link through the VOL */ + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->driver->cls, + lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } else if(type == H5L_TYPE_SOFT) { - /* Soft links only need one location, the new_loc_id, but it's possible - * that new_loc_id is H5L_SAME_LOC - */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + + /* Soft links only need one location, the new_loc_id, but it's possible that + * new_loc_id is H5L_SAME_LOC */ if(new_loc_id == H5L_SAME_LOC) new_loc_id = cur_loc_id; - /* Finish checking arguments */ - if(H5G_loc(new_loc_id, &new_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = new_name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params.obj_type = H5I_get_type(new_loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Create the link */ - if(H5L_create_soft(cur_name, &new_loc, new_name, lcpl_id) < 0) + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &cur_name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") + + /* Create the link through the VOL */ + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls, + lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } else HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__link() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Glink2() */ /*------------------------------------------------------------------------- @@ -444,7 +518,10 @@ done: herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params1; + H5VL_loc_params_t loc_params2; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name); @@ -453,8 +530,22 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) if(H5CX_set_loc(src_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(src_loc_id); + loc_params1.loc_data.loc_by_name.name = src_name; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = dst_name; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(src_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Move the link */ - if(H5G__move(src_loc_id, src_name, H5L_SAME_LOC, dst_name, H5P_LINK_CREATE_DEFAULT) < 0) + if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->driver->cls, + H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: @@ -473,21 +564,45 @@ herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name) { + H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */ + H5VL_loc_params_t loc_params1; + H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */ + H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name); - /* Check arguments */ - if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") - /* Set up collective metadata if appropriate */ if(H5CX_set_loc(dst_loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set location parameter for source object */ + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.loc_data.loc_by_name.name = src_name; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params1.obj_type = H5I_get_type(src_loc_id); + /* Set location parameter for destination object */ + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = dst_name; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params2.obj_type = H5I_get_type(dst_loc_id); + + if(H5L_SAME_LOC != src_loc_id) { + /* get the location object */ + if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + } + if(H5L_SAME_LOC != dst_loc_id) { + /* get the location object */ + if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + } + /* Move the link */ - if(H5G__move(src_loc_id, src_name, dst_loc_id, dst_name, H5P_LINK_CREATE_DEFAULT) < 0) + if((ret_value = H5VL_link_move(vol_obj1->data, loc_params1, vol_obj2->data, loc_params2, + vol_obj1->driver->cls, H5P_DEFAULT, H5P_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -496,60 +611,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__move - * - * Purpose: Renames an object within an HDF5 file and moves it to a new - * group. The original name SRC is unlinked from the group graph - * and then inserted with the new name DST (which can specify a - * new path for the object) as an atomic operation. The names - * are interpreted relative to SRC_LOC_ID and - * DST_LOC_ID, which are either file IDs or group ID. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, - const char *dst_name, hid_t lcpl_id) -{ - H5G_loc_t src_loc, *src_loc_p; /* Group info for source location */ - H5G_loc_t dst_loc, *dst_loc_p; /* Group info for destination location */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check arguments */ - if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") - if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") - if(!src_name || !*src_name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no current name specified") - if(!dst_name || !*dst_name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no destination name specified") - - /* Set up src & dst location pointers */ - src_loc_p = &src_loc; - dst_loc_p = &dst_loc; - if(src_loc_id == H5L_SAME_LOC) - src_loc_p = dst_loc_p; - else if(dst_loc_id == H5L_SAME_LOC) - dst_loc_p = src_loc_p; - - /* Move the link */ - if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__move() */ - - -/*------------------------------------------------------------------------- * Function: H5Gunlink * * Purpose: Removes a link. The new API is H5Ldelete/H5Ldelete_by_idx. @@ -559,15 +620,14 @@ done: herr_t H5Gunlink(hid_t loc_id, const char *name) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", loc_id, name); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") @@ -575,8 +635,18 @@ H5Gunlink(hid_t loc_id, const char *name) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Delete the link */ - if(H5L_delete(&loc, name) < 0) + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: @@ -595,15 +665,14 @@ done: herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*szx", loc_id, name, size, buf); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") @@ -611,9 +680,19 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Get the link value */ - if(H5L_get_val(&loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") + if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Gint.c b/src/H5Gint.c index 7e2f279..88ef82b 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -39,6 +39,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ +#include "H5VLnative.h" /* Virtual Object Layer (native) */ /****************/ @@ -807,7 +808,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, */ if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Set up user data for callback */ @@ -1069,7 +1070,7 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the starting group */ - if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Get the location of the starting group */ diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 2f935e8..2dacd94 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -137,29 +137,25 @@ static herr_t H5G__loc_get_comment_cb(H5G_loc_t *grp_loc, const char *name, /*------------------------------------------------------------------------- - * Function: H5G_loc + * Function: H5G_loc_real * - * Purpose: Given an object ID return a location for the object. + * Purpose: Utility routine to get object location * * Returns: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5G_loc(hid_t loc_id, H5G_loc_t *loc) +H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - switch(H5I_get_type(loc_id)) { + switch(type) { case H5I_FILE: { - H5F_t *f = NULL; - - /* Get the file struct */ - if(NULL == (f = (H5F_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file ID") + H5F_t *f = (H5F_t *)obj; /* Construct a group location for root group of the file */ if(H5G_root_loc(f, loc) < 0) @@ -169,10 +165,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) case H5I_GROUP: { - H5G_t *group = NULL; + H5G_t *group = (H5G_t *)obj; - if(NULL == (group = (H5G_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group ID") if(NULL == (loc->oloc = H5G_oloc(group))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group") if(NULL == (loc->path = H5G_nameof(group))) @@ -184,8 +178,9 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) { H5T_t *dt = NULL; - if(NULL == (dt = (H5T_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid type ID") + /* Get the actual datatype object if the VOL object is set */ + dt = H5T_get_actual_type((H5T_t *)obj); + if(NULL == (loc->oloc = H5T_oloc(dt))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype") if(NULL == (loc->path = H5T_nameof(dt))) @@ -195,10 +190,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) case H5I_DATASET: { - H5D_t *dset = NULL; + H5D_t *dset = (H5D_t *)obj; - if(NULL == (dset = (H5D_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data ID") if(NULL == (loc->oloc = H5D_oloc(dset))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset") if(NULL == (loc->path = H5D_nameof(dset))) @@ -208,10 +201,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) case H5I_ATTR: { - H5A_t *attr = NULL; + H5A_t *attr = (H5A_t *)obj; - if(NULL == (attr = (H5A_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid attribute ID") if(NULL == (loc->oloc = H5A_oloc(attr))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute") if(NULL == (loc->path = H5A_nameof(attr))) @@ -237,6 +228,9 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) case H5I_VFL: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual file driver (VFD)") + case H5I_VOL: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) driver") + case H5I_UNINIT: case H5I_BADID: case H5I_NTYPES: @@ -246,6 +240,36 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_loc_real() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_loc + * + * Purpose: Given an object ID return a location for the object. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_loc(hid_t loc_id, H5G_loc_t *loc) +{ + void *obj = NULL; /* VOL object */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Get the object from the VOL */ + if(NULL == (obj = H5VL_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Fill in the struct */ + if(H5G_loc_real(obj, H5I_get_type(loc_id), loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to fill in location struct") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_loc() */ diff --git a/src/H5Gname.c b/src/H5Gname.c index 31ed0f1..b6b0c20 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -835,6 +835,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: diff --git a/src/H5Goh.c b/src/H5Goh.c index ec3d30d..f29529b 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -27,6 +27,7 @@ #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -46,7 +47,7 @@ static void *H5O__group_get_copy_file_udata(void); static void H5O__group_free_copy_file_udata(void *udata); static htri_t H5O__group_isa(const H5O_t *loc); -static hid_t H5O__group_open(const H5G_loc_t *obj_loc, hbool_t app_ref); +static void *H5O__group_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type); static void *H5O__group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc); static H5O_loc_t *H5O__group_get_oloc(hid_t obj_id); static herr_t H5O__group_bh_info(const H5O_loc_t *loc, H5O_t *oh, @@ -197,36 +198,36 @@ done: * * Purpose: Open a group at a particular location * - * Return: Success: Open object identifier - * Failure: Negative + * Return: Success: Pointer to group data + * Failure: NULL * * Programmer: Quincey Koziol * Monday, November 6, 2006 * *------------------------------------------------------------------------- */ -static hid_t -H5O__group_open(const H5G_loc_t *obj_loc, hbool_t app_ref) +static void * +H5O__group_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) { - H5G_t *grp = NULL; /* Group opened */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5G_t *grp = NULL; /* Group opened */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC HDassert(obj_loc); + *opened_type = H5I_GROUP; + /* Open the group */ if(NULL == (grp = H5G_open(obj_loc))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") - /* Register an ID for the group */ - if((ret_value = H5I_register(H5I_GROUP, grp, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") + ret_value = (void *)grp; done: - if(ret_value < 0) + if(NULL == ret_value) if(grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release group") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__group_open() */ @@ -303,7 +304,7 @@ H5O__group_get_oloc(hid_t obj_id) FUNC_ENTER_STATIC /* Get the group */ - if(NULL == (grp = (H5G_t *)H5I_object(obj_id))) + if(NULL == (grp = (H5G_t *)H5VL_object(obj_id))) HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") /* Get the group's object header location */ diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index c56b1c8..f4f04bc 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -268,6 +268,7 @@ H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char /* * These functions operate on group "locations" */ +H5_DLL herr_t H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc); H5_DLL herr_t H5G_loc(hid_t loc_id, H5G_loc_t *loc); H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth); H5_DLL herr_t H5G_loc_find(const H5G_loc_t *loc, const char *name, diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 1899606..1995015 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -35,6 +35,8 @@ #include "H5Gpkg.h" /* Groups */ #include "H5HLprivate.h" /* Local Heaps */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ + /****************/ /* Local Macros */ @@ -102,7 +104,7 @@ H5G__is_empty_test(hid_t gid) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -222,7 +224,7 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -289,7 +291,7 @@ H5G__has_stab_test(hid_t gid) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -348,7 +350,7 @@ H5G__is_new_dense_test(hid_t gid) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -427,7 +429,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -515,7 +517,7 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) FUNC_ENTER_PACKAGE /* Get group structure */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set API context */ @@ -576,7 +578,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign HDassert(obj_hidden); /* Get pointer to object for ID */ - if(NULL == (obj_ptr = H5I_object(obj_id))) + if(NULL == (obj_ptr = H5VL_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get object for ID") /* Set API context */ @@ -609,6 +611,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -829,7 +832,7 @@ H5G__verify_cached_stabs_test(hid_t gid) HDassert(gid >= 0); /* Check args */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) + if(NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set up metadata tagging */ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index e412e7c..a103f53 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -43,6 +43,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppublic.h" /* Property Lists */ #include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5VLnative.h" /* Virtual Object Layer (native) */ /****************/ @@ -197,7 +198,7 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, /* Create a group ID to pass to the user-defined callback */ if(NULL == (grp = H5G_open(&grp_loc_copy))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((cur_grp = H5I_register(H5I_GROUP, grp, FALSE)) < 0) + if((cur_grp = H5VL_native_register(H5I_GROUP, grp, FALSE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") /* User-defined callback function */ diff --git a/src/H5I.c b/src/H5I.c index 34874c7..7d445a5 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -41,6 +41,7 @@ #include "H5Oprivate.h" /* Object headers */ #include "H5SLprivate.h" /* Skip Lists */ #include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Local Macros */ @@ -74,11 +75,24 @@ typedef struct { void *ret_obj; /* Object to return */ } H5I_search_ud_t; +typedef struct { + H5I_iterate_func_t op; /* Application's callback routine */ + void *op_data; /* Application's user data */ +} H5I_iterate_pub_ud_t; + +/* User data for iterator callback for retrieving an ID corresponding to an object pointer */ +typedef struct { + const void *object; /* object pointer to search for */ + H5I_type_t obj_type; /* type of object we are searching for */ + hid_t ret_id; /* ID returned */ +} H5I_get_id_ud_t; + /* User data for iterator callback for ID iteration */ typedef struct { H5I_search_func_t user_func; /* 'User' function to invoke */ void *user_udata; /* User data to pass to 'user' function */ hbool_t app_ref; /* Whether this is an appl. ref. call */ + H5I_type_t obj_type; /* Type of object we are iterating over */ } H5I_iterate_ud_t; /* User data for H5I__clear_type_cb */ @@ -113,6 +127,8 @@ H5FL_DEFINE_STATIC(H5I_id_type_t); /* Declare a free list to manage the H5I_class_t struct */ H5FL_DEFINE_STATIC(H5I_class_t); +H5FL_EXTERN(H5VL_object_t); + /*--------------------- Local function prototypes ---------------------------*/ static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); static int H5I__destroy_type(H5I_type_t type); @@ -122,7 +138,9 @@ static int H5I__inc_type_ref(H5I_type_t type); static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); +static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); static hid_t H5I__get_file_id(hid_t obj_id, H5I_type_t id_type); +static int H5I__find_id_cb(void *_item, void *_key, void *_udata); static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); @@ -543,7 +561,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) if(udata->force) { #ifdef H5I_DEBUG if(H5DEBUG(I)) { - fprintf(H5DEBUG(I), "H5I: free type=%d obj=0x%08lx " + HDfprintf(H5DEBUG(I), "H5I: free type=%d obj=0x%08lx " "failure ignored\n", (int)udata->type_ptr->cls->type_id, (unsigned long)(id->obj_ptr)); @@ -760,8 +778,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t id) +H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t 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 */ @@ -770,6 +789,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t /* Check arguments */ HDassert(object); + HDassert(vol_driver); /* Make sure ID is not already in use */ if(NULL != (id_ptr = H5I__find_id(id))) @@ -793,11 +813,29 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t 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->count = 1; /* initial reference count*/ id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; + 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; /* Insert into the type */ if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) @@ -1842,6 +1880,91 @@ done: /*------------------------------------------------------------------------- + * Function: H5I__iterate_pub_cb + * + * Purpose: Callback routine for H5Iiterate, when it calls + * H5I_iterate. Calls "user" callback search function, and + * then sets return value, based on the result of that + * callback. + * + * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) + * Failure: H5_ITER_ERROR (-1) + * + * Programmer: Neil Fortner + * Friday, October 11, 2013 + * + *------------------------------------------------------------------------- + */ +static int +H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) +{ + H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */ + herr_t cb_ret_val; /* User callback return value */ + int ret_value = H5_ITER_ERROR; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Invoke the callback */ + cb_ret_val = (*udata->op)(id, udata->op_data); + + /* Set the return value based on the callback's return value */ + if(cb_ret_val > 0) + ret_value = H5_ITER_STOP; /* terminate iteration early */ + else if(cb_ret_val < 0) + ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__iterate_pub_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5Iiterate + * + * Purpose: Call the callback funciton op for each member of the id + * type type. op takes as parameters the id and a + * passthrough of op_data, and returns an herr_t. A positive + * return from op will cause the iteration to stop and + * H5Iiterate will return the value returned by op. A + * negative return from op will cause the iteration to stop + * and H5Iiterate will return failure. A zero return from op + * will allow iteration to continue, as long as there are + * other ids remaining in type. + * + * Limitation: Currently there is no way to start searching from where a + * previous search left off. + * + * Return: The last value returned by op + * + * Programmer: Neil Fortner + * Friday, October 11, 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data) +{ + H5I_iterate_pub_ud_t int_udata; /* Internal user data */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "Itx*x", type, op, op_data); + + /* Set up udata struct */ + int_udata.op = op; + int_udata.op_data = op_data; + + /* Note that H5I_iterate returns an error code. We ignore it + * here, as we can't do anything with it without revising the API. + */ + if ((ret_value = H5I_iterate(type, H5I__iterate_pub_cb, &int_udata, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "can't iterate over ids") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Iiterate() */ + + +/*------------------------------------------------------------------------- * Function: H5I__iterate_cb * * Purpose: Callback routine for H5I_iterate, invokes "user" callback @@ -1866,10 +1989,26 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) * its reference count is positive. */ if((!udata->app_ref) || (item->app_count > 0)) { + H5I_type_t type = udata->obj_type; + const void *obj_ptr = NULL; herr_t cb_ret_val; + /* The stored object pointer might be an H5VL_object_t, in which + * case we'll need to get the wrapped object struct (H5F_t *, etc.). + */ + if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; + obj_ptr = vol_obj->data; + } + else if(H5I_DATATYPE == type) { + const H5T_t *dt = (const H5T_t *)item->obj_ptr; + obj_ptr = (void *)H5T_get_actual_type(dt); + } + else + obj_ptr = item->obj_ptr; + /* Invoke callback function */ - cb_ret_val = (*udata->user_func)((void *)item->obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ + cb_ret_val = (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ /* Set the return value based on the callback's return value */ if(cb_ret_val > 0) @@ -1929,6 +2068,7 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re iter_udata.user_func = func; iter_udata.user_udata = udata; iter_udata.app_ref = app_ref; + iter_udata.obj_type = type; /* Iterate over IDs */ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) @@ -1987,6 +2127,9 @@ done: * * Failure: -1 * + * NOTE: Not safe for arbitrary VOL drivers as it relies on + * private H5G calls. + * * Comments: Public function * If 'name' is non-NULL then write up to 'size' bytes into that * buffer and always return the length of the entry name. @@ -2072,34 +2215,136 @@ done: static hid_t H5I__get_file_id(hid_t obj_id, H5I_type_t type) { + H5VL_object_t *vol_obj = NULL; + void *file = NULL; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC - /* Process based on object type */ - if (type == H5I_FILE) { - /* Increment reference count on file ID */ - if(H5I_inc_ref(obj_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + /* Get the object pointer */ + if (NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") - /* Set return value */ - ret_value = obj_id; + /* Get the file through the VOL */ + if (H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, &file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file") + if (NULL == file) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file through the VOL") + + /* Check if the file's ID already exists */ + if (H5I_find_id(file, H5I_FILE, &ret_value) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") + + /* 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) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") } else { - H5G_loc_t loc; /* Location of object */ + /* Increment ref count on existing ID */ + if (H5I_inc_ref(ret_value, TRUE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__get_file_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5I__find_id_cb + * + * Purpose: Callback for searching for an ID with a specific pointer + * + * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) + * Failure: H5_ITER_ERROR (-1) + * + *------------------------------------------------------------------------- + */ +static int +H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) +{ + H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */ + H5I_type_t type = udata->obj_type; + const void *obj_ptr = NULL; + int ret_value = H5_ITER_CONT; /* Return value */ - /* Get the object location information */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get object location") + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(item); + HDassert(udata); - /* Get the file ID for the object */ - if((ret_value = H5F_get_id(loc.oloc->file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't get file ID") + /* Get a pointer to the VOL driver's data */ + if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; + obj_ptr = vol_obj->data; + } + else if (H5I_DATATYPE == type) { + const H5T_t *dt = (const H5T_t *)item->obj_ptr; + obj_ptr = (void *)H5T_get_actual_type(dt); + } + else + obj_ptr = item->obj_ptr; + + /* Check for a match */ + if (obj_ptr == udata->object) { + udata->ret_id = item->id; + ret_value = H5_ITER_STOP; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__find_id_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5I_find_id + * + * Purpose: Return the ID of an object by searching through the ID list + * for the type. + * + * Return: SUCCEED/FAIL + * (id will be set to H5I_INVALID_HID on errors or not found) + * + *------------------------------------------------------------------------- + */ +herr_t +H5I_find_id(const void *object, H5I_type_t type, hid_t *id) +{ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(id); + + *id = H5I_INVALID_HID; + + type_ptr = H5I_id_type_list_g[type]; + if (!type_ptr || type_ptr->init_count <= 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") + + /* Only iterate through ID list if it is initialized and there are IDs in type */ + if (type_ptr->init_count > 0 && type_ptr->id_count > 0) { + H5I_get_id_ud_t udata; /* User data */ + herr_t iter_status; /* Iteration status */ + + /* Set up iterator user data */ + udata.object = object; + udata.obj_type = type; + udata.ret_id = H5I_INVALID_HID; + + /* Iterate over IDs for the ID type */ + if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__find_id_cb, &udata)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") + + *id = udata.ret_id; } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__get_file_id() */ +} /* end H5I_find_id() */ /*------------------------------------------------------------------------- @@ -2117,6 +2362,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ H5G_name_t *path = NULL; /* Path to file object */ + const void *obj_ptr = NULL; /* Pointer to VOL driver object */ FUNC_ENTER_STATIC_NOERR @@ -2128,17 +2374,31 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) switch (type) { case H5I_GROUP: { - path = H5G_nameof((H5G_t*)item->obj_ptr); + const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; + + obj_ptr = vol_obj->data; + + if(H5_VOL_NATIVE == vol_obj->driver->cls->value) + path = H5G_nameof((H5G_t *)obj_ptr); break; } case H5I_DATASET: { - path = H5D_nameof((H5D_t*)item->obj_ptr); + const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; + + obj_ptr = vol_obj->data; + + if(H5_VOL_NATIVE == vol_obj->driver->cls->value) + path = H5D_nameof((H5D_t *)obj_ptr); break; } case H5I_DATATYPE: { - path = H5T_nameof((H5T_t*)item->obj_ptr); + const H5T_t *dt = (const H5T_t *)item->obj_ptr; + + obj_ptr = (void *)H5T_get_actual_type(dt); + + path = H5T_nameof((H5T_t *)obj_ptr); break; } case H5I_UNINIT: @@ -2148,6 +2408,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 6a0fc01..8fd7caa 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -25,6 +25,7 @@ /* Private headers needed by this file */ #include "H5private.h" +#include "H5VLprivate.h" /**************************/ /* Library Private Macros */ @@ -67,7 +68,7 @@ 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, const void *object, hbool_t app_ref, hid_t id); +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); @@ -80,6 +81,7 @@ H5_DLL int H5I_dec_ref(hid_t id); H5_DLL int H5I_dec_app_ref(hid_t id); 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*/); /* Debugging functions */ H5_DLL herr_t H5I_dump_ids_for_type(H5I_type_t type); diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index c471e5a..f4b5cc9 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -44,6 +44,7 @@ typedef enum H5I_type_t { H5I_ATTR, /* type ID for Attribute objects */ H5I_REFERENCE, /* *DEPRECATED* type ID for Reference objects */ H5I_VFL, /* type ID for virtual file layer */ + H5I_VOL, /* type ID for virtual object layer */ H5I_GENPROP_CLS, /* type ID for generic property list classes */ H5I_GENPROP_LST, /* type ID for generic property lists */ H5I_ERROR_CLASS, /* type ID for error classes */ @@ -71,6 +72,9 @@ typedef herr_t (*H5I_free_t)(void *); /* Type of the function to compare objects & keys */ typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key); +/* Type of the H5Iiterate callback function */ +typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata); + #ifdef __cplusplus extern "C" { #endif @@ -93,6 +97,7 @@ H5_DLL int H5Iinc_type_ref(H5I_type_t type); H5_DLL int H5Idec_type_ref(H5I_type_t type); H5_DLL int H5Iget_type_ref(H5I_type_t type); H5_DLL void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key); +H5_DLL herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data); H5_DLL herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members); H5_DLL htri_t H5Itype_exists(H5I_type_t type); H5_DLL htri_t H5Iis_valid(hid_t id); diff --git a/src/H5L.c b/src/H5L.c index b659d42..656edec 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -33,6 +33,9 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative.h" /* Virtual Object Layer (native) */ + /****************/ /* Local Macros */ @@ -272,8 +275,10 @@ herr_t H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t src_loc, *src_loc_p; - H5G_loc_t dst_loc, *dst_loc_p; + H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ + H5VL_loc_params_t loc_params1; + H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ + H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -283,10 +288,6 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Check arguments */ if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") - if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!src_name || !*src_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") if(!dst_name || !*dst_name) @@ -294,21 +295,49 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Check the link create property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - /* Set up src & dst location pointers */ - src_loc_p = &src_loc; - dst_loc_p = &dst_loc; - if(src_loc_id == H5L_SAME_LOC) - src_loc_p = dst_loc_p; - else if(dst_loc_id == H5L_SAME_LOC) - dst_loc_p = src_loc_p; + /* Set location paramter for source object */ + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.loc_data.loc_by_name.name = src_name; + loc_params1.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params1.obj_type = H5I_get_type(src_loc_id); + + /* Set location paramter for destination object */ + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = dst_name; + loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params2.obj_type = H5I_get_type(dst_loc_id); + + if (H5L_SAME_LOC != src_loc_id) { + /* Get the location object */ + if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + } + if (H5L_SAME_LOC != dst_loc_id) { + /* Get the location object */ + if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + } + + /* Make sure that the VOL drivers are the same */ + if (vol_obj1 && vol_obj2) { + if (vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + } /* Move the link */ - if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) + if (H5VL_link_move((vol_obj1 ? vol_obj1->data : NULL), loc_params1, + (vol_obj2 ? vol_obj2->data : NULL), loc_params2, + (vol_obj1 ? vol_obj1->driver->cls : vol_obj2->driver->cls), + lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -334,8 +363,10 @@ herr_t H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t src_loc, *src_loc_p; - H5G_loc_t dst_loc, *dst_loc_p; + H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ + H5VL_loc_params_t loc_params1; + H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ + H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -345,10 +376,6 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Check arguments */ if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") - if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(dst_loc_id != H5L_SAME_LOC && H5G_loc(dst_loc_id, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!src_name || !*src_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") if(!dst_name || !*dst_name) @@ -361,16 +388,45 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - /* Set up src & dst location pointers */ - src_loc_p = &src_loc; - dst_loc_p = &dst_loc; - if(src_loc_id == H5L_SAME_LOC) - src_loc_p = dst_loc_p; - else if(dst_loc_id == H5L_SAME_LOC) - dst_loc_p = src_loc_p; + /* Check the link create property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + + + /* Set location paramter for source object */ + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.loc_data.loc_by_name.name = src_name; + loc_params1.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params1.obj_type = H5I_get_type(src_loc_id); + + /* Set location paramter for destination object */ + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.loc_data.loc_by_name.name = dst_name; + loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params2.obj_type = H5I_get_type(dst_loc_id); + + if(H5L_SAME_LOC != src_loc_id) { + /* Get the location object */ + if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + } + if(H5L_SAME_LOC != dst_loc_id) { + /* Get the location object */ + if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + } + + /* Make sure that the VOL plugins are the same */ + if(vol_obj1 && vol_obj2) { + if(vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + } /* Copy the link */ - if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0) + if(H5VL_link_copy((vol_obj1 ? vol_obj1->data : NULL), loc_params1, + (vol_obj2 ? vol_obj2->data : NULL), loc_params2, + (vol_obj1 ? vol_obj1->driver->cls : vol_obj2->driver->cls), + lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link") done: @@ -397,18 +453,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lcreate_soft(const char *link_target, hid_t link_loc_id, - const char *link_name, hid_t lcpl_id, hid_t lapl_id) +H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, + hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t link_loc; /* Group location for new link */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "*si*sii", link_target, link_loc_id, link_name, lcpl_id, lapl_id); /* Check arguments */ - if(H5G_loc(link_loc_id, &link_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(link_loc_id == H5L_SAME_LOC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link location id should not be H5L_SAME_LOC") if(!link_target) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be NULL") if(!*link_target) @@ -420,12 +478,35 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Check the group access property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + + /* Set location fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = link_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + 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))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_NAME, &link_target) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Create the link */ - if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls, + lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") done: @@ -453,8 +534,11 @@ herr_t H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t cur_loc, *cur_loc_p; - H5G_loc_t new_loc, *new_loc_p; + H5VL_object_t *vol_obj1 = NULL; /* object token of cur_loc_id */ + H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */ + H5VL_loc_params_t loc_params1; + H5VL_loc_params_t loc_params2; + H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -464,10 +548,6 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, /* Check arguments */ if(cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC") - if(cur_loc_id != H5L_SAME_LOC && H5G_loc(cur_loc_id, &cur_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(new_loc_id != H5L_SAME_LOC && H5G_loc(new_loc_id, &new_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!cur_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be NULL") if(!*cur_name) @@ -479,22 +559,56 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Check the link create property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, cur_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - /* Set up current & new location pointers */ - cur_loc_p = &cur_loc; - new_loc_p = &new_loc; - if(cur_loc_id == H5L_SAME_LOC) - cur_loc_p = new_loc_p; - else if(new_loc_id == H5L_SAME_LOC) - new_loc_p = cur_loc_p; - else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") + /* Set up current & new location structs */ + loc_params1.type = H5VL_OBJECT_BY_NAME; + loc_params1.obj_type = H5I_get_type(cur_loc_id); + loc_params1.loc_data.loc_by_name.name = cur_name; + loc_params1.loc_data.loc_by_name.lapl_id = lapl_id; + + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.obj_type = H5I_get_type(new_loc_id); + loc_params2.loc_data.loc_by_name.name = new_name; + loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; + + 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))) + 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))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + } + + /* Make sure that the VOL drivers are the same */ + if(vol_obj1 && vol_obj2) { + if(vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL drivers and can't be linked") + } + + /* Get the link creation plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_LINK, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET, (vol_obj1 ? &(vol_obj1->data) : NULL)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target id") + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target name") /* Create the link */ - if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, (vol_obj2 ? (vol_obj2->data) : NULL), loc_params2, + (vol_obj1 != NULL ? vol_obj1->driver->cls : vol_obj2->driver->cls), + lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link") done: @@ -530,7 +644,9 @@ herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t link_loc; + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -538,19 +654,43 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, udata_size, lcpl_id, lapl_id); /* Check arguments */ - if(H5G_loc(link_loc_id, &link_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!link_name || !*link_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") + /* Check the group access property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = link_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(link_loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + if(H5P_set(plist, H5VL_PROP_LINK_UDATA, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + /* Create external link */ - if(H5L__create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->driver->cls, + lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -578,15 +718,14 @@ done: herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*si", loc_id, name, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") @@ -594,8 +733,19 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill in the location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Unlink */ - if(H5L_delete(&loc, name) < 0) + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -626,15 +776,14 @@ herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -646,8 +795,21 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Delete the link */ - if(H5L_delete_by_idx(&loc, group_name, idx_type, order, n) < 0) + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -678,15 +840,14 @@ herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Group location for location to query */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*sxzi", loc_id, name, buf, size, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") @@ -694,8 +855,18 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Get the link value */ - if(H5L_get_val(&loc, name, buf, size) < 0) + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: @@ -726,7 +897,8 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Group location for location to query */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -734,8 +906,6 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -747,8 +917,21 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Get the link value */ - if(H5L_get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size) < 0) + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value") done: @@ -771,15 +954,14 @@ done: htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("t", "i*si", loc_id, name, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") if(!*name) @@ -789,8 +971,19 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Check for the existence of the link */ - if((ret_value = H5L_exists(&loc, name)) < 0) + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_EXISTS, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -816,15 +1009,14 @@ herr_t H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") @@ -832,8 +1024,18 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Get the link information */ - if(H5L_get_info(&loc, name, linfo) < 0) + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_INFO, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -860,7 +1062,8 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5L_info_t *linfo /*out*/, hid_t lapl_id) { - H5G_loc_t loc; /* Group location for group to query */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -868,8 +1071,6 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -881,8 +1082,21 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Get the link information */ - if(H5L_get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0) + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_INFO, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1044,7 +1258,8 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) @@ -1052,8 +1267,6 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") if(!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -1065,8 +1278,22 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + /* Get the link information */ - if((ret_value = H5L_get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0) + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_NAME, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name") done: @@ -1096,7 +1323,8 @@ herr_t H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ herr_t ret_value; /* Return value */ @@ -1104,8 +1332,6 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5TRACE6("e", "iIiIo*hx*x", group_id, idx_type, order, idx_p, op, op_data); /* Check arguments */ - if(H5G_loc(group_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") id_type = H5I_get_type(group_id); if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") @@ -1116,8 +1342,18 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if (!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + /* Get the location object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(group_id); + /* Iterate over the links */ - if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1152,7 +1388,8 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data, hid_t lapl_id) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1160,8 +1397,6 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, op_data, lapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") if(!*group_name) @@ -1177,8 +1412,19 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = group_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + /* Iterate over the links */ - if((ret_value = H5L_iterate(&loc, group_name, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1218,7 +1464,8 @@ herr_t H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ herr_t ret_value; /* Return value */ @@ -1226,8 +1473,6 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5TRACE5("e", "iIiIox*x", group_id, idx_type, order, op, op_data); /* Check args */ - if(H5G_loc(group_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") id_type = H5I_get_type(group_id); if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") @@ -1238,8 +1483,18 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(group_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Iterate over the links */ - if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1279,7 +1534,8 @@ herr_t H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1287,8 +1543,6 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") if(!*group_name) @@ -1304,8 +1558,20 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = group_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + /* Visit the links */ - if((ret_value = H5G_visit(&loc, group_name, idx_type, order, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1683,7 +1949,7 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((grp_id = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group") /* Make callback */ @@ -2468,7 +2734,7 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5I_register(H5I_GROUP, grp, TRUE)) < 0) + if((grp_id = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID") if(udata->copy) { diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 1cab17d..d9cc7a3 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -33,6 +33,8 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative.h" /* Native VOL Driver */ /****************/ @@ -125,7 +127,9 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, unsigned intent; /* File access permissions */ H5L_elink_cb_t cb_info; /* Callback info struct */ hid_t fapl_id = -1; /* File access property list for external link's file */ - hid_t ext_obj = -1; /* ID for external link's object */ + void *ext_obj = NULL; /* External link's object */ + hid_t ext_obj_id = H5I_INVALID_HID; /* ID for external link's object */ + H5I_type_t opened_type; /* ID type of external link's object */ char *parent_group_name = NULL;/* Temporary pointer to group name */ char local_group_name[H5L_EXT_TRAVERSE_BUF_SIZE]; /* Local buffer to hold group name */ H5P_genplist_t *fa_plist; /* File access property list pointer */ @@ -235,13 +239,18 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, H5I_INVALID_HID, "unable to create location for file") /* Open the object referenced in the external file */ - if((ext_obj = H5O_open_name(&root_loc, obj_name, FALSE)) < 0) + if(NULL == (ext_obj = H5O_open_name(&root_loc, obj_name, &opened_type))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + /* Get an ID for the external link's object */ + if((ext_obj_id = H5VL_native_register(opened_type, ext_obj, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object") + /* Set return value */ - ret_value = ext_obj; + ret_value = ext_obj_id; done: +/* XXX (VOL MERGE): Probably also want to consider closing ext_obj here on failures */ /* Release resources */ if(fapl_id > 0 && H5I_dec_ref(fapl_id) < 0) HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for file access property list") @@ -251,7 +260,7 @@ done: parent_group_name = (char *)H5MM_xfree(parent_group_name); if(ret_value < 0) { /* Close object if it's open and something failed */ - if(ext_obj >= 0 && H5I_dec_ref(ext_obj) < 0) + if(ext_obj_id >= 0 && H5I_dec_ref(ext_obj_id) < 0) HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close atom for external object") } /* end if */ @@ -333,13 +342,16 @@ herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t link_loc; /* Group location to create link */ - char *norm_obj_name = NULL; /* Pointer to normalized current name */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + char *norm_obj_name = NULL; /* Pointer to normalized current name */ void *ext_link_buf = NULL; /* Buffer to contain external link */ size_t buf_size; /* Size of buffer to hold external link */ size_t file_name_len; /* Length of file name string */ size_t norm_obj_name_len; /* Length of normalized object name string */ uint8_t *p; /* Pointer into external link buffer */ + H5P_genplist_t *plist; /* Property list pointer */ + H5L_type_t link_type = H5L_TYPE_EXTERNAL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -351,11 +363,13 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified") if(!obj_name || !*obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name specified") - if(H5G_loc(link_loc_id, &link_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!link_name || !*link_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") + /* Check the group access property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + /* Get normalized copy of the link target */ if(NULL == (norm_obj_name = H5G_normalize(obj_name))) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize object name") @@ -378,8 +392,30 @@ H5Lcreate_external(const char *file_name, const char *obj_name, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = link_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(link_loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + if(H5P_set(plist, H5VL_PROP_LINK_UDATA, &ext_link_buf) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &buf_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + /* Create an external link */ - if(H5L__create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id) < 0) + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->driver->cls, + lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link") done: diff --git a/src/H5O.c b/src/H5O.c index b33e6e2..77b9498 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -100,15 +100,16 @@ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") if(!*name) @@ -118,10 +119,24 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Open the object */ - if((ret_value = H5O_open_name(&loc, name, TRUE)) < 0) + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, + &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: FUNC_LEAVE_API(ret_value) } /* end H5Oopen() */ @@ -154,15 +169,16 @@ hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE6("i", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -174,10 +190,26 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Open the object */ - if((ret_value = H5O_open_by_idx(&loc, group_name, idx_type, order, n)) < 0) + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, + &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) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + done: FUNC_LEAVE_API(ret_value) } /* end H5Oopen_by_idx() */ @@ -221,22 +253,32 @@ done: hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr) { - H5G_loc_t loc; /* Location within file */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "ia", loc_id, addr); - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") - if(!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no address supplied") + loc_params.type = H5VL_OBJECT_BY_ADDR; + loc_params.loc_data.loc_by_addr.addr = addr; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if((ret_value = H5O_open_by_addr(&loc, addr)) < 0) + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, &opened_type, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + done: FUNC_LEAVE_API(ret_value) } /* end H5Oopen_by_addr() */ @@ -267,20 +309,19 @@ herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { - H5G_loc_t new_loc; /* Location of group to link from */ - H5G_loc_t obj_loc; /* Location of object to link to */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj1 = NULL; /* object token of obj_id */ + H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */ + H5VL_loc_params_t loc_params1; + H5VL_loc_params_t loc_params2; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*sii", obj_id, new_loc_id, new_name, lcpl_id, lapl_id); /* Check arguments */ - if(H5G_loc(obj_id, &obj_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(new_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot use H5L_SAME_LOC when only one location is specified") - if(H5G_loc(new_loc_id, &new_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!new_name || !*new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Avoid compiler warning on 32-bit machines */ @@ -291,12 +332,52 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Check the group access property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Link to the object */ - if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0) + loc_params1.type = H5VL_OBJECT_BY_SELF; + loc_params1.obj_type = H5I_get_type(obj_id); + + loc_params2.type = H5VL_OBJECT_BY_NAME; + loc_params2.obj_type = H5I_get_type(new_loc_id); + loc_params2.loc_data.loc_by_name.name = new_name; + loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; + + if(H5L_SAME_LOC != obj_id) { + /* get the location object */ + if(NULL == (vol_obj1 = H5VL_get_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))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + } + /* Make sure that the VOL plugins are the same */ + if(vol_obj1 && vol_obj2) { + if (vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + } + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* set creation properties */ + if(H5P_set(plist, H5VL_PROP_LINK_TARGET, &vol_obj1->data) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") + if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") + + /* Create a link to the object */ + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, + (vol_obj1 != NULL ? vol_obj1->driver->cls : vol_obj2->driver->cls), + lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") done: @@ -327,22 +408,27 @@ done: herr_t H5Oincr_refcount(hid_t object_id) { - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", object_id); - /* Get the object's oloc so we can adjust its link count */ - if((oloc = H5O_get_loc(object_id)) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(object_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5O_link(oloc, 1) < 0) + if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_CHANGE_REF_COUNT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -373,22 +459,27 @@ done: herr_t H5Odecr_refcount(hid_t object_id) { - H5O_loc_t *oloc; /* Object location */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", object_id); - /* Get the object's oloc so we can adjust its link count */ - if((oloc = H5O_get_loc(object_id)) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(object_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5O_link(oloc, -1) < 0) + if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_CHANGE_REF_COUNT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -412,15 +503,14 @@ done: htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { - H5G_loc_t loc; /* Location info */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("t", "i*si", loc_id, name, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") if(!*name) @@ -430,8 +520,19 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set the location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Check if the object exists */ - if((ret_value = H5G_loc_exists(&loc, name)) < 0) + if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_EXISTS, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -456,22 +557,30 @@ done: herr_t H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*xIu", loc_id, oinfo, fields); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") if(fields & ~H5O_INFO_ALL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Retrieve the object's information */ - if(H5G_loc_info(&loc, ".", oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -497,15 +606,14 @@ herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*s*xIui", loc_id, name, oinfo, fields, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") if(!*name) @@ -519,8 +627,19 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Retrieve the object's information */ - if(H5G_loc_info(&loc, name, oinfo/*out*/, fields) < 0) + if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -548,7 +667,8 @@ herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -556,8 +676,6 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, fields, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -573,8 +691,21 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Retrieve the object's information */ - if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -602,22 +733,28 @@ done: herr_t H5Oset_comment(hid_t obj_id, const char *comment) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*s", obj_id, comment); - /* Check args */ - if(H5G_loc(obj_id, &loc) < 0) + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(obj_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + /* (Re)set the object's comment */ - if(H5G_loc_set_comment(&loc, ".", comment) < 0) + if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: @@ -646,15 +783,14 @@ herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*s*si", loc_id, name, comment, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") @@ -662,8 +798,19 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* (Re)set the object's comment */ - if(H5G_loc_set_comment(&loc, name, comment) < 0) + if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: @@ -690,18 +837,24 @@ done: ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); - /* Check args */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") + /* Get the object */ + if (NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + + /* Set fields in the location struct */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) + if (H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: @@ -729,15 +882,14 @@ ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name") @@ -745,8 +897,19 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, (-1), "can't set access property list info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize)) < 0) + if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: @@ -793,15 +956,14 @@ herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields); /* Check args */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -811,8 +973,18 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, if(fields & ~H5O_INFO_ALL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + /* Visit the objects */ - if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0) + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: @@ -859,7 +1031,8 @@ herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -867,8 +1040,6 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, fields, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL") if(!*obj_name) @@ -886,8 +1057,20 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Visit the objects */ - if((ret_value = H5O__visit(&loc, obj_name, idx_type, order, op, op_data, fields)) < 0) + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: @@ -938,6 +1121,7 @@ H5Oclose(hid_t object_id) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 5183026..1d509e5 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -713,7 +713,7 @@ H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_ unsigned long attr_fnum; /* Attributes file serial number */ /* Get pointer to attribute */ - if(NULL == (*attr = (H5A_t *)H5I_object_verify(attr_id_list[u], H5I_ATTR))) + if(NULL == (*attr = (H5A_t *)H5VL_object_verify(attr_id_list[u], H5I_ATTR))) HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, FAIL, "not an attribute") /* Get file serial number for attribute */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 1ba4901..c03c352 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -43,6 +43,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -197,10 +198,12 @@ H5FL_DEFINE(haddr_t); */ herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, - const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id) + const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id) { - H5G_loc_t loc; /* Source group group location */ - H5G_loc_t dst_loc; /* Destination group location */ + H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */ + H5VL_loc_params_t loc_params1; + H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */ + H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -208,10 +211,6 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, ocpypl_id, lcpl_id); /* Check arguments */ - if(H5G_loc(src_loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(H5G_loc(dst_loc_id, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!src_name || !*src_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source name specified") if(!dst_name || !*dst_name) @@ -235,8 +234,22 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(H5CX_set_loc(src_loc_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* get the object */ + if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + loc_params1.type = H5VL_OBJECT_BY_SELF; + loc_params1.obj_type = H5I_get_type(src_loc_id); + + /* get the object */ + if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + loc_params2.type = H5VL_OBJECT_BY_SELF; + loc_params2.obj_type = H5I_get_type(dst_loc_id); + /* Copy the object */ - if(H5O_copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) + if((ret_value = H5VL_object_copy(vol_obj1->data, loc_params1, vol_obj1->driver->cls, src_name, + vol_obj2->data, loc_params2, vol_obj2->driver->cls, dst_name, + ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: @@ -1784,7 +1797,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, HDassert(oh_src); HDassert(oloc_dst); HDassert(oloc_dst->file); - HDassert(H5F_FILE_ID(oloc_dst->file) >= 0); + HDassert(H5F_ID_EXISTS(oloc_dst->file)); HDassert(cpy_info); /* Allocate key */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 3441d8b..ead2028 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -34,6 +34,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ @@ -88,20 +89,28 @@ herr_t H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", loc_id, oinfo); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Retrieve the object's information */ - if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -122,15 +131,14 @@ done: herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*s*xi", loc_id, name, oinfo, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") if(!*name) @@ -142,8 +150,19 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Retrieve the object's information */ - if(H5G_loc_info(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -169,9 +188,8 @@ herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - H5G_loc_t obj_loc; /* Location used to open group */ - hbool_t loc_found = FALSE; /* Entry at 'name' found */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -179,8 +197,6 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!group_name || !*group_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -194,15 +210,24 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = group_name; + loc_params.loc_data.loc_by_idx.idx_type = idx_type; + loc_params.loc_data.loc_by_idx.order = order; + loc_params.loc_data.loc_by_idx.n = n; + loc_params.loc_data.loc_by_idx.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Retrieve the object's information */ - if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: - /* Release the object location */ - if(loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_idx1() */ @@ -243,15 +268,14 @@ herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data); /* Check args */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) @@ -259,8 +283,18 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + /* Visit the objects */ - if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: @@ -304,7 +338,8 @@ herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { - H5G_loc_t loc; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -312,8 +347,6 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, lapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!obj_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL") if(!*obj_name) @@ -329,8 +362,20 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Get the location object */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = obj_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Visit the objects */ - if((ret_value = H5O__visit(&loc, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: diff --git a/src/H5Ofill.c b/src/H5Ofill.c index c131c76..adf36b9 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -344,7 +344,7 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, if((exists = H5O_msg_exists_oh(open_oh, H5O_DTYPE_ID)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read object header") if(exists) { - if((dt = H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL)) < 0) + if(NULL == (dt = (H5T_t *)H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't read DTYPE message") /* Verify size */ if(fill->size != H5T_GET_SIZE(dt)) diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 2302d4c..b27f01b 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -27,6 +27,7 @@ /****************/ #include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5T_FRIEND /* Suppress error about including H5Tpkg */ /***********/ /* Headers */ @@ -40,6 +41,7 @@ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Objects */ +#include "H5Tpkg.h" /* Datatypes */ /********************/ /* Local Prototypes */ @@ -70,22 +72,28 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, herr_t H5Oflush(hid_t obj_id) { - H5O_loc_t *oloc; /* Object location */ + H5VL_object_t *vol_obj = NULL; /* Object token */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", obj_id); /* Check args */ - if(NULL == (oloc = H5O_get_loc(obj_id))) + if(NULL == (vol_obj = H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(obj_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + /* Flush the object */ - if(H5O_flush(oloc, obj_id) < 0) + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") done: @@ -116,7 +124,7 @@ H5O_flush(H5O_loc_t *oloc, hid_t obj_id) FUNC_ENTER_NOAPI(FAIL) /* Get the object pointer */ - if(NULL == (obj_ptr = H5I_object(obj_id))) + if(NULL == (obj_ptr = H5VL_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the object class */ @@ -229,22 +237,28 @@ done: herr_t H5Orefresh(hid_t oid) { - H5O_loc_t *oloc; /* object location */ - herr_t ret_value = SUCCEED; /* return value */ - + H5VL_object_t *vol_obj = NULL; /* Object token */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", oid); /* Check args */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (vol_obj = H5VL_get_object(oid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(oid) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(oid); + /* Refresh the object */ - if(H5O_refresh_metadata(oid, *oloc) < 0) + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: @@ -275,6 +289,7 @@ done: herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) { + H5VL_object_t *vol_obj = NULL; /* VOL object associated with the ID */ hbool_t objs_incr = FALSE; /* Whether the object count in the file was incremented */ herr_t ret_value = SUCCEED; /* Return value */ @@ -285,6 +300,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) H5G_loc_t obj_loc; H5O_loc_t obj_oloc; H5G_name_t obj_path; + H5O_shared_t cached_H5O_shared; /* Create empty object location */ obj_loc.oloc = &obj_oloc; @@ -297,13 +313,36 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) H5F_incr_nopen_objs(oloc.file); objs_incr = TRUE; + /* Save important datatype state */ + if(H5I_get_type(oid) == H5I_DATATYPE) + if(H5T_save_refresh_state(oid, &cached_H5O_shared) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state") + + /* Get the VOL object from the ID */ + if(NULL == (vol_obj = H5VL_get_object(oid))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Bump the number of references on the VOL driver. + * If you don't do this, VDS refreshes can accidentally close the driver. + */ + vol_obj->driver->nrefs++; + /* Close object & evict its metadata */ if((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Re-open the object, re-fetching its metadata */ - if((H5O_refresh_metadata_reopen(oid, &obj_loc, FALSE)) < 0) + if((H5O_refresh_metadata_reopen(oid, &obj_loc, vol_obj->driver, FALSE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") + + /* Restore the number of references on the VOL driver */ + vol_obj->driver->nrefs--; + + /* Restore important datatype state */ + if(H5I_get_type(oid) == H5I_DATATYPE) + if(H5T_restore_refresh_state(oid, &cached_H5O_shared) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to restore datatype state") + } /* end if */ done: @@ -350,7 +389,7 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) H5G_loc_copy(obj_loc, &tmp_loc, H5_COPY_DEEP); } /* end if */ - /* Get object's type */ + /* Handle close for multiple dataset opens */ if(H5I_get_type(oid) == H5I_DATASET) if(H5D_mult_refresh_close(oid) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") @@ -400,7 +439,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) +H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, hbool_t start_swmr) { void *object = NULL; /* Object for this operation */ H5I_type_t type; /* Type of object for the ID */ @@ -410,6 +449,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) /* Sanity check */ HDassert(obj_loc); + HDassert(vol_driver); /* Get object's type */ type = H5I_get_type(oid); @@ -443,6 +483,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -455,7 +496,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr) } /* end switch */ /* Re-register ID for the object */ - if((H5I_register_with_id(type, object, TRUE, oid)) < 0) + if((H5I_register_with_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/H5Oint.c b/src/H5Oint.c index 44809e1..c569226 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -42,6 +42,8 @@ #include "H5MMprivate.h" /* Memory management */ #endif /* H5O_ENABLE_BOGUS */ #include "H5Opkg.h" /* Object headers */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative.h" /* Virtual Object Layer (native) */ /****************/ @@ -515,26 +517,26 @@ done: /*------------------------------------------------------------------------- * Function: H5O_open_name * - * Purpose: Opens an object within an HDF5 file. + * Purpose: Opens an object by name * - * Return: Success: Open object identifier - * Failure: H5I_INVALID_HID + * Return: Success: Pointer to object data + * Failure: NULL * * Programmer: Quincey Koziol * March 5 2007 * *------------------------------------------------------------------------- */ -hid_t -H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref) +void * +H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t ret_value = H5I_INVALID_HID; + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(H5I_INVALID_HID) + FUNC_ENTER_NOAPI(NULL) /* Check args */ HDassert(loc); @@ -547,17 +549,17 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref) /* Find the object's location */ if(H5G_loc_find(loc, name, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5I_INVALID_HID, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "object not found") loc_found = TRUE; /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, app_ref)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") done: - if(ret_value < 0 && loc_found) - if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") + if(NULL == ret_value) + if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_name() */ @@ -568,25 +570,25 @@ done: * * Purpose: Internal routine to open an object by index within group * - * Return: Success: Open object identifier - * Failure: H5I_INVALID_HID + * Return: Success: Pointer to object data + * Failure: NULL * * Programmer: Quincey Koziol * December 28, 2017 * *------------------------------------------------------------------------- */ -hid_t +void * H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n) + H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(H5I_INVALID_HID) + FUNC_ENTER_NOAPI(NULL) /* Check arguments */ HDassert(loc); @@ -598,18 +600,18 @@ H5O_open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, /* Find the object's location, according to the order in the index */ if(H5G_loc_find_by_idx(loc, name, idx_type, order, n, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5I_INVALID_HID, "group not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "group not found") loc_found = TRUE; /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") done: /* Release the object location if we failed after copying it */ - if(ret_value < 0 && loc_found) - if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") + if(NULL == ret_value) + if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_by_idx() */ @@ -620,23 +622,23 @@ done: * * Purpose: Internal routine to open an object by its address * - * Return: Success: Open object identifier - * Failure: H5I_INVALID_HID + * Return: Success: Pointer to object data + * Failure: NULL * * Programmer: Quincey Koziol * December 28, 2017 * *------------------------------------------------------------------------- */ -hid_t -H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr) +void * +H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(H5I_INVALID_HID) + FUNC_ENTER_NOAPI(NULL) /* Check arguments */ HDassert(loc); @@ -650,8 +652,8 @@ H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr) H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */ /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + if(NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") done: FUNC_LEAVE_NOAPI(ret_value) @@ -661,34 +663,34 @@ done: /*------------------------------------------------------------------------- * Function: H5O_open_by_loc * - * Purpose: Opens an object and returns an ID given its group loction. + * Purpose: Opens an object * - * Return: Success: Open object identifier - * Failure: H5I_INVALID_HID + * Return: Success: Pointer to object data + * Failure: NULL * * Programmer: James Laird * July 25 2006 * *------------------------------------------------------------------------- */ -hid_t -H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref) +void * +H5O_open_by_loc(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) { const H5O_obj_class_t *obj_class; /* Class of object for location */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(H5I_INVALID_HID) + FUNC_ENTER_NOAPI(NULL) HDassert(obj_loc); /* Get the object class for this location */ if(NULL == (obj_class = H5O__obj_class(obj_loc->oloc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "unable to determine object class") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object class") /* Call the object class's 'open' routine */ HDassert(obj_class->open); - if((ret_value = obj_class->open(obj_loc, app_ref)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + if(NULL == (ret_value = obj_class->open(obj_loc, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") done: FUNC_LEAVE_NOAPI(ret_value) @@ -733,7 +735,7 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) #ifdef H5O_DEBUG if(H5DEBUG(O)) { - if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file)) + if(FALSE == H5F_ID_EXISTS(loc->file) && 1 == H5F_NREFS(loc->file)) HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); else HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); @@ -1766,6 +1768,7 @@ H5O_get_loc(hid_t object_id) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -2622,6 +2625,8 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ H5O_info_t oinfo; /* Object info struct */ + void *obj = NULL; /* Object */ + H5I_type_t opened_type; /* ID type of object */ hid_t obj_id = H5I_INVALID_HID; /* ID of object */ herr_t ret_value = FAIL; /* Return value */ @@ -2649,9 +2654,13 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, /* Open the object */ /* (Takes ownership of the obj_loc information) */ - if((obj_id = H5O_open_by_loc(&obj_loc, TRUE)) < 0) + if(NULL == (obj = H5O_open_by_loc(&obj_loc, &opened_type))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") + /* Get an ID for the visited object */ + if((obj_id = H5VL_native_register(opened_type, obj, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register visited object") + /* Make callback for starting object */ if((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "can't visit objects") @@ -2663,6 +2672,7 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, /* Check for object being a group */ if(oinfo.type == H5O_TYPE_GROUP) { H5G_loc_t start_loc; /* Location of starting group */ + H5G_loc_t vis_loc; /* Location of visited group */ /* Get the location of the starting group */ if(H5G_loc(obj_id, &start_loc) < 0) @@ -2697,12 +2707,17 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list") } + /* Get the location of the visited group */ + if(H5G_loc(obj_id, &vis_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + /* Call internal group visitation routine */ - if((ret_value = H5G_visit(&start_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0) + if((ret_value = H5G_visit(&vis_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") } /* end if */ done: +/* XXX (VOL MERGE): Probably also want to consider closing obj here on failures */ if(obj_id != H5I_INVALID_HID) { if(H5I_dec_app_ref(obj_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") diff --git a/src/H5Opkg.h b/src/H5Opkg.h index ea654d2..7254edb 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -339,7 +339,7 @@ typedef struct H5O_obj_class_t { void *(*get_copy_file_udata)(void); /*retrieve user data for 'copy file' operation */ void (*free_copy_file_udata)(void *); /*free user data for 'copy file' operation */ htri_t (*isa)(const H5O_t *); /*if a header matches an object class */ - hid_t (*open)(const H5G_loc_t *, hbool_t ); /*open an object of this class */ + void *(*open)(const H5G_loc_t *, H5I_type_t *); /*open an object of this class */ void *(*create)(H5F_t *, void *, H5G_loc_t *); /*create an object of this class */ H5O_loc_t *(*get_oloc)(hid_t ); /*get the object header location for an object */ herr_t (*bh_info)(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info); /*get the index & heap info for an object */ @@ -414,6 +414,12 @@ typedef struct H5O_chk_cache_ud_t { H5O_common_cache_ud_t common; /* Common object header cache callback info */ } H5O_chk_cache_ud_t; +/* types for object optional VOL operations */ +typedef enum H5VL_object_optional_t { + H5VL_OBJECT_GET_COMMENT, /* get object comment */ + H5VL_OBJECT_GET_INFO, /* get object info */ + H5VL_OBJECT_SET_COMMENT /* set object comment */ +} H5VL_object_optional_t; /* Header message ID to class mapping */ H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES]; diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 4a401b5..048e13e 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -43,6 +43,7 @@ typedef struct H5O_fill_t H5O_fill_t; #include "H5HGprivate.h" /* Global Heaps */ #include "H5SLprivate.h" /* Skip lists */ #include "H5Tprivate.h" /* Datatype functions */ +#include "H5VLprivate.h" #include "H5Zprivate.h" /* I/O pipeline filters */ /* Forward references of package typedefs */ @@ -866,10 +867,10 @@ H5_DLL herr_t H5O_init(void); H5_DLL herr_t H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id, H5O_loc_t *loc/*out*/); H5_DLL herr_t H5O_open(H5O_loc_t *loc); -H5_DLL hid_t H5O_open_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n); -H5_DLL hid_t H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr); -H5_DLL hid_t H5O_open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref); +H5_DLL void *H5O_open_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5I_type_t *opened_type/*out*/); +H5_DLL void *H5O_open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type/*out*/); +H5_DLL void *H5O_open_by_loc(const H5G_loc_t *obj_loc, H5I_type_t *opened_type/*out*/); H5_DLL herr_t H5O_close(H5O_loc_t *loc, hbool_t *file_closed/*out*/); H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust); H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks); @@ -887,7 +888,7 @@ H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, H5O_hdr_info_t *hdr); H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, H5O_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type); H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, struct H5P_genplist_t *oc_plist); -H5_DLL hid_t H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref); +H5_DLL void *H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type/*out*/); H5_DLL herr_t H5O_get_nlinks(const H5O_loc_t *loc, hsize_t *nlinks); H5_DLL void *H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc); H5_DLL haddr_t H5O_get_oh_addr(const H5O_t *oh); @@ -945,7 +946,7 @@ H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t H5_DLL herr_t H5O_flush(H5O_loc_t *oloc, hid_t obj_id); H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id); H5_DLL herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc); -H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, hbool_t start_swmr); +H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, hbool_t start_swmr); /* Object copying routines */ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, diff --git a/src/H5PLint.c b/src/H5PLint.c index b190746..166b300 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -30,6 +30,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5MMprivate.h" /* Memory management */ #include "H5PLpkg.h" /* Plugin */ +#include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5Zprivate.h" /* Filter pipeline */ @@ -250,6 +251,10 @@ H5PL_load(H5PL_type_t type, H5PL_key_t key) if ((H5PL_plugin_control_mask_g & H5PL_FILTER_PLUGIN) == 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "filter plugins disabled") break; + case H5PL_TYPE_VOL: + if((H5PL_plugin_control_mask_g & H5PL_VOL_PLUGIN) == 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Virtual Object Layer (VOL) driver plugins disabled") + break; case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: @@ -352,6 +357,22 @@ H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, break; } + case H5PL_TYPE_VOL: + { + const H5VL_class_t *cls = NULL; + + /* Get the plugin info */ + if (NULL == (cls = (const H5VL_class_t *)(*get_plugin_info)())) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VOL driver info from plugin") + + /* If the plugin names match, we're done. Set the output parameters. */ + if (cls->name && !HDstrcmp(cls->name, key.name)) { + *plugin_info = (const void *)cls; + *success = TRUE; + } + + break; + } case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index cc2e258..2af1b70 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -36,6 +36,7 @@ /* The key that will be used to find the plugin */ typedef union H5PL_key_t { int id; /* filters */ + const char *name; /* VOL drivers */ } H5PL_key_t; diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index fe5bdfb..8e022cc 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -32,11 +32,13 @@ typedef enum H5PL_type_t { H5PL_TYPE_ERROR = -1, /* Error */ H5PL_TYPE_FILTER = 0, /* Filter */ - H5PL_TYPE_NONE = 1 /* This must be last! */ + H5PL_TYPE_VOL = 1, /* VOL driver */ + H5PL_TYPE_NONE = 2 /* This must be last! */ } H5PL_type_t; /* Common dynamic plugin type flags used by the set/get_loading_state functions */ #define H5PL_FILTER_PLUGIN 0x0001 +#define H5PL_VOL_PLUGIN 0x0002 #define H5PL_ALL_PLUGIN 0xFFFF #ifdef __cplusplus diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c index 530ede3..2322c76 100644 --- a/src/H5Pacpl.c +++ b/src/H5Pacpl.c @@ -33,12 +33,17 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Ppkg.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ /****************/ +/* Definitions for locations parameters */ +#define H5A_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t) +#define H5A_CRT_LOCATION_DEF H5I_BADID + /******************/ /* Local Typedefs */ @@ -54,6 +59,9 @@ /* Local Prototypes */ /********************/ +/* Property class callbacks */ +static herr_t H5P_acrt_reg_prop(H5P_genclass_t *pclass); + /*********************/ /* Package Variables */ @@ -68,7 +76,7 @@ const H5P_libclass_t H5P_CLS_ACRT[1] = {{ &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class */ &H5P_CLS_ATTRIBUTE_CREATE_ID_g, /* Pointer to class ID */ &H5P_LST_ATTRIBUTE_CREATE_ID_g, /* Pointer to default property list ID */ - NULL, /* Default property registration routine */ + H5P_acrt_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ @@ -83,4 +91,44 @@ const H5P_libclass_t H5P_CLS_ACRT[1] = {{ /* Library Private Variables */ /*****************************/ + +/*------------------------------------------------------------------------- + * Function: H5P_acrt_reg_prop + * + * Purpose: Register the attribute creation property list class's properties + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P_acrt_reg_prop(H5P_genclass_t *pclass) +{ + hid_t type_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + /* Register the type ID property*/ + if(H5P__register_real(pclass, H5VL_PROP_ATTR_TYPE_ID, sizeof(hid_t), &type_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the space ID property */ + if(H5P__register_real(pclass, H5VL_PROP_ATTR_SPACE_ID, sizeof(hid_t), &space_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the lcpl ID property */ + HDmemset(&loc_params, 0, sizeof(H5VL_loc_params_t)); + loc_params.obj_type = H5A_CRT_LOCATION_DEF; + if(H5P__register_real(pclass, H5VL_PROP_ATTR_LOC_PARAMS, H5A_CRT_LOCATION_SIZE, &loc_params, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_acrt_reg_prop() */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 7e9fc52..a5a16bb 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -240,6 +240,9 @@ static hbool_t H5P_dcrt_def_layout_init_g = FALSE; static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass) { + hid_t type_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -268,6 +271,21 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass) H5D_CRT_EXT_FILE_LIST_DEL, H5D_CRT_EXT_FILE_LIST_COPY, H5D_CRT_EXT_FILE_LIST_CMP, H5D_CRT_EXT_FILE_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the type ID property*/ + if(H5P__register_real(pclass, H5VL_PROP_DSET_TYPE_ID, sizeof(hid_t), &type_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the space ID property */ + if(H5P__register_real(pclass, H5VL_PROP_DSET_SPACE_ID, sizeof(hid_t), &space_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the lcpl ID property */ + if(H5P__register_real(pclass, H5VL_PROP_DSET_LCPL_ID, sizeof(hid_t), &lcpl_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5P_ignore_cmp, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dcrt_reg_prop() */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 5320da1..0340b67 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -39,6 +39,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory Management */ #include "H5Ppkg.h" /* Property lists */ +#include "H5VLprivate.h" /* VOL drivers */ /* Includes needed to set as default file driver */ #include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ @@ -47,6 +48,9 @@ #include "H5FDwindows.h" /* Win32 I/O */ #endif +/* Includes needed to set the default VOL driver */ +#include "H5VLnative.h" /* Native HDF5 file VOL driver */ + /****************/ /* Local Macros */ @@ -258,6 +262,16 @@ #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF 0 #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC H5P__encode_unsigned #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC H5P__decode_unsigned +/* Definition for file VOL driver properties (ID, etc.) */ +#define H5F_ACS_VOL_SIZE sizeof(H5VL_driver_prop_t) +#define H5F_ACS_VOL_DEF {H5_DEFAULT_VOL, NULL} +#define H5F_ACS_VOL_CRT H5P__facc_vol_create +#define H5F_ACS_VOL_SET H5P__facc_vol_set +#define H5F_ACS_VOL_GET H5P__facc_vol_get +#define H5F_ACS_VOL_DEL H5P__facc_vol_del +#define H5F_ACS_VOL_COPY H5P__facc_vol_copy +#define H5F_ACS_VOL_CMP H5P__facc_vol_cmp +#define H5F_ACS_VOL_CLOSE H5P__facc_vol_close /******************/ @@ -320,6 +334,15 @@ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_c static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); +/* VOL driver callbacks */ +static herr_t H5P__facc_vol_create(const char *name, size_t size, void *value); +static herr_t H5P__facc_vol_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_vol_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_vol_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_vol_copy(const char *name, size_t size, void *value); +static int H5P__facc_vol_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_vol_close(const char *name, size_t size, void *value); + /*********************/ /* Package Variables */ @@ -414,6 +437,7 @@ static herr_t H5P__facc_reg_prop(H5P_genclass_t *pclass) { const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */ + const H5VL_driver_prop_t def_vol_prop = H5F_ACS_VOL_DEF; /* Default VOL driver ID & info (initialized from a variable) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -644,6 +668,13 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the file VOL driver ID & info */ + /* (Note: this property should not have an encode/decode callback -QAK) */ + if(H5P__register_real(pclass, H5F_ACS_VOL_DRV_NAME, H5F_ACS_VOL_SIZE, &def_vol_prop, + H5F_ACS_VOL_CRT, H5F_ACS_VOL_SET, H5F_ACS_VOL_GET, NULL, NULL, + H5F_ACS_VOL_DEL, H5F_ACS_VOL_COPY, H5F_ACS_VOL_CMP, H5F_ACS_VOL_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_reg_prop() */ @@ -4939,3 +4970,495 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_page_buffer_size() */ + +/*------------------------------------------------------------------------- + * Function: H5P_set_vol + * + * Purpose: Set the VOL driver for a file access property list + * (PLIST_ID). The vol properties will + * be copied into the property list and the reference count on + * the vol will be incremented. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + H5VL_driver_prop_t vol_prop; /* Property for VOL ID & info */ + + /* Prepare the VOL driver property */ + vol_prop.driver_id = vol_id; + vol_prop.driver_info = vol_info; + + /* Set the driver ID & info property */ + if(H5P_set(plist, H5F_ACS_VOL_DRV_NAME, &vol_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL driver ID & info") + } + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_set_vol() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_vol + * + * Purpose: Set the file VOL driver (VOL_ID) for a file access + * property list (PLIST_ID) + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "ii*x", plist_id, new_vol_id, new_vol_info); + + /* Check arguments */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + if(NULL == H5I_object_verify(new_vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file vol ID") + + /* Set the vol */ + if(H5P_set_vol(plist, new_vol_id, new_vol_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_vol() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_get_vol_info + * + * Purpose: Returns a pointer directly to the file vol-specific + * information of a file access property list. + * + * Return: Success: Ptr to *uncopied* vol specific data + * structure if any. + * + * Failure: NULL. Null is also returned if the vol has + * not registered any vol-specific properties + * although no error is pushed on the stack in + * this case. + * + *------------------------------------------------------------------------- + */ +void * +H5P_get_vol_info(H5P_genplist_t *plist) +{ + void *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) + + /* Get the current vol info */ + if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") + ret_value = (void *)driver_prop.driver_info; + } else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_get_vol_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_vol_info + * + * Purpose: Returns a pointer directly to the file vol-specific + * information of a file access property list. + * + * XXX (VOL MERGE): This API call seems like a REALLY bad idea - DER + * + * Return: Success: Ptr to *uncopied* vol specific data + * structure if any. + * + * Failure: NULL. Null is also returned if the vol has + * not registered any vol-specific properties + * although no error is pushed on the stack in + * this case. + * + *------------------------------------------------------------------------- + */ +void * +H5Pget_vol_info(hid_t plist_id) +{ + H5P_genplist_t *plist; /* Property list pointer */ + void *ret_value; /* Return value */ + + FUNC_ENTER_API(NULL) + H5TRACE1("*x", "i", plist_id); + + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") + + if(NULL == (ret_value = H5P_get_vol_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol info") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_vol_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__vol_copy + * + * Purpose: Copy VOL driver ID & info. + * + * Note: This is an "in-place" copy, since this routine gets called + * after the top-level copy has been performed and this routine + * finishes the "deep" part of the copy. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__vol_copy(void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(value) { + H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */ + + /* Copy the driver ID & info, if there is one */ + if(info->driver_id > 0) { + /* Increment the reference count on driver ID and copy driver info */ + if(H5I_inc_ref(info->driver_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL driver ID") + + /* Copy driver info, if it exists */ + if(info->driver_info) { + H5VL_class_t *driver; /* Pointer to driver */ + void *new_driver; /* Copy of driver info */ + + /* Retrieve the driver for the ID */ + if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Allow the driver to copy or do it ourselves */ + if(driver->fapl_copy) { + if(NULL == (new_driver = (driver->fapl_copy)(info->driver_info))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver info copy failed") + } + else if(driver->fapl_size > 0) { + if(NULL == (new_driver = H5MM_malloc(driver->fapl_size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed") + HDmemcpy(new_driver, info->driver_info, driver->fapl_size); + } + else + HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info") + + /* Set the driver info for the copy */ + info->driver_info = new_driver; + } + } + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__vol_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__vol_free + * + * Purpose: Free VOL driver ID & info. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__vol_free(void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(value) { + H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */ + + /* Free the driver info (if it exists) and decrement the ID */ + if(info->driver_id > 0) { + if(info->driver_info) { + H5VL_class_t *driver; /* Pointer to driver */ + + /* Retrieve the driver for the ID */ + if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Allow the driver to free info or do it ourselves */ + if(driver->fapl_free) { + if((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") + } + else + H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */ + } + + /* Decrement reference count for driver ID */ + if(H5I_dec_ref(info->driver_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID") + } + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__vol_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_create + * + * Purpose: Create callback for the VOL driver ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make copy of the VOL driver */ + if(H5P__vol_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_set + * + * Purpose: Copies a VOL driver property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of VOL driver ID & info */ + if(H5P__vol_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_get + * + * Purpose: Copies a VOL driver property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of VOL driver */ + if(H5P__vol_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_del + * + * Purpose: Frees memory used to store the VOL driver ID & info property + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the VOL driver ID & info */ + if(H5P__vol_free(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_copy + * + * Purpose: Copy callback for the VOL driver ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make copy of VOL driver */ + if(H5P__vol_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_cmp + * + * Purpose: Callback routine which is called whenever the VOL driver + * ID & info property in the file access property list + * is compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + *------------------------------------------------------------------------- + */ +static int +H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED size) +{ + const H5VL_driver_prop_t *info1 = (const H5VL_driver_prop_t *)_info1; /* Create local aliases for values */ + const H5VL_driver_prop_t *info2 = (const H5VL_driver_prop_t *)_info2; + H5VL_class_t *cls1, *cls2; /* Driver class for each property */ + int cmp_value; /* Value from comparison */ + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(info1); + HDassert(info2); + HDassert(size == sizeof(H5VL_driver_prop_t)); + + /* Compare drivers */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->driver_id))) + HGOTO_DONE(-1) + if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->driver_id))) + HGOTO_DONE(1) + if(cls1->name == NULL && cls2->name != NULL) + HGOTO_DONE(-1); + if(cls1->name != NULL && cls2->name == NULL) + HGOTO_DONE(1); + if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) + HGOTO_DONE(cmp_value); + + /* Compare driver info */ + if(cls1->fapl_size < cls2->fapl_size) + HGOTO_DONE(-1) + if(cls1->fapl_size > cls2->fapl_size) + HGOTO_DONE(1) + HDassert(cls1->fapl_size == cls2->fapl_size); + + if(info1->driver_info == NULL && info2->driver_info != NULL) + HGOTO_DONE(-1); + if(info1->driver_info != NULL && info2->driver_info == NULL) + HGOTO_DONE(1); + if(info1->driver_info) { + HDassert(cls1->fapl_size > 0); + if(0 != (cmp_value = HDmemcmp(info1->driver_info, info2->driver_info, cls1->fapl_size))) + HGOTO_DONE(cmp_value); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_vol_close + * + * Purpose: Close callback for the VOL driver ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the VOL driver */ + if(H5P__vol_free(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_vol_close() */ + + diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index e2fdcea..ab289e4 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -128,6 +128,7 @@ static const H5O_linfo_t H5G_def_linfo_g = H5G_CRT_LINK_INFO_DEF; /* Defaul static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass) { + hid_t lcpl_id = H5P_LINK_CREATE_DEFAULT; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -144,6 +145,11 @@ H5P__gcrt_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the lcpl ID property */ + if(H5P__register_real(pclass, H5VL_PROP_GRP_LCPL_ID, sizeof(hid_t), &lcpl_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__gcrt_reg_prop() */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 179f883..e2ae792 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -5452,3 +5452,22 @@ H5P_get_class(const H5P_genplist_t *plist) FUNC_LEAVE_NOAPI(plist->pclass) } /* end H5P_get_class() */ + +/*------------------------------------------------------------------------- + * Function: H5P_ignore_cmp + * + * Purpose: Callback routine to ignore comparing property values. + * + * Return: zero + * + *------------------------------------------------------------------------- + */ +int +H5P_ignore_cmp(const void H5_ATTR_UNUSED *val1, const void H5_ATTR_UNUSED *val2, + size_t H5_ATTR_UNUSED size) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + FUNC_LEAVE_NOAPI(0) +} /* end H5P_ignore_cmp() */ + diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 1d45bed..6568ecd 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -48,6 +48,31 @@ #define H5L_CRT_INTERMEDIATE_GROUP_ENC H5P__encode_unsigned #define H5L_CRT_INTERMEDIATE_GROUP_DEC H5P__decode_unsigned +/* ======== VOL specific properties ========= */ +/* Definitions for target object ID */ +#define H5L_CRT_TARGET_SIZE sizeof(void *) +#define H5L_CRT_TARGET_DEF NULL + +/* Definitions for Location params */ +#define H5L_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t) +#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {HADDR_UNDEF}} + +/* Definitions for target object NAME */ +#define H5L_CRT_TARGET_NAME_SIZE sizeof(char *) +#define H5L_CRT_TARGET_NAME_DEF NULL + +/* Definitions for link type */ +#define H5L_CRT_LINK_TYPE_SIZE sizeof(link_type) +#define H5L_CRT_LINK_TYPE_DEF H5L_TYPE_ERROR + +/* Definitions for UDATA */ +#define H5L_CRT_UDATA_SIZE sizeof(void *) +#define H5L_CRT_UDATA_DEF NULL + +/* Definitions for UDATA_SIZE */ +#define H5L_CRT_UDATA_SIZE_SIZE sizeof(size_t) +#define H5L_CRT_UDATA_SIZE_DEF 0 + /******************/ /* Local Typedefs */ /******************/ @@ -118,6 +143,12 @@ static const unsigned H5L_def_intmd_group_g = H5L_CRT_INTERMEDIATE_GROUP_DEF; herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass) { + void* target = H5L_CRT_TARGET_DEF; + H5VL_loc_params_t loc_params = H5L_CRT_LOCATION_DEF; + char *target_name = H5L_CRT_TARGET_NAME_DEF; + H5L_type_t link_type = H5L_CRT_LINK_TYPE_DEF; + void *udata = H5L_CRT_UDATA_DEF; + size_t udata_size = H5L_CRT_UDATA_SIZE_DEF; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -128,6 +159,30 @@ H5P_lcrt_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET, H5L_CRT_TARGET_SIZE, &target, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET_LOC_PARAMS, H5L_CRT_LOCATION_SIZE, &loc_params, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + if(H5P__register_real(pclass, H5VL_PROP_LINK_TARGET_NAME, H5L_CRT_TARGET_NAME_SIZE, &target_name, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + if(H5P__register_real(pclass, H5VL_PROP_LINK_TYPE, H5L_CRT_LINK_TYPE_SIZE, &link_type, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + if(H5P__register_real(pclass, H5VL_PROP_LINK_UDATA, H5L_CRT_UDATA_SIZE, &udata, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + if(H5P__register_real(pclass, H5VL_PROP_LINK_UDATA_SIZE, H5L_CRT_UDATA_SIZE_SIZE, &udata_size, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_lcrt_reg_prop() */ diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 7792671..cd749cb 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -177,6 +177,8 @@ H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist); H5_DLL const void *H5P_peek_driver_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info); +H5_DLL herr_t H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info); +H5_DLL void * H5P_get_vol_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info); @@ -204,6 +206,8 @@ H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status); H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const struct H5T_t *type, void *value); +H5_DLL int H5P_ignore_cmp(const void H5_ATTR_UNUSED *val1, const void H5_ATTR_UNUSED *val2, + size_t H5_ATTR_UNUSED size); #endif /* _H5Pprivate_H */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index c5596e5..77d8ebb 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -313,6 +313,8 @@ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info); H5_DLL hid_t H5Pget_driver(hid_t plist_id); H5_DLL const void *H5Pget_driver_info(hid_t plist_id); +H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); +H5_DLL void *H5Pget_vol_info(hid_t plist_id); H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset); H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type); diff --git a/src/H5R.c b/src/H5R.c index 65aa6cb..3e6517f 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -91,8 +91,8 @@ herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id) { - H5G_loc_t loc; /* File location */ - H5S_t *space = NULL; /* Pointer to dataspace containing region */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -101,8 +101,6 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t /* Check args */ if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) @@ -111,15 +109,27 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported") if(space_id == (-1) && ref_type == H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") - if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the file object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") /* Create reference */ - if((ret_value = H5R__create(ref, &loc, name, ref_type, space)) < 0) + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_CREATE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + ref, name, ref_type, space_id)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference") done: @@ -157,16 +167,16 @@ done: hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_ref) { - H5G_loc_t loc; /* Group location */ - H5F_t *file = NULL; /* File object */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "iiRt*x", obj_id, oapl_id, ref_type, _ref); /* Check args */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(oapl_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) @@ -178,13 +188,25 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r if(H5CX_set_apl(&oapl_id, H5P_CLS_DACC, obj_id, FALSE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Get the file pointer from the entry */ - file = loc.oloc->file; + /* Get the VOL object */ + if(NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_REF; + loc_params.loc_data.loc_by_ref.ref_type = ref_type; + loc_params.loc_data.loc_by_ref._ref = _ref; + loc_params.loc_data.loc_by_ref.lapl_id = oapl_id; + loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if((ret_value = H5R__dereference(file, oapl_id, ref_type, _ref)) < 0) + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, + &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) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + done: FUNC_LEAVE_API(ret_value) } /* end H5Rdereference2() */ @@ -216,29 +238,32 @@ done: hid_t H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) { - H5G_loc_t loc; /* Object's group location */ - H5S_t *space = NULL; /* Dataspace object */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iRt*x", id, ref_type, ref); /* Check args */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(ref_type != H5R_DATASET_REGION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); + + /* get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + /* Get the dataspace with the correct region selected */ - if(NULL == (space = H5R__get_region(loc.oloc->file, ref))) + if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_REGION, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") - /* Atomize */ - if((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") - done: FUNC_LEAVE_API(ret_value) } /* end H5Rget_region() */ @@ -271,22 +296,31 @@ herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "iRt*x*Ot", id, ref_type, ref, obj_type); /* Check args */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); + + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + /* Get the object type */ - if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0) + if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, + H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") done: @@ -331,26 +365,31 @@ ssize_t H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size) { - H5G_loc_t loc; /* Group location */ - H5F_t *file; /* File object */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size); /* Check args */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") - /* Get the file pointer from the entry */ - file = loc.oloc->file; + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); + + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get name */ - if((ret_value = H5R__get_name(file, id, ref_type, _ref, name, size)) < 0) + if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_NAME, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + &ret_value, name, size, ref_type, _ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path") done: diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 41765cf..9c1fcc5 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -42,6 +42,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5Oprivate.h" /* Object headers */ #include "H5Rpkg.h" /* References */ @@ -102,7 +103,8 @@ H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; H5O_type_t obj_type; /* Object type */ H5G_obj_t ret_value; /* Return value */ @@ -110,15 +112,22 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) H5TRACE3("Go", "iRt*x", id, ref_type, ref); /* Check args */ - if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location") if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type") if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer") + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); + + /* Get the vol object */ + if (NULL == (vol_obj = H5VL_get_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier") + /* Get the object information */ - if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, &obj_type) < 0) + if (H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_TYPE, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ @@ -148,28 +157,40 @@ done: hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) { - H5G_loc_t loc; /* Group location */ - H5F_t *file = NULL; /* File object */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "iRt*x", obj_id, ref_type, _ref); /* Check args */ - if (H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") if (_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") - /* Get the file pointer from the entry */ - file = loc.oloc->file; + /* Get the VOL object */ + if (NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + + loc_params.type = H5VL_OBJECT_BY_REF; + loc_params.loc_data.loc_by_ref.ref_type = ref_type; + loc_params.loc_data.loc_by_ref._ref = _ref; + loc_params.loc_data.loc_by_ref.lapl_id = H5P_DATASET_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if((ret_value = H5R__dereference(file, H5P_DATASET_ACCESS_DEFAULT, ref_type, _ref)) < 0) + if (NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, &opened_type, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + done: FUNC_LEAVE_API(ret_value) } /* end H5Rdereference1() */ diff --git a/src/H5Rint.c b/src/H5Rint.c index 1bbe217..52a4ee1 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -692,8 +692,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ ssize_t -H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, - char *name, size_t size) +H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_t size) { hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */ H5O_loc_t oloc; /* Object location describing object for reference */ diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 504d2af..1c1c8eb 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -54,7 +54,7 @@ H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, H5R_type_ H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, const void *_ref); H5_DLL H5S_t *H5R__get_region(H5F_t *file, const void *_ref); H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); -H5_DLL ssize_t H5R__get_name(H5F_t *file, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size); +H5_DLL ssize_t H5R__get_name(H5F_t *file, H5R_type_t ref_type, const void *_ref, char *name, size_t size); #endif /* _H5Rpkg_H */ diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 09b474a..d7a5d29 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -131,6 +131,7 @@ H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id); H5_DLL herr_t H5Sset_extent_none(hid_t space_id); H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id); H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2); +H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); H5_DLL herr_t H5Sselect_all(hid_t spaceid); H5_DLL herr_t H5Sselect_none(hid_t spaceid); H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 2ce3f10..ea10517 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -89,6 +89,52 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset) /*-------------------------------------------------------------------------- NAME + H5Sselect_copy + PURPOSE + Copy a selection from one dataspace to another + USAGE + herr_t H5Sselect_copy(dst, src) + hid_t dst; OUT: ID of the destination dataspace + hid_t src; IN: ID of the source dataspace + + RETURNS + Non-negative on success/Negative on failure + DESCRIPTION + Copies all the selection information (including offset) from the source + dataspace to the destination dataspace. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5Sselect_copy(hid_t dst_id, hid_t src_id) +{ + H5S_t *src; + H5S_t *dst; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ii", dst_id, src_id); + + /* Check args */ + if(NULL == (src = (H5S_t *)H5I_object_verify(src_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(NULL == (dst = (H5S_t *)H5I_object_verify(dst_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Copy */ + if(H5S_select_copy(dst, src, FALSE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy selection") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Sselect_copy() */ + + +/*-------------------------------------------------------------------------- + NAME H5S_select_copy PURPOSE Copy a selection from one dataspace to another diff --git a/src/H5T.c b/src/H5T.c index a9d2168..d0b1c0a 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -41,6 +41,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -1607,6 +1608,21 @@ H5T__close_cb(H5T_t *dt) HDassert(dt); HDassert(dt->shared); + /* If this datatype is VOL-managed (i.e.: has a VOL object), + * close it through the VOL driver. + */ + if(NULL != dt->vol_obj) { + + /* Close the driver-managed datatype data */ + if(H5VL_datatype_close(dt->vol_obj->data, dt->vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + + /* Free the VOL object */ + if(H5VL_free_object(dt->vol_obj) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object"); + dt->vol_obj = NULL; + } + /* Close the datatype */ if(H5T_close(dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); @@ -1650,11 +1666,11 @@ H5Tcreate(H5T_class_t type, size_t size) /* create the type */ if(NULL == (dt = H5T__create(type, size))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type") /* Get an ID for the datatype */ if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype ID") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype ID") done: FUNC_LEAVE_API(ret_value) @@ -1701,7 +1717,7 @@ H5Tcopy(hid_t type_id) H5D_t *dset; /* Dataset for datatype */ /* The argument is a dataset handle */ - if(NULL == (dset = (H5D_t *)H5I_object(type_id))) + if(NULL == (dset = (H5D_t *)H5VL_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") if(NULL == (dt = H5D_typeof(dset))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the dataset datatype") @@ -1716,6 +1732,7 @@ H5Tcopy(hid_t type_id) case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -3039,6 +3056,8 @@ H5T_decode(size_t buf_size, const unsigned char *buf) if(H5T_set_loc(ret_value, NULL, H5T_LOC_MEMORY) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + /* No VOL object */ + ret_value->vol_obj = NULL; done: /* Release fake file structure */ if(f && H5F_fake_free(f) < 0) @@ -3162,6 +3181,9 @@ H5T__create(H5T_class_t type, size_t size) if(H5T_STRING != type || H5T_VARIABLE != size) dt->shared->size = size; + /* No VOL object */ + dt->vol_obj = NULL; + /* Set return value */ ret_value = dt; @@ -3215,6 +3237,9 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Copy shared information (entry information is copied last) */ *(new_dt->shared) = *(old_dt->shared); + /* No VOL object */ + new_dt->vol_obj = NULL; + /* Check what sort of copy we are making */ switch (method) { case H5T_COPY_TRANSIENT: @@ -3543,6 +3568,9 @@ H5T__alloc(void) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") dt->shared->version = H5O_DTYPE_VERSION_1; + /* No VOL object initially */ + dt->vol_obj = NULL; + /* Assign return value */ ret_value = dt; @@ -3643,7 +3671,8 @@ done: * * Purpose: Frees a datatype and all associated memory. * - * Hote: Does _not_ deal with open named datatypes, etc. + * Note: Does _not_ deal with open named datatypes, etc. so this + * should never see a type managed by a VOL driver. * * Return: Non-negative on success/Negative on failure * @@ -5115,8 +5144,10 @@ H5T_is_named(const H5T_t *dt) HDassert(dt); - if(dt->shared->state == H5T_STATE_OPEN || dt->shared->state == H5T_STATE_NAMED) + if(dt->vol_obj) ret_value = TRUE; + else + ret_value = (H5T_STATE_OPEN == dt->shared->state || H5T_STATE_NAMED == dt->shared->state); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5158,6 +5189,20 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) if(H5G_name_free(&dt->path) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path") + /* If the datatype is committed through the VOL, close it */ + if (NULL != dt->vol_obj) { + H5VL_object_t *vol_obj = dt->vol_obj; + + /* Close the datatype through the VOL*/ + if ((ret_value = H5VL_datatype_close(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + + /* Free the datatype and set the VOL object pointer to NULL */ + if (H5VL_free_object(vol_obj) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object"); + dt->vol_obj = NULL; + } + dt->shared->state = H5T_STATE_TRANSIENT; } diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index ce537dc..8f7b4de 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -30,12 +30,15 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ #include "H5FOprivate.h" /* File objects */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory Management */ +#include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ #include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -78,6 +81,12 @@ static H5T_t *H5T__open_oid(const H5G_loc_t *loc); /* Local Variables */ /*******************/ +/* Declare a free list to manage the H5VL_t struct */ +H5FL_EXTERN(H5VL_t); + +/* Declare a free list to manage the H5VL_object_t struct */ +H5FL_EXTERN(H5VL_object_t); + /*------------------------------------------------------------------------- @@ -94,22 +103,25 @@ herr_t H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id) { - H5G_loc_t loc; /* Location to create datatype */ - H5T_t *type = NULL; /* Datatype for ID */ + void *data = NULL; /* VOL-managed datatype data */ + H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */ + H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*siiii", loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") if(!*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_is_named(dt)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") /* Get correct property list */ if(H5P_DEFAULT == lcpl_id) @@ -119,7 +131,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") /* Get correct property list */ - if(H5P_DEFAULT == tcpl_id) + if (H5P_DEFAULT == tcpl_id) tcpl_id = H5P_DATATYPE_CREATE_DEFAULT; else if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) @@ -129,10 +141,30 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object from the loc_id */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Commit the type */ - if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) + if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, + name, type_id, lcpl_id, tcpl_id, tapl_id, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + /* Set up VOL object */ + if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) + HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") + new_obj->driver = vol_obj->driver; + new_obj->driver->nrefs ++; + new_obj->data = data; + + /* Set the committed type object to the VOL driver pointer in the H5T_t struct */ + dt->vol_obj = new_obj; + done: FUNC_LEAVE_API(ret_value) } /* end H5Tcommit2() */ @@ -237,16 +269,17 @@ done: herr_t H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { - H5G_loc_t loc; /* Group location for location */ + void *dt = NULL; /* datatype object created by VOL plugin */ + H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */ H5T_t *type = NULL; /* Datatype created */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "iiii", loc_id, type_id, tcpl_id, tapl_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(H5T_is_named(type)) @@ -263,10 +296,30 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the file object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + /* Commit the datatype */ - if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) + if(NULL == (dt = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, + NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + /* Setup VOL object */ + if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) + HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") + new_obj->driver = vol_obj->driver; + new_obj->driver->nrefs ++; + new_obj->data = dt; + + /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */ + type->vol_obj = new_obj; + done: FUNC_LEAVE_API(ret_value) } /* end H5Tcommit_anon() */ @@ -515,16 +568,15 @@ done: hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) { - H5T_t *type = NULL; /* Datatype opened in file */ - H5G_loc_t loc; /* Group location of object to open */ + void *dt = NULL; /* datatype token created by VOL driver */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, tapl_id); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") if(!*name) @@ -534,19 +586,28 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + /* Open the datatype */ - if(NULL == (type = H5T__open_name(&loc, name))) + if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->driver->cls, + name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ - if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ if(H5I_INVALID_HID == ret_value) - if(type != NULL) - (void)H5T_close(type); + if(dt && H5VL_datatype_close(dt, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") FUNC_LEAVE_API(ret_value) } /* end H5Topen2() */ @@ -600,7 +661,11 @@ H5Tget_create_plist(hid_t dtype_id) } /* If the datatype is committed, retrieve further information */ else { - if((ret_value = H5T__get_create_plist(type)) < 0) + H5VL_object_t *vol_obj = type->vol_obj; + + /* Get the property list through the VOL */ + if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_TCPL, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") } @@ -641,8 +706,10 @@ H5Tflush(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Flush metadata for named datatype */ - if(H5O_flush_common(&dt->oloc, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") + if(dt->vol_obj) + if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->driver->cls, H5VL_DATATYPE_FLUSH, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") done: FUNC_LEAVE_API(ret_value) @@ -681,8 +748,10 @@ H5Trefresh(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Refresh the datatype's metadata */ - if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") + if(dt->vol_obj) + if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->driver->cls, H5VL_DATATYPE_REFRESH, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") done: FUNC_LEAVE_API(ret_value) @@ -865,6 +934,7 @@ H5T_open(const H5G_loc_t *loc) else { if(NULL == (dt = H5FL_MALLOC(H5T_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") + dt->vol_obj = NULL; #if defined(H5_USING_MEMCHECKER) || !defined(NDEBUG) /* Clear object location */ @@ -1014,3 +1084,187 @@ H5T_update_shared(H5T_t *dt) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5T_update_shared() */ + +/*------------------------------------------------------------------------- + * Function: H5T_construct_datatype + * + * Purpose: Create a Library datatype with a plugin specific datatype object + * + * Return: Success: A type structure + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5T_t * +H5T_construct_datatype(H5VL_object_t *vol_obj) +{ + ssize_t nalloc; + void *buf = NULL; + H5T_t *dt = NULL; /* datatype token from VOL plugin */ + H5T_t *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) + + /* get required buf size for encoding the datatype */ + if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_BINARY, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size") + + /* allocate buffer to store binary description of the datatype */ + if(NULL == (buf = (void *)H5MM_calloc((size_t)nalloc))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") + + /* get binary description of the datatype */ + if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_BINARY, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype") + + if(NULL == (dt = H5T_decode((size_t)nalloc, (const unsigned char *)buf))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't decode datatype") + + dt->vol_obj = vol_obj; + + ret_value = dt; + +done: + if(buf) + buf = H5MM_xfree(buf); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_construct_datatype() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_get_named_type + * + * Purpose: Returns the VOL object for the named datatype if it exists + * + * Return: Success: Pointer to the VOL object for the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5VL_object_t * +H5T_get_named_type(const H5T_t *dt) +{ + H5VL_object_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(NULL != dt->vol_obj) + ret_value = dt->vol_obj; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_get_named_type() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_get_actual_type + * + * Purpose: Returns underlying native datatype created by native driver + * if datatype is committed, otherwise return the datatype + * object associate with the ID. + * + * Return: Success: Pointer to the VOL-managed data for this datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5T_t * +H5T_get_actual_type(H5T_t *dt) +{ + H5T_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Check if the datatype is committed */ + if(NULL == dt->vol_obj) + ret_value = dt; + else + ret_value = (H5T_t *)dt->vol_obj->data; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_get_actual_type() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_save_refresh_state + * + * Purpose: Save state for datatype reconstuction after a refresh. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_save_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared) +{ + H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ + H5T_t *vol_dt = NULL; /* H5T_t pointer stored in the datatype's vol_obj field */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(cached_H5O_shared); + + if(NULL == (dt = (H5T_t *)H5I_object_verify(tid, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not a datatype ID") + vol_dt = (H5T_t *)(dt->vol_obj->data); + if(NULL == vol_dt) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID") + + /* Increase the count on the file object */ + vol_dt->shared->fo_count += 1; + + /* Increment object count for the object in the top file */ + if(H5FO_top_incr(vol_dt->sh_loc.file, vol_dt->sh_loc.u.loc.oh_addr) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, FAIL, "can't increment object count") + + /* Cache the H5O_shared_t data */ + HDmemcpy(cached_H5O_shared, &(vol_dt->sh_loc), sizeof(H5O_shared_t)); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_save_refresh_state() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_restore_refresh_state + * + * Purpose: Restore state for datatype reconstuction after a refresh. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_restore_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared) +{ + H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ + H5T_t *vol_dt = NULL; /* H5T_t pointer stored in the datatype's vol_obj field */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(cached_H5O_shared); + + if(NULL == (dt = (H5T_t *)H5I_object_verify(tid, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid not a datatype ID") + vol_dt = (H5T_t *)(dt->vol_obj->data); + if(NULL == vol_dt) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID") + + /* Restore the H5O_shared_t data */ + HDmemcpy(&(vol_dt->sh_loc), cached_H5O_shared, sizeof(H5O_shared_t)); + + /* Decrement the ref. count for this object in the top file */ + if(H5FO_top_decr(vol_dt->sh_loc.file, vol_dt->sh_loc.u.loc.oh_addr) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "can't decrement object count") + + /* Decrease the count on the file object */ + vol_dt->shared->fo_count -= 1; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_restore_refresh_state() */ + diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 563de65..e6d83bb 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -7480,7 +7480,7 @@ H5T__conv_llong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_LLONG_LDOUBLE +#ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE herr_t H5T__conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, @@ -7548,7 +7548,7 @@ H5T__conv_ullong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_ULLONG_LDOUBLE +#ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE herr_t H5T__conv_ullong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, @@ -8244,7 +8244,7 @@ H5_GCC_DIAG_ON(float-equal) * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_LDOUBLE_LLONG +#ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG herr_t H5T__conv_ldouble_llong (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index a7f54a7..1b59c6b 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -43,6 +43,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Ppublic.h" /* Property Lists */ #include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* VOL plugins */ /****************/ @@ -79,6 +80,12 @@ /* Local Variables */ /*******************/ +/* Declare a free list to manage the H5VL_t struct */ +H5FL_EXTERN(H5VL_t); + +/* Declare a free list to manage the H5VL_object_t struct */ +H5FL_EXTERN(H5VL_object_t); + #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -100,29 +107,52 @@ herr_t H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) { - H5G_loc_t loc; /* Location to create datatype */ - H5T_t *type; /* Datatype for ID */ + void *data = NULL; /* VOL-managed datatype data */ + H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */ + H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*si", loc_id, name, type_id); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_is_named(dt)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the object from the loc_id */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Commit the datatype */ - if(H5T__commit_named(&loc, name, type, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT) < 0) + if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, + name, type_id, H5P_LINK_CREATE_DEFAULT, + H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + /* Set up VOL object */ + if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) + HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") + new_obj->driver = vol_obj->driver; + new_obj->driver->nrefs ++; + new_obj->data = data; + + /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */ + dt->vol_obj = new_obj; + done: FUNC_LEAVE_API(ret_value) } /* end H5Tcommit1() */ @@ -147,31 +177,39 @@ done: hid_t H5Topen1(hid_t loc_id, const char *name) { - H5T_t *type = NULL; - H5G_loc_t loc; + void *dt = NULL; /* Datatype token created by VOL plugin */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + /* Open the datatype */ - if(NULL == (type = H5T__open_name(&loc, name))) + if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->driver->cls, + name, H5P_DATATYPE_ACCESS_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ - if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ if(H5I_INVALID_HID == ret_value) - if(type && H5T_close(type) < 0) + if(dt && H5VL_datatype_close(dt, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype") FUNC_LEAVE_API(ret_value) diff --git a/src/H5Toh.c b/src/H5Toh.c index c5ee994..b21ce72 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -44,7 +44,7 @@ /********************/ static htri_t H5O__dtype_isa(const H5O_t *loc); -static hid_t H5O__dtype_open(const H5G_loc_t *obj_loc, hbool_t app_ref); +static void *H5O__dtype_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type); static void *H5O__dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc); static H5O_loc_t *H5O__dtype_get_oloc(hid_t obj_id); @@ -125,28 +125,28 @@ done: * *------------------------------------------------------------------------- */ -static hid_t -H5O__dtype_open(const H5G_loc_t *obj_loc, hbool_t app_ref) +static void * +H5O__dtype_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) { - H5T_t *type = NULL; /* Datatype opened */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5T_t *type = NULL; /* Datatype opened */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC HDassert(obj_loc); + *opened_type = H5I_DATATYPE; + /* Open the datatype */ if(NULL == (type = H5T_open(obj_loc))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open datatype") - /* Register an ID for the datatype */ - if((ret_value = H5I_register(H5I_DATATYPE, type, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") + ret_value = (void *)type; done: - if(ret_value < 0) + if(NULL == ret_value) if(type && H5T_close(type) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, NULL, "unable to release datatype") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dtype_open() */ @@ -212,14 +212,17 @@ done: static H5O_loc_t * H5O__dtype_get_oloc(hid_t obj_id) { - H5T_t *type; /* Datatype opened */ + H5T_t *type = NULL; /* Datatype opened */ + H5T_t *dt = NULL; H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC /* Get the datatype */ - if(NULL == (type = (H5T_t *)H5I_object(obj_id))) + if(NULL == (dt = (H5T_t *)H5I_object(obj_id))) HGOTO_ERROR(H5E_OHDR, H5E_BADATOM, NULL, "couldn't get object from ID") + /* If this is a named datatype, get the VOL driver pointer to the datatype */ + type = (H5T_t *)H5T_get_actual_type(dt); /* Get the datatype's object header location */ if(NULL == (ret_value = H5T_oloc(type))) diff --git a/src/H5Torder.c b/src/H5Torder.c index 1995a03..d687d03 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -210,6 +210,8 @@ H5Tset_order(hid_t type_id, H5T_order_t order) HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") if(order < H5T_ORDER_LE || order > H5T_ORDER_NONE || order == H5T_ORDER_MIXED) HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order") + if(NULL != dt->vol_obj) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") if(H5T_STATE_TRANSIENT != dt->shared->state) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 04e9451..c909f18 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -320,6 +320,7 @@ struct H5T_t { H5T_shared_t *shared; /* all other information */ H5O_loc_t oloc; /* Object location, if the type is a named type */ H5G_name_t path; /* group hier. path if the type is a named type */ + H5VL_object_t *vol_obj; /* pointer to VOL object when working with committed datatypes */ }; /* The master list of soft conversion functions */ diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c index 59bac8b..bd28fc2 100644 --- a/src/H5Tprecis.c +++ b/src/H5Tprecis.c @@ -154,6 +154,8 @@ H5Tset_precision(hid_t type_id, size_t prec) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + if (NULL != dt->vol_obj) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is committed") if (prec == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 9dae53b..c0a6d8d 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -30,6 +30,7 @@ typedef struct H5T_t H5T_t; #include "H5private.h" /* Generic Functions */ #include "H5Gprivate.h" /* Groups */ #include "H5Rprivate.h" /* References */ +#include "H5VLprivate.h" /* VOL Drivers */ /* Macro for size of temporary buffers to contain a single element */ #define H5T_ELEM_BUF_SIZE 256 @@ -98,7 +99,7 @@ typedef struct H5T_subset_info_t { } H5T_subset_info_t; /* Forward declarations for prototype arguments */ -struct H5O_t; +struct H5O_shared_t; /* The native endianness of the platform */ H5_DLLVAR H5T_order_t H5T_native_order_g; @@ -138,6 +139,11 @@ H5_DLL herr_t H5T_set_version(H5F_t *f, H5T_t *dt); H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f); H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5F_t *f); H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt); +H5_DLL H5T_t *H5T_construct_datatype(H5VL_object_t *dt_obj); +H5_DLL H5VL_object_t *H5T_get_named_type(const H5T_t *dt); +H5_DLL H5T_t *H5T_get_actual_type(H5T_t *dt); +H5_DLL herr_t H5T_save_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); +H5_DLL herr_t H5T_restore_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); /* Reference specific functions */ H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); diff --git a/src/H5VL.c b/src/H5VL.c new file mode 100644 index 0000000..24e558c --- /dev/null +++ b/src/H5VL.c @@ -0,0 +1,2296 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The Virtual Object Layer as described in documentation. + * The pupose is to provide an abstraction on how to access the + * underlying HDF5 container, whether in a local file with + * a specific file format, or remotely on other machines, etc... + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5VLmodule.h" /* This source code file is part of the H5VL module */ + + +/***********/ +/* Headers */ +/***********/ + +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5PLprivate.h" /* Plugins */ +#include "H5VLpkg.h" /* Virtual Object Layer */ + + +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Information needed for iterating over the registered VOL driver hid_t IDs. + * The name of the new VOL driver that is being registered is stored in the + * name field and the found_id field is initialized to H5I_INVALID_HID (-1). + * If we find a VOL driver with the same name, we set the found_id field to + * the existing ID for return to the function. + */ +typedef struct { + const char *name; /* The name of the VOL driver to check */ + hid_t found_id; /* The library ID if we found a match */ +} H5VL_get_driver_ud_t; + +/********************/ +/* Local Prototypes */ +/********************/ +static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data); + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + + +/*------------------------------------------------------------------------- + * Function: H5VL__get_driver_cb + * + * Purpose: Callback routine to search through registered VOLs + * + * Return: Success: H5_ITER_STOP if the class and op_data name + * members match. H5_ITER_CONT otherwise. + * + * Failure: Can't fail + * + *------------------------------------------------------------------------- + */ +static int +H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data) +{ + H5VL_get_driver_ud_t *op_data = (H5VL_get_driver_ud_t *)_op_data; /* User data for callback */ + H5VL_class_t *cls = (H5VL_class_t *)obj; + int ret_value = H5_ITER_CONT; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + if (0 == HDstrcmp(cls->name, op_data->name)) { + op_data->found_id = id; + ret_value = H5_ITER_STOP; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__get_driver_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLinitialize + * + * Purpose: Calls the driver-specific callback to initialize the driver. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLinitialize(hid_t driver_id, hid_t vipl_id) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ii", driver_id, vipl_id); + + /* Check args */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if (cls->initialize && cls->initialize(vipl_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not initialize") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLinitialize() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLterminate + * + * Purpose: Calls the driver-specific callback to terminate the driver. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLterminate(hid_t driver_id, hid_t vtpl_id) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ii", driver_id, vtpl_id); + + /* Check args */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if (cls->terminate && cls->terminate(vtpl_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not terminate cleanly") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLterminate() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLclose + * + * Purpose: Closes the specified VOL driver. The VOL ID will no longer + * be valid for accessing the VOL. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLclose(hid_t vol_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", vol_id); + + /* Check args */ + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(H5I_dec_app_ref(vol_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close VOL driver ID") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLclose() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLregister + * + * Purpose: Registers a new VOL driver as a member of the virtual object + * layer class. + * + * Return: Success: A VOL driver ID which is good until the + * library is closed or the driver is + * unregistered. + * + * Failure: A negative value (H5I_INVALID_HID). + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLregister(const H5VL_class_t *cls) +{ + H5VL_get_driver_ud_t op_data; + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_API(FAIL) + H5TRACE1("i", "*x", cls); + + /* Check arguments */ + if (!cls) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL driver class pointer cannot be NULL") + if (!cls->name) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver class name cannot be the NULL pointer"); + /* XXX: Should probably come up with a max length so we can use strnlen()? */ + if (0 == HDstrlen(cls->name)) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver class name cannot be the empty string"); + + op_data.found_id = H5I_INVALID_HID; + op_data.name = cls->name; + + /* check if driver is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs") + + /* XXX: Does this need to be an error? Users probably don't care as long + * as their VOL driver is available. + */ + if (op_data.found_id != H5I_INVALID_HID) + 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) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLregister() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLregister_by_name + * + * Purpose: Registers a new VOL driver as a member of the virtual object + * layer class. + * + * Return: Success: A VOL driver ID which is good until the + * library is closed or the driver is + * unregistered. + * + * Failure: A negative value. + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLregister_by_name(const char *name) +{ + H5VL_get_driver_ud_t op_data; + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_API(FAIL) + H5TRACE1("i", "*s", name); + + /* Check arguments */ + if (!name) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL driver name is disallowed") + if (0 == HDstrlen(name)) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL driver name is disallowed") + + op_data.found_id = H5I_INVALID_HID; + op_data.name = name; + + /* Check if driver is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") + + if (op_data.found_id != H5I_INVALID_HID) { + /* If driver alread registered, increment ref count on ID and return ID */ + if (H5I_inc_ref(op_data.found_id, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") + ret_value = op_data.found_id; + } + else { + H5PL_key_t key; + const H5VL_class_t *cls; + + /* Try loading the driver */ + key.name = name; + if (NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, key))) + 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) + 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() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLunregister + * + * 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 driver. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLunregister(hid_t vol_id) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", vol_id); + + /* Check arguments */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(vol_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a vol driver") + + /* The H5VL_class_t struct will be freed by this function */ + if (H5I_dec_app_ref(vol_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister vol driver") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLunregister() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLis_registered + * + * Purpose: Tests whether a VOL class has been registered or not + * + * Return: Positive if the VOL class has been registered + * + * Zero if it is unregistered + * + * Negative on error (if the class is not a valid class ID) + * + *------------------------------------------------------------------------- + */ +htri_t +H5VLis_registered(const char *name) +{ + H5VL_get_driver_ud_t op_data; + htri_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("t", "*s", name); + + op_data.found_id = H5I_INVALID_HID; + op_data.name = name; + + /* Check arguments */ + if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids") + + if (op_data.found_id != H5I_INVALID_HID) + ret_value = TRUE; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLis_registered() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLget_driver_id + * + * Purpose: Retrieves the ID for a registered VOL driver. + * + * Return: Positive if the VOL class has been registered + * Negative on error (if the class is not a valid class or not registered) + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLget_driver_id(const char *name) +{ + H5VL_get_driver_ud_t op_data; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE1("i", "*s", name); + + op_data.found_id = H5I_INVALID_HID; + op_data.name = name; + + /* Check arguments */ + if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL driver IDs") + + if (op_data.found_id != H5I_INVALID_HID) { + if (H5I_inc_ref(op_data.found_id, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") + + ret_value = op_data.found_id; + } + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLget_driver_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLget_driver_name + * + * Purpose: Returns the driver name for the VOL associated with the + * object or file ID + * + * Return: Success: The length of the driver name + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +ssize_t +H5VLget_driver_name(hid_t obj_id, char *name/*out*/, size_t size) +{ + ssize_t ret_value = -1; + + FUNC_ENTER_API(FAIL) + H5TRACE3("Zs", "ixz", obj_id, name, size); + + if ((ret_value = H5VL_get_driver_name(obj_id, name, size)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get driver name") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLget_driver_name() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLobject_register + * + * Purpose: Public routine to create an HDF5 hid_t with library + * specific types, bypassing the limitation of H5Iregister. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +hid_t +H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t driver_id) +{ + hid_t ret_value = FAIL; + + FUNC_ENTER_API(FAIL) + H5TRACE3("i", "*xIti", obj, obj_type, driver_id); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object to register") + + if ((ret_value = H5VL_object_register(obj, obj_type, driver_id, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLobject_register */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject + * + * Purpose: Public utility function to return the VOL object pointer + * associated with an hid_t. + * + * Return: Success: object pointer + * Failure: NULL + * + * Programmer: Jordan Henderson + * January, 2018 + * + *------------------------------------------------------------------------- + */ +void * +H5VLobject(hid_t id) +{ + void *ret_value = NULL; + + FUNC_ENTER_API(NULL) + H5TRACE1("*x", "i", id); + + if (NULL == (ret_value = H5VL_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLget_object + * + * Purpose: Retrieves the object pointer associated with the ID. This + * also optionally returns the H5VL_t struct that this ID + * belongs to, if the user passes a valid pointer value. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_object(hid_t obj_id, void **obj) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i**x", obj_id, obj); + + /* Check args */ + if (!obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object pointer") + + if (NULL == (*obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain a valid object") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLget_object */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_create + * + * Purpose: Creates an attribute + * + * Return: Success: Pointer to the new attribute + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API(NULL) + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, acpl_id, + aapl_id, dxpl_id, req); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, cls, name, + acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_open + * + * Purpose: Opens an attribute + * + * Return: Success: Pointer to the new attribute + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, + hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API(NULL) + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, aapl_id, + dxpl_id, req); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, cls, name, aapl_id, + dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_read + * + * Purpose: Reads data from an attribute + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t H5VLattr_read(void *attr, hid_t driver_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == attr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_attr_read(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_write + * + * Purpose: Writes data to an attribute + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t H5VLattr_write(void *attr, hid_t driver_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == attr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_attr_write(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_get + * + * Purpose: Gets information about the attribute + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_get(void *obj, hid_t driver_id, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*xiVai**xx", obj, driver_id, get_type, dxpl_id, req, arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Bypass the H5VLint layer */ + if(NULL == cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr get' method") + if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_specific + * + * Purpose: Performs a driver-specific operation on an attribute + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, driver_id, specific_type, + dxpl_id, req, arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Bypass the H5VLint layer */ + if(NULL == cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr specific' method") + if((ret_value = (cls->attr_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_optional + * + * Purpose: Performs an optional driver-specific operation on an attribute + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Have to bypass the H5VLint layer due to unknown val_list arguments */ + if(NULL == cls->attr_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr optional' method") + if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_close + * + * Purpose: Closes an attribute + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_close(void *attr, hid_t driver_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*xii**x", attr, driver_id, dxpl_id, req); + + if (NULL == attr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_attr_close(attr, cls, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_create + * + * Purpose: Creates a dataset + * + * Return: Success: Pointer to the new dataset + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API(NULL) + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, dcpl_id, + dapl_id, dxpl_id, req); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, cls, name, + dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_open + * + * Purpose: Opens a dataset + * + * Return: Success: Pointer to the new dataset + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; + + FUNC_ENTER_API(NULL) + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, dapl_id, + dxpl_id, req); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_read + * + * Purpose: Reads data from a dataset + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_read(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE8("e", "*xiiiii*x**x", dset, driver_id, mem_type_id, mem_space_id, + file_space_id, plist_id, buf, req); + + if (NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_dataset_read(dset, cls, mem_type_id, mem_space_id, file_space_id, + plist_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_write + * + * Purpose: Writes data to a dataset + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_write(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE8("e", "*xiiiii*x**x", dset, driver_id, mem_type_id, mem_space_id, + file_space_id, plist_id, buf, req); + + if (NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_dataset_write(dset, cls, mem_type_id, mem_space_id, file_space_id, + plist_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_get + * + * Purpose: Gets information about a dataset + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_get(void *dset, hid_t driver_id, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*xiVci**xx", dset, driver_id, get_type, dxpl_id, req, arguments); + + if (NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Bypass the H5VLint layer */ + if(NULL == cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset get' method") + if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_specific + * + * Purpose: Performs a driver-specific operation on a dataset + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_specific(void *obj, hid_t driver_id, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*xiVdi**xx", obj, driver_id, specific_type, dxpl_id, req, + arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(NULL == cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset specific' method") + if((ret_value = (cls->dataset_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_optional + * + * Purpose: Performs an optional driver-specific operation on a dataset + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(NULL == cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset optional' method") + if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_close + * + * Purpose: Closes a dataset + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_close(void *dset, hid_t driver_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*xii**x", dset, driver_id, dxpl_id, req); + + if (NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_dataset_close(dset, cls, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_create + * + * Purpose: Creates a file + * + * Return: Success: Pointer to the new file + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, + hid_t dxpl_id, void **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; + + FUNC_ENTER_API(NULL) + H5TRACE6("*x", "*sIuiii**x", name, flags, fcpl_id, fapl_id, dxpl_id, req); + + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") + + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id, + dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_open + * + * Purpose: Opens a file + * + * Return: Success: Pointer to the new file + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; + + FUNC_ENTER_API(NULL) + H5TRACE5("*x", "*sIuii**x", name, flags, fapl_id, dxpl_id, req); + + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") + + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_get + * + * Purpose: Gets information about the file + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_get(void *file, hid_t driver_id, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*xiVgi**xx", file, driver_id, get_type, dxpl_id, req, arguments); + + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Bypass the H5VLint layer */ + if(NULL == cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file get' method") + if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute file get callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_specific + * + * Purpose: Performs a driver-specific operation on a file + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_specific(void *file, hid_t driver_id, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*xiVhi**xx", file, driver_id, specific_type, dxpl_id, req, + arguments); + + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + hid_t fapl_id; + + fapl_id = va_arg (arguments, hid_t); + + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol driver info") + + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = (cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + } + else { + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(NULL == cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file specific' method") + if((ret_value = (cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file specific callback") + } + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_optional + * + * Purpose: Performs an optional driver-specific operation on a file + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_optional(void *file, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*xii**xx", file, driver_id, dxpl_id, req, arguments); + + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(NULL == cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file optional' method") + if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_close + * + * Purpose: Closes a file + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_close(void *file, hid_t driver_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*xii**x", file, driver_id, dxpl_id, req); + + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_file_close(file, cls, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_create + * + * Purpose: Creates a group + * + * Return: Success: Pointer to the new group + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; + + FUNC_ENTER_API(NULL) + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, gcpl_id, + gapl_id, dxpl_id, req); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_group_create(obj, loc_params, cls, name, + gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_open + * + * Purpose: Opens a group + * + * Return: Success: Pointer to the new group + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, + hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; + + FUNC_ENTER_API(NULL) + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, gapl_id, + dxpl_id, req); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_group_open(obj, loc_params, cls, name, + gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_get + * + * Purpose: Gets information about the group + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_get(void *obj, hid_t driver_id, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*xiVii**xx", obj, driver_id, get_type, dxpl_id, req, arguments); + + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Bypass the H5VLint layer */ + if(NULL == cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group get' method") + if((ret_value = (cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute group get callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_specific + * + * Purpose: Performs a driver-specific operation on a group + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_specific(void *obj, hid_t driver_id, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*xiVji**xx", obj, driver_id, specific_type, dxpl_id, req, + arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(NULL == cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group specific' method") + if((ret_value = (cls->group_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_optional + * + * Purpose: Performs an optional driver-specific operation on a group + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(NULL == cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group optional' method") + if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_close + * + * Purpose: Closes a group + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_close(void *grp, hid_t driver_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*xii**x", grp, driver_id, dxpl_id, req); + + if(NULL == grp) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_group_close(grp, cls, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close group") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_create + * + * Purpose: Creates a hard link + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + hid_t driver_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, driver_id, lcpl_id, + lapl_id, dxpl_id, req); + + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to create link") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_copy + * + * Purpose: Copies a link to a new location + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, hid_t driver_id, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + driver_id, lcpl_id, lapl_id, dxpl_id, req); + + if(NULL == src_obj || NULL == dst_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, + lcpl_id, lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to copy object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_move + * + * Purpose: Moves a link to another location + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, hid_t driver_id, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + driver_id, lcpl_id, lapl_id, dxpl_id, req); + + if(NULL == src_obj || NULL == dst_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, + lcpl_id, lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_get + * + * Purpose: Gets information about a link + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*xxiVli**xx", obj, loc_params, driver_id, get_type, dxpl_id, req, + arguments); + + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(NULL == cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link get' method") + if((ret_value = (cls->link_cls.get) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link get callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_specific + * + * Purpose: Performs a driver-specific operation on a link + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, driver_id, specific_type, + dxpl_id, req, arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Bypass the H5VLint layer */ + if(NULL == cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link specific' method") + if((ret_value = (cls->link_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_optional + * + * Purpose: Performs an optional driver-specific operation on a link + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Have to bypass the H5VLint layer due to unknown val_list arguments */ + if(NULL == cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link optional' method") + if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_open + * + * Purpose: Opens an object + * + * Return: Success: Pointer to the new object + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t driver_id, H5I_type_t *opened_type, + hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; + + FUNC_ENTER_API(NULL) + H5TRACE6("*x", "*xxi*Iti**x", obj, params, driver_id, opened_type, dxpl_id, req); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_object_open(obj, params, cls, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_copy + * + * Purpose: Copies an object to another location + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t driver_id1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls1 = NULL; + H5VL_class_t *cls2 = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, driver_id1, + src_name, dst_obj, loc_params2, driver_id2, dst_name, ocpypl_id, + lcpl_id, dxpl_id, req); + + if(NULL == src_obj || NULL == dst_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(driver_id1, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(driver_id2, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_object_copy(src_obj, loc_params1, cls1, src_name, + dst_obj, loc_params2, cls2, dst_name, + ocpypl_id, lcpl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_get + * + * Purpose: Gets information about an object + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*xxiVni**xx", obj, loc_params, driver_id, get_type, dxpl_id, req, + arguments); + + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(NULL == cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object get' method") + if((ret_value = (cls->object_cls.get) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object get callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_specific + * + * Purpose: Performs a driver-specific operation on an object + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, driver_id, specific_type, + dxpl_id, req, arguments); + + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Bypass the H5VLint layer */ + if(NULL == cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object specific' method") + if((ret_value = (cls->object_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_optional + * + * Purpose: Performs an optional driver-specific operation on an object + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Have to bypass the H5VLint layer due to unknown val_list arguments */ + if(NULL == cls->object_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object optional' method") + if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_commit + * + * Purpose: Commits a datatype to the file + * + * Return: Success: Pointer to the new datatype + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; + + FUNC_ENTER_API(NULL) + H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, driver_id, name, type_id, + lcpl_id, tcpl_id, tapl_id, dxpl_id, req); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, cls, name, type_id, + lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to commit datatype") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_open + * + * Purpose: Opens a named datatype + * + * Return: Success: Pointer to the new datatype + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, + hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; + + FUNC_ENTER_API(NULL) + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, tapl_id, + dxpl_id, req); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + + if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, cls, name, + tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open datatype") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_specific + * + * Purpose: Performs a driver-specific operation on a datatype + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_specific(void *obj, hid_t driver_id, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*xiVfi**xx", obj, driver_id, specific_type, dxpl_id, req, + arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(NULL == cls->datatype_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype specific' method") + if((ret_value = (cls->datatype_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_optional + * + * Purpose: Performs an optional driver-specific operation on a datatype + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if(NULL == cls->datatype_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype optional' method") + if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_get + * + * Purpose: Gets information about the datatype + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_get(void *obj, hid_t driver_id, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*xiVei**xx", obj, driver_id, get_type, dxpl_id, req, arguments); + + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + /* Bypass the H5VLint layer */ + if(NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype get' method") + if((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute datatype get callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_close + * + * Purpose: Closes a datatype + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_close(void *dt, hid_t driver_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*xii**x", dt, driver_id, dxpl_id, req); + + if (NULL == dt) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if((ret_value = H5VL_datatype_close(dt, cls, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close datatype") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_cancel + * + * Purpose: Cancels a request + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_cancel(void **req, hid_t driver_id, H5ES_status_t *status) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "**xi*Es", req, driver_id, status); + + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if ((ret_value = H5VL_request_cancel(req, cls, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLrequest_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_test + * + * Purpose: Tests a request + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_test(void **req, hid_t driver_id, H5ES_status_t *status) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "**xi*Es", req, driver_id, status); + + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if ((ret_value = H5VL_request_test(req, cls, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to test request") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLrequest_test() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_wait + * + * Purpose: Waits on a request + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_wait(void **req, hid_t driver_id, H5ES_status_t *status) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "**xi*Es", req, driver_id, status); + + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + if ((ret_value = H5VL_request_wait(req, cls, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") + + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLrequest_wait() */ + + diff --git a/src/H5VLint.c b/src/H5VLint.c new file mode 100644 index 0000000..78ba6d9 --- /dev/null +++ b/src/H5VLint.c @@ -0,0 +1,2192 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The Virtual Object Layer as described in documentation. + * The pupose is to provide an abstraction on how to access the + * underlying HDF5 container, whether in a local file with + * a specific file format, or remotely on other machines, etc... + */ + + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5VLmodule.h" /* This source code file is part of the H5VL module */ + + +/***********/ +/* Headers */ +/***********/ + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5VLpkg.h" /* Virtual Object Layer */ + + +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Package Typedefs */ +/********************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5VL_free_cls(H5VL_class_t *cls); + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/* VOL ID class */ +static const H5I_class_t H5I_VOL_CLS[1] = {{ + H5I_VOL, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5VL_free_cls /* Callback routine for closing objects of this class */ +}}; + +/* Declare a free list to manage the H5VL_t struct */ +H5FL_DEFINE(H5VL_t); + +/* Declare a free list to manage the H5VL_object_t struct */ +H5FL_DEFINE(H5VL_object_t); + + +/*------------------------------------------------------------------------- + * Function: H5VL_init + * + * Purpose: Initialize the interface from some other package + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_init() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__init_package + * + * Purpose: Initialize interface-specific information + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL__init_package(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Initialize the atom group for the VL IDs */ + if (H5I_register_type(H5I_VOL_CLS) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__init_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_term_package + * + * Purpose: Terminate various H5VL objects + * + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +int +H5VL_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (H5_PKG_INIT_VAR) { + if (H5I_nmembers(H5I_VOL) > 0) { + (void)H5I_clear_type(H5I_VOL, FALSE, FALSE); + n++; + } + else { + /* Destroy the VOL driver ID group */ + n += (H5I_dec_type_ref(H5I_VOL) > 0); + + /* Mark interface as closed */ + if (0 == n) + H5_PKG_INIT_VAR = FALSE; + } + } + + FUNC_LEAVE_NOAPI(n) +} /* end H5VL_term_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_cls + * + * Purpose: Frees a file VOL class struct and returns an indication of + * success. This function is used as the free callback for the + * virtual object layer object identifiers + * (c.f.: H5VL_init_interface). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_free_cls(H5VL_class_t *cls) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity check */ + HDassert(cls); + + /* XXX: Need to retrieve the VOL termination property list for the + * terminate operation - JTH + */ + if (cls->terminate && cls->terminate(H5P_DEFAULT) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not terminate cleanly"); + + /* XXX (VOL MERGE): We'll leak memory if the name string was dynamically allocated. */ + H5MM_xfree(cls); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_cls() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_register_id + * + * Purpose: Wrapper to register an object ID with a VOL aux struct + * and increment ref count on VOL driver 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_object_t *new_obj = NULL; + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Check arguments */ + HDassert(object); + HDassert(vol_driver); + + /* setup VOL object */ + if (NULL == (new_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_driver->nrefs++; + + if (H5I_DATATYPE == type) { + + H5T_t *dt = NULL; + + if (NULL == (dt = H5T_construct_datatype(new_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) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle"); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_register_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_object + * + * Purpose: Wrapper to unregister an object ID with a VOL aux struct + * and decrement ref count on VOL driver ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_object(H5VL_object_t *vol_obj) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(SUCCEED) + + /* Check arguments */ + HDassert(vol_obj); + + vol_obj->driver->nrefs --; + + if (0 == vol_obj->driver->nrefs) { + if (H5I_dec_ref(vol_obj->driver->id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL driver"); + vol_obj->driver = H5FL_FREE(H5VL_t, vol_obj->driver); + } + + vol_obj = H5FL_FREE(H5VL_object_t, vol_obj); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_object() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_register + * + * Purpose: Registers a new VOL driver as a member of the virtual object + * layer class. + * + * Return: Success: A VOL driver ID which is good until the + * library is closed or the driver is unregistered. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_register(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; + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Check arguments */ + HDassert(cls); + + /* Copy the class structure so the caller can reuse or free it */ + if (NULL == (saved = (H5VL_class_t *)H5MM_calloc(size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for VOL driver class struct"); + HDmemcpy(saved, cls, size); + + /* Create the new class ID */ + if ((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID"); + +done: + if (ret_value < 0) + if (saved) + 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() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_get_driver_name + * + * Purpose: Private version of H5VLget_driver_name + * + * Return: Success: The length of the driver name + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +ssize_t +H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size) +{ + H5VL_object_t *vol_obj = NULL; + const H5VL_class_t *cls = NULL; + size_t len; + ssize_t ret_value = -1; + + FUNC_ENTER_NOAPI(FAIL) + + /* get the object pointer */ + if (NULL == (vol_obj = H5VL_get_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); + + cls = vol_obj->driver->cls; + + len = HDstrlen(cls->name); + if (name) { + HDstrncpy(name, cls->name, MIN(len + 1,size)); + if (len >= size) + name[size-1]='\0'; + } + + /* Set the return value for the API call */ + ret_value = (ssize_t)len; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_get_driver_name() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_get_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 + * except for named datatypes, where the vol_obj is returned that + * is attached to the H5T_t struct. + * + * Return: Success: object pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5VL_object_t * +H5VL_get_object(hid_t id) +{ + void *obj = NULL; + H5I_type_t obj_type = H5I_get_type(id); + H5VL_object_t *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) + + if (H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type || + H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) { + /* get the object */ + if (NULL == (obj = H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + + /* if this is a datatype, get the VOL object attached to the H5T_t struct */ + if (H5I_DATATYPE == obj_type) { + if (NULL == (obj = H5T_get_named_type((H5T_t *)obj))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); + } + } + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function"); + + + ret_value = (H5VL_object_t *)obj; +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_get_object() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object + * + * Purpose: Utility function to return the VOL object pointer associated with + * a hid_t. + * + * Return: Success: object pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object(hid_t id) +{ + H5VL_object_t *vol_obj = NULL; + void *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) + + /* Get the symbol table entry */ + switch (H5I_get_type(id)) { + case H5I_GROUP: + case H5I_DATASET: + case H5I_FILE: + case H5I_ATTR: + /* get the object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + + ret_value = vol_obj->data; + break; + case H5I_DATATYPE: + { + H5T_t *dt = NULL; + + /* get the object */ + if (NULL == (dt = (H5T_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + + /* Get the actual datatype object that should be the vol_obj */ + if (NULL == (vol_obj = H5T_get_named_type(dt))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); + + ret_value = vol_obj->data; + break; + } + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type"); + } +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_verify + * + * Purpose: Utility function to return the VOL object pointer associated + * with an identifier. + * + * Return: Success: object pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object_verify(hid_t id, H5I_type_t obj_type) +{ + H5VL_object_t *vol_obj = NULL; + void *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) + + /* Get the symbol table entry */ + switch (obj_type) { + case H5I_GROUP: + case H5I_DATASET: + case H5I_FILE: + case H5I_ATTR: + /* get the object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(id, obj_type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + + ret_value = vol_obj->data; + break; + case H5I_DATATYPE: + { + H5T_t *dt = NULL; + + /* get the object */ + if (NULL == (dt = (H5T_t *)H5I_object_verify(id, obj_type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + + /* Get the actual datatype object that should be the vol_obj */ + if (NULL == (vol_obj = H5T_get_named_type(dt))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); + + ret_value = vol_obj->data; + break; + } + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type") + } +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_verify() */ + + +/* XXX (VOL MERGE): This could be a macro like in H5F */ +void * +H5VL_driver_object(H5VL_object_t *vol_obj) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + FUNC_LEAVE_NOAPI(vol_obj->data) +} /* end H5VL_driver_object() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_create + * + * Purpose: Creates an attribute through the VOL + * + * Return: Success: pointer to the new attribute + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if (NULL == cls->attr_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'attr create' method") + + /* call the corresponding VOL create callback */ + if (NULL == (ret_value = (cls->attr_cls.create) + (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_open + * + * Purpose: Opens an attribute through the VOL + * + * Return: Success: pointer to the new attr. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t aapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the type specific corresponding VOL open callback exists */ + if(NULL == cls->attr_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'attr open' method") + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->attr_cls.open) + (obj, loc_params, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_read + * + * Purpose: Reads data from attr through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr read' method") + if((ret_value = (cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_write + * + * Purpose: Writes data to attr through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr write' method") + if((ret_value = (cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_get + * + * Purpose: Get specific information about the attribute through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr get' method") + + va_start (arguments, req); + if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_specific + * + * Purpose: specific operation on attributes through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr specific' method") + + va_start (arguments, req); + if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_optional + * + * Purpose: optional operation specific to drivers. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr optional' method") + + va_start (arguments, req); + if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_close + * + * Purpose: Closes an attribute through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + HDassert(attr); + HDassert(cls); + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->attr_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr close' method"); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->attr_cls.close)(attr, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_create + * + * Purpose: Creates a dataset through the VOL + * + * Return: Success: pointer to dataset + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->dataset_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'dataset create' method") + + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->dataset_cls.create) + (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_open + * + * Purpose: Opens a dataset through the VOL + * + * Return: Success: pointer to dataset + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the type specific corresponding VOL open callback exists */ + if(NULL == cls->dataset_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'dset open' method") + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->dataset_cls.open) + (obj, loc_params, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_read + * + * Purpose: Reads data from dataset through the VOL +* + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset read' method") + if((ret_value = (cls->dataset_cls.read) + (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_write + * + * Purpose: Writes data from dataset through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset write' method") + if((ret_value = (cls->dataset_cls.write) + (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_get + * + * Purpose: Get specific information about the dataset through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset get' method") + + va_start (arguments, req); + if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_specific + * + * Purpose: specific operation on datasets through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset specific' method") + + va_start (arguments, req); + if((ret_value = (cls->dataset_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_optional + * + * Purpose: optional operation specific to drivers. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset optional' method") + + va_start (arguments, req); + if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_close + * + * Purpose: Closes a dataset through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(dset); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->dataset_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dset close' method"); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->dataset_cls.close)(dset, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); + +done: + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_create + * + * Purpose: Creates a file through the VOL + * + * Return: Success: pointer to file. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->file_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'file create' method") + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_open + * + * Purpose: Opens a file through the VOL. + * + * Return: Success: pointer to file. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->file_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'file open' method") + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file get' method") + + va_start(arguments, req); + if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end(arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_specific + * + * Purpose: perform File specific operations through the VOL + * + * Return: Success: non negative + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_driver_prop_t driver_prop; /* Property for VOL driver ID & info */ + va_list tmp_args; /* argument list passed from the API call */ + hid_t fapl_id; + + va_start (tmp_args, req); + fapl_id = va_arg (tmp_args, hid_t); + va_end (tmp_args); + + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL driver info") + + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + + va_start (arguments, req); + if((ret_value = (cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + va_end (arguments); + } + else { + if(NULL == cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file specific' method") + + va_start (arguments, req); + if((ret_value = (cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + va_end (arguments); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_optional + * + * Purpose: perform a driver specific operation + * + * Return: Success: non negative + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file optional' method") + + va_start (arguments, req); + if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_close + * + * Purpose: Closes a file through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(file); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->file_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file close' method"); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->file_cls.close)(file, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_create + * + * Purpose: Creates a group through the VOL + * + * Return: Success: pointer to new group. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->group_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'group create' method") + + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->group_cls.create) + (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_open + * + * Purpose: Opens a group through the VOL + * + * Return: Success: pointer to new group. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t gapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + if(NULL == cls->group_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'group open' method") + + if(NULL == (ret_value = (cls->group_cls.open) + (obj, loc_params, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_get + * + * Purpose: Get specific information about the group through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group get' method") + + va_start (arguments, req); + if((ret_value = (cls->group_cls.get) + (obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_specific + * + * Purpose: specific operation on groups through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group specific' method") + + va_start (arguments, req); + if((ret_value = (cls->group_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_optional + * + * Purpose: optional operation specific to drivers. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group optional' method") + + va_start (arguments, req); + if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_close + * + * Purpose: Closes a group through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + HDassert(grp); + HDassert(cls); + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->group_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group close' method"); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->group_cls.close)(grp, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_create + * + * Purpose: Creates a hard link through the VOL + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->link_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link create' method") + /* call the corresponding VOL create callback */ + if((ret_value = (cls->link_cls.create) + (create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_copy + * + * Purpose: Copys a link from src to dst. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check if the corresponding VOL copy callback exists */ + if(NULL == cls->link_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link copy' method") + + /* call the corresponding VOL copy callback */ + if((ret_value = (cls->link_cls.copy) + (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, + lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_move + * + * Purpose: Moves a link from src to dst. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check if the corresponding VOL move callback exists */ + if(NULL == cls->link_cls.move) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link move' method") + + /* call the corresponding VOL move callback */ + if((ret_value = (cls->link_cls.move) + (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, + lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link move failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_get + * + * Purpose: Get specific information about the link through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link get' method") + + va_start (arguments, req); + if((ret_value = (cls->link_cls.get) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_specific + * + * Purpose: specific operation on links through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link specific' method") + + va_start (arguments, req); + if((ret_value = (cls->link_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_optional + * + * Purpose: optional operation specific to drivers. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link optional' method") + + va_start (arguments, req); + if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_open + * + * Purpose: Opens a object through the VOL + * + * Return: Success: User ID of the new object. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, + hid_t dxpl_id, void **req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL open callback exists */ + if(NULL == cls->object_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'object open' method") + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->object_cls.open) + (obj, params, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_copy + * + * Purpose: Copies an object to another destination through the VOL + * + * Return: Success: Non Negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Make sure that the VOL drivers are the same */ + if (cls1->value != cls2->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL drivers and can't be linked") + + if(NULL == cls1->object_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object copy' method") + + if((ret_value = (cls1->object_cls.copy) + (src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id, + lcpl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_get + * + * Purpose: Get specific information about the object through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object get' method") + + va_start (arguments, req); + if((ret_value = (cls->object_cls.get) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_specific + * + * Purpose: specific operation on objects through the VOL + * + * Return: Success: non negative + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object specific' method") + + va_start (arguments, req); + if((ret_value = (cls->object_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_optional + * + * Purpose: optional operation specific to drivers. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->object_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object optional' method") + + va_start (arguments, req); + if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: Positive + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL commit callback exists */ + if(NULL == cls->datatype_cls.commit) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'datatype commit' method") + + /* call the corresponding VOL commit callback */ + if(NULL == (ret_value = (cls->datatype_cls.commit) + (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "commit failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_open + * + * Purpose: Opens a named datatype through the VOL + * + * Return: Success: User ID of the datatype. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t tapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the type specific corresponding VOL open callback exists */ + if(NULL == cls->datatype_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback"); + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->datatype_cls.open) + (obj, loc_params, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_get + * + * Purpose: Get specific information about the datatype through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype get' method"); + va_start (arguments, req); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed"); + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_specific + * + * Purpose: specific operation on datatypes through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->datatype_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype specific' method") + + va_start (arguments, req); + if((ret_value = (cls->datatype_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_optional + * + * Purpose: optional operation specific to drivers. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->datatype_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype optional' method") + + va_start (arguments, req); + if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_close + * + * Purpose: Closes a datatype through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->datatype_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype close' method"); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->datatype_cls.close)(dt, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_cancel + * + * Purpose: Cancels an asynchronous request through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->async_cls.cancel) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async cancel' method"); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->async_cls.cancel)(req, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_test + * + * Purpose: Tests an asynchronous request through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->async_cls.test) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async test' method"); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->async_cls.test)(req, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request test failed"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_test() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_wait + * + * Purpose: Waits on an asychronous request through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->async_cls.wait) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async wait' method"); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->async_cls.wait)(req, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_wait() */ + diff --git a/src/H5VLmodule.h b/src/H5VLmodule.h new file mode 100644 index 0000000..1ae0d61 --- /dev/null +++ b/src/H5VLmodule.h @@ -0,0 +1,31 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: This file contains declarations which define macros for the + * H5VL package. Including this header means that the source file + * is part of the H5VL package. + */ + +#ifndef _H5VLmodule_H +#define _H5VLmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5VL_MODULE +#define H5_MY_PKG H5VL +#define H5_MY_PKG_ERR H5E_VOL +#define H5_MY_PKG_INIT YES + +#endif /* _H5VLmodule_H */ + diff --git a/src/H5VLnative.c b/src/H5VLnative.c new file mode 100644 index 0000000..acfceed --- /dev/null +++ b/src/H5VLnative.c @@ -0,0 +1,3533 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 native VOL driver where access is to a single HDF5 file + * using HDF5 VFDs. + */ + +#define H5A_FRIEND /* Suppress error about including H5Apkg */ +#define H5D_FRIEND /* Suppress error about including H5Dpkg */ +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ +#define H5G_FRIEND /* Suppress error about including H5Gpkg */ +#define H5L_FRIEND /* Suppress error about including H5Lpkg */ +#define H5O_FRIEND /* Suppress error about including H5Opkg */ +#define H5R_FRIEND /* Suppress error about including H5Rpkg */ +#define H5T_FRIEND /* Suppress error about including H5Tpkg */ + + +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Rpkg.h" /* References */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* VOL drivers */ +#include "H5VLnative.h" /* Native VOL driver */ + +/* + * The VOL driver identification number. + */ +static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; + + +/* Prototypes */ +static H5F_t *H5VL_native_get_file(void *obj, H5I_type_t type); +static herr_t H5VL__native_term(void); + +/* Atrribute callbacks */ +static void *H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +static void *H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_attr_close(void *attr, hid_t dxpl_id, void **req); + +/* Dataset callbacks */ +static void *H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req); +static herr_t H5VL_native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +static herr_t H5VL_native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_dataset_close(void *dset, hid_t dxpl_id, void **req); + +/* File callbacks */ +static void *H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void *H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_file_close(void *file, hid_t dxpl_id, void **req); + +/* Group callbacks */ +static void *H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_group_specific(void *dset, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_group_close(void *grp, hid_t dxpl_id, void **req); + +/* Link callbacks */ +static herr_t H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, + H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); + +/* Object callbacks */ +static void *H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); + +/* Datatype callbacks */ +static void *H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_native_datatype_close(void *dt, hid_t dxpl_id, void **req); + +/* Native VOL driver class struct */ +static H5VL_class_t H5VL_native_cls_g = { + H5VL_NATIVE_VERSION, /* version */ + H5VL_NATIVE_VALUE, /* value */ + H5VL_NATIVE_NAME, /* name */ + NULL, /* initialize */ + NULL, /* terminate */ + (size_t)0, /* fapl size */ + NULL, /* fapl copy */ + NULL, /* fapl free */ + { /* attribute_cls */ + H5VL_native_attr_create, /* create */ + H5VL_native_attr_open, /* open */ + H5VL_native_attr_read, /* read */ + H5VL_native_attr_write, /* write */ + H5VL_native_attr_get, /* get */ + H5VL_native_attr_specific, /* specific */ + NULL, /* optional */ + H5VL_native_attr_close /* close */ + }, + { /* dataset_cls */ + H5VL_native_dataset_create, /* create */ + H5VL_native_dataset_open, /* open */ + H5VL_native_dataset_read, /* read */ + H5VL_native_dataset_write, /* write */ + H5VL_native_dataset_get, /* get */ + H5VL_native_dataset_specific, /* specific */ + H5VL_native_dataset_optional, /* optional */ + H5VL_native_dataset_close /* close */ + }, + { /* datatype_cls */ + H5VL_native_datatype_commit, /* commit */ + H5VL_native_datatype_open, /* open */ + H5VL_native_datatype_get, /* get */ + H5VL_native_datatype_specific, /* specific */ + NULL, /* optional */ + H5VL_native_datatype_close /* close */ + }, + { /* file_cls */ + H5VL_native_file_create, /* create */ + H5VL_native_file_open, /* open */ + H5VL_native_file_get, /* get */ + H5VL_native_file_specific, /* specific */ + H5VL_native_file_optional, /* optional */ + H5VL_native_file_close /* close */ + }, + { /* group_cls */ + H5VL_native_group_create, /* create */ + H5VL_native_group_open, /* open */ + H5VL_native_group_get, /* get */ + H5VL_native_group_specific, /* specific */ + NULL, /* optional */ + H5VL_native_group_close /* close */ + }, + { /* link_cls */ + H5VL_native_link_create, /* create */ + H5VL_native_link_copy, /* copy */ + H5VL_native_link_move, /* move */ + H5VL_native_link_get, /* get */ + H5VL_native_link_specific, /* specific */ + NULL /* optional */ + }, + { /* object_cls */ + H5VL_native_object_open, /* open */ + H5VL_native_object_copy, /* copy */ + H5VL_native_object_get, /* get */ + H5VL_native_object_specific, /* specific */ + H5VL_native_object_optional /* optional */ + }, + { /* async_cls */ + NULL, /* cancel */ + NULL, /* test */ + NULL /* wait */ + }, + NULL /* optional */ +}; + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_init + * + * Purpose: Initialize this VOL driver by registering it with the + * library. + * + * Return: Success: The ID for the native driver + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_native_init(void) +{ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* 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, + sizeof(H5VL_class_t), TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL driver") + } + + /* Set return value */ + ret_value = H5VL_NATIVE_ID_g; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_init() */ + +/* XXX (VOL_MERGE): TEMPORARY */ +hid_t +H5VL_native_get_driver_id(void) +{ + return H5VL_NATIVE_ID_g; +} + + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_term + * + * Purpose: Shut down the native VOL + * + * Returns: SUCCEED (Can't fail) + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_term(void) +{ + FUNC_ENTER_STATIC_NOERR + + /* Reset VFL ID */ + H5VL_NATIVE_ID_g = H5I_INVALID_HID; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__native_term() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_fapl_native + * + * Purpose: Modify the file access property list to use the H5VL_NATIVE + * driver defined in this source file. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_fapl_native(hid_t fapl_id) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value; + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", fapl_id); + + if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + ret_value = H5P_set_vol(plist, H5VL_NATIVE_ID_g, NULL); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_fapl_native() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_native_get_file + * + * Purpose: Utility routine to get file struct for an object via the + * native VOL driver. + * + * Returns: SUCCESS: A pointer to the H5F_t struct for the file + * associated with the object. + * FAILURE: NULL + * + *--------------------------------------------------------------------------- + */ +static H5F_t * +H5VL_native_get_file(void *obj, H5I_type_t type) +{ + H5F_t *ret_value = NULL; /* File pointer */ + H5O_loc_t *oloc = NULL; /* Object location for ID */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(type) { + case H5I_FILE: + ret_value = (H5F_t *)obj; + break; + case H5I_GROUP: + { + H5G_t *grp; + grp = (H5G_t *)obj; + oloc = H5G_oloc(grp); + break; + } + case H5I_DATATYPE: + { + H5T_t *dt; + dt = (H5T_t *)obj; + oloc = H5T_oloc(dt); + break; + } + case H5I_DATASET: + { + H5D_t *dset; + dset = (H5D_t *)obj; + oloc = H5D_oloc(dset); + break; + } + + case H5I_ATTR: + { + H5A_t *attr; + attr = (H5A_t *)obj; + oloc = H5A_oloc(attr); + break; + } + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + } + + if(!ret_value) { + if (!oloc) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not assocated with a file") + ret_value = oloc->file; + } + if(!ret_value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5VL_native_get_file */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_native_register + * + * Purpose: Utility routine to register an ID with the native VOL driver + * as an auxilary object. + * + * Returns: Success: An ID for the object + * Failure: H5I_INVALID_HID + * + *--------------------------------------------------------------------------- + */ +hid_t +H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) +{ + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(obj); + + /* If the datatype is already VOL-managed, the datatype's vol_obj + * field will get clobbered later, so disallow this. + */ + if(type == H5I_DATATYPE) + if(((H5T_t *)obj)->vol_obj != NULL) + 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) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_register() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_native_unregister + * + * Purpose: Utility routine to decrement ref count on Native VOL driver + * objects. + * + * Returns: SUCCEED/FAIL + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL_native_unregister(hid_t obj_id) +{ + H5VL_object_t *vol_obj = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + /* get the driver pointer */ + if(NULL == (vol_obj = (H5VL_object_t *)H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid ID") + + /* free object */ + if(H5VL_free_object(vol_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_unregister() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_attr_create + * + * Purpose: Creates an attribute on an object. + * + * Return: Success: attr id. + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, + hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t loc; /* Object location */ + H5G_loc_t obj_loc; /* Location used to open group */ + hbool_t loc_found = FALSE; + H5P_genplist_t *plist; /* Property list pointer */ + hid_t type_id, space_id; + H5T_t *type, *dt; /* Datatype to use for attribute */ + H5S_t *space; /* Dataspace to use for attribute */ + H5A_t *attr = NULL; + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") + + /* get creation properties */ + if(H5P_get(plist, H5VL_PROP_ATTR_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id") + if(H5P_get(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id") + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, NULL, "no write intent on file") + + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + /* If this is a named datatype, get the driver pointer to the datatype */ + type = H5T_get_actual_type(dt); + + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data space") + + if(loc_params.type == H5VL_OBJECT_BY_SELF) { + /* H5Acreate */ + /* Go do the real work for attaching the attribute to the dataset */ + if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + /* H5Acreate_by_name */ + if(NULL == (attr = H5A__create_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name, type, space, acpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute create parameters") + } + ret_value = (void *)attr; + +done: + /* Release resources */ + if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_attr_open + * + * Purpose: Opens a attr inside a native h5 file. + * + * Return: Success: attr id. + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t loc; /* Object location */ + H5A_t *attr = NULL; /* Attribute opened */ + void *ret_value; + + FUNC_ENTER_NOAPI_NOINIT + + /* check arguments */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + if(loc_params.type == H5VL_OBJECT_BY_SELF) { + /* H5Aopen */ + /* Open the attribute */ + if(NULL == (attr = H5A__open(&loc, attr_name))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name) + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + /* H5Aopen_by_name */ + /* Open the attribute on the object header */ + if(NULL == (attr = H5A__open_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") + } + else if(loc_params.type == H5VL_OBJECT_BY_IDX) { + /* H5Aopen_by_idx */ + /* Open the attribute in the object header */ + if(NULL == (attr = H5A__open_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, + loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, + loc_params.loc_data.loc_by_idx.n))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute open parameters") + } + + ret_value = (void *)attr; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_attr_read + * + * Purpose: Reads in data from attribute. + * + * Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5T_t *mem_type; /* Memory datatype */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + /* Go write the actual data to the attribute */ + if((ret_value = H5A__read((H5A_t*)attr, mem_type, buf)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_attr_write + * + * Purpose: Writes out data to attribute. + * + * Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5T_t *mem_type; /* Memory datatype */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + /* Go write the actual data to the attribute */ + if((ret_value = H5A__write((H5A_t*)attr, mem_type, buf)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_attr_get + * + * Purpose: Gets certain information about an attribute + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(get_type) { + /* H5Aget_space */ + case H5VL_ATTR_GET_SPACE: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + H5A_t *attr = (H5A_t *)obj; + + if((*ret_id = H5A_get_space(attr)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") + break; + } + /* H5Aget_type */ + case H5VL_ATTR_GET_TYPE: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + H5A_t *attr = (H5A_t *)obj; + + if((*ret_id = H5A__get_type(attr)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") + break; + } + /* H5Aget_create_plist */ + case H5VL_ATTR_GET_ACPL: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + H5A_t *attr = (H5A_t *)obj; + + if((*ret_id = H5A__get_create_plist(attr)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr") + + break; + } + /* H5Aget_name */ + case H5VL_ATTR_GET_NAME: + { + H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + size_t buf_size = va_arg(arguments, size_t); + char *buf = va_arg(arguments, char *); + ssize_t *ret_val = va_arg(arguments, ssize_t *); + H5A_t *attr = NULL; + + if(H5VL_OBJECT_BY_SELF == loc_params.type) { + attr = (H5A_t *)obj; + /* Call private function in turn */ + if(0 > (*ret_val = H5A__get_name(attr, buf_size, buf))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name") + } + else if(H5VL_OBJECT_BY_IDX == loc_params.type) { + H5G_loc_t loc; + + /* check arguments */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Open the attribute on the object header */ + if(NULL == (attr = H5A__open_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, + loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, + loc_params.loc_data.loc_by_idx.n))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + + /* Get the length of the name */ + *ret_val = (ssize_t)HDstrlen(attr->shared->name); + + /* Copy the name into the user's buffer, if given */ + if(buf) { + HDstrncpy(buf, attr->shared->name, MIN((size_t)(*ret_val + 1), buf_size)); + if((size_t)(*ret_val) >= buf_size) + buf[buf_size - 1]='\0'; + } /* end if */ + + /* Release resources */ + if(attr && H5A__close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + } + else + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") + + break; + } + /* H5Aget_info */ + case H5VL_ATTR_GET_INFO: + { + H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + H5A_info_t *ainfo = va_arg(arguments, H5A_info_t *); + H5A_t *attr = NULL; + + if(H5VL_OBJECT_BY_SELF == loc_params.type) { + attr = (H5A_t *)obj; + if(H5A__get_info(attr, ainfo) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get attribute info") + } + else if(H5VL_OBJECT_BY_NAME == loc_params.type) { + char *attr_name = va_arg(arguments, char *); + H5G_loc_t loc; + + /* check arguments */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Open the attribute on the object header */ + if(NULL == (attr = H5A__open_by_name(&loc, loc_params.loc_data.loc_by_name.name, + attr_name))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + + /* Get the attribute information */ + if(H5A__get_info(attr, ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + + /* Release resources */ + if(attr && H5A__close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + } + else if(H5VL_OBJECT_BY_IDX == loc_params.type) { + H5G_loc_t loc; + + /* check arguments */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Open the attribute on the object header */ + if(NULL == (attr = H5A__open_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, + loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, + loc_params.loc_data.loc_by_idx.n))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + + /* Get the attribute information */ + if(H5A__get_info(attr, ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + + /* Release resources */ + if(attr && H5A__close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + } + else + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") + + break; + } + case H5VL_ATTR_GET_STORAGE_SIZE: + { + hsize_t *ret = va_arg(arguments, hsize_t *); + H5A_t *attr = (H5A_t *)obj; + + /* Set return value */ + *ret = attr->shared->data_size; + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_attr_specific + * + * Purpose: Specific operations for attributes + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * August, 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5G_loc_t loc; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Get location for passed-in object */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + /* XXX: Do I need to clean this up? */ + + switch(specific_type) { + case H5VL_ATTR_DELETE: + { + char *attr_name = va_arg(arguments, char *); + + if(H5VL_OBJECT_BY_SELF == loc_params.type) { + /* H5Adelete */ + /* Delete the attribute from the location */ + if(H5O__attr_remove(loc.oloc, attr_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + } + else if(H5VL_OBJECT_BY_NAME == loc_params.type) { + /* H5Adelete_by_name */ + /* Delete the attribute */ + if(H5A__delete_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + } + else if(H5VL_OBJECT_BY_IDX == loc_params.type) { + /* H5Adelete_by_idx */ + /* Delete the attribute from the location */ + if(H5A__delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + } + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters") + break; + } + case H5VL_ATTR_EXISTS: + { + const char *attr_name = va_arg(arguments, const char *); + htri_t *ret = va_arg(arguments, htri_t *); + + if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */ + /* Check if the attribute exists */ + if((*ret = H5O__attr_exists(loc.oloc, attr_name)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */ + /* Check if the attribute exists */ + if((*ret = H5A__exists_by_name(loc, loc_params.loc_data.loc_by_name.name, attr_name)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + } + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") + break; + } + case H5VL_ATTR_ITER: + { + H5_index_t idx_type = va_arg(arguments, H5_index_t); + H5_iter_order_t order = va_arg(arguments, H5_iter_order_t); + hsize_t *idx = va_arg(arguments, hsize_t *); + H5A_operator2_t op = va_arg(arguments, H5A_operator2_t); + void *op_data = va_arg(arguments, void *); + + if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */ + + /* Iterate over attributes */ + if((ret_value = H5A__iterate(&loc, ".", idx_type, order, idx, op, op_data)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */ + + /* Iterate over attributes by name */ + if((ret_value = H5A__iterate(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, idx, op, op_data)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed"); + } + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") + break; + } + /* H5Arename/rename_by_name */ + case H5VL_ATTR_RENAME: + { + const char *old_name = va_arg(arguments, const char *); + const char *new_name = va_arg(arguments, const char *); + + if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Arename */ + /* Call attribute rename routine */ + if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */ + /* Call attribute rename routine */ + if(H5A__rename_by_name(loc, loc_params.loc_data.loc_by_name.name, old_name, new_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + } + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters") + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_attr_close + * + * Purpose: Closes an attribute. + * + * Return: Success: 0 + * Failure: -1, attr not closed. + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(H5A__close((H5A_t*)attr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_dataset_create + * + * Purpose: Creates a dataset in a native HDF5 file + * + * Return: Success: Pointer to a dataset struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, + hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5G_loc_t loc; /* Object location to insert dataset into */ + hid_t type_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t lcpl_id = H5I_INVALID_HID; + H5D_t *dset = NULL; /* New dataset's info */ + const H5S_t *space; /* Dataspace for dataset */ + void *ret_value; + + FUNC_ENTER_NOAPI_NOINIT + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") + + /* Get creation properties */ + if(H5P_get(plist, H5VL_PROP_DSET_TYPE_ID, &type_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for datatype id") + if(H5P_get(plist, H5VL_PROP_DSET_SPACE_ID, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id") + if(H5P_get(plist, H5VL_PROP_DSET_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id") + + /* Check arguments */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + if(H5I_DATATYPE != H5I_get_type(type_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype ID") + if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a dataspace ID") + + /* H5Dcreate_anon */ + if(NULL == name) { + /* build and open the new dataset */ + if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") + } + /* H5Dcreate2 */ + else { + /* Create the new dataset & get its ID */ + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, + dcpl_id, dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") + } + ret_value = (void *)dset; + +done: + if(NULL == name) { + /* Release the dataset's object header, if it was created */ + if(dset) { + H5O_loc_t *oloc; /* Object location for dataset */ + + /* Get the new dataset's object location */ + if(NULL == (oloc = H5D_oloc(dset))) + HDONE_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get object location of dataset") + + /* Decrement refcount on dataset's object header in memory */ + if(H5O_dec_rc_by_loc(oloc) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") + } + } + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_dataset_open + * + * Purpose: Opens a dataset in a native HDF5 file. + * + * Return: Success: Pointer to a dataset struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5D_t *dset = NULL; + H5G_loc_t loc; /* Object location of group */ + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + /* Open the dataset */ + if(NULL == (dset = H5D__open_name(&loc, name, dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset") + + ret_value = (void *)dset; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_dataset_read + * + * Purpose: Reads raw data from a dataset into a buffer. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf, void H5_ATTR_UNUSED **req) +{ + H5D_t *dset = (H5D_t *)obj; + const H5S_t *mem_space = NULL; + const H5S_t *file_space = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Check arguments */ + if(NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + + /* Get validated dataspace pointers */ + if(H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") + if(H5S_get_validated_dataspace(file_space_id, &file_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") + + /* Read raw data */ + if(H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_dataset_write + * + * Purpose: Writes raw data from a buffer into a dataset. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf, void H5_ATTR_UNUSED **req) +{ + H5D_t *dset = (H5D_t *)obj; + const H5S_t *mem_space = NULL; + const H5S_t *file_space = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* check arguments */ + if(NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + + /* Get validated dataspace pointers */ + if(H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") + if(H5S_get_validated_dataspace(file_space_id, &file_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") + + /* Write the data */ + if(H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_dataset_get + * + * Purpose: Gets certain information about a dataset + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5D_t *dset = (H5D_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(get_type) { + /* H5Dget_space */ + case H5VL_DATASET_GET_SPACE: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + + if((*ret_id = H5D__get_space(dset)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of dataset") + + break; + } + /* H5Dget_space_statuc */ + case H5VL_DATASET_GET_SPACE_STATUS: + { + H5D_space_status_t *allocation = va_arg(arguments, H5D_space_status_t *); + + /* Read data space address and return */ + if(H5D__get_space_status(dset, allocation) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status") + + break; + } + /* H5Dget_type */ + case H5VL_DATASET_GET_TYPE: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + + if((*ret_id = H5D__get_type(dset)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of dataset") + + break; + } + /* H5Dget_create_plist */ + case H5VL_DATASET_GET_DCPL: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + + if((*ret_id = H5D_get_create_plist(dset)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for dataset") + + break; + } + /* H5Dget_access_plist */ + case H5VL_DATASET_GET_DAPL: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + + if((*ret_id = H5D_get_access_plist(dset)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get access property list for dataset") + + break; + } + /* H5Dget_storage_size */ + case H5VL_DATASET_GET_STORAGE_SIZE: + { + hsize_t *ret = va_arg(arguments, hsize_t *); + + /* Set return value */ + if(H5D__get_storage_size(dset, ret) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") + break; + } + /* H5Dget_offset */ + case H5VL_DATASET_GET_OFFSET: + { + haddr_t *ret = va_arg(arguments, haddr_t *); + + /* Set return value */ + *ret = H5D__get_offset(dset); + if(!H5F_addr_defined(*ret)) + *ret = HADDR_UNDEF; + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_dataset_specific + * + * Purpose: Specific operations for datasets + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5D_t *dset = (H5D_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(specific_type) { + /* H5Dspecific_space */ + case H5VL_DATASET_SET_EXTENT: + { + const hsize_t *size = va_arg(arguments, const hsize_t *); + + if(H5D__set_extent(dset, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset") + break; + } + case H5VL_DATASET_FLUSH: + { + hid_t dset_id = va_arg(arguments, hid_t); + + /* Flush the dataset */ + if(H5D__flush(dset, dset_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") + + break; + } + case H5VL_DATASET_REFRESH: + { + hid_t dset_id = va_arg(arguments, hid_t); + + /* Refresh the dataset */ + if((H5D__refresh(dset_id, dset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") + + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_dataset_optional + * + * Purpose: Perform a driver specific operation on a native dataset + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5D_t *dset = NULL; /* Dataset */ + H5VL_dataset_optional_t optional_type = va_arg(arguments, H5VL_dataset_optional_t); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(optional_type) { + case H5VL_DATASET_FORMAT_CONVERT: + { + dset = (H5D_t *)obj; + + switch(dset->shared->layout.type) { + case H5D_CHUNKED: + /* Convert the chunk indexing type to version 1 B-tree if not */ + if(dset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE) + if((H5D__format_convert(dset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade chunk indexing type for dataset") + break; + + case H5D_CONTIGUOUS: + case H5D_COMPACT: + /* Downgrade the layout version to 3 if greater than 3 */ + if(dset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT) + if((H5D__format_convert(dset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to downgrade layout version for dataset") + break; + + case H5D_VIRTUAL: + /* Nothing to do even though layout is version 4 */ + break; + + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") + } /* end switch */ + + break; + } + case H5VL_DATASET_GET_CHUNK_INDEX_TYPE: + { + H5D_chunk_index_t *idx_type = va_arg(arguments, H5D_chunk_index_t *); + + dset = (H5D_t *)obj; + + /* Make sure the dataset is chunked */ + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Get the chunk indexing type */ + *idx_type = dset->shared->layout.u.chunk.idx_type; + + break; + } + case H5VL_DATASET_GET_CHUNK_STORAGE_SIZE: + { + hsize_t *offset = va_arg(arguments, hsize_t *); + hsize_t *chunk_nbytes = va_arg(arguments, hsize_t *); + + dset = (H5D_t *)obj; + + /* Make sure the dataset is chunked */ + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Call private function */ + if(H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") + + break; + } + case H5VL_DATASET_CHUNK_READ: + { + const hsize_t *offset = va_arg(arguments, hsize_t *); + uint32_t *filters = va_arg(arguments, uint32_t *); + void *buf = va_arg(arguments, void *); + hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ + + dset = (H5D_t *)obj; + + /* Check arguments */ + if(NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Copy the user's offset array so we can be sure it's terminated properly. + * (we don't want to mess with the user's buffer). + */ + if(H5D__get_offset_copy(dset, offset, offset_copy) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") + + /* Read the raw chunk */ + if(H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") + + break; + } + case H5VL_DATASET_CHUNK_WRITE: + { + uint32_t filters = va_arg(arguments, uint32_t); + const hsize_t *offset = va_arg(arguments, const hsize_t *); + uint32_t data_size_32 = va_arg(arguments, uint32_t); + const void *buf = va_arg(arguments, const void *); + hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ + + dset = (H5D_t *)obj; + + /* Check arguments */ + if(NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Copy the user's offset array so we can be sure it's terminated properly. + * (we don't want to mess with the user's buffer). + */ + if(H5D__get_offset_copy(dset, offset, offset_copy) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") + + /* Write chunk */ + if(H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") + + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_dataset_close + * + * Purpose: Closes a dataset. + * + * Return: Success: SUCCEED + * Failure: FAIL (dataset will not be closed) + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(H5D_close((H5D_t*)dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_file_create + * + * Purpose: Creates a file as a native HDF5 file. + * + * Return: Success: A pointer to an H5F_t file struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5F_t *new_file = NULL; + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + /* Adjust bit flags by turning on the creation bit and making sure that + * the EXCL or TRUNC bit is set. All newly-created files are opened for + * reading and writing. + */ + if(0 == (flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))) + flags |= H5F_ACC_EXCL; /*default*/ + flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; + + /* Create the file */ + if(NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id))) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file") + + new_file->id_exists = TRUE; + ret_value = (void *)new_file; + +done: + if(NULL == ret_value && new_file) + if(H5F__close(new_file) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_file_open + * + * Purpose: Opens a file as a native HDF5 file. + * + * Return: Success: A pointer to an H5F_t file struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5F_t *new_file = NULL; + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + /* Open the file */ + if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") + + new_file->id_exists = TRUE; + ret_value = (void *)new_file; + +done: + if(NULL == ret_value && new_file && H5F_try_close(new_file, NULL) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_file_get + * + * Purpose: Gets certain data about a file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5F_t *f = NULL; /* File struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(get_type) { + /* H5Fget_access_plist */ + case H5VL_FILE_GET_FAPL: + { + H5P_genplist_t *new_plist; /* New property list */ + hid_t *plist_id = va_arg(arguments, hid_t *); + + f = (H5F_t *)obj; + + /* Retrieve the file's access property list */ + if((*plist_id = H5F_get_access_plist(f, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list") + + if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(*plist_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + break; + } + /* H5Fget_create_plist */ + case H5VL_FILE_GET_FCPL: + { + H5P_genplist_t *plist; /* Property list */ + hid_t *plist_id = va_arg(arguments, hid_t *); + + f = (H5F_t *)obj; + if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Create the property list object to return */ + if((*plist_id = H5P_copy_plist(plist, TRUE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file creation properties") + + break; + } + /* H5Fget_obj_count */ + case H5VL_FILE_GET_OBJ_COUNT: + { + unsigned types = va_arg(arguments, unsigned); + ssize_t *ret = va_arg(arguments, ssize_t *); + size_t obj_count = 0; /* Number of opened objects */ + + f = (H5F_t *)obj; + /* Perform the query */ + if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + + /* Set the return value */ + *ret = (ssize_t)obj_count; + break; + } + /* H5Fget_obj_ids */ + case H5VL_FILE_GET_OBJ_IDS: + { + unsigned types = va_arg(arguments, unsigned); + size_t max_objs = va_arg(arguments, size_t); + hid_t *oid_list = va_arg(arguments, hid_t *); + ssize_t *ret = va_arg(arguments, ssize_t *); + size_t obj_count = 0; /* Number of opened objects */ + + f = (H5F_t *)obj; + /* Perform the query */ + if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_count) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed") + + /* Set the return value */ + *ret = (ssize_t)obj_count; + break; + } + /* H5Fget_intent */ + case H5VL_FILE_GET_INTENT: + { + unsigned *intent_flags = va_arg(arguments, unsigned *); + + f = (H5F_t *)obj; + + /* HDF5 uses some flags internally that users don't know about. + * Simplify things for them so that they only get either H5F_ACC_RDWR + * or H5F_ACC_RDONLY and any SWMR flags. + */ + if(H5F_INTENT(f) & H5F_ACC_RDWR) { + *intent_flags = H5F_ACC_RDWR; + + /* Check for SWMR write access on the file */ + if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) + *intent_flags |= H5F_ACC_SWMR_WRITE; + } + else { + *intent_flags = H5F_ACC_RDONLY; + + /* Check for SWMR read access on the file */ + if(H5F_INTENT(f) & H5F_ACC_SWMR_READ) + *intent_flags |= H5F_ACC_SWMR_READ; + } + + break; + } + /* H5Fget_name */ + case H5VL_FILE_GET_NAME: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + size_t size = va_arg(arguments, size_t); + char *name = va_arg(arguments, char *); + ssize_t *ret = va_arg(arguments, ssize_t *); + size_t len; + + if(NULL == (f = H5VL_native_get_file(obj, type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + len = HDstrlen(H5F_OPEN_NAME(f)); + + if(name) { + HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size)); + if(len >= size) + name[size-1]='\0'; + } + + /* Set the return value for the API call */ + *ret = (ssize_t)len; + break; + } + /* H5Iget_file_id */ + case H5VL_OBJECT_GET_FILE: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + void **ret = va_arg(arguments, void **); + + if(NULL == (f = H5VL_native_get_file(obj, type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + f->id_exists = TRUE; + *ret = (void*)f; + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information") + } /* end switch */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_file_specific + * + * Purpose: Perform an operation + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(specific_type) { + /* H5Fflush */ + case H5VL_FILE_FLUSH: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + H5F_scope_t scope = va_arg(arguments, H5F_scope_t); + H5F_t *f = NULL; /* File to flush */ + + /* Get the file for the object */ + if(NULL == (f = H5VL_native_get_file(obj, type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Nothing to do if the file is read only. This determination is + * made at the shared open(2) flags level, implying that opening a + * file twice, once for read-only and once for read-write, and then + * calling H5Fflush() with the read-only handle, still causes data + * to be flushed. + */ + if(H5F_ACC_RDWR & H5F_INTENT(f)) { + /* Flush other files, depending on scope */ + if(H5F_SCOPE_GLOBAL == scope) { + /* Call the flush routine for mounted file hierarchies */ + if(H5F_flush_mounts(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") + } + else { + /* Call the flush routine, for this file */ + if(H5F__flush(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + } + } + break; + } + /* H5Fmount */ + case H5VL_FILE_MOUNT: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + const char *name = va_arg(arguments, const char *); + H5F_t *child = va_arg(arguments, H5F_t *); + hid_t plist_id = va_arg(arguments, hid_t); + H5G_loc_t loc; + + if(H5G_loc_real(obj, type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Do the mount */ + if(H5F__mount(&loc, name, child, plist_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") + + break; + } + /* H5Funmount */ + case H5VL_FILE_UNMOUNT: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + const char *name = va_arg(arguments, const char *); + H5G_loc_t loc; + + if(H5G_loc_real(obj, type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Unmount */ + if(H5F__unmount(&loc, name) < 0) + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") + + break; + } + /* H5Fis_accessible */ + case H5VL_FILE_IS_ACCESSIBLE: + { + hid_t fapl_id = va_arg(arguments, hid_t); + const char *name = va_arg(arguments, const char *); + htri_t *ret = va_arg(arguments, htri_t *); + + /* Call private routine */ + if((*ret = H5F__is_hdf5(name, fapl_id)) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "error in HDF5 file check") + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_file_optional + * + * Purpose: Perform a driver specific operation on a native file + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5F_t *f = NULL; /* File */ + H5VL_file_optional_t optional_type = va_arg(arguments, H5VL_file_optional_t); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(optional_type) { + /* H5Fget_filesize */ + case H5VL_FILE_GET_SIZE: + { + haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */ + haddr_t base_addr; /* Base address for the file */ + hsize_t *size = va_arg(arguments, hsize_t *); + + f = (H5F_t *)obj; + + /* Go get the actual file size */ + if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") + + base_addr = H5FD_get_base_addr(f->shared->lf); + + if(size) + *size = (hsize_t)(max_eof_eoa + base_addr); /* Convert relative base address for file to absolute address */ + + break; + } + /* H5Fget_file_image */ + case H5VL_FILE_GET_FILE_IMAGE: + { + void *buf_ptr = va_arg(arguments, void *); + ssize_t *ret = va_arg(arguments, ssize_t *); + size_t buf_len = va_arg(arguments, size_t ); + + f = (H5F_t *)obj; + /* Do the actual work */ + if((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed") + break; + } + /* H5Fget_freespace */ + case H5VL_FILE_GET_FREE_SPACE: + { + hsize_t tot_space; /* Amount of free space in the file */ + hssize_t *ret = va_arg(arguments, hssize_t *); + + f = (H5F_t *)obj; + /* Go get the actual amount of free space in the file */ + if(H5MF_get_freespace(f, &tot_space, NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + *ret = (hssize_t)tot_space; + break; + } + case H5VL_FILE_GET_FREE_SECTIONS: + { + H5F_sect_info_t *sect_info = va_arg(arguments, H5F_sect_info_t *); + ssize_t *ret = va_arg(arguments, ssize_t *); + H5F_mem_t type = va_arg(arguments, H5F_mem_t); + size_t nsects = va_arg(arguments, size_t); + + f = (H5F_t *)obj; + /* Go get the free-space section information in the file */ + if((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + break; + } + /* H5Fget_info2 */ + case H5VL_FILE_GET_INFO: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + H5F_info2_t *finfo = va_arg(arguments, H5F_info2_t *); + + /* Get the file struct. This call is careful to not return the file pointer + * for the top file in a mount hierarchy. + */ + if(NULL == (f = H5VL_native_get_file(obj, type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct") + + /* Get the file info */ + if(H5F__get_info(f, finfo) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") + + break; + } + /* H5Fget_mdc_config */ + case H5VL_FILE_GET_MDC_CONF: + { + H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *); + + f = (H5F_t *)obj; + /* Go get the resize configuration */ + if(H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") + break; + } + /* H5Fget_mdc_hit_rate */ + case H5VL_FILE_GET_MDC_HR: + { + double *hit_rate_ptr = va_arg(arguments, double *); + + f = (H5F_t *)obj; + /* Go get the current hit rate */ + if(H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") + break; + } + /* H5Fget_mdc_size */ + case H5VL_FILE_GET_MDC_SIZE: + { + size_t *max_size_ptr = va_arg(arguments, size_t *); + size_t *min_clean_size_ptr = va_arg(arguments, size_t *); + size_t *cur_size_ptr = va_arg(arguments, size_t *); + int *cur_num_entries_ptr = va_arg(arguments, int *); + uint32_t cur_num_entries; + + f = (H5F_t *)obj; + /* Go get the size data */ + if(H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr, + cur_size_ptr, &cur_num_entries) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") + + if(cur_num_entries_ptr != NULL) + *cur_num_entries_ptr = (int)cur_num_entries; + break; + } + /* H5Fget_vfd_handle */ + case H5VL_FILE_GET_VFD_HANDLE: + { + void **file_handle = va_arg(arguments, void **); + hid_t fapl_id = va_arg(arguments, hid_t); + + f = (H5F_t *)obj; + + /* Retrieve the VFD handle for the file */ + if(H5F_get_vfd_handle(f, fapl_id, file_handle) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") + break; + } + /* H5Fclear_elink_file_cache */ + case H5VL_FILE_CLEAR_ELINK_CACHE: + { + f = (H5F_t *)obj; + + /* Release the EFC */ + if(f->shared->efc) + if(H5F__efc_release(f->shared->efc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") + break; + } + /* H5Freopen */ + case H5VL_FILE_REOPEN: + { + void **ret = va_arg(arguments, void **); + H5F_t *new_file = NULL; + + f = (H5F_t *)obj; + + /* Reopen the file through the VOL driver */ + if(NULL == (new_file = H5F__reopen(f))) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + + new_file->id_exists = TRUE; + + *ret = (void *)new_file; + break; + } + /* H5Freset_mdc_hit_rate_stats */ + case H5VL_FILE_RESET_MDC_HIT_RATE: + { + f = (H5F_t *)obj; + /* Reset the hit rate statistic */ + if(H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") + break; + } + case H5VL_FILE_SET_MDC_CONFIG: + { + H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *); + + f = (H5F_t *)obj; + /* set the resize configuration */ + if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed") + break; + } + case H5VL_FILE_GET_METADATA_READ_RETRY_INFO: + { + H5F_retry_info_t *info = va_arg(arguments, H5F_retry_info_t *); + + f = (H5F_t *)obj; + + if(H5F_get_metadata_read_retry_info(f, info) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get metadata read retry info") + + break; + } + case H5VL_FILE_START_SWMR_WRITE: + { + f = (H5F_t *)obj; + + if(H5F__start_swmr_write(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write") + + break; + } + case H5VL_FILE_START_MDC_LOGGING: + { + f = (H5F_t *)obj; + + /* Call mdc logging function */ + if(H5C_start_logging(f->shared->cache) < 0) + HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") + + break; + } + case H5VL_FILE_STOP_MDC_LOGGING: + { + f = (H5F_t *)obj; + + /* Call mdc logging function */ + if(H5C_stop_logging(f->shared->cache) < 0) + HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") + + break; + } + case H5VL_FILE_GET_MDC_LOGGING_STATUS: + { + hbool_t *is_enabled = va_arg(arguments, hbool_t *); + hbool_t *is_currently_logging = va_arg(arguments, hbool_t *); + + f = (H5F_t *)obj; + + /* Call mdc logging function */ + if(H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0) + HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") + + break; + } + case H5VL_FILE_SET_LATEST_FORMAT: + { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + break; + } + case H5VL_FILE_FORMAT_CONVERT: + { + f = (H5F_t *)obj; + + /* Convert the format */ + if(H5F__format_convert(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") + + break; + } + case H5VL_FILE_RESET_PAGE_BUFFERING_STATS: + { + f = (H5F_t *)obj; + + /* Sanity check */ + if(NULL == f->shared->page_buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") + + /* Reset the statistics */ + if (H5PB_reset_stats(f->shared->page_buf) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering") + + break; + } + case H5VL_FILE_GET_PAGE_BUFFERING_STATS: + { + unsigned *accesses = va_arg(arguments, unsigned *); + unsigned *hits = va_arg(arguments, unsigned *); + unsigned *misses = va_arg(arguments, unsigned *); + unsigned *evictions = va_arg(arguments, unsigned *); + unsigned *bypasses = va_arg(arguments, unsigned *); + + f = (H5F_t *)obj; + + /* Sanity check */ + if(NULL == f->shared->page_buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") + + /* Get the statistics */ + if(H5PB_get_stats(f->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") + + break; + } + case H5VL_FILE_GET_MDC_IMAGE_INFO: + { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + break; + } + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_file_close + * + * Purpose: Closes a file. + * + * Return: SUCCEED/FAIL (the file will not be closed on failure) + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + int nref; + H5F_t *f = (H5F_t *)file; + hid_t file_id = H5I_INVALID_HID; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* This routine should only be called when a file ID's ref count drops to zero */ + HDassert(H5F_ID_EXISTS(f)); + + /* Flush file if this is the last reference to this id and we have write + * intent, unless it will be flushed by the "shared" file being closed. + * This is only necessary to replicate previous behaviour, and could be + * disabled by an option/property to improve performance. + */ + if((H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { + /* Get the file ID corresponding to the H5F_t struct */ + if(H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "invalid atom") + /* Get the number of references outstanding for this file ID */ + if((nref = H5I_get_ref(file_id, FALSE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") + if(nref == 1) + if(H5F__flush(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") + } + + /* Close the file */ + if(H5F__close(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_group_create + * + * Purpose: Creates a group inside a native h5 file. + * + * Return: Success: Pointer to a group struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, + hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5G_loc_t loc; /* Location to create group */ + H5G_t *grp = NULL; /* New group created */ + hid_t lcpl_id; + void *ret_value; + + FUNC_ENTER_NOAPI_NOINIT + + /* Get the property list structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") + + /* Get creation properties */ + if(H5P_get(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id") + + /* Set up the location */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + /* if name is NULL then this is from H5Gcreate_anon */ + if(name == NULL) { + H5G_obj_create_t gcrt_info; /* Information for group creation */ + + /* Set up group creation info */ + gcrt_info.gcpl_id = gcpl_id; + gcrt_info.cache_type = H5G_NOTHING_CACHED; + HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); + + /* Create the new group & get its ID */ + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") + } + /* otherwise it's from H5Gcreate */ + else { + /* Create the new group & get its ID */ + if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") + } + ret_value = (void *)grp; + +done: + if(name == NULL) { + /* Release the group's object header, if it was created */ + if(grp) { + H5O_loc_t *oloc; /* Object location for group */ + + /* Get the new group's object location */ + if(NULL == (oloc = H5G_oloc(grp))) + HDONE_ERROR(H5E_SYM, H5E_CANTGET, NULL, "unable to get object location of group") + + /* Decrement refcount on group's object header in memory */ + if(H5O_dec_rc_by_loc(oloc) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") + } + } + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_group_open + * + * Purpose: Opens a group inside a native h5 file. + * + * Return: Success: Pointer to a group struct + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t loc; /* Location to open group */ + H5G_t *grp = NULL; /* New group opend */ + void *ret_value; + + FUNC_ENTER_NOAPI_NOINIT + + /* Set up the location */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + /* Open the group */ + if((grp = H5G__open_name(&loc, name)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") + + ret_value = (void *)grp; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_group_get + * + * Purpose: Gets data about a group + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(get_type) { + /* H5Gget_create_plist */ + case H5VL_GROUP_GET_GCPL: + { + hid_t *new_gcpl_id = va_arg(arguments, hid_t *); + H5G_t *grp = (H5G_t *)obj; + + if((*new_gcpl_id = H5G_get_create_plist(grp)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group") + break; + } + /* H5Gget_info */ + case H5VL_GROUP_GET_INFO: + { + H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + H5G_info_t *group_info = va_arg(arguments, H5G_info_t *); + H5G_loc_t loc; + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + if(loc_params.type == H5VL_OBJECT_BY_SELF) { + /* H5Gget_info */ + + /* Retrieve the group's information */ + if(H5G__obj_info(loc.oloc, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + } + else if (loc_params.type == H5VL_OBJECT_BY_NAME) { + /* H5Gget_info_by_name */ + + /* Retrieve the group's information */ + if(H5G__get_info_by_name(&loc, loc_params.loc_data.loc_by_name.name, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + } + else if(loc_params.type == H5VL_OBJECT_BY_IDX) { + /* H5Gget_info_by_idx */ + + /* Retrieve the group's information */ + if(H5G__get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, group_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + } + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_group_specific + * + * Purpose: Specific operations for groups + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_group_specific(void *obj, H5VL_group_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5G_t *grp = (H5G_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(specific_type) { + case H5VL_GROUP_FLUSH: + { + hid_t group_id = va_arg(arguments, hid_t); + + /* Flush object's metadata to file */ + if(H5O_flush_common(&grp->oloc, group_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") + + break; + } + case H5VL_GROUP_REFRESH: + { + hid_t group_id = va_arg(arguments, hid_t); + + /* Call private function to refresh group object */ + if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") + + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_group_close + * + * Purpose: Closes a group. + * + * Return: SUCCEED/FAIL (the group will not be closed on failure) + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(H5G_close((H5G_t *)grp) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_link_create + * + * Purpose: Creates an hard/soft/UD/external links. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + switch(create_type) { + case H5VL_LINK_CREATE_HARD: + { + H5G_loc_t cur_loc; + H5G_loc_t link_loc; + void *cur_obj; + H5VL_loc_params_t cur_params; + + if(H5P_get(plist, H5VL_PROP_LINK_TARGET, &cur_obj) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current location id") + if(H5P_get(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &cur_params) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for current name") + + if(NULL != cur_obj && H5G_loc_real(cur_obj, cur_params.obj_type, &cur_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + if(NULL != obj && H5G_loc_real(obj, loc_params.obj_type, &link_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* H5Lcreate_hard */ + if(H5VL_OBJECT_BY_NAME == cur_params.type) { + H5G_loc_t *cur_loc_p, *link_loc_p; + + /* Set up current & new location pointers */ + cur_loc_p = &cur_loc; + link_loc_p = &link_loc; + if(NULL == cur_obj) + cur_loc_p = link_loc_p; + else if(NULL == obj) + link_loc_p = cur_loc_p; + else if(cur_loc_p->oloc->file != link_loc_p->oloc->file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") + + /* Create the link */ + if((ret_value = H5L_create_hard(cur_loc_p, cur_params.loc_data.loc_by_name.name, + link_loc_p, loc_params.loc_data.loc_by_name.name, lcpl_id)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + } + else { /* H5Olink */ + /* Link to the object */ + if(H5L_link(&link_loc, loc_params.loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") + } + break; + } + case H5VL_LINK_CREATE_SOFT: + { + char *target_name; + H5G_loc_t link_loc; /* Group location for new link */ + + if(H5G_loc_real(obj, loc_params.obj_type, &link_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + if(H5P_get(plist, H5VL_PROP_LINK_TARGET_NAME, &target_name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for targe name") + + /* Create the link */ + if((ret_value = H5L_create_soft(target_name, &link_loc, loc_params.loc_data.loc_by_name.name, lcpl_id)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + break; + } + case H5VL_LINK_CREATE_UD: + { + H5G_loc_t link_loc; /* Group location for new link */ + H5L_type_t link_type; + void *udata; + size_t udata_size; + + if(H5G_loc_real(obj, loc_params.obj_type, &link_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + if(H5P_get(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for link type") + if(H5P_get(plist, H5VL_PROP_LINK_UDATA, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata") + if(H5P_get(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata size") + + /* Create link */ + if(H5L__create_ud(&link_loc, loc_params.loc_data.loc_by_name.name, udata, udata_size, + link_type, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + break; + } + default: + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call") + } +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_link_copy + * + * Purpose: Renames an object within an HDF5 file and copies it to a new + * group. The original name SRC is unlinked from the group graph + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, + hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t src_loc, *src_loc_p; + H5G_loc_t dst_loc, *dst_loc_p; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2.obj_type, &dst_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Set up src & dst location pointers */ + src_loc_p = &src_loc; + dst_loc_p = &dst_loc; + if(NULL == src_obj) + src_loc_p = dst_loc_p; + else if(NULL == dst_obj) + dst_loc_p = src_loc_p; + + /* Copy the link */ + if(H5L_move(src_loc_p, loc_params1.loc_data.loc_by_name.name, + dst_loc_p, loc_params2.loc_data.loc_by_name.name, + TRUE, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_link_move + * + * Purpose: Renames an object within an HDF5 file and moves it to a new + * group. The original name SRC is unlinked from the group graph + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, + hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t src_loc, *src_loc_p; + H5G_loc_t dst_loc, *dst_loc_p; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2.obj_type, &dst_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Set up src & dst location pointers */ + src_loc_p = &src_loc; + dst_loc_p = &dst_loc; + if(NULL == src_obj) + src_loc_p = dst_loc_p; + else if(NULL == dst_obj) + dst_loc_p = src_loc_p; + + /* Move the link */ + if(H5L_move(src_loc_p, loc_params1.loc_data.loc_by_name.name, + dst_loc_p, loc_params2.loc_data.loc_by_name.name, + FALSE, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_link_get + * + * Purpose: Gets certain data about a link + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5G_loc_t loc; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + switch(get_type) { + /* H5Lget_info/H5Lget_info_by_idx */ + case H5VL_LINK_GET_INFO: + { + H5L_info_t *linfo = va_arg(arguments, H5L_info_t *); + + /* Get the link information */ + if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */ + if(H5L_get_info(&loc, loc_params.loc_data.loc_by_name.name, linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + } + else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */ + + if(H5L_get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + } + else + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + break; + } + /* H5Lget_name_by_idx */ + case H5VL_LINK_GET_NAME: + { + char *name = va_arg(arguments, char *); + size_t size = va_arg(arguments, size_t); + ssize_t *ret = va_arg(arguments, ssize_t *); + + /* Get the link name */ + if((*ret = H5L_get_name_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, name, size)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + + break; + } + /* H5Lget_val/H5Lget_val_by_idx */ + case H5VL_LINK_GET_VAL: + { + void *buf = va_arg(arguments, void *); + size_t size = va_arg(arguments, size_t); + + /* Get the link information */ + if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */ + if(H5L_get_val(&loc, loc_params.loc_data.loc_by_name.name, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value") + } + else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */ + + if(H5L_get_val_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val") + } + else + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val") + + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_link_specific + * + * Purpose: Specific operations with links + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(specific_type) { + case H5VL_LINK_EXISTS: + { + htri_t *ret = va_arg(arguments, htri_t *); + H5G_loc_t loc; + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Check for the existence of the link */ + if((*ret = H5L_exists(&loc, loc_params.loc_data.loc_by_name.name)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info") + break; + } + case H5VL_LINK_ITER: + { + H5G_loc_t loc; + hbool_t recursive = va_arg(arguments, int); + H5_index_t idx_type = va_arg(arguments, H5_index_t); + H5_iter_order_t order = va_arg(arguments, H5_iter_order_t); + hsize_t *idx_p = va_arg(arguments, hsize_t *); + H5L_iterate_t op = va_arg(arguments, H5L_iterate_t); + void *op_data = va_arg(arguments, void *); + + /* Get the location */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + + /* Visit or iterate over the links */ + if(loc_params.type == H5VL_OBJECT_BY_SELF) { + if(recursive) { + /* H5Lvisit */ + if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + } + else { + /* H5Literate */ + if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") + } + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + if(recursive) { + /* H5Lvisit_by_name */ + if((ret_value = H5G_visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + } + else { + /* H5Literate_by_name */ + if((ret_value = H5L_iterate(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, idx_p, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") + } + } + else{ + HGOTO_ERROR(H5E_LINK, H5E_UNSUPPORTED, FAIL, "unknown link iterate params") + } + + break; + } + case H5VL_LINK_DELETE: + { + H5G_loc_t loc; + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Unlink */ + if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ + if(H5L_delete(&loc, loc_params.loc_data.loc_by_name.name) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + } + else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ + + if(H5L_delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + } + else + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_object_open + * + * Purpose: Opens a object inside a native h5 file. + * + * Return: Success: object id. + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t loc; + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + switch(loc_params.type) { + case H5VL_OBJECT_BY_NAME: + { + /* Open the object */ + if(NULL == (ret_value = H5O_open_name(&loc, loc_params.loc_data.loc_by_name.name, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name") + break; + } + case H5VL_OBJECT_BY_IDX: + { + /* Open the object */ + if(NULL == (ret_value = H5O_open_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index") + break; + } + case H5VL_OBJECT_BY_ADDR: + { + /* Open the object */ + if(NULL == (ret_value = H5O_open_by_addr(&loc, loc_params.loc_data.loc_by_addr.addr, opened_type))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address") + break; + } + case H5VL_OBJECT_BY_REF: + { + hid_t temp_id = H5I_INVALID_HID; + H5F_t *file = NULL; + + /* Get the file pointer from the entry */ + file = loc.oloc->file; + + /* Create reference */ + if((temp_id = H5R__dereference(file, loc_params.loc_data.loc_by_ref.lapl_id, + loc_params.loc_data.loc_by_ref.ref_type, + loc_params.loc_data.loc_by_ref._ref)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, NULL, "unable to dereference object") + + *opened_type = H5I_get_type(temp_id); + if(NULL == (ret_value = H5I_remove(temp_id))) + HDONE_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object") + break; + } + case H5VL_OBJECT_BY_SELF: + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown open parameters") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_object_copy + * + * Purpose: Copys a object inside a native h5 file. + * + * Return: Success: object id. + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t src_loc; /* Source object group location */ + H5G_loc_t dst_loc; /* Destination group location */ + herr_t ret_value = FAIL; + + FUNC_ENTER_NOAPI_NOINIT + + /* get location for objects */ + if(H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + if(H5G_loc_real(dst_obj, loc_params2.obj_type, &dst_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Open the object */ + if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object") +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_object_get + * + * Purpose: Gets certain data about an object + * + * Return: SUCCEED/FAIL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Location of group */ + + FUNC_ENTER_NOAPI_NOINIT + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + switch(get_type) { + /* H5Rget_region */ + case H5VL_REF_GET_REGION: + { + hid_t *ret = va_arg(arguments, hid_t *); + H5R_type_t H5_ATTR_UNUSED ref_type = va_arg(arguments, H5R_type_t); + void *ref = va_arg(arguments, void *); + H5S_t *space = NULL; /* Dataspace object */ + + /* Get the dataspace with the correct region selected */ + if((space = H5R__get_region(loc.oloc->file, ref)) == NULL) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve region") + + /* Atomize */ + if((*ret = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") + + break; + } + /* H5Rget_obj_type2 */ + case H5VL_REF_GET_TYPE: + { + H5O_type_t *obj_type = va_arg(arguments, H5O_type_t *); + H5R_type_t ref_type = va_arg(arguments, H5R_type_t); + void *ref = va_arg(arguments, void *); + + /* Get the object information */ + if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") + break; + } + /* H5Rget_name */ + case H5VL_REF_GET_NAME: + { + ssize_t *ret = va_arg(arguments, ssize_t *); + char *name = va_arg(arguments, char *); + size_t size = va_arg(arguments, size_t); + H5R_type_t ref_type = va_arg(arguments, H5R_type_t); + void *ref = va_arg(arguments, void *); + + /* Get name */ + if((*ret = H5R__get_name(loc.oloc->file, ref_type, ref, name, size)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path") + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") + } +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_object_specific + * + * Purpose: Perform a driver specific operation for an objectibute + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5G_loc_t loc; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + switch(specific_type) { + /* H5Oincr_refcount / H5Odecr_refcount */ + case H5VL_OBJECT_CHANGE_REF_COUNT: + { + int update_ref = va_arg(arguments, int); + H5O_loc_t *oloc = loc.oloc; + + if(H5O_link(oloc, update_ref) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") + + break; + } + /* H5Oexists_by_name */ + case H5VL_OBJECT_EXISTS: + { + htri_t *ret = va_arg(arguments, htri_t *); + + if(loc_params.type == H5VL_OBJECT_BY_NAME) { + /* Check if the object exists */ + if((*ret = H5G_loc_exists(&loc, loc_params.loc_data.loc_by_name.name)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", + loc_params.loc_data.loc_by_name.name) + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters") + } + break; + } + case H5VL_OBJECT_VISIT: + { + H5_index_t idx_type = va_arg(arguments, H5_index_t); + H5_iter_order_t order = va_arg(arguments, H5_iter_order_t); + H5O_iterate_t op = va_arg(arguments, H5O_iterate_t); + void *op_data = va_arg(arguments, void *); + unsigned fields = va_arg(arguments, unsigned); + + /* Call internal object visitation routine */ + if(loc_params.type == H5VL_OBJECT_BY_SELF) { + /* H5Ovisit */ + if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + /* H5Ovisit_by_name */ + if((ret_value = H5O__visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, op, op_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + } + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params"); + break; + } + case H5VL_OBJECT_FLUSH: + { + hid_t oid = va_arg(arguments, hid_t); + + /* Flush the object's metadata */ + if(H5O_flush(loc.oloc, oid) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") + + break; + } + case H5VL_OBJECT_REFRESH: + { + hid_t oid = va_arg(arguments, hid_t); + H5O_loc_t *oloc = loc.oloc; + + /* Refresh the metadata */ + if(H5O_refresh_metadata(oid, *oloc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") + + break; + } + case H5VL_REF_CREATE: + { + void *ref = va_arg(arguments, void *); + const char *name = va_arg(arguments, char *); + H5R_type_t ref_type = va_arg(arguments, H5R_type_t); + hid_t space_id = va_arg(arguments, hid_t); + H5S_t *space = NULL; /* Pointer to dataspace containing region */ + + if(space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Create reference */ + if(H5R__create(ref, &loc, name, ref_type, space) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference") + + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_object_optional + * + * Purpose: Perform a driver specific operation for an objectibute + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5VL_object_optional_t optional_type = va_arg(arguments, H5VL_object_optional_t); + H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + H5G_loc_t loc; /* Location of group */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + switch(optional_type) { + /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */ + case H5VL_OBJECT_GET_INFO: + { + H5O_info_t *obj_info = va_arg(arguments, H5O_info_t *); + unsigned fields = va_arg(arguments, unsigned); + + if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */ + /* Retrieve the object's information */ + if(H5G_loc_info(&loc, ".", obj_info, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ + /* Retrieve the object's information */ + if(H5G_loc_info(&loc, loc_params.loc_data.loc_by_name.name, obj_info, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } + else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ + H5G_loc_t obj_loc; /* Location used to open group */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ + + /* Set up opened group location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object's location, according to the order in the index */ + if(H5G_loc_find_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, + loc_params.loc_data.loc_by_idx.idx_type, + loc_params.loc_data.loc_by_idx.order, + loc_params.loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") + + /* Retrieve the object's information */ + if(H5O_get_info(obj_loc.oloc, obj_info, fields) < 0) { + H5G_loc_free(&obj_loc); + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") + } + + /* Release the object location */ + if(H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + } + break; + } + /* H5Oget_comment / H5Oget_comment_by_name */ + case H5VL_OBJECT_GET_COMMENT: + { + char *comment = va_arg(arguments, char *); + size_t bufsize = va_arg(arguments, size_t); + ssize_t *ret = va_arg(arguments, ssize_t *); + + /* Retrieve the object's comment */ + if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */ + if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */ + if((*ret = H5G_loc_get_comment(&loc, loc_params.loc_data.loc_by_name.name, comment/*out*/, bufsize)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") + } + break; + } + /* H5Oset_comment */ + case H5VL_OBJECT_SET_COMMENT: + { + const char *comment = va_arg(arguments, char *); + + if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */ + /* (Re)set the object's comment */ + if(H5G_loc_set_comment(&loc, ".", comment) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */ + /* (Re)set the object's comment */ + if(H5G_loc_set_comment(&loc, loc_params.loc_data.loc_by_name.name, comment) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") + } + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object"); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_datatype_commit + * + * Purpose: Commits a datatype inside a native h5 file. + * + * Return: Success: datatype id. + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, + hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5G_loc_t loc; /* Location to commit datatype */ + H5T_t *dt; /* Datatype for ID */ + H5T_t *type = NULL; /* copy of the original type which will be committed */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* check arguments */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + + /* Check arguments. We cannot commit an immutable type because H5Tclose() + * normally fails on such types (try H5Tclose(H5T_NATIVE_INT)) but closing + * a named type should always succeed. + */ + if(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is already committed") + if(H5T_STATE_IMMUTABLE == dt->shared->state) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is immutable") + + /* Check for a "sensible" datatype to store on disk */ + if(H5T_is_sensible(dt) <= 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible") + + /* Copy the datatype - the copied one will be the type that is + * committed, and attached to original datatype above the VOL + * layer + */ + if(NULL == (type = H5T_copy(dt, H5T_COPY_TRANSIENT))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy"); + + /* Commit the datatype */ + if(NULL != name) { + /* H5Tcommit */ + if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") + } + else { + /* H5Tcommit_anon */ + if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") + } + ret_value = (void *)type; + +done: + if(NULL == ret_value && type) + H5T_close(type); + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_datatype_open + * + * Purpose: Opens a named datatype inside a native h5 file. + * + * Return: Success: datatype pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + H5T_t *type = NULL; /* Datatype opened in file */ + H5G_loc_t loc; /* Group location of object to open */ + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + + /* Open the datatype */ + if(NULL == (type = H5T__open_name(&loc, name))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") + + type->vol_obj = NULL; + + ret_value = (void *)type; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_datatype_get + * + * Purpose: Gets certain information about a datatype + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * June, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5T_t *dt = (H5T_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch (get_type) { + case H5VL_DATATYPE_GET_BINARY: + { + ssize_t *nalloc = va_arg(arguments, ssize_t *); + void *buf = va_arg(arguments, void *); + size_t size = va_arg(arguments, size_t); + + if(H5T_encode(dt, (unsigned char *)buf, &size) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype") + + *nalloc = (ssize_t) size; + break; + } + /* H5Tget_create_plist */ + case H5VL_DATATYPE_GET_TCPL: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + + if(H5I_INVALID_HID == (*ret_id = H5T__get_create_plist(dt))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info"); + + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_datatype_specific + * + * Purpose: Specific operations for datatype + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5T_t *dt = (H5T_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch(specific_type) { + case H5VL_DATATYPE_FLUSH: + { + hid_t type_id = va_arg(arguments, hid_t); + + /* To flush metadata and invoke flush callback if there is */ + if (H5O_flush_common(&dt->oloc, type_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") + + break; + } + case H5VL_DATATYPE_REFRESH: + { + hid_t type_id = va_arg(arguments, hid_t); + + /* Call private function to refresh datatype object */ + if ((H5O_refresh_metadata(type_id, dt->oloc)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") + + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_datatype_close + * + * Purpose: Closes an datatype. + * + * Return: Success: 0 + * Failure: -1, datatype not closed. + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(H5T_close((H5T_t*)dt) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close datatype") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_datatype_close() */ + diff --git a/src/H5VLnative.h b/src/H5VLnative.h new file mode 100644 index 0000000..4e33e8a --- /dev/null +++ b/src/H5VLnative.h @@ -0,0 +1,44 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 public header file for the native VOL driver. + */ + +#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 */ +#define H5VL_NATIVE_VERSION 0 + + +#ifdef __cplusplus +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, void *obj, hbool_t app_ref); +H5_DLL herr_t H5VL_native_unregister(hid_t obj_id); + +#ifdef __cplusplus +} +#endif + +#endif /* _H5VLnative_H */ diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h new file mode 100644 index 0000000..bbdb0cc --- /dev/null +++ b/src/H5VLpkg.h @@ -0,0 +1,48 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: This file contains declarations which are visible only within + * the H5VL package. Source files outside the H5VL package should + * include H5VLprivate.h instead. + */ + +#if !(defined H5VL_FRIEND || defined H5VL_MODULE) +#error "Do not include this file outside the H5VL package!" +#endif + +#ifndef _H5VLpkg_H +#define _H5VLpkg_H + +/* Get package's private header */ +#include "H5VLprivate.h" /* Generic Functions */ + +/* Other private headers needed by this file */ + +/**************************/ +/* Package Private Macros */ +/**************************/ + +/****************************/ +/* Package Private Typedefs */ +/****************************/ + +/*****************************/ +/* Package Private Variables */ +/*****************************/ + +/******************************/ +/* Package Private Prototypes */ +/******************************/ + +#endif /* _H5VLpkg_H */ + diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h new file mode 100644 index 0000000..98be308 --- /dev/null +++ b/src/H5VLprivate.h @@ -0,0 +1,132 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef _H5VLprivate_H +#define _H5VLprivate_H + +/* Include package's public header */ +#include "H5VLpublic.h" /* Generic Functions */ + +/* Private headers needed by this file */ + +/**************************/ +/* Library Private Macros */ +/**************************/ + +/****************************/ +/* Library Private Typedefs */ +/****************************/ + +/* Internal struct to track VOL driver information for objects */ +typedef struct H5VL_t { + const H5VL_class_t *cls; /* Pointer to driver class struct */ + int64_t nrefs; /* Number of references by objects using this struct */ + hid_t id; /* Identifier for the VOL driver */ +} H5VL_t; + +/* Internal vol object structure returned to the API */ +typedef struct H5VL_object_t { + void *data; /* Pointer to driver-managed data for this object */ + H5VL_t *driver; /* Pointer to VOL driver struct */ +} H5VL_object_t; + +/* Internal structure to hold the driver ID & info for FAPLs */ +typedef struct H5VL_driver_prop_t { + hid_t driver_id; /* VOL driver's ID */ + const void *driver_info; /* VOL driver info, for open callbacks */ +} H5VL_driver_prop_t; + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/******************************/ +/* Library Private Prototypes */ +/******************************/ + +/* Common 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); +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); +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); + +/* 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); +H5_DLL void *H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req); + +/* Dataset functions */ +H5_DLL void *H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req); + +/* File functions */ +H5_DLL void *H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req); + +/* Group functions */ +H5_DLL void *H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req); + +/* Link functions */ +H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); + +/* Object functions */ +H5_DLL void *H5VL_object_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); + +/* Datatype functions */ +H5_DLL void *H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_datatype_get(void *dt, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req); + +/* Asynchronous functions */ +H5_DLL herr_t H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status); +H5_DLL herr_t H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status); +H5_DLL herr_t H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status); +#endif /* _H5VLprivate_H */ + diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h new file mode 100644 index 0000000..d118bcc --- /dev/null +++ b/src/H5VLpublic.h @@ -0,0 +1,498 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This file contains public declarations for the H5VL (VOL) module. + */ + +#ifndef _H5VLpublic_H +#define _H5VLpublic_H + +/* Public headers needed by this file */ +#include "H5public.h" /* Generic Functions */ +#include "H5Apublic.h" /* Attributes */ +#include "H5ESpublic.h" /* Event Stack */ +#include "H5Fpublic.h" /* Files */ +#include "H5Lpublic.h" /* Links */ +#include "H5Opublic.h" /* Objects */ +#include "H5Rpublic.h" /* References */ + + +/*****************/ +/* Public Macros */ +/*****************/ + +/* Dataset creation property names */ +#define H5VL_PROP_DSET_TYPE_ID "dataset_type_id" +#define H5VL_PROP_DSET_SPACE_ID "dataset_space_id" +#define H5VL_PROP_DSET_LCPL_ID "dataset_lcpl_id" + +/* Attribute creation property names */ +#define H5VL_PROP_ATTR_TYPE_ID "attr_type_id" +#define H5VL_PROP_ATTR_SPACE_ID "attr_space_id" +#define H5VL_PROP_ATTR_LOC_PARAMS "attr_location" + +/* Link creation property names */ +#define H5VL_PROP_LINK_TARGET "target_location_object" +#define H5VL_PROP_LINK_TARGET_LOC_PARAMS "target_params" +#define H5VL_PROP_LINK_TARGET_NAME "target_name" +#define H5VL_PROP_LINK_TYPE "link type" +#define H5VL_PROP_LINK_UDATA "udata" +#define H5VL_PROP_LINK_UDATA_SIZE "udata size" + +/* Group creation property names */ +#define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id" + +/* Default VOL driver value */ +#define H5VL_VOL_DEFAULT 0 + + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* types for attribute GET callback */ +typedef enum H5VL_attr_get_t { + H5VL_ATTR_GET_ACPL, /* creation property list */ + H5VL_ATTR_GET_INFO, /* info */ + H5VL_ATTR_GET_NAME, /* access property list */ + H5VL_ATTR_GET_SPACE, /* dataspace */ + H5VL_ATTR_GET_STORAGE_SIZE, /* storage size */ + H5VL_ATTR_GET_TYPE /* datatype */ +} H5VL_attr_get_t; + +/* types for attribute SPECFIC callback */ +typedef enum H5VL_attr_specific_t { + H5VL_ATTR_DELETE, /* H5Adelete(_by_name/idx) */ + H5VL_ATTR_EXISTS, /* H5Aexists(_by_name) */ + H5VL_ATTR_ITER, /* H5Aiterate(_by_name) */ + H5VL_ATTR_RENAME /* H5Arename(_by_name) */ +} H5VL_attr_specific_t; + +/* types for dataset GET callback */ +typedef enum H5VL_dataset_get_t { + H5VL_DATASET_GET_DAPL, /* access property list */ + H5VL_DATASET_GET_DCPL, /* creation property list */ + H5VL_DATASET_GET_OFFSET, /* offset */ + H5VL_DATASET_GET_SPACE, /* dataspace */ + H5VL_DATASET_GET_SPACE_STATUS, /* space status */ + H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */ + H5VL_DATASET_GET_TYPE /* datatype */ +} H5VL_dataset_get_t; + +/* types for dataset SPECFIC callback */ +typedef enum H5VL_dataset_specific_t { + H5VL_DATASET_SET_EXTENT, /* H5Dset_extent */ + H5VL_DATASET_FLUSH, /* H5Dflush */ + H5VL_DATASET_REFRESH /* H5Drefresh */ +} H5VL_dataset_specific_t; + +/* types for datatype GET callback */ +typedef enum H5VL_datatype_get_t { + H5VL_DATATYPE_GET_BINARY, /* get serialized form of transient type */ + H5VL_DATATYPE_GET_TCPL /* datatype creation property list */ +} H5VL_datatype_get_t; + +/* types for datatype SPECFIC callback */ +typedef enum H5VL_datatype_specific_t { + H5VL_DATATYPE_FLUSH, + H5VL_DATATYPE_REFRESH +} H5VL_datatype_specific_t; + +/* types for file GET callback */ +typedef enum H5VL_file_get_t { + H5VL_FILE_GET_FAPL, /* file access property list */ + H5VL_FILE_GET_FCPL, /* file creation property list */ + H5VL_FILE_GET_INTENT, /* file intent */ + H5VL_FILE_GET_NAME, /* file name */ + H5VL_FILE_GET_OBJ_COUNT, /* object count in file */ + H5VL_FILE_GET_OBJ_IDS, /* object ids in file */ + H5VL_OBJECT_GET_FILE /* retrieve or resurrect file of object */ +} H5VL_file_get_t; + +/* types for file SPECIFIC callback */ +typedef enum H5VL_file_specific_t { + H5VL_FILE_FLUSH, /* Flush file */ + H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */ + H5VL_FILE_MOUNT, /* Mount a file */ + H5VL_FILE_UNMOUNT /* Un-Mount a file */ +} H5VL_file_specific_t; + +/* types for group GET callback */ +typedef enum H5VL_group_get_t { + H5VL_GROUP_GET_GCPL, /* group creation property list */ + H5VL_GROUP_GET_INFO /* group info */ +} H5VL_group_get_t; + +/* types for group SPECFIC callback */ +typedef enum H5VL_group_specific_t { + H5VL_GROUP_FLUSH, + H5VL_GROUP_REFRESH +} H5VL_group_specific_t; + +/* link create types for VOL */ +typedef enum H5VL_link_create_type_t { + H5VL_LINK_CREATE_HARD, + H5VL_LINK_CREATE_SOFT, + H5VL_LINK_CREATE_UD +} H5VL_link_create_type_t; + +/* types for link GET callback */ +typedef enum H5VL_link_get_t { + H5VL_LINK_GET_INFO, /* link info */ + H5VL_LINK_GET_NAME, /* link name */ + H5VL_LINK_GET_VAL /* link value */ +} H5VL_link_get_t; + +/* types for link SPECIFIC callback */ +typedef enum H5VL_link_specific_t { + H5VL_LINK_DELETE, /* H5Ldelete(_by_idx) */ + H5VL_LINK_EXISTS, /* link existence */ + H5VL_LINK_ITER /* H5Literate/visit(_by_name) */ +} H5VL_link_specific_t; + +/* types for object GET callback */ +typedef enum H5VL_object_get_t { + H5VL_REF_GET_NAME, /* object name */ + H5VL_REF_GET_REGION, /* dataspace of region */ + H5VL_REF_GET_TYPE /* type of object */ +} H5VL_object_get_t; + +/* types for object SPECIFIC callback */ +typedef enum H5VL_object_specific_t { + H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */ + H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */ + H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */ + H5VL_REF_CREATE, /* H5Rcreate */ + H5VL_OBJECT_FLUSH, + H5VL_OBJECT_REFRESH +} H5VL_object_specific_t; + +/* types for different ways that objects are located in an HDF5 container */ +typedef enum H5VL_loc_type_t { + H5VL_OBJECT_BY_SELF, + H5VL_OBJECT_BY_NAME, + H5VL_OBJECT_BY_IDX, + H5VL_OBJECT_BY_ADDR, + H5VL_OBJECT_BY_REF +} H5VL_loc_type_t; + +struct H5VL_loc_by_name { + const char *name; + hid_t lapl_id; +}; + +struct H5VL_loc_by_idx { + const char *name; + H5_index_t idx_type; + H5_iter_order_t order; + hsize_t n; + hid_t lapl_id; +}; + +struct H5VL_loc_by_addr { + haddr_t addr; +}; + +struct H5VL_loc_by_ref { + H5R_type_t ref_type; + const void *_ref; + hid_t lapl_id; +}; + +/* Structure to hold parameters for object locations. + * either: BY_ADDR, BY_ID, BY_NAME, BY_IDX, BY_REF + * + * Note: Leave loc_by_addr as the first union member so we + * can perform the simplest initialization of the struct + * without raising warnings. + */ +typedef struct H5VL_loc_params_t { + H5I_type_t obj_type; + H5VL_loc_type_t type; + union{ + struct H5VL_loc_by_addr loc_by_addr; + struct H5VL_loc_by_name loc_by_name; + struct H5VL_loc_by_idx loc_by_idx; + struct H5VL_loc_by_ref loc_by_ref; + } loc_data; +} H5VL_loc_params_t; + +/* H5A routines */ +typedef struct H5VL_attr_class_t { + void *(*create)(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); + void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + hid_t aapl_id, hid_t dxpl_id, void **req); + herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); + herr_t (*write)(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *attr, hid_t dxpl_id, void **req); +} H5VL_attr_class_t; + +/* H5D routines */ +typedef struct H5VL_dataset_class_t { + void *(*create)(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); + void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req); + herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t xfer_plist_id, void * buf, void **req); + herr_t (*write)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t xfer_plist_id, const void * buf, void **req); + herr_t (*get)(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *dset, hid_t dxpl_id, void **req); +} H5VL_dataset_class_t; + +/* H5T routines*/ +typedef struct H5VL_datatype_class_t { + void *(*commit)(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, + hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); + void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char * name, + hid_t tapl_id, hid_t dxpl_id, void **req); + herr_t (*get) (void *obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *dt, hid_t dxpl_id, void **req); +} H5VL_datatype_class_t; + +/* H5F routines */ +typedef struct H5VL_file_class_t { + void *(*create)(const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id, void **req); + void *(*open)(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *file, hid_t dxpl_id, void **req); +} H5VL_file_class_t; + +/* H5G routines */ +typedef struct H5VL_group_class_t { + void *(*create)(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); + void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t gapl_id, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *grp, hid_t dxpl_id, void **req); +} H5VL_group_class_t; + +/* H5L routines */ +typedef struct H5VL_link_class_t { + herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); + herr_t (*copy)(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, + hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req); + herr_t (*move)(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, + hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); +} H5VL_link_class_t; + +/* H5O routines */ +typedef struct H5VL_object_class_t { + void *(*open)(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, + hid_t dxpl_id, void **req); + herr_t (*copy)(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); +} H5VL_object_class_t; + +/* H5AO routines */ +typedef struct H5VL_async_class_t { + herr_t (*cancel)(void **, H5ES_status_t *); + herr_t (*test) (void **, H5ES_status_t *); + herr_t (*wait) (void **, H5ES_status_t *); +} H5VL_async_class_t; + +/* VOL category (internal, external, etc.) + * XXX: This is intended to replace the H5VL_class_value_t struct, which seems + * difficult to manage. It's currently unused so I don't break struct + * compatibility with existing VOLs. + */ +typedef enum H5VL_category_t { + H5VL_INTERNAL, /* Internal VOL driver */ + H5VL_EXTERNAL /* External VOL driver (plugin) */ +} H5VL_category_t; + +/* enum value to identify the class of a VOL driver (mostly for comparison purposes) */ +typedef enum H5VL_class_value_t { + H5_VOL_NATIVE = 0, /* This should be first */ + H5_VOL_MAX_LIB_VALUE = 128 /* This should be last */ +} H5VL_class_value_t; + +/* Class information for each VOL driver */ +/* XXX: We should consider adding a UUID/GUID field to this struct + * as well as a H5VLregister_by_uuid() API call for people who + * really care about getting a particular VOL driver. + * XXX: We should also consider adding enough information so that + * files can be opened without specifying the VOL driver. + * e.g.: If we stored a UUID and version, we could search for + * a matching VOL driver so a user did not have to make any + * H5VL calls. + */ +typedef struct H5VL_class_t { + /* XXX: How do we identify unique VOL drivers? + * This is unclear, but for now we'll keep + * all the ID fields from the original VOL + * branch. + */ + unsigned int version; /* VOL driver version # + * XXX: Is this supposed to be a VOL driver + * version number or a VOL API version + * number? Maybe we need both? + */ + H5VL_class_value_t value; /* value to identify driver */ + const char *name; /* Plugin name (MUST be unique!) */ + herr_t (*initialize)(hid_t vipl_id); /* Plugin initialization callback */ + herr_t (*terminate)(hid_t vtpl_id); /* Plugin termination callback */ + size_t fapl_size; /* size of the vol info in the fapl property */ + void * (*fapl_copy)(const void *info); /* callback to create a copy of the vol info */ + herr_t (*fapl_free)(void *info); /* callback to release the vol info copy */ + + /* Data Model */ + H5VL_attr_class_t attr_cls; /* attribute class callbacks */ + H5VL_dataset_class_t dataset_cls; /* dataset class callbacks */ + H5VL_datatype_class_t datatype_cls; /* datatype class callbacks */ + H5VL_file_class_t file_cls; /* file class callbacks */ + H5VL_group_class_t group_cls; /* group class callbacks */ + H5VL_link_class_t link_cls; /* link class callbacks */ + H5VL_object_class_t object_cls; /* object class callbacks */ + + /* Services */ + H5VL_async_class_t async_cls; /* asynchronous class callbacks */ + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ +} H5VL_class_t; + + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* VOL Driver/Plugin Functionality */ +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 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 void *H5VLobject(hid_t id); +H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj); + +/* Attributes */ +H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_read(void *attr, hid_t driver_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_write(void *attr, hid_t driver_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_get(void *obj, hid_t driver_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_close(void *attr, hid_t driver_id, hid_t dxpl_id, void **req); + +/* Datasets */ +H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdataset_read(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VLdataset_write(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VLdataset_get(void *dset, hid_t driver_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t driver_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_close(void *dset, hid_t driver_id, hid_t dxpl_id, void **req); + +/* Files */ +H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLfile_get(void *file, hid_t driver_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_specific(void *obj, hid_t driver_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_close(void *file, hid_t driver_id, hid_t dxpl_id, void **req); + +/* Groups */ +H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLgroup_get(void *obj, hid_t driver_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t driver_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_close(void *grp, hid_t driver_id, hid_t dxpl_id, void **req); + +/* Links */ +H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); + +/* Objects */ +H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t driver_id1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); + +/* Datatypes */ +H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t driver_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t driver_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t driver_id, hid_t dxpl_id, void **req); + +/* Asynchronous Requests */ +H5_DLL herr_t H5VLrequest_cancel(void **req, hid_t driver_id, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_test(void **req, hid_t driver_id, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_wait(void **req, hid_t driver_id, H5ES_status_t *status); + +#ifdef __cplusplus +} +#endif + +#endif /* _H5VLpublic_H */ diff --git a/src/H5err.txt b/src/H5err.txt index 19374cd..3965242 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -46,7 +46,7 @@ MAJOR, H5E_ARGS, Invalid arguments to routine MAJOR, H5E_RESOURCE, Resource unavailable MAJOR, H5E_INTERNAL, Internal error (too specific to document in detail) -MAJOR, H5E_FILE, File accessibilty +MAJOR, H5E_FILE, File accessibility MAJOR, H5E_IO, Low-level I/O MAJOR, H5E_FUNC, Function entry/exit MAJOR, H5E_ATOM, Object atom @@ -66,6 +66,7 @@ MAJOR, H5E_PLINE, Data filters MAJOR, H5E_EFL, External file list MAJOR, H5E_REFERENCE, References MAJOR, H5E_VFL, Virtual File Layer +MAJOR, H5E_VOL, Virtual Object Layer MAJOR, H5E_TST, Ternary Search Trees MAJOR, H5E_RS, Reference Counted Strings MAJOR, H5E_ERROR, Error API @@ -82,7 +83,7 @@ MAJOR, H5E_NONE_MAJOR, No error # Sections (for grouping minor errors) SECTION, ARGS, Argument errors SECTION, RESOURCE, Resource errors -SECTION, FILEACC, File accessibilty errors +SECTION, FILEACC, File accessibility errors SECTION, FILE, Generic low-level file I/O errors SECTION, FUNC, Function entry/exit interface errors SECTION, ATOM, Object atom related errors @@ -123,7 +124,7 @@ MINOR, RESOURCE, H5E_CANTGC, Unable to garbage collect MINOR, RESOURCE, H5E_CANTGETSIZE, Unable to compute size MINOR, RESOURCE, H5E_OBJOPEN, Object is already open -# File accessibilty errors +# File accessibility errors MINOR, FILEACC, H5E_FILEEXISTS, File already exists MINOR, FILEACC, H5E_FILEOPEN, File already open MINOR, FILEACC, H5E_CANTCREATE, Unable to create file diff --git a/src/H5private.h b/src/H5private.h index 2dff0f0..63f6858 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -169,6 +169,9 @@ */ #define H5_DEFAULT_VFD H5FD_SEC2 +/* Define the default VOL driver */ +#define H5_DEFAULT_VOL H5VL_NATIVE + #ifdef H5_HAVE_WIN32_API /* The following two defines must be before any windows headers are included */ #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ @@ -510,6 +513,11 @@ # define H5_INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1)) #endif +/* Represents an empty asynchronous request handle. + * Used in the VOL code. + */ +#define H5_REQUEST_NULL NULL + /* * A macro to portably decrement enumerated types. */ @@ -1704,6 +1712,7 @@ typedef enum { H5_PKG_S, /* Dataspaces */ H5_PKG_T, /* Datatypes */ H5_PKG_V, /* Vector functions */ + H5_PKG_VL, /* VOL functions */ H5_PKG_Z, /* Raw data filters */ H5_NPKGS /* Must be last */ } H5_pkg_t; @@ -2620,6 +2629,7 @@ H5_DLL int H5S_top_term_package(void); H5_DLL int H5SL_term_package(void); H5_DLL int H5T_term_package(void); H5_DLL int H5T_top_term_package(void); +H5_DLL int H5VL_term_package(void); H5_DLL int H5Z_term_package(void); /* Checksum functions */ diff --git a/src/H5trace.c b/src/H5trace.c index eef268c..08db09a 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -36,6 +36,7 @@ #include "H5FDprivate.h" /* File drivers */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ +#include "H5VLprivate.h" /* Virtual Object Layer */ #ifdef H5_HAVE_PARALLEL /* datatypes of predefined drivers needed by H5_trace() */ @@ -813,6 +814,37 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end else */ break; + case 's': + if(ptr) { + if(vp) + HDfprintf(out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5ES_status_t status = (H5ES_status_t)va_arg(ap, int); + + switch(status) { + case H5ES_STATUS_IN_PROGRESS: + HDfprintf(out, "H5ES_STATUS_IN_PROGRESS"); + break; + case H5ES_STATUS_SUCCEED: + HDfprintf(out, "H5ES_STATUS_SUCCEED"); + break; + case H5ES_STATUS_FAIL: + HDfprintf(out, "H5ES_STATUS_FAIL"); + break; + case H5ES_STATUS_CANCEL: + HDfprintf(out, "H5ES_STATUS_CANCEL"); + break; + + default: + HDfprintf(out, "%ld", (long)status); + break; + } /* end switch */ + } /* end else */ + break; + case 't': if(ptr) { if(vp) @@ -1331,6 +1363,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "%ld (file driver)", (long)obj); break; + case H5I_VOL: + HDfprintf(out, "%ld (VOL plugin)", (long)obj); + break; + case H5I_GENPROP_CLS: HDfprintf(out, "%ld (genprop class)", (long)obj); break; @@ -1512,6 +1548,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "H5I_VFL"); break; + case H5I_VOL: + HDfprintf(out, "H5I_VOL"); + break; + case H5I_GENPROP_CLS: HDfprintf(out, "H5I_GENPROP_CLS"); break; @@ -2466,6 +2506,440 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ break; + case 'V': + switch(type[1]) { + case 'a': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_attr_get_t get = (H5VL_attr_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_ATTR_GET_SPACE: + HDfprintf(out, "H5VL_ATTR_GET_SPACE"); + break; + case H5VL_ATTR_GET_TYPE: + HDfprintf(out, "H5VL_ATTR_GET_TYPE"); + break; + case H5VL_ATTR_GET_ACPL: + HDfprintf(out, "H5VL_ATTR_GET_ACPL"); + break; + case H5VL_ATTR_GET_NAME: + HDfprintf(out, "H5VL_ATTR_GET_NAME"); + break; + case H5VL_ATTR_GET_STORAGE_SIZE: + HDfprintf(out, "H5VL_ATTR_GET_STORAGE_SIZE"); + break; + case H5VL_ATTR_GET_INFO: + HDfprintf(out, "H5VL_ATTR_GET_INFO"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'b': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_attr_specific_t specific = (H5VL_attr_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_ATTR_DELETE: + HDfprintf(out, "H5VL_ATTR_DELETE"); + break; + case H5VL_ATTR_EXISTS: + HDfprintf(out, "H5VL_ATTR_EXISTS"); + break; + case H5VL_ATTR_ITER: + HDfprintf(out, "H5VL_ATTR_ITER"); + break; + case H5VL_ATTR_RENAME: + HDfprintf(out, "H5VL_ATTR_RENAME"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'c': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_dataset_get_t get = (H5VL_dataset_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_DATASET_GET_SPACE: + HDfprintf(out, "H5VL_DATASET_GET_SPACE"); + break; + case H5VL_DATASET_GET_SPACE_STATUS: + HDfprintf(out, "H5VL_DATASET_GET_SPACE_STATUS"); + break; + case H5VL_DATASET_GET_TYPE: + HDfprintf(out, "H5VL_DATASET_GET_TYPE"); + break; + case H5VL_DATASET_GET_DCPL: + HDfprintf(out, "H5VL_DATASET_GET_DCPL"); + break; + case H5VL_DATASET_GET_DAPL: + HDfprintf(out, "H5VL_DATASET_GET_DAPL"); + break; + case H5VL_DATASET_GET_STORAGE_SIZE: + HDfprintf(out, "H5VL_DATASET_GET_STORAGE_SIZE"); + break; + case H5VL_DATASET_GET_OFFSET: + HDfprintf(out, "H5VL_DATASET_GET_OFFSET"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'd': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_dataset_specific_t specific = (H5VL_dataset_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_DATASET_SET_EXTENT: + HDfprintf(out, "H5VL_DATASET_SET_EXTENT"); + break; + case H5VL_DATASET_FLUSH: + HDfprintf(out, "H5VL_DATASET_FLUSH"); + break; + case H5VL_DATASET_REFRESH: + HDfprintf(out, "H5VL_DATASET_REFRESH"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'e': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_datatype_get_t get = (H5VL_datatype_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_DATATYPE_GET_BINARY: + HDfprintf(out, "H5VL_DATATYPE_GET_BINARY"); + break; + case H5VL_DATATYPE_GET_TCPL: + HDfprintf(out, "H5VL_DATATYPE_GET_TCPL"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'f': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_datatype_specific_t specific = (H5VL_datatype_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_DATATYPE_FLUSH: + HDfprintf(out, "H5VL_DATATYPE_FLUSH"); + break; + case H5VL_DATATYPE_REFRESH: + HDfprintf(out, "H5VL_DATATYPE_REFRESH"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'g': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_file_get_t get = (H5VL_file_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_FILE_GET_FAPL: + HDfprintf(out, "H5VL_FILE_GET_FAPL"); + break; + case H5VL_FILE_GET_FCPL: + HDfprintf(out, "H5VL_FILE_GET_FCPL"); + break; + case H5VL_FILE_GET_INTENT: + HDfprintf(out, "H5VL_FILE_GET_INTENT"); + break; + case H5VL_FILE_GET_NAME: + HDfprintf(out, "H5VL_FILE_GET_NAME"); + break; + case H5VL_FILE_GET_OBJ_COUNT: + HDfprintf(out, "H5VL_FILE_GET_OBJ_COUNT"); + break; + case H5VL_FILE_GET_OBJ_IDS: + HDfprintf(out, "H5VL_FILE_GET_OBJ_IDS"); + break; + case H5VL_OBJECT_GET_FILE: + HDfprintf(out, "H5VL_OBJECT_GET_FILE"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'h': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_file_specific_t specific = (H5VL_file_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_FILE_FLUSH: + HDfprintf(out, "H5VL_FILE_FLUSH"); + break; + case H5VL_FILE_MOUNT: + HDfprintf(out, "H5VL_FILE_MOUNT"); + break; + case H5VL_FILE_UNMOUNT: + HDfprintf(out, "H5VL_FILE_UNMOUNT"); + break; + case H5VL_FILE_IS_ACCESSIBLE: + HDfprintf(out, "H5VL_FILE_IS_ACCESSIBLE"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'i': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_group_get_t get = (H5VL_group_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_GROUP_GET_GCPL: + HDfprintf(out, "H5VL_GROUP_GET_GCPL"); + break; + case H5VL_GROUP_GET_INFO: + HDfprintf(out, "H5VL_GROUP_GET_INFO"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'j': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_group_specific_t specific = (H5VL_group_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_GROUP_FLUSH: + HDfprintf(out, "H5VL_GROUP_FLUSH"); + break; + case H5VL_GROUP_REFRESH: + HDfprintf(out, "H5VL_GROUP_REFRESH"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'k': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_link_create_type_t create = (H5VL_link_create_type_t)va_arg(ap, int); + + switch(create) { + case H5VL_LINK_CREATE_HARD: + HDfprintf(out, "H5VL_LINK_CREATE_HARD"); + break; + case H5VL_LINK_CREATE_SOFT: + HDfprintf(out, "H5VL_LINK_CREATE_SOFT"); + break; + case H5VL_LINK_CREATE_UD: + HDfprintf(out, "H5VL_LINK_CREATE_UD"); + break; + default: + HDfprintf(out, "%ld", (long)create); + break; + } /* end switch */ + } /* end else */ + break; + case 'l': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_link_get_t get = (H5VL_link_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_LINK_GET_INFO: + HDfprintf(out, "H5VL_LINK_GET_INFO"); + break; + case H5VL_LINK_GET_NAME: + HDfprintf(out, "H5VL_LINK_GET_NAME"); + break; + case H5VL_LINK_GET_VAL: + HDfprintf(out, "H5VL_LINK_GET_VAL"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'm': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_link_specific_t specific = (H5VL_link_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_LINK_DELETE: + HDfprintf(out, "H5VL_LINK_DELETE"); + break; + case H5VL_LINK_EXISTS: + HDfprintf(out, "H5VL_LINK_EXISTS"); + break; + case H5VL_LINK_ITER: + HDfprintf(out, "H5VL_LINK_ITER"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'n': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_object_get_t get = (H5VL_object_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_REF_GET_REGION: + HDfprintf(out, "H5VL_REF_GET_REGION"); + break; + case H5VL_REF_GET_TYPE: + HDfprintf(out, "H5VL_REF_GET_TYPE"); + break; + case H5VL_REF_GET_NAME: + HDfprintf(out, "H5VL_REF_GET_NAME"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'o': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_object_specific_t specific = (H5VL_object_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_OBJECT_CHANGE_REF_COUNT: + HDfprintf(out, "H5VL_OBJECT_CHANGE_REF_COUNT"); + break; + case H5VL_OBJECT_EXISTS: + HDfprintf(out, "H5VL_OBJECT_EXISTS"); + break; + case H5VL_OBJECT_VISIT: + HDfprintf(out, "H5VL_OBJECT_VISIT"); + break; + case H5VL_REF_CREATE: + HDfprintf(out, "H5VL_REF_CREATE"); + break; + case H5VL_OBJECT_FLUSH: + HDfprintf(out, "H5VL_OBJECT_FLUSH"); + break; + case H5VL_OBJECT_REFRESH: + HDfprintf(out, "H5VL_OBJECT_REFRESH"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + default: + HDfprintf(out, "BADTYPE(Z%c)", type[1]); + goto error; + } /* end switch */ + break; + case 'x': if(ptr) { if(vp) { diff --git a/src/Makefile.am b/src/Makefile.am index 472dfc6..7889e10 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -114,6 +114,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Topaque.c \ H5Torder.c \ H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ + H5VL.c H5VLint.c H5VLnative.c \ H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ H5Zscaleoffset.c H5Zszip.c H5Ztrans.c @@ -132,7 +133,7 @@ endif include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \ H5Apublic.h H5ACpublic.h \ H5Cpublic.h H5Dpublic.h \ - H5Epubgen.h H5Epublic.h H5Fpublic.h \ + H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \ H5FDpublic.h H5FDcore.h H5FDdirect.h \ H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \ H5FDmulti.h H5FDsec2.h H5FDstdio.h \ @@ -140,7 +141,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ H5Rpublic.h H5Spublic.h H5Tpublic.h \ - H5Zpublic.h + H5VLnative.h H5VLpublic.h H5Zpublic.h # install libhdf5.settings in lib directory settingsdir=$(libdir) diff --git a/src/hdf5.h b/src/hdf5.h index 1709375..fbeae83 100644 --- a/src/hdf5.h +++ b/src/hdf5.h @@ -36,6 +36,7 @@ #include "H5Rpublic.h" /* References */ #include "H5Spublic.h" /* Dataspaces */ #include "H5Tpublic.h" /* Datatypes */ +#include "H5VLpublic.h" /* Virtual Object Layer */ #include "H5Zpublic.h" /* Data filters */ /* Predefined file drivers */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c8119fe..959bac8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -128,6 +128,38 @@ endif () ) endforeach () + #----------------------------------------------------------------------------- + # Define VOL Plugin Test Sources + #----------------------------------------------------------------------------- + set (VOL_PLUGIN_LIBS + echo_vol + ) + + foreach (vol_lib ${VOL_PLUGIN_LIBS}) + set (HDF5_VOL_PLUGIN_LIB_CORENAME "${vol_lib}") + set (HDF5_VOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_VOL_PLUGIN_LIB_CORENAME}") + set (HDF5_VOL_PLUGIN_LIB_TARGET ${HDF5_VOL_PLUGIN_LIB_CORENAME}) + + add_library (${HDF5_VOL_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${vol_lib}.c) + target_include_directories(${HDF5_VOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_VOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_VOL_PLUGIN_LIB_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_VOL_PLUGIN_LIB_TARGET} ${HDF5_VOL_PLUGIN_LIB_NAME} SHARED "LIB") + set_target_properties (${HDF5_VOL_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) + + #----------------------------------------------------------------------------- + # Copy VOL plugin to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_VOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/vol/$" + ) + endforeach () + ################################################################################# # Test program sources ################################################################################# @@ -234,6 +266,7 @@ set (H5_TESTS cache_logging cork swmr + vol ) macro (ADD_H5_EXE file) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 8838c34..bc759ce 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -527,6 +527,7 @@ set (test_CLEANFILES vds_swmr_src_*.h5 tmp/vds_src_2.h5 direct_chunk.h5 + native_vol_test.h5 ) # Remove any output file left over from previous test run @@ -1058,13 +1059,13 @@ if (TEST_SHELL_SCRIPTS) endif() if (ENABLE_EXTENDED_TESTS) - ############################################################################## - ### S W M R T E S T S - ############################################################################## - # testflushrefresh.sh: flushrefresh - # test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes - # testswmr.sh: swmr* - # testvdsswmr.sh: vds_swmr* +############################################################################## +### S W M R T E S T S +############################################################################## +# testflushrefresh.sh: flushrefresh +# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes +# testswmr.sh: swmr* +# testvdsswmr.sh: vds_swmr* # add_test (NAME H5Test-swmr_check_compat_vfd COMMAND $) diff --git a/test/Makefile.am b/test/Makefile.am index d4db6d0..61dcda8 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -60,7 +60,7 @@ TEST_PROG= testhdf5 \ flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \ reserved cross_read freespace mf vds file_image unregister \ - cache_logging cork swmr + cache_logging cork swmr vol # List programs to be built when testing here. # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. @@ -106,7 +106,9 @@ if HAVE_SHARED_CONDITIONAL # The libh5test library provides common support code for the tests. # The filter_plugin* libraries are for use in filter_plugin.c. # Build them as shared libraries if that option was enabled in configure. - noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la + # + # echo_vol is used for testing VOL plugin functionality. + noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la echo_vol.la libfilter_plugin1_dsets_la_SOURCES=filter_plugin1_dsets.c libfilter_plugin2_dsets_la_SOURCES=filter_plugin2_dsets.c libfilter_plugin3_dsets_la_SOURCES=filter_plugin3_dsets.c @@ -117,6 +119,11 @@ if HAVE_SHARED_CONDITIONAL libfilter_plugin4_groups_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere libfilter_plugin3_dsets_la_LIBADD=$(LIBHDF5) libfilter_plugin4_groups_la_LIBADD=$(LIBHDF5) + + # VOL plugin test libraries + echo_vol_la_SOURCES=echo_vol.c + echo_vol_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere + else # The libh5test library provides common support code for the tests. noinst_LTLIBRARIES=libh5test.la @@ -193,7 +200,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse flushrefresh_VERIFICATION_DONE atomic_data accum_swmr_big.h5 ohdr_swmr.h5 \ test_swmr*.h5 cache_logging.h5 cache_logging.out vds_swmr.h5 vds_swmr_src_*.h5 \ swmr[0-2].h5 swmr_writer.out swmr_writer.log.* swmr_reader.out.* swmr_reader.log.* \ - tbogus.h5.copy cache_image_test.h5 direct_chunk.h5 + tbogus.h5.copy cache_image_test.h5 direct_chunk.h5 native_vol_test.h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/accum.c b/test/accum.c index 91786a9..40829f9 100644 --- a/test/accum.c +++ b/test/accum.c @@ -23,6 +23,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename */ #define FILENAME "accum.h5" @@ -104,7 +105,7 @@ main(void) api_ctx_pushed = TRUE; /* Get H5F_t * to internal file structure */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* We'll be writing lots of garbage data, so extend the file a ways. 10MB should do. */ @@ -1882,7 +1883,7 @@ test_swmr_write_big(hbool_t newest_format) api_ctx_pushed = TRUE; /* Get H5F_t * to internal file structure */ - if(NULL == (rf = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR + if(NULL == (rf = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* We'll be writing lots of garbage data, so extend the file a ways. 10MB should do. */ diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index cf2616e..16e0ddc 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -20,6 +20,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename: this is the same as the define in accum.c used by test_swmr_write_big() */ #define SWMR_FILENAME "accum_swmr_big.h5" @@ -77,7 +78,7 @@ main(void) api_ctx_pushed = TRUE; /* Get H5F_t * to internal file structure */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Should read in [1024, 2024] with buf data */ diff --git a/test/btree2.c b/test/btree2.c index d26fed5..8d77438 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -26,7 +26,7 @@ /* Other private headers that this test requires */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ const char *FILENAME[] = { "btree2", @@ -117,7 +117,7 @@ create_file(hid_t *file, H5F_t **f, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -191,7 +191,7 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3017,7 +3017,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3055,7 +3055,7 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -8568,7 +8568,7 @@ gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam, STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -8722,7 +8722,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -8817,7 +8817,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -8905,7 +8905,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -8990,7 +8990,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9338,7 +9338,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9382,7 +9382,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9439,7 +9439,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9496,7 +9496,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9826,7 +9826,7 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -9880,7 +9880,7 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5VL_object(file2))) FAIL_STACK_ERROR /* Open the B-tree through the second file handle */ diff --git a/test/cache_api.c b/test/cache_api.c index 7c0ffa3..4f29009 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -230,7 +230,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -378,7 +378,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { diff --git a/test/cache_common.c b/test/cache_common.c index b078964..94d3f59 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3287,7 +3287,7 @@ setup_cache(size_t max_cache_size, HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); } else { - file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE); if(file_ptr == NULL) { pass = FALSE; failure_mssg = "Can't get file_ptr."; @@ -3483,7 +3483,7 @@ takedown_cache(H5F_t * file_ptr, if ( H5F_addr_defined(saved_actual_base_addr) ) { if ( NULL == file_ptr ) { - file_ptr = (H5F_t *)H5I_object_verify(saved_fid, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(saved_fid, H5I_FILE); HDassert ( file_ptr ); } @@ -6033,7 +6033,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -6170,7 +6170,7 @@ check_and_validate_cache_size(hid_t file_id, /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -6352,7 +6352,7 @@ validate_mdc_config(hid_t file_id, /* get a pointer to the files internal data structure */ if ( pass ) { - file_ptr = (H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { diff --git a/test/cache_common.h b/test/cache_common.h index 9c66357..2604567 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -28,6 +28,7 @@ #include "H5Cpkg.h" #include "H5Fpkg.h" #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Include test header files */ #include "h5test.h" diff --git a/test/cache_image.c b/test/cache_image.c index 5967ecc..4d6b065 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -720,7 +720,7 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -6732,7 +6732,7 @@ cache_image_api_error_check_4(void) } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -6882,7 +6882,7 @@ cache_image_api_error_check_4(void) } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -6960,7 +6960,7 @@ cache_image_api_error_check_4(void) } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 0160607..8d90eb6 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -119,7 +119,7 @@ static int dump_cache(hid_t fid) H5F_t *f; /* File Pointer */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; /* Dump the cache */ @@ -159,7 +159,7 @@ verify_no_unknown_tags(hid_t fid) int i; /* Iterator */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; cache_ptr = f->shared->cache; @@ -207,7 +207,7 @@ mark_all_entries_investigated(hid_t fid) int i; /* Iterator */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; cache_ptr = f->shared->cache; @@ -253,7 +253,7 @@ reset_all_entries_investigated(hid_t fid) int i; /* Iterator */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; cache_ptr = f->shared->cache; @@ -301,7 +301,7 @@ verify_tag(hid_t fid, int id, haddr_t tag) int i; /* Iterator */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; cache_ptr = f->shared->cache; @@ -341,7 +341,7 @@ evict_entries(hid_t fid) H5F_t *f; /* File Pointer */ /* Get Internal File / Cache Pointers */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR; /* Mark all entries investigated */ @@ -3653,7 +3653,7 @@ check_invalid_tag_application(void) api_ctx_pushed = TRUE; /* Get internal file pointer*/ - if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR; + if ( NULL == (f = (H5F_t *)H5VL_object(fid)) ) TEST_ERROR; /* Call H5HL_create, an internal function that calls H5AC_insert_entry without setting up a tag */ /* Ensure this returns FAILURE, as a tag has not been set up. */ diff --git a/test/dsets.c b/test/dsets.c index faf2ad7..050bd8f 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -877,10 +877,10 @@ test_compact_io(hid_t fapl) } /* end */ /* Get the internal file pointer */ - if((fp = (H5F_t *)H5I_object(verfile)) == NULL) TEST_ERROR + if((fp = (H5F_t *)H5VL_object(verfile)) == NULL) TEST_ERROR /* Get the internal dataset pointer */ - if((dsetp = (H5D_t *)H5I_object(dataset)) == NULL) TEST_ERROR + if((dsetp = (H5D_t *)H5VL_object(dataset)) == NULL) TEST_ERROR /* Verify the dataset's layout and fill message versions */ if(fp->shared->low_bound == H5F_LIBVER_EARLIEST) { diff --git a/test/earray.c b/test/earray.c index 02e4d85..bb258c7 100644 --- a/test/earray.c +++ b/test/earray.c @@ -27,6 +27,7 @@ /* Other private headers that this test requires */ #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VMprivate.h" /* Vectors and arrays */ @@ -300,7 +301,7 @@ create_file(unsigned flags, hid_t fapl, hid_t *file, H5F_t **f) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -433,7 +434,7 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -943,7 +944,7 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5VL_object(file2))) FAIL_STACK_ERROR /* Open the extensible array through the second file handle */ @@ -1089,7 +1090,7 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5VL_object(file2))) FAIL_STACK_ERROR /* Open the extensible array through the second file handle */ diff --git a/test/echo_vol.c b/test/echo_vol.c new file mode 100644 index 0000000..02c0fb3 --- /dev/null +++ b/test/echo_vol.c @@ -0,0 +1,116 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: A simple virtual object layer (VOL) plugin that just echoes + * the name of the API call. + */ + +#include "H5PLextern.h" + +/* The VOL class struct. + */ +static const H5VL_class_t echo_vol_g = { + 0, /* version */ + (H5VL_class_value_t)501, /* value */ + "echo", /* name */ + NULL, /* initialize */ + NULL, /* terminate */ + (size_t)0, /* fapl size */ + NULL, /* fapl copy */ + NULL, /* fapl free */ + { /* attribute_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* dataset_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* datatype_cls */ + NULL, /* commit */ + NULL, /* open */ + NULL, /* get_size */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* file_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* group_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* link_cls */ + NULL, /* create */ + NULL, /* copy */ + NULL, /* move */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* object_cls */ + NULL, /* open */ + NULL, /* copy */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* async_cls */ + NULL, /* cancel */ + NULL, /* test */ + NULL /* wait */ + }, + NULL /* optional */ +}; + + + +/* These two functions are necessary to load this plugin using + * the HDF5 library. + */ + +H5PL_type_t +H5PLget_plugin_type(void) +{ + return H5PL_TYPE_VOL; +} + + +const void* +H5PLget_plugin_info(void) +{ + return &echo_vol_g; +} + diff --git a/test/enc_dec_plist_cross_platform.c b/test/enc_dec_plist_cross_platform.c index 1fbb41b..15c7391 100644 --- a/test/enc_dec_plist_cross_platform.c +++ b/test/enc_dec_plist_cross_platform.c @@ -28,7 +28,7 @@ int main(void) { if(VERBOSE_MED) - printf("Encode/Decode property list endianess\n"); + HDprintf("Encode/Decode property list endianess\n"); /******* ENCODE/DECODE DCPLS *****/ TESTING("Default DCPL Encoding/Decoding"); @@ -227,7 +227,7 @@ test_plists(const char *filename_prefix) return 1; error: - printf("***** Plist Encode/Decode tests FAILED! *****\n"); + HDprintf("***** Plist Encode/Decode tests FAILED! *****\n"); return -1; } diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 9d23f2f..9918829 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -32,6 +32,7 @@ #include "H5Fpkg.h" #include "H5Gpkg.h" #include "H5Ipkg.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Evict on close is not supported under parallel at this time. * In the meantime, we just run a simple check that EoC can't be @@ -598,7 +599,7 @@ check_group_layout(hid_t fid, const char *group_name) /* NOTE: The TESTING() macro is called in main() */ /* Get a pointer to the file struct */ - if(NULL == (file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) + if(NULL == (file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE))) TEST_ERROR; /* Record the number of cache entries */ @@ -614,7 +615,7 @@ check_group_layout(hid_t fid, const char *group_name) /* Open the main group and get its tag */ if((gid1 = H5Gopen2(fid, group_name, H5P_DEFAULT)) < 0) TEST_ERROR; - if(NULL == (grp_ptr = (H5G_t *)H5I_object_verify(gid1, H5I_GROUP))) + if(NULL == (grp_ptr = (H5G_t *)H5VL_object_verify(gid1, H5I_GROUP))) TEST_ERROR; tag1 = grp_ptr->oloc.addr; @@ -631,7 +632,7 @@ check_group_layout(hid_t fid, const char *group_name) if((gid2 = H5Gopen2(gid1, subgroup_name, H5P_DEFAULT)) < 0) TEST_ERROR; - if(NULL == (grp_ptr = (H5G_t *)H5I_object_verify(gid2, H5I_GROUP))) + if(NULL == (grp_ptr = (H5G_t *)H5VL_object_verify(gid2, H5I_GROUP))) TEST_ERROR; tag2 = grp_ptr->oloc.addr; @@ -712,7 +713,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) /* NOTE: The TESTING() macro is called in main() */ /* Get a pointer to the file struct */ - if(NULL == (file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) + if(NULL == (file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE))) TEST_ERROR; /* Create the data buffer */ @@ -732,7 +733,7 @@ check_dset_scheme(hid_t fid, const char *dset_name) /* Open dataset and get the metadata tag */ if((did = H5Dopen2(fid, dset_name, H5P_DEFAULT)) < 0) TEST_ERROR; - if(NULL == (dset_ptr = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + if(NULL == (dset_ptr = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) TEST_ERROR; tag = dset_ptr->oloc.addr; diff --git a/test/farray.c b/test/farray.c index 21d3186..c9584b8 100644 --- a/test/farray.c +++ b/test/farray.c @@ -28,6 +28,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" /* IDs */ #include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Local macros */ @@ -149,15 +150,15 @@ static herr_t create_file(hid_t fapl_id, hid_t *fid, H5F_t **f) { /* Create the file to work on */ - if((*fid = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) - FAIL_STACK_ERROR + if ((*fid = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*fid))) + if (NULL == (*f = (H5F_t *)H5VL_object(*fid))) FAIL_STACK_ERROR; /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) + if (H5AC_ignore_tags(*f) < 0) FAIL_STACK_ERROR; /* Success */ @@ -183,23 +184,23 @@ check_stats(const H5FA_t *fa, const farray_state_t *state) H5FA_stat_t farray_stats; /* Statistics about the array */ /* Get statistics for fixed array and verify they are correct */ - if(H5FA_get_stats(fa, &farray_stats) < 0) + if (H5FA_get_stats(fa, &farray_stats) < 0) FAIL_STACK_ERROR /* Compare information */ - if(farray_stats.hdr_size != state->hdr_size) { + if (farray_stats.hdr_size != state->hdr_size) { HDfprintf(stdout, "farray_stats.hdr_size = %Hu, state->hdr_size = %Hu\n", farray_stats.hdr_size, state->hdr_size); TEST_ERROR } - if(farray_stats.dblk_size != state->dblk_size) { + if (farray_stats.dblk_size != state->dblk_size) { HDfprintf(stdout, "farray_stats.dblk_size = %Hu, state->dblk_size = %Hu\n", farray_stats.dblk_size, state->dblk_size); TEST_ERROR } - if(farray_stats.nelmts != state->nelmts) { + if (farray_stats.nelmts != state->nelmts) { HDfprintf(stdout, "farray_stats.nelmts = %Hu, state->nelmts = %Hu\n", farray_stats.nelmts, state->nelmts); TEST_ERROR @@ -236,7 +237,7 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) state->nelmts = cparam->nelmts; dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits; - if(state->nelmts > dblk_page_nelmts) { + if (state->nelmts > dblk_page_nelmts) { size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); size_t dblk_page_init_size = (npages + 7) / 8; hsize_t checksum_size = npages * 4; @@ -266,38 +267,38 @@ reopen_file(hid_t *fid, H5F_t **f, hid_t fapl_id, { /* Check for closing & re-opening the array */ /* (actually will close & re-open the file as well) */ - if(tparam->reopen_array) { + if (tparam->reopen_array) { /* Close array, if given */ - if(fa && *fa) { - if(H5FA_close(*fa) < 0) + if (fa && *fa) { + if (H5FA_close(*fa) < 0) FAIL_STACK_ERROR *fa = NULL; } /* Close file */ - if(*fid) { - if(H5Fclose(*fid) < 0) + if (*fid) { + if (H5Fclose(*fid) < 0) FAIL_STACK_ERROR *fid = H5I_INVALID_HID; *f = NULL; } /* Re-open the file */ - if((*fid = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) + if ((*fid = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*fid))) - FAIL_STACK_ERROR + if (NULL == (*f = (H5F_t *)H5VL_object(*fid))) + FAIL_STACK_ERROR; /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) + if (H5AC_ignore_tags(*f) < 0) FAIL_STACK_ERROR /* Re-open array, if given */ - if(fa) - if(NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) + if (fa) + if (NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) FAIL_STACK_ERROR } @@ -325,20 +326,20 @@ create_array(H5F_t *f, const H5FA_create_t *cparam, farray_state_t state; /* State of extensible array */ /* Create array */ - if(NULL == (*fa = H5FA_create(f, cparam, NULL))) + if (NULL == (*fa = H5FA_create(f, cparam, NULL))) FAIL_STACK_ERROR /* Check status of array */ - if(H5FA_get_addr(*fa, fa_addr) < 0) + if (H5FA_get_addr(*fa, fa_addr) < 0) FAIL_STACK_ERROR - if(!H5F_addr_defined(*fa_addr)) + if (!H5F_addr_defined(*fa_addr)) TEST_ERROR /* Check array stats */ HDmemset(&state, 0, sizeof(state)); state.hdr_size = FA_HDR_SIZE; state.nelmts = cparam->nelmts; - if(check_stats(*fa, &state)) + if (check_stats(*fa, &state)) TEST_ERROR /* Success */ @@ -365,11 +366,11 @@ verify_cparam(const H5FA_t *fa, const H5FA_create_t *cparam) /* Retrieve creation parameters */ HDmemset(&test_cparam, 0, sizeof(H5FA_create_t)); - if(H5FA__get_cparam_test(fa, &test_cparam) < 0) + if (H5FA__get_cparam_test(fa, &test_cparam) < 0) FAIL_STACK_ERROR /* Verify creation parameters */ - if(H5FA__cmp_cparam_test(cparam, &test_cparam)) + if (H5FA__cmp_cparam_test(cparam, &test_cparam)) TEST_ERROR /* Success */ @@ -396,23 +397,23 @@ finish(hid_t fid, hid_t fapl_id, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) h5_stat_size_t file_size; /* File size, after deleting array */ /* Close the fixed array */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR /* Delete array */ - if(H5FA_delete(f, fa_addr, NULL) < 0) + if (H5FA_delete(f, fa_addr, NULL) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size = h5_get_file_size(filename_g, fapl_id)) < 0) + if ((file_size = h5_get_file_size(filename_g, fapl_id)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size != empty_size_g) + if (file_size != empty_size_g) TEST_ERROR /* Success */ @@ -625,61 +626,61 @@ static unsigned test_open_twice(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t fid2 = H5I_INVALID_HID; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ H5FA_t *fa = NULL; /* Fixed array wrapper */ H5FA_t *fa2 = NULL; /* Fixed array wrapper */ haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl_id, &fid, &f) < 0) + if (create_file(fapl_id, &fid, &f) < 0) TEST_ERROR /* Display testing message */ TESTING("open fixed array twice"); /* Create array */ - if(create_array(f, cparam, &fa, &fa_addr) < 0) + if (create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2) < 0) + if (H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) + if (reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Re-open the file */ - if((fid2 = H5Freopen(fid)) < 0) + if ((fid2 = H5Freopen(fid)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(fid2))) - FAIL_STACK_ERROR + if (NULL == (f2 = (H5F_t *)H5VL_object(fid2))) + FAIL_STACK_ERROR; /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR /* Close the first extensible array wrapper */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; @@ -687,11 +688,11 @@ test_open_twice(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tpara /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) + if (finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -701,9 +702,9 @@ test_open_twice(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tpara error: H5E_BEGIN_TRY { - if(fa) + if (fa) H5FA_close(fa); - if(fa2) + if (fa2) H5FA_close(fa2); H5Fclose(fid); H5Fclose(fid2); @@ -732,12 +733,12 @@ static unsigned test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ - hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t fid2 = H5I_INVALID_HID; /* File ID */ - hid_t fid0 = H5I_INVALID_HID; /* File ID */ - hid_t fid00 = H5I_INVALID_HID; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fid0 = H5I_INVALID_HID; /* File ID */ + hid_t fid00 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ H5FA_t *fa = NULL; /* Fixed array wrapper */ H5FA_t *fa2 = NULL; /* Fixed array wrapper */ haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ @@ -746,25 +747,25 @@ test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t * TESTING("open fixed array twice, through different file handles"); /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl_id, &fid, &f) < 0) + if (create_file(fapl_id, &fid, &f) < 0) TEST_ERROR /* Create array */ - if(create_array(f, cparam, &fa, &fa_addr) < 0) + if (create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2) < 0) + if (H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; @@ -772,15 +773,15 @@ test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t * /* (So that there is something holding the file open when the extensible * array is closed) */ - if((fid0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) + if ((fid0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) + if (reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Close the first fixed array wrapper */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; @@ -788,7 +789,7 @@ test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t * /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR fid = H5I_INVALID_HID; @@ -798,33 +799,33 @@ test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t * * header stale) */ h5_fixname(FILENAME[1], fapl_id, filename_tmp, sizeof(filename_tmp)); - if((fid00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + if ((fid00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR /* Re-open the file with the fixed array */ - if((fid2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) + if ((fid2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(fid2))) - FAIL_STACK_ERROR + if (NULL == (f2 = (H5F_t *)H5VL_object(fid2))) + FAIL_STACK_ERROR; /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the extra file handles */ - if(H5Fclose(fid0) < 0) + if (H5Fclose(fid0) < 0) FAIL_STACK_ERROR - if(H5Fclose(fid00) < 0) + if (H5Fclose(fid00) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) + if (finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -834,9 +835,9 @@ test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t * error: H5E_BEGIN_TRY { - if(fa) + if (fa) H5FA_close(fa); - if(fa2) + if (fa2) H5FA_close(fa2); H5Fclose(fid); H5Fclose(fid2); diff --git a/test/fheap.c b/test/fheap.c index 1af56a6..c7f6ff0 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -30,9 +30,9 @@ /* Other private headers that this test requires */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Max. testfile name length */ #define FHEAP_FILENAME_LEN 1024 @@ -605,7 +605,7 @@ reopen_file(hid_t *file, H5F_t **f, const char *filename, hid_t fapl, FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -656,7 +656,7 @@ open_heap(char *filename, hid_t fapl, const H5HF_create_t *cparam, /* Check for deleting the entire heap */ if(tparam->del_dir != FHEAP_DEL_HEAP) { /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -698,7 +698,7 @@ open_heap(char *filename, hid_t fapl, const H5HF_create_t *cparam, FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) + if(NULL == (*f = (H5F_t *)H5VL_object(*file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -1868,7 +1868,7 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -1986,7 +1986,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE) @@ -2032,7 +2032,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2140,7 +2140,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR if(f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE) @@ -2195,7 +2195,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) + if(NULL == (f2 = (H5F_t *)H5VL_object(file2))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2314,7 +2314,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2387,7 +2387,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2472,7 +2472,7 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2814,7 +2814,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2857,7 +2857,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2936,7 +2936,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -2990,7 +2990,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3078,7 +3078,7 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file1))) + if(NULL == (f = (H5F_t *)H5VL_object(file1))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3122,7 +3122,7 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) FAIL_STACK_ERROR /* Get a pointer to the internal file object (file1) */ - if(NULL == (f = (H5F_t *)H5I_object(file1))) + if(NULL == (f = (H5F_t *)H5VL_object(file1))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3144,7 +3144,7 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* Get a pointer to the internal file object (file2) */ - if(NULL == (f = (H5F_t *)H5I_object(file2))) + if(NULL == (f = (H5F_t *)H5VL_object(file2))) FAIL_STACK_ERROR /* Reopen the heap */ @@ -3216,7 +3216,7 @@ test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3325,7 +3325,7 @@ test_man_insert_first(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3425,7 +3425,7 @@ test_man_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3521,7 +3521,7 @@ test_man_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3619,7 +3619,7 @@ test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_par TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3724,7 +3724,7 @@ test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3830,7 +3830,7 @@ test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -3940,7 +3940,7 @@ test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4035,7 +4035,7 @@ test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4137,7 +4137,7 @@ test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4237,7 +4237,7 @@ test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4347,7 +4347,7 @@ test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4443,7 +4443,7 @@ test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4538,7 +4538,7 @@ test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_ TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4639,7 +4639,7 @@ test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhe TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4748,7 +4748,7 @@ test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_ TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4850,7 +4850,7 @@ test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -4960,7 +4960,7 @@ test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5067,7 +5067,7 @@ test_man_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_te TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Create absolute heap */ @@ -5164,7 +5164,7 @@ test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5272,7 +5272,7 @@ test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_te TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5374,7 +5374,7 @@ test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5483,7 +5483,7 @@ test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5593,7 +5593,7 @@ test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5699,7 +5699,7 @@ test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5806,7 +5806,7 @@ test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -5920,7 +5920,7 @@ test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6039,7 +6039,7 @@ test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6150,7 +6150,7 @@ test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6264,7 +6264,7 @@ test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6397,7 +6397,7 @@ test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6549,7 +6549,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6590,7 +6590,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6712,7 +6712,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6753,7 +6753,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6904,7 +6904,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -6945,7 +6945,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -7072,7 +7072,7 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -7113,7 +7113,7 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -7315,7 +7315,7 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -7356,7 +7356,7 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -7613,7 +7613,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -13774,7 +13774,7 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -14950,7 +14950,7 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15135,7 +15135,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15199,7 +15199,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15235,7 +15235,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15272,7 +15272,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15308,7 +15308,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -15946,7 +15946,7 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -16013,7 +16013,7 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -16177,7 +16177,7 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ @@ -16207,7 +16207,7 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Ignore metadata tags in the file's cache */ diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 42b5e43..92c9f87 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -698,7 +698,6 @@ herr_t test_refresh(void) /* ================= */ /* Refresh Datatypes */ /* ================= */ - TESTING("to ensure that H5Trefresh correctly refreshes single datatypes"); /* Verify First Committed Datatype can be refreshed with H5Trefresh */ @@ -718,7 +717,6 @@ herr_t test_refresh(void) if(H5Oflush(tid2) < 0) TEST_ERROR; if(end_refresh_verification_process() != 0) TEST_ERROR; - PASSED(); /* =============== */ @@ -998,7 +996,7 @@ herr_t refresh_verification(const char * obj_pathname) check to ensure we didn't erroneously flush the attribute before starting the verification. */ if(flushed_oinfo.num_attrs != 0) - PROCESS_ERROR; + PROCESS_ERROR; /* Send Signal to MAIN PROCESS indicating that it can go ahead and modify the object. */ diff --git a/test/freespace.c b/test/freespace.c index f397377..0011bd2 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -26,6 +26,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VMprivate.h" #define FILENAME_LEN 1024 @@ -480,7 +481,7 @@ test_fs_create(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* initialize creation parameters for free-space manager */ @@ -622,7 +623,7 @@ test_fs_sect_add(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -686,7 +687,7 @@ test_fs_sect_add(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -756,7 +757,7 @@ test_fs_sect_add(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */ @@ -825,7 +826,7 @@ test_fs_sect_add(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */ @@ -946,7 +947,7 @@ test_fs_sect_find(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -1334,7 +1335,7 @@ test_fs_sect_merge(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -1464,7 +1465,7 @@ test_fs_sect_merge(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -1566,7 +1567,7 @@ test_fs_sect_merge(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -1801,7 +1802,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -1903,7 +1904,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -2004,7 +2005,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -2142,7 +2143,7 @@ test_fs_sect_change_class(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -2251,7 +2252,7 @@ test_fs_sect_change_class(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); @@ -2433,7 +2434,7 @@ test_fs_sect_extend(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Tag with the global free space tag */ @@ -2787,7 +2788,7 @@ test_fs_sect_iterate(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR init_cparam(&cparam); diff --git a/test/gheap.c b/test/gheap.c index 4dc3fb0..5b51c0e 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -28,6 +28,7 @@ #include "H5HGprivate.h" #include "H5Iprivate.h" #include "H5Pprivate.h" +#include "H5VLprivate.h" /* Macros for printing error messages in loops. These print up to * GHEAP_REPEATED_ERR_LIM errors, and suppress the rest */ @@ -96,7 +97,7 @@ test_1 (hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); HDputs(" Unable to create file"); goto error; @@ -203,7 +204,7 @@ test_2 (hid_t fapl) h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); HDputs(" Unable to create file"); goto error; @@ -302,7 +303,7 @@ test_3 (hid_t fapl) h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); HDputs(" Unable to create file"); goto error; @@ -392,7 +393,7 @@ test_4 (hid_t fapl) h5_fixname(FILENAME[3], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); HDputs(" Unable to create file"); goto error; @@ -485,7 +486,7 @@ test_ooo_indices(hid_t fapl) h5_fixname(FILENAME[4], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); HDputs(" Unable to create file"); goto error; @@ -529,7 +530,7 @@ test_ooo_indices(hid_t fapl) goto error; if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); HDputs(" Unable to open file"); goto error; diff --git a/test/h5test.c b/test/h5test.c index fb5b83d..888fded 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1901,3 +1901,46 @@ error: return NULL; } /* h5_get_dummy_vfd_class */ + +/*------------------------------------------------------------------------- + * Function: h5_get_dummy_vol_class() + * + * Purpose: Returns a disposable, generally non-functional, + * VOL class struct. + * + * In some of the test code, we need a disposable VOL driver + * but we don't want to mess with the real VFDs and we also + * don't have access to the internals of the real VOL drivers + * (which use static globals and functions) to easily duplicate + * 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(). + * + * Return: Success: A pointer to a VOL class struct + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5VL_class_t * +h5_get_dummy_vol_class(void) +{ + H5VL_class_t *vol_class = NULL; /* Dummy VOL class that will be returned */ + + /* Create the class and initialize everything to zero/NULL */ + if(NULL == (vol_class = (H5VL_class_t *)HDcalloc((size_t)1, sizeof(H5VL_class_t)))) + TEST_ERROR; + + /* Fill in the minimum parameters to make a VOL driver class that + * can be registered. + */ + vol_class->name = "dummy"; + + return vol_class; + +error: + if(vol_class) + HDfree(vol_class); + return NULL; +} /* h5_get_dummy_vol_class */ + diff --git a/test/h5test.h b/test/h5test.h index 8e87192..2fb0e0c 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -142,6 +142,7 @@ H5TEST_DLL int print_func(const char *format, ...); H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name); H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void); +H5TEST_DLL H5VL_class_t *h5_get_dummy_vol_class(void); /* Functions that will replace VFD-dependent functions that violate * the single responsibility principle. Unlike their predecessors, diff --git a/test/lheap.c b/test/lheap.c index d309fb0..e9e626f 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -23,6 +23,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5HLprivate.h" #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ const char *FILENAME[] = { "lheap", @@ -78,7 +79,7 @@ main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if(FAIL == (file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -128,7 +129,7 @@ main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if(FAIL == (file = H5Fopen(filename, H5F_ACC_RDONLY, fapl))) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5VL_object(file))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; diff --git a/test/links.c b/test/links.c index 786aa8f..e0dc39e 100644 --- a/test/links.c +++ b/test/links.c @@ -7745,6 +7745,7 @@ done: case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -7833,6 +7834,7 @@ done: case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: diff --git a/test/mf.c b/test/mf.c index eefd2a1..4dccae6 100644 --- a/test/mf.c +++ b/test/mf.c @@ -36,6 +36,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5FLprivate.h" #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VMprivate.h" #define FILENAME_LEN 1024 @@ -255,7 +256,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -297,7 +298,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30); @@ -400,7 +401,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -432,7 +433,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -477,7 +478,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -526,7 +527,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -569,7 +570,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -681,7 +682,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -712,7 +713,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* should succeed */ @@ -759,7 +760,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -899,7 +900,7 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Retrieve the file's maxaddr */ @@ -953,7 +954,7 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 1/3 of the file as temporary address space */ @@ -1061,7 +1062,7 @@ test_mf_fs_start(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1173,7 +1174,7 @@ test_mf_fs_alloc_free(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1250,7 +1251,7 @@ test_mf_fs_alloc_free(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1325,7 +1326,7 @@ test_mf_fs_alloc_free(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1498,7 +1499,7 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1606,7 +1607,7 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1708,7 +1709,7 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1810,7 +1811,7 @@ test_mf_fs_extend(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -1982,7 +1983,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -2038,7 +2039,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -2164,7 +2165,7 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) TEST_ERROR /* Allocate first block from meta_aggr */ @@ -2202,7 +2203,7 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) TEST_ERROR /* Free the two blocks: order matters because of H5F_FSPACE_STRATEGY_AGGR strategy */ @@ -2305,7 +2306,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; @@ -2351,7 +2352,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30+TBLOCK_SIZE50+TBLOCK_SIZE2058); @@ -2461,7 +2462,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate first block from meta_aggr */ @@ -2624,7 +2625,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate first block from meta_aggr */ @@ -2772,7 +2773,7 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate first block from meta_aggr */ @@ -2906,7 +2907,7 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; @@ -3073,7 +3074,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate the first block from meta_aggr */ @@ -3236,7 +3237,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate the first block from meta_aggr */ @@ -3327,7 +3328,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate the first block from meta_aggr */ @@ -3397,7 +3398,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate first block from meta_aggr */ @@ -3527,7 +3528,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate block A from meta_aggr */ @@ -3574,7 +3575,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate block A from meta_aggr */ @@ -3633,7 +3634,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate block A from meta_aggr */ @@ -3782,7 +3783,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* calculate fragment for alignment of block 30 */ @@ -3864,7 +3865,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* allocate a block of 50 from meta_aggr */ @@ -3886,7 +3887,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* shrink the block */ @@ -3919,7 +3920,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* allocate a block of 50 */ @@ -3941,7 +3942,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* try to extend the block */ @@ -4041,7 +4042,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -4104,7 +4105,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -4187,7 +4188,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ @@ -4407,7 +4408,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* calculate fragment for alignment of block 30 */ @@ -4663,7 +4664,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* calculate fragment for alignment of block 30 */ @@ -5002,7 +5003,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* calculate fragment for alignment of block 30 */ @@ -5303,7 +5304,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* get alignment setting */ @@ -5514,7 +5515,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* get alignment setting */ @@ -5778,7 +5779,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* get alignment setting */ @@ -6028,7 +6029,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) TEST_ERROR /* Allocate a block of size align from meta_aggr. This should create an @@ -6114,7 +6115,7 @@ test_mf_fs_persist_split(void) TESTING("File's free-space managers are persistent for split-file"); - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the split file driver. */ SKIPPED(); @@ -6124,7 +6125,7 @@ test_mf_fs_persist_split(void) /* File creation property list template */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the split file driver. */ SKIPPED(); @@ -6156,7 +6157,7 @@ test_mf_fs_persist_split(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 4 blocks of type H5FD_MEM_SUPER */ @@ -6201,7 +6202,7 @@ test_mf_fs_persist_split(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the H5FD_MEM_SUPER free-space manager is there */ @@ -6286,7 +6287,7 @@ test_mf_fs_persist_split(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the free-space manager for H5FD_MEM_DRAW is not there */ @@ -6330,7 +6331,7 @@ test_mf_fs_persist_split(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the H5FD_MEM_SUPER free-space manager is there */ @@ -6436,14 +6437,14 @@ test_mf_fs_persist_multi(void) TESTING("File's free-space managers are persistent for multi-file"); - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the multi file driver. */ SKIPPED(); HDfprintf(stdout, " Persistent FSMs disabled in multi file driver.\n"); return 0; /* <========== note return */ - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the multi file driver. */ SKIPPED(); @@ -6473,7 +6474,7 @@ test_mf_fs_persist_multi(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 4 blocks of type H5FD_MEM_SUPER */ @@ -6518,7 +6519,7 @@ test_mf_fs_persist_multi(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the H5FD_MEM_SUPER free-space manager is there */ @@ -6600,7 +6601,7 @@ test_mf_fs_persist_multi(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the free-space manager for H5FD_MEM_SUPER is there */ @@ -6666,7 +6667,7 @@ test_mf_fs_persist_multi(void) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* If H5FD_MEM_SUPER is there, should not find block #1 & #3 */ @@ -6778,7 +6779,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 6 blocks */ @@ -6812,7 +6813,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); @@ -6867,7 +6868,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that H5FD_MEM_SUPER free-space manager is there */ @@ -6959,7 +6960,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 4 blocks */ @@ -6993,7 +6994,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type); @@ -7014,7 +7015,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that H5FD_MEM_SUPER free-space manager is there */ @@ -7071,7 +7072,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Verify that the H5FD_MEM_SUPER free-space manager is not there */ if(H5F_addr_defined(f->shared->fs_addr[fs_type])) @@ -7169,7 +7170,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 6 blocks */ @@ -7205,13 +7206,13 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR if(f->shared->fs_persist) { @@ -7341,7 +7342,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate 6 blocks */ @@ -7424,7 +7425,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Free-space manager should be empty */ @@ -7498,7 +7499,7 @@ test_dichotomy(hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR /* Allocate the first block of type H5FD_MEM_SUPER */ @@ -7658,7 +7659,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Allocate 3 small metadata blocks: addr1, addr2, addr3 */ @@ -7727,7 +7728,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Verify that the large generic manager is there */ @@ -7869,7 +7870,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Allocate a small metadata block with addr1 */ @@ -7990,7 +7991,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Allocate a small metadata block with addr1 */ @@ -8144,7 +8145,7 @@ test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Allocate a large data block with gaddr1 */ @@ -8286,7 +8287,7 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Allocate a large data block with gaddr1 */ @@ -8442,7 +8443,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Allocate 2 small metadata blocks: addr1, addr2 */ @@ -8686,7 +8687,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Allocate 2 small raw data blocks */ @@ -8738,7 +8739,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Allocate 2 small metadata blocks */ @@ -8799,7 +8800,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Allocate 2 small raw data blocks */ diff --git a/test/objcopy.c b/test/objcopy.c index 9aa2265..f13537e 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -23,6 +23,7 @@ #include "H5Iprivate.h" #include "H5Pprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ #define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING @@ -2179,7 +2180,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) if (ret < 0) TEST_ERROR /* Get the internal dset ptr to get the fill version for verifying later */ - if ((dsetp = (H5D_t *)H5I_object(did_src)) == NULL) TEST_ERROR + if ((dsetp = (H5D_t *)H5VL_object(did_src)) == NULL) TEST_ERROR srcdset_fillversion = dsetp->shared->dcpl_cache.fill.version; /* Close dataspace */ diff --git a/test/ohdr.c b/test/ohdr.c index ffede25..2b57ada 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -18,6 +18,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" /* Identifiers */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* * This file needs to access private datatypes from the H5O package. @@ -78,7 +79,7 @@ test_cont(char *filename, hid_t fapl) /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR if (H5AC_ignore_tags(f) < 0) { H5_FAILED(); @@ -200,7 +201,7 @@ test_ohdr_cache(char *filename, hid_t fapl) FAIL_STACK_ERROR if(H5Pclose(my_fapl) < 0) FAIL_STACK_ERROR - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR if(H5AC_ignore_tags(f) < 0) FAIL_STACK_ERROR @@ -303,17 +304,17 @@ error: static herr_t test_ohdr_swmr(hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t fapl = -1; /* File access property list */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t plist = -1; /* Dataset creation property list */ - size_t compact_size = 1024; /* The size of compact dataset */ - int *wbuf = NULL; /* Buffer for writing */ - hsize_t dims[1]; /* Dimension sizes */ - size_t u; /* Iterator */ - int n; /* Data variable */ - H5O_info_t obj_info; /* Information for the object */ + hid_t fid = -1; /* File ID */ + hid_t fapl = -1; /* File access property list */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t plist = -1; /* Dataset creation property list */ + size_t compact_size = 1024; /* The size of compact dataset */ + int *wbuf = NULL; /* Buffer for writing */ + hsize_t dims[1]; /* Dimension sizes */ + size_t u; /* Iterator */ + int n; /* Data variable */ + H5O_info_t obj_info; /* Information for the object */ if(new_format) { TESTING("exercise the coding for the re-read of the object header for SWMR access: latest-format"); @@ -840,7 +841,7 @@ main(void) /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR if(H5AC_ignore_tags(f) < 0) { H5_FAILED(); @@ -938,7 +939,7 @@ main(void) FAIL_STACK_ERROR if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - if(NULL == (f = (H5F_t *)H5I_object(file))) + if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR if (H5AC_ignore_tags(f) < 0) FAIL_STACK_ERROR diff --git a/test/page_buffer.c b/test/page_buffer.c index 79f110c..b9b31f8 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -24,6 +24,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" #include "H5PBprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* * This file needs to access private information from the H5F package. @@ -241,7 +242,7 @@ open_file(char *filename, hid_t fapl, hsize_t page_size, FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; if(f->shared->page_buf == NULL) @@ -604,7 +605,7 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. @@ -887,7 +888,7 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. @@ -1146,7 +1147,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. @@ -1281,7 +1282,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. @@ -1411,7 +1412,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. @@ -1552,7 +1553,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; page_buf = f->shared->page_buf; @@ -1776,7 +1777,7 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file_id))) + if(NULL == (f = (H5F_t *)H5VL_object(file_id))) FAIL_STACK_ERROR; /* opening the file inserts one or more pages into the page buffer. diff --git a/test/swmr.c b/test/swmr.c index 8f50123..3b2af4e 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -26,6 +26,7 @@ #include "h5test.h" #include "H5Iprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* * This file needs to access private information from the H5F package. @@ -1168,7 +1169,7 @@ test_metadata_read_retry_info(hid_t in_fapl) TEST_ERROR /* Get a pointer to the internal file object */ - if((f = (H5F_t *)H5I_object(fid)) == NULL) + if((f = (H5F_t *)H5VL_object(fid)) == NULL) FAIL_STACK_ERROR /* @@ -1326,7 +1327,7 @@ test_metadata_read_retry_info(hid_t in_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if((f = (H5F_t *)H5I_object(fid)) == NULL) + if((f = (H5F_t *)H5VL_object(fid)) == NULL) FAIL_STACK_ERROR /* File's superblock: log retry 1 for 1 time */ @@ -1430,7 +1431,7 @@ test_metadata_read_retry_info(hid_t in_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object for fid */ - if((f = (H5F_t *)H5I_object(fid)) == NULL) + if((f = (H5F_t *)H5VL_object(fid)) == NULL) FAIL_STACK_ERROR /* Re-open fid */ @@ -1438,7 +1439,7 @@ test_metadata_read_retry_info(hid_t in_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object for fid1 */ - if((f1 = (H5F_t *)H5I_object(fid1)) == NULL) + if((f1 = (H5F_t *)H5VL_object(fid1)) == NULL) FAIL_STACK_ERROR /* For fid: fixed array data block page--log retry 9 for 500 times */ @@ -6288,7 +6289,7 @@ test_bug_refresh(hid_t in_fapl) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(fid))) + if(NULL == (f = (H5F_t *)H5VL_object(fid))) FAIL_STACK_ERROR /* Create groups: compact to dense storage */ @@ -6618,8 +6619,8 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) /* Wait for notification from child process */ while(notify != 2) { - if(HDread(in_pdf[0], ¬ify, sizeof(int)) < 0) - FAIL_STACK_ERROR; + if(HDread(in_pdf[0], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; } /* Cork the metadata cache, to prevent the object header from being @@ -7043,7 +7044,7 @@ main(void) */ driver = HDgetenv("HDF5_DRIVER"); if(!H5FD__supports_swmr_test(driver)) { - printf("This VFD does not support SWMR I/O\n"); + HDprintf("This VFD does not support SWMR I/O\n"); return EXIT_SUCCESS; } /* end if */ @@ -7133,7 +7134,7 @@ main(void) if(nerrors) goto error; - printf("All tests passed.\n"); + HDprintf("All tests passed.\n"); h5_cleanup(FILENAME, fapl); @@ -7141,7 +7142,7 @@ main(void) error: nerrors = MAX(1, nerrors); - printf("***** %d SWMR TEST%s FAILED! *****\n", + HDprintf("***** %d SWMR TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index d81dba1..fc99f77 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -12,18 +12,12 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dcreate2(): not a location ID + #000: (file name) line (number) in H5Dcreate2(): invalid location identifier major: Invalid arguments to routine minor: Inappropriate type - #001: (file name) line (number) in H5G_loc(): invalid location ID - major: Invalid arguments to routine - minor: Bad value ********* Print error stack in customized way ********* - error #000: (file name) in H5G_loc(): line (number) - major: Invalid arguments to routine - minor: Bad value - error #001: (file name) in H5Dcreate2(): line (number) + error #000: (file name) in H5Dcreate2(): line (number) major: Invalid arguments to routine minor: Inappropriate type @@ -33,19 +27,13 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Can't get value ********* Print error stack in customized way ********* - error #000: (file name) in H5G_loc(): line (number) - major: Invalid arguments to routine - minor: Bad value - error #001: (file name) in H5Dcreate2(): line (number) + error #000: (file name) in H5Dcreate2(): line (number) major: Invalid arguments to routine minor: Inappropriate type HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dcreate2(): not a location ID + #000: (file name) line (number) in H5Dcreate2(): invalid location identifier major: Invalid arguments to routine minor: Inappropriate type - #001: (file name) line (number) in H5G_loc(): invalid location ID - major: Invalid arguments to routine - minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in main(): Error test failed diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index 02cfed8..473c53e 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -41,19 +41,25 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dread(): can't read data major: Dataset minor: Read failed - #001: (file name) line (number) in H5D__read(): can't read data + #001: (file name) line (number) in H5VL_dataset_read(): read failed + major: Virtual Object Layer + minor: Read failed + #002: (file name) line (number) in H5VL_native_dataset_read(): can't read data + major: Dataset + minor: Read failed + #003: (file name) line (number) in H5D__read(): can't read data major: Dataset minor: Read failed - #002: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk + #004: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk major: Low-level I/O minor: Read failed - #003: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed + #005: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed major: Dataset minor: Filter operation failed - #004: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered + #006: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered major: Data filters minor: Read failed - #005: (file name) line (number) in H5PL_load(): filter plugins disabled + #007: (file name) line (number) in H5PL_load(): filter plugins disabled major: Plugin for dynamically loaded library minor: Unable to load metadata into cache diff --git a/test/tfile.c b/test/tfile.c index 0db4c1b..12a0eca 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -24,6 +24,7 @@ #include "H5Iprivate.h" #include "H5Pprivate.h" +#include "H5VLprivate.h" /* Virtual Object Layer */ /* * This file needs to access private information from the H5F package. @@ -1431,6 +1432,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, case H5I_ATTR: case H5I_REFERENCE: case H5I_VFL: + case H5I_VOL: case H5I_GENPROP_CLS: case H5I_GENPROP_LST: case H5I_ERROR_CLASS: @@ -1586,6 +1588,87 @@ test_file_perm2(void) } /* end test_file_perm2() */ +/**************************************************************** +** +** test_file_is_accessible(): low-level file test routine. +** Clone of test_file_ishdf5 but uses the newer VOL-enabled +** H5Fis_accessible() API call. +** +*****************************************************************/ +static void +test_file_is_accessible(void) +{ + hid_t fid; /* File opened with read-write permission */ + hid_t fcpl_id; /* File creation property list */ + int fd; /* POSIX file descriptor */ + ssize_t nbytes; /* Number of bytes written */ + unsigned u; /* Local index variable */ + unsigned char buf[1024]; /* Buffer of data to write */ + htri_t status; /* Whether a file is an HDF5 file */ + herr_t ret; + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Detection of HDF5 Files\n")); + + /* Create a file */ + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Verify that the file is an HDF5 file */ + status = H5Fis_accessible(FILE1, H5P_DEFAULT); + VERIFY(status, TRUE, "H5Fis_accessible"); + + + /* Create a file creation property list with a non-default user block size */ + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl_id, FAIL, "H5Pcreate"); + + ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); + CHECK(ret, FAIL, "H5Pset_userblock"); + + /* Create file with non-default user block */ + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Release file-creation property list */ + ret = H5Pclose(fcpl_id); + CHECK(ret, FAIL, "H5Pclose"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Verify that the file is an HDF5 file */ + status = H5Fis_accessible(FILE1, H5P_DEFAULT); + VERIFY(status, TRUE, "H5Fis_accessible"); + + + /* Create non-HDF5 file and check it */ + fd = HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); + CHECK(fd, FAIL, "HDopen"); + + /* Initialize information to write */ + for (u=0; u<1024; u++) + buf[u]=(unsigned char)u; + + /* Write some information */ + nbytes = HDwrite(fd, buf, (size_t)1024); + VERIFY(nbytes, 1024, "HDwrite"); + + /* Close the file */ + ret = HDclose(fd); + CHECK(ret, FAIL, "HDclose"); + + /* Verify that the file is not an HDF5 file */ + status = H5Fis_accessible(FILE1, H5P_DEFAULT); + VERIFY(status, FALSE, "H5Fis_accessible"); + +} /* end test_file_is_accessible() */ + /**************************************************************** ** @@ -1594,6 +1677,7 @@ test_file_perm2(void) ** correctly in variuous situations. ** *****************************************************************/ +#ifndef H5_NO_DEPRECATED_SYMBOLS static void test_file_ishdf5(void) { @@ -1607,7 +1691,7 @@ test_file_ishdf5(void) herr_t ret; /* Output message about test being performed */ - MESSAGE(5, ("Testing Detection of HDF5 Files\n")); + MESSAGE(5, ("Testing Detection of HDF5 Files (using deprecated H5Fis_hdf5() call)\n")); /* Create a file */ file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -1667,6 +1751,7 @@ test_file_ishdf5(void) VERIFY(status, FALSE, "H5Fis_hdf5"); } /* end test_file_ishdf5() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /**************************************************************** ** @@ -5334,8 +5419,8 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) /* Get the internal file pointer if the create succeeds */ if((ok = fid >= 0)) { - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); } /* Retrieve the low/high bounds */ @@ -5483,8 +5568,8 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) CHECK(fid, FAIL, "H5Fcreate"); /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* The file's superblock version */ super_vers = f->shared->sblock->super_vers; @@ -5515,8 +5600,8 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) /* Get the internal file pointer if the open succeeds */ if((ok = fid >= 0)) { - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); } /* Verify the file open succeeds or fails */ @@ -5687,8 +5772,8 @@ test_libver_bounds_obj(hid_t fapl) if(fid >=0 ) { /* The file open succeeds */ /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* Create a group in the file */ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -5795,8 +5880,8 @@ test_libver_bounds_dataset(hid_t fapl) CHECK(did, FAIL, "H5Dcreate"); /* Get the internal dataset pointer */ - dset = (H5D_t *)H5I_object(did); - CHECK(dset, NULL, "H5I_object"); + dset = (H5D_t *)H5VL_object(did); + CHECK(dset, NULL, "H5VL_object"); /* Verify version for layout and fill value messages */ if(low == H5F_LIBVER_EARLIEST) { @@ -5840,8 +5925,8 @@ test_libver_bounds_dataset(hid_t fapl) if(did >= 0) { /* Get the internal dataset pointer */ - dset = (H5D_t *)H5I_object(did); - CHECK(dset, NULL, "H5I_object"); + dset = (H5D_t *)H5VL_object(did); + CHECK(dset, NULL, "H5VL_object"); /* Verify layout message version and chunk indexing type */ VERIFY(dset->shared->layout.version, H5O_LAYOUT_VERSION_4, "H5O_layout_ver_bounds"); @@ -5898,16 +5983,16 @@ test_libver_bounds_dataset(hid_t fapl) if(fid >=0 ) { /* The file open succeeds */ /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); CHECK(did, FAIL, "H5Dcreate2"); /* Get the internal file pointer */ - dset = (H5D_t *)H5I_object(did); - CHECK(dset, NULL, "H5I_object"); + dset = (H5D_t *)H5VL_object(did); + CHECK(dset, NULL, "H5VL_object"); /* Verify the dataset's layout, fill value and filter pipeline message versions */ /* Also verify the chunk indexing type */ @@ -6114,8 +6199,8 @@ test_libver_bounds_dataspace(hid_t fapl) if(fid >=0 ) { /* The file open succeeds */ /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -6436,14 +6521,14 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) if(fid >= 0 ) { /* The file open succeeds */ /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* Open the committed datatype */ str_tid = H5Topen2(fid, "datatype", H5P_DEFAULT); CHECK(str_tid, FAIL, "H5Topen2"); - str_dtype = (H5T_t *)H5I_object(str_tid); - CHECK(str_dtype, NULL, "H5I_object"); + str_dtype = (H5T_t *)H5VL_object(str_tid); + CHECK(str_dtype, NULL, "H5VL_object"); /* Verify the committed datatype message version */ VERIFY(str_dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "H5O_dtype_ver_bounds"); @@ -6594,8 +6679,8 @@ test_libver_bounds_attributes(hid_t fapl) CHECK(aid, FAIL, "H5Acreate2"); /* Get the internal attribute pointer */ - attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + attr = (H5A_t *)H5VL_object(aid); + CHECK(attr, NULL, "H5VL_object"); /* Verify the attribute version */ if(low == H5F_LIBVER_EARLIEST) @@ -6613,8 +6698,8 @@ test_libver_bounds_attributes(hid_t fapl) CHECK(aid, FAIL, "H5Acreate2"); /* Get the internal attribute pointer */ - attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + attr = (H5A_t *)H5VL_object(aid); + CHECK(attr, NULL, "H5VL_object"); /* Verify attribute version */ VERIFY(attr->shared->version, H5O_attr_ver_bounds[low], "H5O_attr_ver_bounds"); @@ -6634,8 +6719,8 @@ test_libver_bounds_attributes(hid_t fapl) CHECK(aid, FAIL, "H5Acreate2"); /* Get internal attribute pointer */ - attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + attr = (H5A_t *)H5VL_object(aid); + CHECK(attr, NULL, "H5VL_object"); /* Verify attribute version */ if(low == H5F_LIBVER_EARLIEST) @@ -6699,8 +6784,8 @@ test_libver_bounds_attributes(hid_t fapl) CHECK(aid, FAIL, "H5Acreate2"); /* Get the internal attribute pointer */ - attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + attr = (H5A_t *)H5VL_object(aid); + CHECK(attr, NULL, "H5VL_object"); /* Verify the attribute version */ if(low == H5F_LIBVER_EARLIEST) @@ -6757,8 +6842,8 @@ test_libver_bounds_attributes(hid_t fapl) if(fid >=0 ) { /* The file open succeeds */ /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); /* Open the group */ gid = H5Gopen2(fid, GRP_NAME, H5P_DEFAULT); @@ -6769,8 +6854,8 @@ test_libver_bounds_attributes(hid_t fapl) CHECK(aid, FAIL, "H5Acreate2"); /* Get the internal attribute pointer */ - attr = (H5A_t *)H5I_object(aid); - CHECK(attr, NULL, "H5I_object"); + attr = (H5A_t *)H5VL_object(aid); + CHECK(attr, NULL, "H5VL_object"); /* Verify the attribute message version */ VERIFY(attr->shared->version, H5O_attr_ver_bounds[f->shared->low_bound], "H5O_attr_ver_bounds"); @@ -7295,7 +7380,7 @@ test_file(void) test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ test_file_perm(); /* Test file access permissions */ test_file_perm2(); /* Test file access permission again */ - test_file_ishdf5(); /* Test detecting HDF5 files correctly */ + test_file_is_accessible(); /* Test detecting HDF5 files correctly */ test_file_open_dot(); /* Test opening objects with "." for a name */ test_file_open_overlap(); /* Test opening files in an overlapping manner */ test_file_getname(); /* Test basic H5Fget_name() functionality */ @@ -7330,6 +7415,7 @@ test_file(void) test_libver_macros2(); /* Test the macros for library version comparison */ test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */ #ifndef H5_NO_DEPRECATED_SYMBOLS + test_file_ishdf5(); /* Test detecting HDF5 files correctly */ test_deprec(); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_file() */ diff --git a/test/tmisc.c b/test/tmisc.c index 47c0606..9eed5db 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2717,7 +2717,7 @@ test_misc15(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is still OK */ - ret = H5Fis_hdf5(MISC15_FILE); + ret = H5Fis_accessible(MISC15_FILE, fapl); CHECK(ret, FAIL, "H5Fis_hdf5"); ret = H5Pclose(fapl); @@ -3028,7 +3028,9 @@ test_misc19(void) hid_t emid = -1; /* Error Message ID */ hid_t esid = -1; /* Error Stack ID */ hid_t vfdid = -1; /* Virtual File Driver ID */ + hid_t volid = -1; /* Virtual Object Layer ID */ H5FD_class_t *vfd_cls = NULL; /* VFD class */ + H5VL_class_t *vol_cls = NULL; /* VOL class */ int rc; /* Reference count */ herr_t ret; /* Generic return value */ @@ -3479,6 +3481,44 @@ test_misc19(void) HDfree(vfd_cls); +/* Check H5I operations on virtual object drivers */ + + /* Get a VOL class to register */ + 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"); + + /* Check the reference count */ + rc = H5Iget_ref(volid); + VERIFY(rc, 1, "H5Iget_ref"); + + /* Increment the reference count */ + rc = H5Iinc_ref(volid); + VERIFY(rc, 2, "H5Iinc_ref"); + + /* Unregister the VOL driver normally */ + ret = H5VLunregister(volid); + CHECK(ret, FAIL, "H5VLunregister"); + + /* Check the reference count */ + rc = H5Iget_ref(volid); + VERIFY(rc, 1, "H5Iget_ref"); + + /* Unregister the VOL driver by decrementing the reference count */ + rc = H5Idec_ref(volid); + VERIFY(rc, 0, "H5Idec_ref"); + + /* Try unregistering the VOL driver again (should fail) */ + H5E_BEGIN_TRY { + ret = H5VLunregister(volid); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5VLunregister"); + + HDfree(vol_cls); + } /* end test_misc19() */ /**************************************************************** diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 4160d3a..e04ddf3 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -38,7 +38,7 @@ /* Having a common dataset name is an error */ #define DATASETNAME "commonname" -#define EXPECTED_ERROR_DEPTH 7 +#define EXPECTED_ERROR_DEPTH 9 #define WRITE_NUMBER 37 /* Typedefs */ @@ -73,23 +73,29 @@ tts_error(void) expected_g[0].maj_num = H5E_DATASET; expected_g[0].min_num = H5E_CANTINIT; - expected_g[1].maj_num = H5E_DATASET; + expected_g[1].maj_num = H5E_VOL; expected_g[1].min_num = H5E_CANTINIT; - expected_g[2].maj_num = H5E_LINK; + expected_g[2].maj_num = H5E_DATASET; expected_g[2].min_num = H5E_CANTINIT; - expected_g[3].maj_num = H5E_LINK; - expected_g[3].min_num = H5E_CANTINSERT; + expected_g[3].maj_num = H5E_DATASET; + expected_g[3].min_num = H5E_CANTINIT; - expected_g[4].maj_num = H5E_SYM; - expected_g[4].min_num = H5E_NOTFOUND; + expected_g[4].maj_num = H5E_LINK; + expected_g[4].min_num = H5E_CANTINIT; - expected_g[5].maj_num = H5E_SYM; - expected_g[5].min_num = H5E_CALLBACK; + expected_g[5].maj_num = H5E_LINK; + expected_g[5].min_num = H5E_CANTINSERT; - expected_g[6].maj_num = H5E_LINK; - expected_g[6].min_num = H5E_EXISTS; + expected_g[6].maj_num = H5E_SYM; + expected_g[6].min_num = H5E_NOTFOUND; + + expected_g[7].maj_num = H5E_SYM; + expected_g[7].min_num = H5E_CALLBACK; + + expected_g[8].maj_num = H5E_LINK; + expected_g[8].min_num = H5E_EXISTS; /* set up mutex for global count of errors */ H5TS_mutex_init(&error_mutex_g); diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c index 42721d5..16f3abe 100644 --- a/test/vds_swmr_reader.c +++ b/test/vds_swmr_reader.c @@ -97,7 +97,6 @@ main(void) TEST_ERROR if(H5Dread(did, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, buffer) < 0) TEST_ERROR - if(H5Sclose(fsid) < 0) TEST_ERROR diff --git a/test/vol.c b/test/vol.c new file mode 100644 index 0000000..3152a93 --- /dev/null +++ b/test/vol.c @@ -0,0 +1,956 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: Tests the virtual object layer (H5VL) + * + * This is a minimal test to ensure VOL usage (setting a VOL, etc.) + * works as expected. Actual VOL functionality is tested using + * other mechanisms. + */ + +#include "h5test.h" +#include "H5VLnative.h" + + +#define NATIVE_VOL_TEST_FILENAME "native_vol_test" +#define NATIVE_VOL_TEST_GROUP_NAME "test_group" +#define NATIVE_VOL_TEST_DATASET_NAME "test_dataset" +#define NATIVE_VOL_TEST_ATTRIBUTE_NAME "test_dataset" +#define NATIVE_VOL_TEST_HARD_LINK_NAME "test_hard_link" +#define NATIVE_VOL_TEST_SOFT_LINK_NAME "test_soft_link" +#define NATIVE_VOL_TEST_MOVE_LINK_NAME "test_move_link" +#define NATIVE_VOL_TEST_COPY_LINK_NAME "test_copy_link" +#define NATIVE_VOL_TEST_DATATYPE_NAME "test_datatype" + +#define N_ELEMENTS 10 + +#define FAKE_VOL_NAME "fake" + +/* A VOL class struct that describes a VOL class with no + * functionality. + */ +static const H5VL_class_t fake_vol_g = { + 0, /* version */ + (H5VL_class_value_t)999, /* value */ + FAKE_VOL_NAME, /* name */ + NULL, /* initialize */ + NULL, /* terminate */ + (size_t)0, /* fapl size */ + NULL, /* fapl copy */ + NULL, /* fapl free */ + { /* attribute_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* dataset_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* datatype_cls */ + NULL, /* commit */ + NULL, /* open */ + NULL, /* get_size */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* file_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* group_cls */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ + }, + { /* link_cls */ + NULL, /* create */ + NULL, /* copy */ + NULL, /* move */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* object_cls */ + NULL, /* open */ + NULL, /* copy */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* async_cls */ + NULL, /* cancel */ + NULL, /* test */ + NULL /* wait */ + }, + NULL /* optional */ +}; + + +/*------------------------------------------------------------------------- + * Function: test_vol_registration() + * + * Purpose: Tests if we can load, register, and close a simple + * VOL driver. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_vol_registration(void) +{ + htri_t is_registered; + hid_t vol_id = -1; + + 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) + 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) + FAIL_STACK_ERROR; + + /* The test/fake VOL driver should be registered now */ + if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0) + FAIL_STACK_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL driver is un-registered"); + + /* Close the VOL interface */ + if (H5VLclose(vol_id) < 0) + FAIL_STACK_ERROR; + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5VLclose(vol_id); + } H5E_END_TRY; + return FAIL; + +} /* end test_vol_registration() */ + + +/*------------------------------------------------------------------------- + * Function: test_native_vol_init() + * + * Purpose: Tests if the native VOL driver gets initialized. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_native_vol_init(void) +{ + htri_t is_registered; + + TESTING("Native VOL driver initialization"); + + /* The native VOL driver should always be registered */ + if ((is_registered = H5VLis_registered(H5VL_NATIVE_NAME)) < 0) + FAIL_STACK_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL driver is un-registered"); + + PASSED(); + return SUCCEED; + +error: + return FAIL; + +} /* end test_native_vol_init() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_file_operation() + * + * Purpose: Uses the native VOL driver to test basic VOL file operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_file_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t fid_reopen = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t fcpl_id = H5I_INVALID_HID; + + ssize_t obj_count; + hid_t obj_id_list[1]; + hsize_t file_size; + unsigned intent; + void *os_file_handle = NULL; + H5F_info2_t finfo; + char name[32]; + + TESTING("Basic VOL file operations"); + + /* H5Fcreate */ + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Fget_obj_count */ + if ((obj_count = H5Fget_obj_count(fid, H5F_OBJ_FILE)) < 0) + TEST_ERROR; + if ((obj_count = H5Fget_obj_count(fid, H5F_OBJ_ALL)) < 0) + TEST_ERROR; + if ((obj_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET)) < 0) + TEST_ERROR; + + /* H5Fget_obj_ids */ + if ((obj_count = H5Fget_obj_ids(fid, H5F_OBJ_ALL, 2, obj_id_list)) < 0) + TEST_ERROR; + if ((obj_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET, 2, obj_id_list)) < 0) + TEST_ERROR; + + /* H5Fget_access_plist */ + if ((fapl_id = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* H5Fget_create_plist */ + if ((fcpl_id = H5Fget_create_plist(fid)) < 0) + TEST_ERROR; + if (H5Pclose(fcpl_id) < 0) + TEST_ERROR; + + /* H5Fget_filesize */ + if (H5Fget_filesize(fid, &file_size) < 0) + TEST_ERROR; + + /* H5Fget_vfd_handle */ + if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) + TEST_ERROR; + + /* H5Fget_intent */ + if (H5Fget_intent(fid, &intent) < 0) + TEST_ERROR; + + /* H5Fget_info2 */ + if (H5Fget_info2(fid, &finfo) < 0) + TEST_ERROR; + + /* H5Fget_name */ + if (H5Fget_name(fid, name, 32) < 0) + TEST_ERROR; + + /* H5Fclear_elink_file_cache */ + if (H5Fclear_elink_file_cache(fid) < 0) + TEST_ERROR; + + /* H5Fflush */ + if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) + TEST_ERROR; + + /* H5Fclose */ + if (H5Fclose(fid) < 0) + TEST_ERROR; + + /* H5Fis_accessible */ + if (H5Fis_accessible(NATIVE_VOL_TEST_FILENAME, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Fopen */ + if ((fid = H5Fopen(NATIVE_VOL_TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((fid_reopen = H5Freopen(fid)) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + if (H5Fclose(fid_reopen) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Fclose(fid_reopen); + H5Pclose(fapl_id); + H5Pclose(fcpl_id); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_file_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_group_operation() + * + * Purpose: Uses the native VOL driver to test basic VOL group operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_group_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t gid_a = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + H5G_info_t info; + + TESTING("Basic VOL group operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Gcreate */ + if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Gget_create_plist */ + if ((gcpl_id = H5Gget_create_plist(gid)) < 0) + TEST_ERROR; + if (H5Pclose(gcpl_id) < 0) + TEST_ERROR; + + /* H5Gget_info */ + if (H5Gget_info(gid, &info) < 0) + TEST_ERROR; + if (H5Gget_info(fid, &info) < 0) + TEST_ERROR; + + /* H5Gget_info_by_name */ + if (H5Gget_info_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, &info, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Gget_info_by_idx */ + if (H5Gget_info_by_idx(fid, "/", H5_INDEX_NAME, H5_ITER_NATIVE, 0, &info, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Gflush */ + if (H5Gflush(gid) < 0) + TEST_ERROR; + + /* H5Gclose */ + if (H5Gclose(gid) < 0) + TEST_ERROR; + + /* H5Gopen */ + if ((gid = H5Gopen2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Gcreate_anon */ + if ((gid_a = H5Gcreate_anon(fid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Grefresh */ + if (H5Grefresh(gid) < 0) + TEST_ERROR; + + if (H5Gclose(gid) < 0) + TEST_ERROR; + if (H5Gclose(gid_a) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Gclose(gid); + H5Pclose(gcpl_id); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_group_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_dataset_operation() + * + * Purpose: Uses the native VOL driver to test basic VOL dataset operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_dataset_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t dapl_id = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t did_a = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + + hsize_t curr_dims = 0; + hsize_t max_dims = H5S_UNLIMITED; + + hsize_t storage_size; + haddr_t offset; + H5D_space_status_t status; + + int in_buf[N_ELEMENTS]; + int out_buf[N_ELEMENTS]; + + int i; + + TESTING("Basic VOL dataset operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + for (i = 0; i < N_ELEMENTS; i++) { + in_buf[i] = i; + out_buf[i] = 0; + } + + /* H5Dcreate */ + curr_dims = 0; + if ((sid = H5Screate_simple(1, &curr_dims, &max_dims)) < 0) + TEST_ERROR; + curr_dims = N_ELEMENTS; + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + if (H5Pset_chunk(dcpl_id, 1, &curr_dims) < 0) + TEST_ERROR; + if ((did = H5Dcreate2(fid, NATIVE_VOL_TEST_DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Dcreate_anon */ + if ((did_a = H5Dcreate_anon(fid, H5T_NATIVE_INT, sid, dcpl_id, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if (H5Sclose(sid) < 0) + TEST_ERROR; + if (H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /* H5Dset_extent */ + curr_dims = N_ELEMENTS; + if (H5Dset_extent(did, &curr_dims) < 0) + TEST_ERROR; + + /* H5Dflush */ + if (H5Dflush(did) < 0) + TEST_ERROR; + + /* H5Dwrite */ + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, in_buf) < 0) + TEST_ERROR; + + /* H5Drefresh */ + if (H5Drefresh(did) < 0) + TEST_ERROR; + + /* H5Dclose */ + if (H5Dclose(did) < 0) + TEST_ERROR; + if (H5Dclose(did_a) < 0) + TEST_ERROR; + + /* H5Dopen */ + if ((did = H5Dopen2(fid, NATIVE_VOL_TEST_DATASET_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Dget_space */ + if ((sid = H5Dget_space(did)) < 0) + TEST_ERROR; + if (H5Sclose(sid) < 0) + TEST_ERROR; + + /* H5Dget_space_status */ + if (H5Dget_space_status(did, &status) < 0) + TEST_ERROR; + + /* H5Dget_type */ + if ((tid = H5Dget_type(did)) < 0) + TEST_ERROR; + if (H5Tclose(tid) < 0) + TEST_ERROR; + + /* H5Tcopy (when used w/ a dataset, it gets an H5VL struct */ + if ((tid = H5Tcopy(did)) < 0) + TEST_ERROR; + if (H5Tclose(tid) < 0) + TEST_ERROR; + + /* H5Dget_create_plist */ + if ((dcpl_id = H5Dget_create_plist(did)) < 0) + TEST_ERROR; + if (H5Pclose(dcpl_id) < 0) + TEST_ERROR; + + /* H5Dget_access_plist */ + if ((dapl_id = H5Dget_access_plist(did)) < 0) + TEST_ERROR; + if (H5Pclose(dapl_id) < 0) + TEST_ERROR; + + /* H5Dget_storage_size */ + /* XXX: This is a terrible API call that can't truly indicate failure */ + if (0 == (storage_size = H5Dget_storage_size(did))) + TEST_ERROR; + + /* H5Dget_offset */ + /* XXX: Another bad API call that can't flag error values. Also, this + * returns HADDR_UNDEF for chunked datasets, which is bizarre. + */ + if (HADDR_UNDEF != (offset = H5Dget_offset(did))) + TEST_ERROR; + + /* H5Dread */ + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, out_buf) < 0) + TEST_ERROR; + + for (i = 0; i < N_ELEMENTS; i++) + if (in_buf[i] != out_buf[i]) + TEST_ERROR; + + if (H5Dclose(did) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Dclose(did); + H5Dclose(did_a); + H5Sclose(sid); + H5Tclose(tid); + H5Pclose(dapl_id); + H5Pclose(dcpl_id); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_dataset_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_attribute_operation() + * + * Purpose: Uses the native VOL driver to test basic VOL attribute operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_attribute_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t aid = H5I_INVALID_HID; + hid_t aid_name = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + + hsize_t dims = 1; + + int data_in = 42; + int data_out = 0; + + TESTING("Basic VOL attribute operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + dims = 1; + if ((sid = H5Screate_simple(1, &dims, &dims)) < 0) + TEST_ERROR; + + /* H5Acreate */ + if ((aid = H5Acreate2(fid, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Awrite */ + if (H5Awrite(aid, H5T_NATIVE_INT, &data_in) < 0) + TEST_ERROR; + + /* H5Aread */ + if (H5Aread(aid, H5T_NATIVE_INT, &data_out) < 0) + TEST_ERROR; + if (data_in != data_out) + TEST_ERROR; + + /* H5Aclose */ + if (H5Aclose(aid) < 0) + TEST_ERROR; + + /* H5Aopen */ + if ((aid = H5Aopen(fid, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + if (H5Aclose(aid) < 0) + TEST_ERROR; + + /* H5Adelete */ + if (H5Adelete(fid, NATIVE_VOL_TEST_ATTRIBUTE_NAME) < 0) + TEST_ERROR; + + /* H5Acreate_by_name */ + if ((aid_name = H5Acreate_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + /* H5Aclose */ + if (H5Aclose(aid_name) < 0) + TEST_ERROR; + + /* H5Adelete_by_name */ + if (H5Adelete_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, NATIVE_VOL_TEST_ATTRIBUTE_NAME, H5P_DEFAULT) < 0) + TEST_ERROR; + + if (H5Sclose(sid) < 0) + TEST_ERROR; + if (H5Gclose(gid) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Gclose(gid); + H5Sclose(sid); + H5Aclose(aid); + H5Aclose(aid_name); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_attribute_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_object_operation() + * + * Purpose: Uses the native VOL driver to test basic VOL object operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_object_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t oid = H5I_INVALID_HID; + + H5O_info_t object_info; + + TESTING("Basic VOL object operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Oget_info */ + if (H5Oget_info2(fid, &object_info, H5O_INFO_ALL) < 0) + TEST_ERROR; + + /* H5Oget_info_by_name */ + if (H5Oget_info_by_name2(fid, NATIVE_VOL_TEST_GROUP_NAME, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Oexists_by_name */ + if (H5Oexists_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT) != TRUE) + TEST_ERROR; + + /* H5Oopen/close */ + if ((oid = H5Oopen(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + if (H5Oclose(oid) < 0) + TEST_ERROR; + + if (H5Fclose(fid) < 0) + TEST_ERROR; + if (H5Gclose(gid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Gclose(gid); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_object_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_link_operation() + * + * Purpose: Uses the native VOL driver to test basic VOL link operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_link_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + + TESTING("Basic VOL link operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Lcreate_hard */ + if (H5Lcreate_hard(fid, "/", gid, NATIVE_VOL_TEST_HARD_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Lcreate_soft (to itself) */ + if (H5Lcreate_soft("/", fid, NATIVE_VOL_TEST_SOFT_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Lexists */ + if (H5Lexists(gid, NATIVE_VOL_TEST_HARD_LINK_NAME, H5P_DEFAULT) < 0) + TEST_ERROR; + if (H5Lexists(fid, NATIVE_VOL_TEST_SOFT_LINK_NAME, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Lcopy */ + if (H5Lcopy(gid, NATIVE_VOL_TEST_HARD_LINK_NAME, fid, NATIVE_VOL_TEST_COPY_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Lmove */ + if (H5Lmove(fid, NATIVE_VOL_TEST_COPY_LINK_NAME, gid, NATIVE_VOL_TEST_MOVE_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + if (H5Fclose(fid) < 0) + TEST_ERROR; + if (H5Gclose(gid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Fclose(gid); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_link_operation() */ + + +/*------------------------------------------------------------------------- + * Function: test_basic_datatype_operation() + * + * Purpose: Uses the native VOL driver to test basic VOL datatype operations + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_basic_datatype_operation(void) +{ + hid_t fid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t tid_anon = H5I_INVALID_HID; + hid_t tcpl_id = H5I_INVALID_HID; + + TESTING("Basic VOL datatype operations"); + + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) + TEST_ERROR; + + /* H5Tcommit */ + if (H5Tcommit2(fid, NATIVE_VOL_TEST_DATATYPE_NAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* H5Tflush */ + if (H5Tflush(tid) < 0) + TEST_ERROR; + + /* H5Trefresh */ + if (H5Trefresh(tid) < 0) + TEST_ERROR; + + /* H5Tclose */ + if (H5Tclose(tid) < 0) + TEST_ERROR; + + /* H5Topen */ + if ((tid = H5Topen2(fid, NATIVE_VOL_TEST_DATATYPE_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* H5Tget_create_plist */ + if ((tcpl_id = H5Tget_create_plist(tid)) < 0) + TEST_ERROR; + + /* H5Tcommit_anon */ + if ((tid_anon = H5Tcopy(H5T_NATIVE_INT)) < 0) + TEST_ERROR; + if (H5Tcommit_anon(fid, tid_anon, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; + + if (H5Pclose(tcpl_id) < 0) + TEST_ERROR; + if (H5Tclose(tid) < 0) + TEST_ERROR; + if (H5Tclose(tid_anon) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + + HDremove(NATIVE_VOL_TEST_FILENAME); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(tcpl_id); + H5Fclose(fid); + H5Tclose(tid); + H5Tclose(tid_anon); + } H5E_END_TRY; + + return FAIL; + +} /* end test_basic_datatype_operation() */ + +#if 0 + +/*------------------------------------------------------------------------- + * Function: test_echo_vol_operation() + * + * Purpose: Uses the echo VOL driver to test basic VOL operations + * via the H5VL public API. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_echo_vol_operation(void) +{ + char name[25]; + + TESTING("Echo VOL operations"); + + PASSED(); + return SUCCEED; + +error: + return FAIL; + +} /* end test_basic_vol_operation() */ +#endif + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests the virtual object layer interface (H5VL) + * + * Return: EXIT_SUCCESS/EXIT_FAILURE + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + int nerrors = 0; + + h5_reset(); + + HDputs("Testing basic Virtual Object Layer (VOL) functionality."); + + nerrors += test_vol_registration() < 0 ? 1 : 0; + nerrors += test_native_vol_init() < 0 ? 1 : 0; + nerrors += test_basic_file_operation() < 0 ? 1 : 0; + nerrors += test_basic_group_operation() < 0 ? 1 : 0; + nerrors += test_basic_dataset_operation() < 0 ? 1 : 0; + nerrors += test_basic_attribute_operation() < 0 ? 1 : 0; + nerrors += test_basic_object_operation() < 0 ? 1 : 0; + nerrors += test_basic_link_operation() < 0 ? 1 : 0; + nerrors += test_basic_datatype_operation() < 0 ? 1 : 0; + + if (nerrors) { + HDprintf("***** %d Virtual Object Layer TEST%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + HDexit(EXIT_FAILURE); + } + + HDputs("All Virtual Object Layer (VOL) tests passed."); + + HDexit(EXIT_SUCCESS); + +} /* end main() */ + diff --git a/testpar/t_cache.c b/testpar/t_cache.c index c27fc23..5e15ec2 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -4091,7 +4091,7 @@ setup_cache_for_test(hid_t * fid_ptr, world_mpi_rank, FUNC); } } else { - file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); + file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE); } if ( file_ptr == NULL ) { diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c index 5b512d6..e158d69 100644 --- a/testpar/t_cache_image.c +++ b/testpar/t_cache_image.c @@ -1187,7 +1187,7 @@ open_hdf5_file(const hbool_t create_file, } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { diff --git a/testpar/t_pread.c b/testpar/t_pread.c index 807e092..0905d44 100644 --- a/testpar/t_pread.c +++ b/testpar/t_pread.c @@ -104,7 +104,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) hid_t file_id = -1; hid_t memspace = -1; hid_t filespace = -1; - hid_t fctmpl = -1; + hid_t fctmpl = -1; hid_t fapl_id = -1; hid_t dxpl_id = -1; hid_t dset_id = -1; @@ -180,17 +180,17 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) } } - /* Initialize a file creation template */ - if (pass) { - if ((fctmpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - pass = FALSE; - failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n"; - } - else if (H5Pset_userblock(fctmpl, 512) != SUCCEED) { - pass = FALSE; - failure_mssg = "H5Pset_userblock(,size) failed.\n"; - } - } + /* Initialize a file creation template */ + if (pass) { + if ((fctmpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { + pass = FALSE; + failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n"; + } + else if (H5Pset_userblock(fctmpl, 512) != SUCCEED) { + pass = FALSE; + failure_mssg = "H5Pset_userblock(,size) failed.\n"; + } + } /* setup FAPL */ if ( pass ) { if ( (fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0 ) { @@ -347,7 +347,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) bytes_to_write = HDstrlen(text_to_write); if (pass) { - if ((header = HDopen(data_filename, O_WRONLY)) < 0) { + if ((header = HDopen(data_filename, O_WRONLY)) < 0) { pass = FALSE; failure_mssg = "HDopen(data_filename, O_WRONLY) failed.\n"; } @@ -358,7 +358,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) if (HDwrite(header, text_to_write, bytes_to_write) < 0) { pass = FALSE; failure_mssg = "Unable to write user text into file.\n"; - } + } } if (pass || (header > 0)) { diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 62f269b..79a1316 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -34,4 +34,4 @@ if (HDF5_EXPORTED_TARGETS) ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) -endif () \ No newline at end of file +endif () diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 4f3e7a4..8222e06 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -230,7 +230,7 @@ main (int argc, const char *argv[]) leave (EXIT_FAILURE); } - testval = H5Fis_hdf5 (ub_file); + testval = H5Fis_accessible(ub_file, H5P_DEFAULT); if (testval > 0) { error_msg("-u cannot be HDF5 file, but it appears to be an HDF5 file.\n"); @@ -244,7 +244,7 @@ main (int argc, const char *argv[]) leave (EXIT_FAILURE); } - testval = H5Fis_hdf5 (input_file); + testval = H5Fis_accessible(input_file, H5P_DEFAULT); if (testval <= 0) { error_msg("Input HDF5 file \"%s\" is not HDF5 format.\n", input_file); diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index ffe2aca..aa893f9 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -229,7 +229,7 @@ main(int argc, const char *argv[]) goto done; } - testval = H5Fis_hdf5(input_file); + testval = H5Fis_accessible(input_file, H5P_DEFAULT); if (testval <= 0) { error_msg("Input HDF5 file \"%s\" is not HDF\n", input_file); diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index dc1dc4a..8109b93 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -74,7 +74,7 @@ typedef struct iter_t { ohdr_info_t group_ohdr_info; /* Object header information for groups */ hsize_t max_attrs; /* Maximum attributes from a group */ - unsigned long *num_small_attrs; /* Size of small attributes tracked */ + unsigned long *num_small_attrs; /* Size of small attributes tracked */ unsigned attr_nbins; /* Number of bins for attribute counts */ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */ @@ -257,7 +257,7 @@ leave(int ret) } - + /*------------------------------------------------------------------------- * Function: usage * @@ -297,7 +297,7 @@ static void usage(const char *prog) HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); } - + /*------------------------------------------------------------------------- * Function: ceil_log10 * @@ -324,7 +324,7 @@ ceil_log10(unsigned long x) return ret; } /* ceil_log10() */ - + /*------------------------------------------------------------------------- * Function: attribute_stats * @@ -374,7 +374,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) return 0; } /* end attribute_stats() */ - + /*------------------------------------------------------------------------- * Function: group_stats * @@ -456,7 +456,7 @@ done: return ret_value; } /* end group_stats() */ - + /*------------------------------------------------------------------------- * Function: dataset_stats * @@ -648,7 +648,7 @@ done: return ret_value; } /* end dataset_stats() */ - + /*------------------------------------------------------------------------- * Function: datatype_stats * @@ -680,7 +680,7 @@ done: return ret_value; } /* end datatype_stats() */ - + /*------------------------------------------------------------------------- * Function: obj_stats * @@ -736,7 +736,7 @@ done: return ret_value; } /* end obj_stats() */ - + /*------------------------------------------------------------------------- * Function: lnk_stats * @@ -834,7 +834,7 @@ freespace_stats(hid_t fid, iter_t *iter) return 0; } /* end freespace_stats() */ - + /*------------------------------------------------------------------------- * Function: hand_free * @@ -863,7 +863,7 @@ hand_free(struct handler_t *hand) } /* end if */ } /* end hand_free() */ - + /*------------------------------------------------------------------------- * Function: parse_command_line * @@ -1041,7 +1041,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: iter_free * @@ -1106,7 +1106,7 @@ iter_free(iter_t *iter) } /* end if */ } /* end iter_free() */ - + /*------------------------------------------------------------------------- * Function: print_file_info * @@ -1138,7 +1138,7 @@ print_file_info(const iter_t *iter) return 0; } /* print_file_info() */ - + /*------------------------------------------------------------------------- * Function: print_file_metadata * @@ -1198,7 +1198,7 @@ print_file_metadata(const iter_t *iter) return 0; } /* print_file_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_group_info * @@ -1255,7 +1255,7 @@ print_group_info(const iter_t *iter) return 0; } /* print_group_info() */ - + /*------------------------------------------------------------------------- * Function: print_group_metadata * @@ -1282,7 +1282,7 @@ print_group_metadata(const iter_t *iter) return 0; } /* print_group_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_dataset_info * @@ -1369,7 +1369,7 @@ print_dataset_info(const iter_t *iter) return 0; } /* print_dataset_info() */ - + /*------------------------------------------------------------------------- * Function: print_dataset_metadata * @@ -1398,7 +1398,7 @@ print_dset_metadata(const iter_t *iter) return 0; } /* print_dset_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_dset_dtype_meta * @@ -1439,7 +1439,7 @@ print_dset_dtype_meta(const iter_t *iter) return 0; } /* print_dset_dtype_meta() */ - + /*------------------------------------------------------------------------- * Function: print_attr_info * @@ -1488,7 +1488,7 @@ print_attr_info(const iter_t *iter) return 0; } /* print_attr_info() */ - + /*------------------------------------------------------------------------- * Function: print_freespace_info * @@ -1538,7 +1538,7 @@ print_freespace_info(const iter_t *iter) return 0; } /* print_freespace_info() */ - + /*------------------------------------------------------------------------- * Function: print_storage_summary * @@ -1602,7 +1602,7 @@ print_storage_summary(const iter_t *iter) return 0; } /* print_storage_summary() */ - + /*------------------------------------------------------------------------- * Function: print_file_statistics * @@ -1649,7 +1649,7 @@ print_file_statistics(const iter_t *iter) if(display_summary) print_storage_summary(iter); } /* print_file_statistics() */ - + /*------------------------------------------------------------------------- * Function: print_object_statistics * @@ -1672,7 +1672,7 @@ print_object_statistics(const char *name) printf("Object name %s\n", name); } /* print_object_statistics() */ - + /*------------------------------------------------------------------------- * Function: print_statistics * @@ -1698,7 +1698,7 @@ print_statistics(const char *name, const iter_t *iter) print_file_statistics(iter); } /* print_statistics() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -1780,15 +1780,15 @@ main(int argc, const char *argv[]) iter.free_hdr = finfo.free.meta_size; } /* end else */ - iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long)); - iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); - iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long)); + iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long)); + iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long)); + iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long)); - if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { - error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); - h5tools_setstatus(EXIT_FAILURE); - goto done; - } + if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { + error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } if((fcpl = H5Fget_create_plist(fid)) < 0) warn_msg("Unable to retrieve file creation property\n"); diff --git a/tools/test/h5dump/errfiles/filter_fail.err b/tools/test/h5dump/errfiles/filter_fail.err index a785ea7..6c936b7 100644 --- a/tools/test/h5dump/errfiles/filter_fail.err +++ b/tools/test/h5dump/errfiles/filter_fail.err @@ -2,19 +2,25 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dread(): can't read data major: Dataset minor: Read failed - #001: (file name) line (number) in H5D__read(): can't read data + #001: (file name) line (number) in H5VL_dataset_read(): read failed + major: Virtual Object Layer + minor: Read failed + #002: (file name) line (number) in H5VL_native_dataset_read(): can't read data + major: Dataset + minor: Read failed + #003: (file name) line (number) in H5D__read(): can't read data major: Dataset minor: Read failed - #002: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk + #004: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk major: Low-level I/O minor: Read failed - #003: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed + #005: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed major: Dataset minor: Filter operation failed - #004: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered + #006: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered major: Data filters minor: Read failed - #005: (file name) line (number) in H5PL_load(): filter plugins disabled + #007: (file name) line (number) in H5PL_load(): filter plugins disabled major: Plugin for dynamically loaded library minor: Unable to load metadata into cache h5dump error: unable to print data diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index f4c2d91..64d5aca 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -2,27 +2,33 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + major: Object header + minor: Can't open object + #003: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibilty + #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index f4c2d91..64d5aca 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -2,27 +2,33 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + major: Object header + minor: Can't open object + #003: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibilty + #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index f4c2d91..64d5aca 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -2,27 +2,33 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + major: Object header + minor: Can't open object + #003: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibilty + #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index f4c2d91..64d5aca 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -2,27 +2,33 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + major: Object header + minor: Can't open object + #003: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibilty + #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tarray1_big.err b/tools/test/h5dump/errfiles/tarray1_big.err index be77711..b2cc6b7 100644 --- a/tools/test/h5dump/errfiles/tarray1_big.err +++ b/tools/test/h5dump/errfiles/tarray1_big.err @@ -2,21 +2,39 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + major: References + minor: Can't open object + #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + major: References + minor: Can't open object + #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + major: References + minor: Can't open object + #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tattr-3.err b/tools/test/h5dump/errfiles/tattr-3.err index a6aae76..3190c3d 100644 --- a/tools/test/h5dump/errfiles/tattr-3.err +++ b/tools/test/h5dump/errfiles/tattr-3.err @@ -2,10 +2,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Aopen(): unable to open attribute: 'attr' major: Attribute minor: Can't open object - #001: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' + #001: (file name) line (number) in H5VL_attr_open(): attribute open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_attr_open(): unable to open attribute: 'attr' + major: Attribute + minor: Can't open object + #003: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' major: Attribute minor: Can't open object - #002: (file name) line (number) in H5O__attr_open_by_name(): can't locate attribute: 'attr' + #004: (file name) line (number) in H5O__attr_open_by_name(): can't locate attribute: 'attr' major: Attribute minor: Object not found h5dump error: unable to open attribute "attr" diff --git a/tools/test/h5dump/errfiles/tattrregR.err b/tools/test/h5dump/errfiles/tattrregR.err index d84d5ec..d89b053 100644 --- a/tools/test/h5dump/errfiles/tattrregR.err +++ b/tools/test/h5dump/errfiles/tattrregR.err @@ -2,14 +2,26 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + major: References + minor: Can't open object + #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + major: References + minor: Can't open object + #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tcomp-3.err b/tools/test/h5dump/errfiles/tcomp-3.err index e41e97a..3462761 100644 --- a/tools/test/h5dump/errfiles/tcomp-3.err +++ b/tools/test/h5dump/errfiles/tcomp-3.err @@ -2,18 +2,24 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Topen2(): unable to open named datatype major: Datatype minor: Can't open object - #001: (file name) line (number) in H5T__open_name(): not found + #001: (file name) line (number) in H5VL_datatype_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_datatype_open(): unable to open named datatype + major: Datatype + minor: Can't open object + #003: (file name) line (number) in H5T__open_name(): not found major: Datatype minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5G__loc_find_cb(): object '#6632' doesn't exist + #007: (file name) line (number) in H5G__loc_find_cb(): object '#6632' doesn't exist major: Symbol table minor: Object not found diff --git a/tools/test/h5dump/errfiles/tdataregR.err b/tools/test/h5dump/errfiles/tdataregR.err index d84d5ec..d89b053 100644 --- a/tools/test/h5dump/errfiles/tdataregR.err +++ b/tools/test/h5dump/errfiles/tdataregR.err @@ -2,14 +2,26 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + major: References + minor: Can't open object + #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + major: References + minor: Can't open object + #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err index e61966f..b2a60cd 100644 --- a/tools/test/h5dump/errfiles/tdset-2.err +++ b/tools/test/h5dump/errfiles/tdset-2.err @@ -2,35 +2,47 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dopen2(): unable to open dataset major: Dataset minor: Can't open object - #001: (file name) line (number) in H5D__open_name(): not found + #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_dataset_open(): unable to open dataset + major: Dataset + minor: Can't open object + #003: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5G__loc_find_cb(): object 'dset3' doesn't exist + #007: (file name) line (number) in H5G__loc_find_cb(): object 'dset3' doesn't exist major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5L_get_info(): name doesn't exist + #001: (file name) line (number) in H5VL_link_get(): get failed + major: Virtual Object Layer + minor: Can't get value + #002: (file name) line (number) in H5VL_native_link_get(): unable to get link info + major: Links + minor: Object not found + #003: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + #004: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #005: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #004: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #006: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "dset3" diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index 4a5f545..f516638 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -2,55 +2,67 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + major: Object header + minor: Can't open object + #003: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' + #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file - #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' - major: File accessibilty + #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' + major: File accessibility minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + major: Object header + minor: Can't open object + #003: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' + #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file - #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' - major: File accessibilty + #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err index 1f9241a..ba06406 100644 --- a/tools/test/h5dump/errfiles/textlinkfar.err +++ b/tools/test/h5dump/errfiles/textlinkfar.err @@ -2,49 +2,55 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + major: Object header + minor: Can't open object + #003: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L__extern_traverse(): unable to open object + #009: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #008: (file name) line (number) in H5O_open_name(): object not found + #010: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #009: (file name) line (number) in H5G_loc_find(): can't find object + #011: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #010: (file name) line (number) in H5G_traverse(): internal path traversal failed + #012: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #011: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #013: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #014: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #013: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #015: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #014: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #016: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #015: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #017: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err index 1f9241a..ba06406 100644 --- a/tools/test/h5dump/errfiles/textlinksrc.err +++ b/tools/test/h5dump/errfiles/textlinksrc.err @@ -2,49 +2,55 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + major: Object header + minor: Can't open object + #003: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L__extern_traverse(): unable to open object + #009: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #008: (file name) line (number) in H5O_open_name(): object not found + #010: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #009: (file name) line (number) in H5G_loc_find(): can't find object + #011: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #010: (file name) line (number) in H5G_traverse(): internal path traversal failed + #012: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #011: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #013: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #014: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #013: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #015: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #014: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #016: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #015: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #017: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tgroup-2.err b/tools/test/h5dump/errfiles/tgroup-2.err index 715f2d2..af220b8 100644 --- a/tools/test/h5dump/errfiles/tgroup-2.err +++ b/tools/test/h5dump/errfiles/tgroup-2.err @@ -2,19 +2,25 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Gopen2(): unable to open group major: Symbol table minor: Can't open object - #001: (file name) line (number) in H5G__open_name(): group not found + #001: (file name) line (number) in H5VL_group_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_group_open(): unable to open group + major: Symbol table + minor: Can't open object + #003: (file name) line (number) in H5G__open_name(): group not found major: Symbol table minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5G__loc_find_cb(): object 'y' doesn't exist + #007: (file name) line (number) in H5G__loc_find_cb(): object 'y' doesn't exist major: Symbol table minor: Object not found h5dump error: unable to open group "/y" diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index 648906b..1336de5 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -2,27 +2,33 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + major: Object header + minor: Can't open object + #003: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' - major: File accessibilty + #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index 648906b..1336de5 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -2,27 +2,33 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5VL_object_open(): open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + major: Object header + minor: Can't open object + #003: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' - major: File accessibilty + #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err index 733b652..4df7265 100644 --- a/tools/test/h5dump/errfiles/tperror.err +++ b/tools/test/h5dump/errfiles/tperror.err @@ -2,35 +2,47 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dopen2(): unable to open dataset major: Dataset minor: Can't open object - #001: (file name) line (number) in H5D__open_name(): not found + #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_dataset_open(): unable to open dataset + major: Dataset + minor: Can't open object + #003: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5G__loc_find_cb(): object 'bogus' doesn't exist + #007: (file name) line (number) in H5G__loc_find_cb(): object 'bogus' doesn't exist major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5L_get_info(): name doesn't exist + #001: (file name) line (number) in H5VL_link_get(): get failed + major: Virtual Object Layer + minor: Can't get value + #002: (file name) line (number) in H5VL_native_link_get(): unable to get link info + major: Links + minor: Object not found + #003: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + #004: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #005: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #004: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #006: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "bogus" diff --git a/tools/test/h5dump/errfiles/tslink-D.err b/tools/test/h5dump/errfiles/tslink-D.err index de0705e..ded6719 100644 --- a/tools/test/h5dump/errfiles/tslink-D.err +++ b/tools/test/h5dump/errfiles/tslink-D.err @@ -2,27 +2,33 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dopen2(): unable to open dataset major: Dataset minor: Can't open object - #001: (file name) line (number) in H5D__open_name(): not found + #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL_native_dataset_open(): unable to open dataset + major: Dataset + minor: Can't open object + #003: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #002: (file name) line (number) in H5G_loc_find(): can't find object + #004: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #005: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #007: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #008: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #009: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #008: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #010: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 4ef63e5..cbbbcfa 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -10574,7 +10574,7 @@ static void gent_null_space_group(void) *------------------------------------------------------------------------- */ static void -gent_err_attr_dspace() +gent_err_attr_dspace(void) { hid_t fid = -1; /* File identifier */ hid_t fcpl = -1; /* File access property list */ diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c index 667f2d9..26c725d 100644 --- a/tools/test/h5jam/tellub.c +++ b/tools/test/h5jam/tellub.c @@ -126,7 +126,7 @@ main (int argc, const char *argv[]) ifname = HDstrdup(argv[opt_ind]); - testval = H5Fis_hdf5(ifname); + testval = H5Fis_accessible(ifname, H5P_DEFAULT); if(testval <= 0) { error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname); diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst index 069fb3b..6009723 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst @@ -2,34 +2,40 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): unable to create dataset major: Dataset minor: Unable to initialize object - #001: (file name) line (number) in H5D__create_named(): unable to create and link to dataset + #001: (file name) line (number) in H5VL_dataset_create(): create failed + major: Virtual Object Layer + minor: Unable to initialize object + #002: (file name) line (number) in H5VL_native_dataset_create(): unable to create dataset + major: Dataset + minor: Unable to initialize object + #003: (file name) line (number) in H5D__create_named(): unable to create and link to dataset major: Dataset minor: Unable to initialize object - #002: (file name) line (number) in H5L_link_object(): unable to create new link to object + #004: (file name) line (number) in H5L_link_object(): unable to create new link to object major: Links minor: Unable to initialize object - #003: (file name) line (number) in H5L__create_real(): can't insert link + #005: (file name) line (number) in H5L__create_real(): can't insert link major: Links minor: Unable to insert object - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #006: (file name) line (number) in H5L__link_cb(): unable to create object + #008: (file name) line (number) in H5L__link_cb(): unable to create object major: Links minor: Unable to initialize object - #007: (file name) line (number) in H5O_obj_create(): unable to open object + #009: (file name) line (number) in H5O_obj_create(): unable to open object major: Object header minor: Can't open object - #008: (file name) line (number) in H5O__dset_create(): unable to create dataset + #010: (file name) line (number) in H5O__dset_create(): unable to create dataset major: Dataset minor: Unable to initialize object - #009: (file name) line (number) in H5D__create(): unable to construct layout information + #011: (file name) line (number) in H5D__create(): unable to construct layout information major: Dataset minor: Unable to initialize object - #010: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace + #012: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace major: Dataset minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): -- cgit v0.12 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 c3a813a37fb700d2d1039d6fdc54d8e377412b76 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 11 Oct 2018 15:08:02 -0700 Subject: Fixed a memory issue in H5Drefresh() where the dataset's H5VL_object_t gets closed but we try to use it to find the driver. --- src/H5Oflush.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/H5Oflush.c b/src/H5Oflush.c index b27f01b..84095d9 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -301,6 +301,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) H5O_loc_t obj_oloc; H5G_name_t obj_path; H5O_shared_t cached_H5O_shared; + H5VL_t *driver = NULL; /* Create empty object location */ obj_loc.oloc = &obj_oloc; @@ -318,25 +319,29 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) if(H5T_save_refresh_state(oid, &cached_H5O_shared) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state") - /* Get the VOL object from the ID */ + /* Get the VOL object from the ID and cache a pointer to the driver. + * 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))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + driver = vol_obj->driver; /* Bump the number of references on the VOL driver. * If you don't do this, VDS refreshes can accidentally close the driver. */ - vol_obj->driver->nrefs++; + driver->nrefs++; /* Close object & evict its metadata */ if((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Re-open the object, re-fetching its metadata */ - if((H5O_refresh_metadata_reopen(oid, &obj_loc, vol_obj->driver, FALSE)) < 0) + if((H5O_refresh_metadata_reopen(oid, &obj_loc, driver, FALSE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Restore the number of references on the VOL driver */ - vol_obj->driver->nrefs--; + driver->nrefs--; /* Restore important datatype state */ if(H5I_get_type(oid) == H5I_DATATYPE) -- cgit v0.12 From b0b9eda809282f362eb0e49bebd2956ba5a11bbc Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 12 Oct 2018 10:47:47 -0700 Subject: Fixed a C++ style commenting issue and removed an unused field from H5F_trav_obj_ids_t. --- src/H5F.c | 2 -- src/H5Fpkg.h | 1 - 2 files changed, 3 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 9258830..2dcafb9 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -477,8 +477,6 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) else { H5F_trav_obj_ids_t udata; - /* XXX (VOL MERGE): Unclear why this is commented out */ - //udata.types = types | H5F_OBJ_LOCAL; udata.max_objs = max_objs; udata.oid_list = oid_list; udata.obj_count = &ret_value; diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index f8ab5a9..e97144f 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -418,7 +418,6 @@ typedef struct { size_t max_objs; hid_t *oid_list; ssize_t *obj_count; /* number of objects counted so far */ - unsigned types; /* types of objects to be counted */ } H5F_trav_obj_ids_t; /*****************************/ -- 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 633b7f93ce6f2cca85c9930010fded235ff8eaa6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 9 Oct 2018 09:23:09 -0500 Subject: TRILAB-81 coverity fixes --- hl/tools/gif2h5/decompress.c | 2 +- tools/lib/h5diff.c | 8 +- tools/lib/h5tools.c | 32 +-- tools/lib/h5tools_dump.c | 88 +++---- tools/src/h5dump/h5dump_xml.c | 3 +- tools/src/h5import/h5import.c | 12 +- tools/src/h5repack/h5repack_copy.c | 6 +- tools/src/h5repack/h5repack_main.c | 2 + tools/test/h5format_convert/h5fc_gentest.c | 355 +++++++++++++++-------------- tools/test/h5jam/getub.c | 2 +- tools/test/h5repack/h5repacktst.c | 20 +- tools/test/h5stat/h5stat_gentest.c | 312 +++++++++++-------------- tools/test/perform/zip_perf.c | 6 +- 13 files changed, 409 insertions(+), 439 deletions(-) diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 453db12..6668c22 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -261,7 +261,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) * chain puts its associated output code on the output queue. */ while (CurCode > DataMask) { - if (OutCount > 1024) { + if (OutCount >= 1024) { /*return error message*/ } diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 28b1f00..594bf51 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -274,12 +274,15 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 int cmp; trav_table_t *table = NULL; size_t idx; + int ret_value = 0; h5difftrace("build_match_list start\n"); /* init */ trav_table_init(&table); - if (table == NULL) - H5TOOLS_INFO(H5E_tools_min_id_g, "Cannot create tarverse table"); + if (table == NULL) { + H5TOOLS_INFO(H5E_tools_min_id_g, "Cannot create traverse table"); + HGOTO_DONE(-1); + } /* * This is necessary for the case that given objects are group and * have different names (ex: obj1 is /grp1 and obj2 is /grp5). @@ -367,6 +370,7 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 free_exclude_path_list (opts); +done: *table_out = table; h5difftrace("build_match_list finish\n"); } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 470df63..d93f7b0 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1241,10 +1241,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t H5T_class_t type_class; if((size = H5Tget_size(tid)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed") if((type_class = H5Tget_class(tid)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed") switch (type_class) { case H5T_INTEGER: @@ -1264,7 +1264,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t bytes_wrote = HDfwrite(mem, 1, bytes_in, stream); if(bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed") block_index -= (hsize_t)bytes_wrote; mem = mem + bytes_wrote; @@ -1287,7 +1287,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t if (s != NULL) size = HDstrlen(s); else - H5E_THROW(FAIL, H5E_tools_min_id_g, "NULL string"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "NULL string") } else { s = (char *) mem; @@ -1295,7 +1295,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); if (1 != HDfwrite(&tempuchar, sizeof(unsigned char), 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed") } /* i */ } /* for (block_index = 0; block_index < block_nelmts; block_index++) */ } @@ -1306,7 +1306,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t unsigned nmembs; if((snmembs = H5Tget_nmembers(tid)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed") nmembs = (unsigned)snmembs; for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -1322,7 +1322,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed") } H5Tclose(memb); @@ -1350,7 +1350,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } else { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed") } for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -1358,7 +1358,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t /* dump the array element */ if (render_bin_output(stream, container, memb, mem, nelmts) < 0) { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed") } } H5Tclose(memb); @@ -1380,7 +1380,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t /* dump the array element */ if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed") } } H5Tclose(memb); @@ -1426,7 +1426,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; if (size != HDfwrite(mem, sizeof(char), size, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed") } /* end for */ break; @@ -1434,7 +1434,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t case H5T_NCLASSES: default: /* Badness */ - H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class") break; } /* end switch */ @@ -1562,12 +1562,12 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, hid_t type_id = -1; if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed") nblocks = (hsize_t)snblocks; /* Print block information */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") ndims = (unsigned)sndims; alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); @@ -1683,12 +1683,12 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, hid_t type_id = -1; if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed") npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") ndims = (unsigned)sndims; if((dtype = H5Dget_type(region_id)) < 0) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 69cecb0..a8b7e30 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -618,12 +618,12 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, HDassert(buffer); if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed") nblocks = (hsize_t)snblocks; /* Print block information */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") ndims = (unsigned)sndims; /* Render the region { element begin */ @@ -944,12 +944,12 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, HDassert(buffer); if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed") npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") ndims = (unsigned)sndims; /* Render the region { element begin */ @@ -1156,7 +1156,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c unsigned int vl_data = 0; /* contains VL datatypes */ if ((size_t) ctx->ndims > NELMTS(sm_size)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed") if (ctx->ndims > 0) init_acc_pos(ctx, total_size); @@ -1184,10 +1184,10 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* calculate the potential number of elements we're going to print */ if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed") if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed") sm_nelmts = (hsize_t)ssm_nelmts; if (sm_nelmts > 0) { @@ -1196,7 +1196,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c * a hyperslab whose size is manageable. */ if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed") if (ctx->ndims > 0) for (i = ctx->ndims; i > 0; --i) { @@ -1210,17 +1210,17 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c HDassert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine") if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed") if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed") /* read the data */ if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed") /* print the data */ flags = START_OF_DATA; @@ -1234,7 +1234,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* print array indices. get the lower bound of the hyperslab and calulate the element position at the start of hyperslab */ if(H5Sget_select_bounds(f_space, low, high) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed") elmtno = 0; for (i = 0; i < (size_t) ctx->ndims - 1; i++) { @@ -1259,13 +1259,13 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); if(H5Sclose(sm_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") if(sm_buf) HDfree(sm_buf); sm_buf = NULL; } else - H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print"); + H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print") ctx->continuation++; @@ -1462,10 +1462,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ if((f_space = H5Dget_space(dset)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed") if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") ctx->ndims = (unsigned)sndims; /* assume entire data space to be printed */ @@ -1474,7 +1474,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co ctx->p_min_idx[i] = 0; if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed") ctx->size_last_dim = total_size[ctx->ndims - 1]; /* Set the compound datatype field list for display */ @@ -1484,7 +1484,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co CATCH if(f_space >= 0 && H5Sclose(f_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") return ret_value; } @@ -1540,15 +1540,15 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont f_space = H5Dget_space(dset); if (f_space == FAIL) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed") sndims = H5Sget_simple_extent_ndims(f_space); if(sndims < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed") ctx->ndims = (unsigned)sndims; if ((size_t)ctx->ndims > NELMTS(sm_size)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed") /* Assume entire data space to be printed */ if (ctx->ndims > 0) @@ -1629,7 +1629,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont /* Read the data */ if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) { - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed") } /* Print the data */ @@ -1667,9 +1667,9 @@ CATCH done: if(sm_space >= 0 && H5Sclose(sm_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") if(f_space >= 0 && H5Sclose(f_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") return ret_value; } @@ -1696,11 +1696,11 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte sndims = H5Sget_simple_extent_ndims(space); if(sndims < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed") ctx->ndims = (unsigned)sndims; if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed") /* Assume entire data space to be printed */ for (i = 0; i < ctx->ndims; i++) @@ -1900,7 +1900,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ const char *order_s = NULL; /* byte order string */ if((type_class = H5Tget_class(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed") if (object_search && H5Tcommitted(type) > 0) { H5O_info_t oinfo; obj_t *obj = NULL; /* Found object */ @@ -2280,7 +2280,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ char *ttag; if(NULL == (ttag = H5Tget_tag(type))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed") ctx->need_prefix = TRUE; @@ -2300,7 +2300,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_COMPOUND: if((snmembers = H5Tget_nmembers(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed") nmembers = (unsigned)snmembers; h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin); @@ -2344,7 +2344,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_ENUM: if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed") h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -2374,14 +2374,14 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_VLEN: if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed") h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin); h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); if(H5Tclose(super) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed") h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend); @@ -2456,10 +2456,10 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) int i; if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed") if((space_type = H5Sget_simple_extent_type(space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed") switch(space_type) { case H5S_SCALAR: @@ -2544,15 +2544,15 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i ncols = info->line_ncols; if((snmembs = H5Tget_nmembers(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed") nmembs = (unsigned)snmembs; HDassert(nmembs > 0); if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed") if((type_size = H5Tget_size(type)) <= 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed") /* * Determine what datatype to use for the native values. To simplify @@ -2565,7 +2565,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i dst_size = sizeof(long long); if((sign_type = H5Tget_sign(type))<0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed") if(H5T_SGN_NONE == sign_type) native = H5T_NATIVE_ULLONG; else @@ -2576,20 +2576,20 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i /* Get the names and raw values of all members */ if(NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name") if(NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size)))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value") for (i = 0; i < nmembs; i++) { name[i] = H5Tget_member_name(type, i); if(H5Tget_member_value(type, i, value + i * type_size) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed") } /* Convert values to native datatype */ if (native > 0) if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed") /* * Sort members by increasing value @@ -2646,7 +2646,7 @@ CATCH HDfree(value); if(super >= 0 && H5Tclose(super) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class"); + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class") if(0 == nmembs) h5tools_str_append(buffer, "\n"); diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index e399d8f..ec76511 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -3438,8 +3438,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\""); for (i = 0; i < sz; i++) { - h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf); - buf = (char *) buf + sizeof(unsigned int); + h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf + (i * sizeof(unsigned int))); } h5tools_str_append(&buffer, "\""); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 3b64a0e..ea40322 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -98,6 +98,9 @@ int main(int argc, char *argv[]) (void) HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0); (void) HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0); + /* Initialize the file structure to 0 */ + HDmemset(&opt, 0, sizeof(struct Options)); + if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) { print_version(PROGRAMNAME); HDexit(EXIT_SUCCESS); @@ -112,9 +115,6 @@ int main(int argc, char *argv[]) goto err; } - /* Initialize the file structure to 0 */ - HDmemset(&opt, 0, sizeof(struct Options)); - /* * parse the command line */ @@ -1665,7 +1665,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } else { /* Dimension */ icount++; - if (icount > MAX_NUM_DIMENSION) { + if (icount >+ MAX_NUM_DIMENSION) { (void) HDfprintf(stderr, "Invalid value for rank.\n"); goto error; } @@ -1750,7 +1750,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } else { /* comma */ i++; - if (i > MAX_NUM_DIMENSION) { + if (i >= MAX_NUM_DIMENSION) { (void) HDfprintf(stderr, "Invalid value for rank.\n"); goto error; } @@ -2023,7 +2023,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } else { /* Dimension */ icount++; - if (icount > MAX_NUM_DIMENSION) { + if (icount >= MAX_NUM_DIMENSION) { (void) HDfprintf(stderr, "Invalid value for rank.\n"); goto error; } diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index b279cf9..0567269 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -1422,9 +1422,9 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) } /* end while */ done: - if (infid > 0) + if (infid >= 0) HDclose(infid); - if (outfid > 0) + if (outfid >= 0) HDclose(outfid); return ret_value; @@ -1497,7 +1497,7 @@ print_user_block(const char *filename, hid_t fid) } done: - if (fh > 0) + if (fh >= 0) HDclose(fh); return; diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 8f0178f..dec25f9 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -707,6 +707,8 @@ int main(int argc, const char **argv) void *edata; void *tools_edata; + HDmemset(&options, 0, sizeof(pack_opt_t)); + h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c index 8c873be..e112c9e 100644 --- a/tools/test/h5format_convert/h5fc_gentest.c +++ b/tools/test/h5format_convert/h5fc_gentest.c @@ -14,7 +14,7 @@ /* * Generate the binary hdf5 files for the h5format_convert tests. * Usage: just execute the program without any arguments will - * generate all the binary hdf5 files + * generate all the binary hdf5 files * * If you regenerate the test files (e.g., changing some code, * trying it on a new platform, ...), you need to verify the correctness @@ -24,71 +24,71 @@ #include "hdf5.h" #include "H5private.h" -#define NON_V3_FILE "h5fc_non_v3.h5" -#define EDGE_V3_FILE "h5fc_edge_v3.h5" -#define ERR_LEVEL_FILE "h5fc_err_level.h5" +#define NON_V3_FILE "h5fc_non_v3.h5" +#define EDGE_V3_FILE "h5fc_edge_v3.h5" +#define ERR_LEVEL_FILE "h5fc_err_level.h5" const char *FILENAME[] = { - "h5fc_ext1_i.h5", /* 0 */ - "h5fc_ext1_s.h5", /* 1 */ - "h5fc_ext1_f.h5", /* 2 */ - "h5fc_ext2_is.h5", /* 3 */ - "h5fc_ext2_if.h5", /* 4 */ - "h5fc_ext2_sf.h5", /* 5 */ - "h5fc_ext3_isf.h5", /* 6 */ - "h5fc_ext_none.h5", /* 7 */ + "h5fc_ext1_i.h5", /* 0 */ + "h5fc_ext1_s.h5", /* 1 */ + "h5fc_ext1_f.h5", /* 2 */ + "h5fc_ext2_is.h5", /* 3 */ + "h5fc_ext2_if.h5", /* 4 */ + "h5fc_ext2_sf.h5", /* 5 */ + "h5fc_ext3_isf.h5", /* 6 */ + "h5fc_ext_none.h5", /* 7 */ NULL }; -#define GROUP "GROUP" +#define GROUP "GROUP" -#define DSET_COMPACT "DSET_COMPACT" -#define DSET_CONTIGUOUS "DSET_CONTIGUOUS" +#define DSET_COMPACT "DSET_COMPACT" +#define DSET_CONTIGUOUS "DSET_CONTIGUOUS" -#define DSET_EA "DSET_EA" -#define DSET_NDATA_EA "DSET_NDATA_EA" -#define DSET_BT2 "DSET_BT2" -#define DSET_NDATA_BT2 "DSET_NDATA_BT2" -#define DSET_FA "DSET_FA" -#define DSET_NDATA_FA "DSET_NDATA_FA" -#define DSET_NONE "DSET_NONE" -#define DSET_NDATA_NONE "DSET_NDATA_NONE" +#define DSET_EA "DSET_EA" +#define DSET_NDATA_EA "DSET_NDATA_EA" +#define DSET_BT2 "DSET_BT2" +#define DSET_NDATA_BT2 "DSET_NDATA_BT2" +#define DSET_FA "DSET_FA" +#define DSET_NDATA_FA "DSET_NDATA_FA" +#define DSET_NONE "DSET_NONE" +#define DSET_NDATA_NONE "DSET_NDATA_NONE" -#define DSET_EDGE "DSET_EDGE" -#define DSET_ERR "DSET_ERR" +#define DSET_EDGE "DSET_EDGE" +#define DSET_ERR "DSET_ERR" #define ISTORE_IK 64 -#define ISTORE_ERR 1 +#define ISTORE_ERR 1 #define NUM 500 /* - * Function: gen_non() + * Function: gen_non() * * Create a file with SWMR write+non-latest-format--this will result in v3 superbock+latest version support: - * 1) 1 chunked dataset with extensible array chunk indexing type (without data) - * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data) + * 1) 1 chunked dataset with extensible array chunk indexing type (without data) + * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data) * Re-open the file with write+non-latest-format and create: - * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data) - * 4) 1 chunked dataset with extensible array indexing type (with data) - * 5) 1 compact and 1 contiguous datasets + * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data) + * 4) 1 chunked dataset with extensible array indexing type (with data) + * 5) 1 compact and 1 contiguous datasets */ static void gen_non(const char *fname) { - hid_t fid = -1; /* file id */ - hid_t fcpl = -1; /* file creation property list */ - hid_t gid = -1; /* group id */ - hid_t sid = -1; /* space id */ - hid_t dcpl = -1; /* dataset creation property id */ - hid_t did1 = -1, did2 = -1; /* dataset id */ - hsize_t dims1[1] = {10}; /* dataset dimension */ - hsize_t dims2[2] = {4, 6}; /* dataset dimension */ - hsize_t max_dims[2]; /* maximum dataset dimension */ - hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ - int i; /* local index variable */ - int buf[24]; /* data buffer */ + hid_t fid = -1; /* file id */ + hid_t fcpl = -1; /* file creation property list */ + hid_t gid = -1; /* group id */ + hid_t sid = -1; /* space id */ + hid_t dcpl = -1; /* dataset creation property id */ + hid_t did1 = -1, did2 = -1; /* dataset id */ + hsize_t dims1[1] = {10}; /* dataset dimension */ + hsize_t dims2[2] = {4, 6}; /* dataset dimension */ + hsize_t max_dims[2]; /* maximum dataset dimension */ + hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ + int i; /* local index variable */ + int buf[24]; /* data buffer */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; @@ -115,7 +115,7 @@ gen_non(const char *fname) if(H5Pset_chunk(dcpl, 2, c_dims) < 0) goto error; - /* + /* * Create a chunked dataset with extensible array chunk indexing type (without data) */ @@ -135,7 +135,7 @@ gen_non(const char *fname) if(H5Dclose(did1) < 0) goto error; - /* + /* * Create a chunked dataset with version 2 B-tree chunk indexing type (with data) */ @@ -226,7 +226,7 @@ gen_non(const char *fname) if(H5Dclose(did2) < 0) goto error; - /* + /* * Create a compact dataset in the group */ @@ -251,7 +251,7 @@ gen_non(const char *fname) if(H5Sclose(sid) < 0) goto error; - /* + /* * Create a contiguous dataset with (2d with data) in the file */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) @@ -278,9 +278,9 @@ gen_non(const char *fname) goto error; if(H5Gclose(gid) < 0) - goto error; + goto error; if(H5Pclose(fcpl) < 0) - goto error; + goto error; if(H5Fclose(fid) < 0) goto error; @@ -298,24 +298,24 @@ error: } /* gen_non() */ /* - * Function: gen_edge() + * Function: gen_edge() * * Create a file with write+latest-format--this will result in v3 superblock+latest version support: - * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled - * (i.e. the dataset does not filter partial edge chunks) + * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled + * (i.e. the dataset does not filter partial edge chunks) */ static void gen_edge(const char *fname) { - hid_t fid = -1; /* file id */ - hid_t fapl = -1; /* file access property list */ - hid_t sid = -1; /* dataspace id */ - hid_t dcpl = -1; /* dataset creation property id */ - hid_t did = -1; /* dataset id */ - hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */ - hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */ - float buf[12][6]; /* Buffer for writing data */ - int i, j; /* local index variable */ + hid_t fid = -1; /* file id */ + hid_t fapl = -1; /* file access property list */ + hid_t sid = -1; /* dataspace id */ + hid_t dcpl = -1; /* dataset creation property id */ + hid_t did = -1; /* dataset id */ + hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */ + hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */ + float buf[12][6]; /* Buffer for writing data */ + int i, j; /* local index variable */ /* Create a new format file */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -377,37 +377,37 @@ error: /* - * Function: gen_err_level() + * Function: gen_err_level() * * Generate a file to test the situtation described in HDFFV-9434: - * Exceed the limit of v1-btree level + * Exceed the limit of v1-btree level * - * Create a file with H5Pset_istore_k(fcpl, 1). - * Create a chunked dataset with extensible array chunk index and - * appends many chunks to the dataset. + * Create a file with H5Pset_istore_k(fcpl, 1). + * Create a chunked dataset with extensible array chunk index and + * appends many chunks to the dataset. * - * When h5format_convert tries to convert the dataset with - * extensive array index in the file to v1-btree chunk index, - * it will insert the dataset chunks to the v1-btree chunk index. - * The tree will split quickly due to the 'K' value of 1 and the - * tree level will eventually hit the maximum: 2^8(256). + * When h5format_convert tries to convert the dataset with + * extensive array index in the file to v1-btree chunk index, + * it will insert the dataset chunks to the v1-btree chunk index. + * The tree will split quickly due to the 'K' value of 1 and the + * tree level will eventually hit the maximum: 2^8(256). */ static void gen_err_level(const char *fname) { - hid_t fid = -1; /* file ID */ - hid_t fapl = -1; /* file access property list */ - hid_t fcpl = -1; /* file creation property list */ - hid_t sid = -1; /* dataspace id */ - hid_t dcpl = -1; /* dataset creation property list */ - hid_t did = -1; /* dataset ID */ - hid_t fsid = -1; /* file dataspace ID */ - hid_t msid = -1; /* memory dataspace ID */ - unsigned char *buf = NULL; /* buffer for data */ - hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */ - hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */ - hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */ - int n = 0; /* local index variable */ + hid_t fid = -1; /* file ID */ + hid_t fapl = -1; /* file access property list */ + hid_t fcpl = -1; /* file creation property list */ + hid_t sid = -1; /* dataspace id */ + hid_t dcpl = -1; /* dataset creation property list */ + hid_t did = -1; /* dataset ID */ + hid_t fsid = -1; /* file dataspace ID */ + hid_t msid = -1; /* memory dataspace ID */ + unsigned char *buf = NULL; /* buffer for data */ + hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */ + hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */ + hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */ + int n = 0; /* local index variable */ /* Create a new format file */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -459,50 +459,51 @@ gen_err_level(const char *fname) /* Loop through appending 1 element at a time */ for(n = 0; n < NUM; n++) { - hsize_t start[2] = {0, 0}; - hsize_t count[2] = {1, 1}; - hsize_t extent[2] = {0, 0}; - - start[0] = 0; - start[1] = (hsize_t)n; - extent[0] = 1; - extent[1] = (hsize_t)(n + 1); - - /* Set current dimension sizes for the dataset */ - if(H5Dset_extent(did, extent) < 0) - goto error; - - /* Set up memory dataspace */ - if((msid = H5Screate_simple(2, count, NULL)) < 0) - goto error; - - /* Get file dataspace */ - if((fsid = H5Dget_space(did)) < 0) - goto error; - - if((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0) - goto error; - - /* Write to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0) - goto error; - - if(H5Sclose(fsid) < 0) - goto error; - if(H5Sclose(msid) < 0) - goto error; + hsize_t start[2] = {0, 0}; + hsize_t count[2] = {1, 1}; + hsize_t extent[2] = {0, 0}; + + start[0] = 0; + start[1] = (hsize_t)n; + extent[0] = 1; + extent[1] = (hsize_t)(n + 1); + + /* Set current dimension sizes for the dataset */ + if(H5Dset_extent(did, extent) < 0) + goto error; + + /* Set up memory dataspace */ + if((msid = H5Screate_simple(2, count, NULL)) < 0) + goto error; + + /* Get file dataspace */ + if((fsid = H5Dget_space(did)) < 0) + goto error; + + if((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0) + goto error; + + /* Write to the dataset */ + if(H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0) + goto error; + + if(H5Sclose(fsid) < 0) + goto error; + if(H5Sclose(msid) < 0) + goto error; } /* Closing */ if(H5Dclose(did) < 0) - goto error; + goto error; if(H5Fclose(fid) < 0) - goto error; + goto error; if(H5Pclose(fapl) < 0) - goto error; - if(buf) free(buf); + goto error; error: + if(buf) + free(buf); H5E_BEGIN_TRY { H5Pclose(dcpl); H5Sclose(sid); @@ -517,33 +518,33 @@ error: } /* gen_err_level() */ /* - * Function: gen_ext() + * Function: gen_ext() * * Create a file with/without latest format with: - * 1) 1 contiguous dataset (without data) - * 2) 2 chunked datasets with extensible array chunk indexing type (with/without data) - * 3) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data) - * 4) 2 chunked datasets with fixed array chunk indexing type (with/without data) - * 5) 2 chunked datasets with implicit array chunk indexing type (with/without data) + * 1) 1 contiguous dataset (without data) + * 2) 2 chunked datasets with extensible array chunk indexing type (with/without data) + * 3) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data) + * 4) 2 chunked datasets with fixed array chunk indexing type (with/without data) + * 5) 2 chunked datasets with implicit array chunk indexing type (with/without data) * It will create the file with/without messages in the superblock extension depending * on the parameter "what". */ static void gen_ext(const char *fname, unsigned new_format, unsigned what) { - hid_t fid = -1; /* file id */ - hid_t fapl = -1; /* file access property list */ - hid_t fcpl = -1; /* file creation property list */ - hid_t gid = -1; /* group id */ - hid_t sid = -1; /* space id */ - hid_t dcpl = -1; /* dataset creation property id */ - hid_t did1 = -1, did2 = -1; /* dataset id */ - hsize_t dims1[1] = {10}; /* dataset dimension */ - hsize_t dims2[2] = {4, 6}; /* dataset dimension */ - hsize_t max_dims[2]; /* maximum dataset dimension */ - hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ - int i; /* local index variable */ - int buf[24]; /* data buffer */ + hid_t fid = -1; /* file id */ + hid_t fapl = -1; /* file access property list */ + hid_t fcpl = -1; /* file creation property list */ + hid_t gid = -1; /* group id */ + hid_t sid = -1; /* space id */ + hid_t dcpl = -1; /* dataset creation property id */ + hid_t did1 = -1, did2 = -1; /* dataset id */ + hsize_t dims1[1] = {10}; /* dataset dimension */ + hsize_t dims2[2] = {4, 6}; /* dataset dimension */ + hsize_t max_dims[2]; /* maximum dataset dimension */ + hsize_t c_dims[2] = {2, 3}; /* chunk dimension */ + int i; /* local index variable */ + int buf[24]; /* data buffer */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; @@ -559,34 +560,34 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) /* Generate messages that might be placed in superblock extension */ switch(what) { - case 0: - H5Pset_istore_k(fcpl, ISTORE_IK); - break; - case 1: - H5Pset_shared_mesg_nindexes(fcpl, 4); - break; - case 2: - H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1); - break; - case 3: - H5Pset_istore_k(fcpl, ISTORE_IK); - H5Pset_shared_mesg_nindexes(fcpl, 4); - break; - case 4: - H5Pset_istore_k(fcpl, ISTORE_IK); - H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1); - break; - case 5: - H5Pset_shared_mesg_nindexes(fcpl, 4); - H5Pset_file_space_page_size(fcpl, (hsize_t)512); - break; - case 6: - H5Pset_istore_k(fcpl, ISTORE_IK); - H5Pset_shared_mesg_nindexes(fcpl, 4); - H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1); - break; - default: - break; + case 0: + H5Pset_istore_k(fcpl, ISTORE_IK); + break; + case 1: + H5Pset_shared_mesg_nindexes(fcpl, 4); + break; + case 2: + H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1); + break; + case 3: + H5Pset_istore_k(fcpl, ISTORE_IK); + H5Pset_shared_mesg_nindexes(fcpl, 4); + break; + case 4: + H5Pset_istore_k(fcpl, ISTORE_IK); + H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1); + break; + case 5: + H5Pset_shared_mesg_nindexes(fcpl, 4); + H5Pset_file_space_page_size(fcpl, (hsize_t)512); + break; + case 6: + H5Pset_istore_k(fcpl, ISTORE_IK); + H5Pset_shared_mesg_nindexes(fcpl, 4); + H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1); + break; + default: + break; } /* Create the file */ @@ -604,8 +605,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) goto error; - /* - * Create a contiguous dataset + /* + * Create a contiguous dataset */ /* Create dataspace */ @@ -622,8 +623,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) if(H5Dclose(did1) < 0) goto error; - /* - * Create 2 chunked datasets with extensible array chunk indexing type + /* + * Create 2 chunked datasets with extensible array chunk indexing type * (one with data; one without data) */ @@ -657,8 +658,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) goto error; - /* - * Create 2 chunked datasets with version 2 B-tree chunk indexing type + /* + * Create 2 chunked datasets with version 2 B-tree chunk indexing type * (one with data; one without data) */ @@ -689,7 +690,7 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) goto error; /* - * Create 2 chunked datasets with fixed array chunk indexing type + * Create 2 chunked datasets with fixed array chunk indexing type * (one with data; one without data) */ @@ -719,8 +720,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what) goto error; - /* - * Create 2 chunked datasets with implicit chunk indexing type + /* + * Create 2 chunked datasets with implicit chunk indexing type * (one with data; one without data) */ diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index 7cfde36..26a427d 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -148,7 +148,7 @@ main(int argc, const char *argv[]) error: if(buf) HDfree(buf); - if(fd > -1) + if(fd >= 0) HDclose(fd); return EXIT_FAILURE; } /* end main() */ diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index f6166da..0ae570b 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -3728,7 +3728,7 @@ out: H5Pclose(fcpl); H5Fclose(fid); } H5E_END_TRY; - if(fd > 0) + if(fd >= 0) HDclose(fd); return -1; @@ -3797,7 +3797,7 @@ out: H5Pclose(fcpl); H5Fclose(fid); } H5E_END_TRY; - if(fd > 0) + if(fd >= 0) HDclose(fd); return -1; @@ -3838,7 +3838,7 @@ make_userblock_file(void) out: - if(fd > 0) + if(fd >= 0) HDclose(fd); return -1; @@ -4134,13 +4134,19 @@ int write_dset_in(hid_t loc_id, } /* create a type larger than TEST_BUFSIZE */ - if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) + if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) { + HDfree(dbuf); goto out; + } size = H5Tget_size(tid); - if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) + if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) { + HDfree(dbuf); goto out; - if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + } + if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + HDfree(dbuf); goto out; + } #if defined(WRITE_ARRAY) H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf); #endif @@ -4149,7 +4155,7 @@ int write_dset_in(hid_t loc_id, H5Dclose(did); H5Tclose(tid); H5Sclose(sid); - HDfree( dbuf ); + HDfree(dbuf); } /*------------------------------------------------------------------------- diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c index 2daf24b..ae11032 100644 --- a/tools/test/h5stat/h5stat_gentest.c +++ b/tools/test/h5stat/h5stat_gentest.c @@ -14,7 +14,7 @@ /* * Generate the binary hdf5 files for the h5stat tests. * Usage: just execute the program without any arguments will - * generate all the binary hdf5 files + * generate all the binary hdf5 files * * If you regenerate the test files (e.g., changing some code, * trying it on a new platform, ...), you need to verify the correctness @@ -24,25 +24,25 @@ #include "H5private.h" /* For gen_newgrat_file() */ -#define NEWGRAT_FILE "h5stat_newgrat.h5" -#define DATASET_NAME "DATASET_NAME" -#define GROUP_NAME "GROUP" -#define ATTR_NAME "ATTR" -#define NUM_GRPS 35000 -#define NUM_ATTRS 100 +#define NEWGRAT_FILE "h5stat_newgrat.h5" +#define DATASET_NAME "DATASET_NAME" +#define GROUP_NAME "GROUP" +#define ATTR_NAME "ATTR" +#define NUM_GRPS 35000 +#define NUM_ATTRS 100 /* Declarations for gen_idx_file() */ -#define IDX_FILE "h5stat_idx.h5" -#define DSET "dset" -#define DSET_FILTER "dset_filter" +#define IDX_FILE "h5stat_idx.h5" +#define DSET "dset" +#define DSET_FILTER "dset_filter" /* For gen_threshold_file() */ -#define THRESHOLD_FILE "h5stat_threshold.h5" -#define THRES_ATTR_NAME "attr" -#define THRES_ATTR_GRP_NAME "grp_attr" -#define THRES_DSET_NAME "dset" -#define THRES_NUM 10 -#define THRES_NUM_25 25 +#define THRESHOLD_FILE "h5stat_threshold.h5" +#define THRES_ATTR_NAME "attr" +#define THRES_ATTR_GRP_NAME "grp_attr" +#define THRES_DSET_NAME "dset" +#define THRES_NUM 10 +#define THRES_NUM_25 25 /* For gen_err_refcount() */ #define ERR_REFCOUNT_FILE "h5stat_err_refcount.h5" @@ -51,7 +51,7 @@ * Generate HDF5 file with latest format with * NUM_GRPS groups and NUM_ATTRS attributes for the dataset */ -static void +static void gen_newgrat_file(const char *fname) { hid_t fcpl = -1; /* File creation property */ @@ -62,79 +62,66 @@ gen_newgrat_file(const char *fname) hid_t sid = -1; /* Dataspace id */ hid_t attr_id = -1; /* Attribute id */ hid_t did = -1; /* Dataset id */ - char name[30]; /* Group name */ - char attrname[30]; /* Attribute name */ - int i; /* Local index variable */ + char name[30]; /* Group name */ + char attrname[30]; /* Attribute name */ + int i; /* Local index variable */ /* Get a copy file access property list */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; + goto error; /* Set to use latest library format */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; + goto error; /* Get a copy of file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - goto error; + goto error; /* Set file space handling strategy */ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1) < 0) - goto error; + goto error; /* Create file */ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - goto error; + goto error; /* Create NUM_GRPS groups in the root group */ for(i = 1; i <= NUM_GRPS; i++) { sprintf(name, "%s%d", GROUP_NAME,i); if((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Gclose(gid) < 0) - goto error; + goto error; } /* end for */ /* Create a datatype to commit and use */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) - goto error; + goto error; /* Create dataspace for dataset */ if((sid = H5Screate(H5S_SCALAR)) < 0) - goto error; + goto error; /* Create dataset */ if((did = H5Dcreate2(fid, DATASET_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create NUM_ATTRS for the dataset */ for(i = 1; i <= NUM_ATTRS; i++) { sprintf(attrname, "%s%d", ATTR_NAME,i); if((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Aclose(attr_id) < 0) - goto error; + goto error; } /* end for */ /* Close dataset, dataspace, datatype, file */ - if(H5Pclose(fapl) < 0) - goto error; - if(H5Pclose(fcpl) < 0) - goto error; - if(H5Dclose(did) < 0) - goto error; - if(H5Sclose(sid) < 0) - goto error; - if(H5Tclose(tid) < 0) - goto error; - if(H5Fclose(fid) < 0) - goto error; - error: H5E_BEGIN_TRY { - H5Pclose(fapl); - H5Pclose(fcpl); - H5Aclose(attr_id); + H5Pclose(fapl); + H5Pclose(fcpl); + H5Aclose(attr_id); H5Dclose(did); H5Tclose(tid); H5Sclose(sid); @@ -145,192 +132,175 @@ error: /* * Generate an HDF5 file with groups, datasets, attributes for testing the options: - * -l N (--links=N): Set the threshold for # of links when printing information for small groups. - * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets. - * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes. + * -l N (--links=N): Set the threshold for # of links when printing information for small groups. + * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets. + * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes. */ static void gen_threshold_file(const char *fname) { - hid_t fid; /* File ID */ - hid_t sid0, sid1, sid2, sid3, sid4; /* Dataspace IDs */ - hid_t did; /* Dataset ID */ - hid_t attr_id; /* Attribute ID */ - hid_t gid; /* Group ID */ - hsize_t two_dims[] = {2, 5}; /* Dimension array */ - hsize_t one_dims[] = {6}; /* Dimension array */ - hsize_t zero_dims[] = {0}; /* Dimension array */ - char name[30]; /* Name */ - unsigned i; /* Local index variable */ + hid_t fid = -1; /* File ID */ + hid_t sid0 = -1; /* Dataspace IDs */ + hid_t sid1 = -1; /* Dataspace IDs */ + hid_t sid2 = -1; /* Dataspace IDs */ + hid_t sid3 = -1; /* Dataspace IDs */ + hid_t sid4 = -1; /* Dataspace IDs */ + hid_t did = -1; /* Dataset ID */ + hid_t attr_id = -1; /* Attribute ID */ + hid_t gid = -1; /* Group ID */ + hsize_t two_dims[] = {2, 5}; /* Dimension array */ + hsize_t one_dims[] = {6}; /* Dimension array */ + hsize_t zero_dims[] = {0}; /* Dimension array */ + char name[30]; /* Name */ + unsigned i; /* Local index variable */ /* Create file */ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create 1-D dataspace with zero dimension size */ if((sid0 = H5Screate_simple(1, zero_dims, NULL)) < 0) - goto error; + goto error; /* Create 1-D dataspace with non-zero dimension size*/ if((sid1 = H5Screate_simple(1, one_dims, NULL)) < 0) - goto error; + goto error; /* Create 2-D dataspace */ if((sid2 = H5Screate_simple(2, two_dims, NULL)) < 0) - goto error; + goto error; /* Create scalar dataspace */ if((sid3 = H5Screate(H5S_SCALAR)) < 0) - goto error; + goto error; /* Create null dataspace */ if((sid4 = H5Screate(H5S_NULL)) < 0) - goto error; + goto error; /* Create an attribute for the root group */ if((attr_id = H5Acreate2(fid, "attr", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Aclose(attr_id) < 0) - goto error; + goto error; /* Create 1-D dataset with zero dimension size for the root group */ if((did = H5Dcreate2(fid, "zero_dset", H5T_NATIVE_UCHAR, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create 11 attributes for the dataset */ for(i = 1; i <= (THRES_NUM+1); i++) { sprintf(name, "%s%d", THRES_ATTR_NAME,i); if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Aclose(attr_id) < 0) - goto error; + goto error; } if(H5Dclose(did) < 0) - goto error; + goto error; /* Create dataset with scalar dataspace for the root group */ if((did = H5Dcreate2(fid, "scalar_dset", H5T_NATIVE_UCHAR, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Dclose(did) < 0) - goto error; + goto error; /* Create dataset with null dataspace for the root group */ if((did = H5Dcreate2(fid, "null_dset", H5T_NATIVE_UCHAR, sid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Dclose(did) < 0) - goto error; + goto error; /* Create 2-D dataset for the root group */ if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create 10 attributes for the 2-D dataset */ for(i = 1; i <= THRES_NUM; i++) { sprintf(name, "%s%d", THRES_ATTR_NAME,i); if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Aclose(attr_id) < 0) - goto error; + goto error; } if(H5Dclose(did) < 0) - goto error; + goto error; /* Create first group */ if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create an attribute for the group */ if((attr_id = H5Acreate2(gid, "ATTR", H5T_NATIVE_INT, sid3, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Close attribute */ if(H5Aclose(attr_id) < 0) - goto error; + goto error; /* Create 10 1-D datasets with non-zero dimension size for the group */ for(i = 1; i <= THRES_NUM; i++) { - /* set up dataset name */ + /* set up dataset name */ sprintf(name, "%s%d", THRES_DSET_NAME,i); - /* Create the dataset */ - if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + /* Create the dataset */ + if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; - /* Close the dataset */ + /* Close the dataset */ if(H5Dclose(did) < 0) - goto error; + goto error; } /* Close the group */ if(H5Gclose(gid) < 0) - goto error; + goto error; /* Create second group */ if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create 25 attributes for the group */ for(i = 1; i <= THRES_NUM_25; i++) { - /* Set up attribute name */ + /* Set up attribute name */ sprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i); - /* Create the attribute */ + /* Create the attribute */ if((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; - /* Close the attribute */ + /* Close the attribute */ if(H5Aclose(attr_id) < 0) - goto error; + goto error; } /* Close the group */ if(H5Gclose(gid) < 0) - goto error; + goto error; /* Create third group */ if((gid = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Create 9 1-D datasets with non-zero dimension size for the group */ for(i = 1; i < THRES_NUM; i++) { - /* set up dataset name */ + /* set up dataset name */ sprintf(name, "%s%d", THRES_DSET_NAME,i); - /* Create the dataset */ - if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + /* Create the dataset */ + if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; - /* Close the dataset */ + /* Close the dataset */ if(H5Dclose(did) < 0) - goto error; + goto error; } - /* Close the group */ - if(H5Gclose(gid) < 0) - goto error; - - - /* Close dataspaces */ - if(H5Sclose(sid0) < 0) - goto error; - if(H5Sclose(sid1) < 0) - goto error; - if(H5Sclose(sid2) < 0) - goto error; - if(H5Sclose(sid3) < 0) - goto error; - if(H5Sclose(sid4) < 0) - goto error; - - /* Close file */ - if(H5Fclose(fid) < 0) - goto error; - error: H5E_BEGIN_TRY { H5Gclose(gid); - H5Aclose(attr_id); + H5Aclose(attr_id); H5Dclose(did); H5Sclose(sid0); H5Sclose(sid1); @@ -346,84 +316,73 @@ error: * Function: gen_idx_file * * Purpose: Create a file with datasets that use Fixed Array indexing: - * one dataset: fixed dimension, chunked layout, w/o filters - * one dataset: fixed dimension, chunked layout, w/ filters + * one dataset: fixed dimension, chunked layout, w/o filters + * one dataset: fixed dimension, chunked layout, w/ filters * */ -static void +static void gen_idx_file(const char *fname) { - hid_t fapl = -1; /* file access property id */ - hid_t fid = -1; /* file id */ - hid_t sid = -1; /* space id */ - hid_t dcpl = -1; /* dataset creation property id */ - hid_t did = -1, did2 = -1; /* dataset id */ - hsize_t dims[1] = {10}; /* dataset dimension */ - hsize_t c_dims[1] = {2}; /* chunk dimension */ - int i; /* local index variable */ - int buf[10]; /* data buffer */ + hid_t fapl = -1; /* file access property id */ + hid_t fid = -1; /* file id */ + hid_t sid = -1; /* space id */ + hid_t dcpl = -1; /* dataset creation property id */ + hid_t did = -1, did2 = -1; /* dataset id */ + hsize_t dims[1] = {10}; /* dataset dimension */ + hsize_t c_dims[1] = {2}; /* chunk dimension */ + int i; /* local index variable */ + int buf[10]; /* data buffer */ /* Get a copy of the file access property */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; + goto error; /* Set the "use the latest format" bounds for creating objects in the file */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; + goto error; /* Create file */ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; /* Create data */ for(i = 0; i < 10; i++) - buf[i] = i; + buf[i] = i; /* Set chunk */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; + goto error; if(H5Pset_chunk(dcpl, 1, c_dims) < 0) - goto error; + goto error; /* Create a 1D dataset */ if((sid = H5Screate_simple(1, dims, NULL)) < 0) - goto error; + goto error; if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - + goto error; + /* Write to the dataset */ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; + goto error; #if defined (H5_HAVE_FILTER_DEFLATE) /* set deflate data */ if(H5Pset_deflate(dcpl, 9) < 0) - goto error; + goto error; /* Create and write the dataset */ if((did2 = H5Dcreate2(fid, DSET_FILTER, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; + goto error; if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto error; + goto error; /* Close the dataset */ if(H5Dclose(did2) < 0) - goto error; + goto error; #endif /* closing: dataspace, dataset, file */ - if(H5Pclose(fapl) < 0) - goto error; - if(H5Pclose(dcpl) < 0) - goto error; - if(H5Sclose(sid) < 0) - goto error; - if(H5Dclose(did) < 0) - goto error; - if(H5Fclose(fid) < 0) - goto error; - error: H5E_BEGIN_TRY { H5Pclose(fapl); @@ -451,7 +410,7 @@ error: * H5O_refcount_decode in the jira issue. * */ -static void +static void gen_err_refcount(const char *fname) { hid_t fid = -1; /* File identifier */ @@ -525,16 +484,13 @@ gen_err_refcount(const char *fname) /* Offset of the message ID to modify is as follows: */ /* 4520: the offset of the object header containing the attribute message with the committed datatype */ - /* 24: the offset in the object header containing the version of the + /* 24: the offset in the object header containing the version of the attribute message */ - if((fd = HDopen(fname, O_RDWR, 0633)) < 0) - goto error; - if(HDlseek(fd, 4520+24, SEEK_SET) < 0) - goto error; - if(HDwrite(fd, &val, 2) < 0) - goto error; - if(HDclose(fd) < 0) - goto error; + if((fd = HDopen(fname, O_RDWR, 0633)) >= 0) { + HDlseek(fd, 4520+24, SEEK_SET); + HDwrite(fd, &val, 2); + HDclose(fd); + } error: H5E_BEGIN_TRY { @@ -548,8 +504,8 @@ error: } H5E_END_TRY; } /* gen_err_refcount() */ -/* - * The following two test files are generated with older versions +/* + * The following two test files are generated with older versions * of the library for HDFFV-10333. They are used for testing in * testh5stat.sh.in. * @@ -559,7 +515,7 @@ error: * Then a "0" is written to the "dimension" field in the layout * message to trigger the error. * This is to verify HDFFV-10333 that h5stat will exit gracefully - * when encountered error similar to H5O__layout_decode in the + * when encountered error similar to H5O__layout_decode in the * jira issue. * * (2) h5stat_err_old_fill.h5 @@ -568,7 +524,7 @@ error: * Then an illegal size is written to the "size" fild in the * fill value message to trigger the error. * This is to verify HDFFV-10333 that h5stat will exit gracefully - * when encountered error similar to H5O_fill_old_decode in the + * when encountered error similar to H5O_fill_old_decode in the * jira issue. */ diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index 0636d3b..e301bb3 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -419,7 +419,9 @@ fill_with_random_data(Bytef *src, uLongf src_len) buf += rc; len -= (size_t)rc; } - } else { + HDclose(fd); + } + else { HDfprintf(stdout, "Using random() for random data\n"); for (u = 0; u < src_len; ++u) @@ -557,7 +559,7 @@ main(int argc, char **argv) int opt; prog = argv[0]; - + /* Initialize h5tools lib */ h5tools_init(); -- cgit v0.12 From e769ee8b5d61819edc23608457c125528b773a7d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 11 Oct 2018 09:51:20 -0500 Subject: TRILAB-34 add batch option (also patch2 from 10633) --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 610111b..135153d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -965,7 +965,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} @@ -974,7 +974,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}$ + 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 e3e0289d4314f914b0bcb9d3141aaa45d85a5e7d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 17 Oct 2018 11:06:45 -0500 Subject: TRILAB-34 fix required through testing --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 135153d..610111b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -965,7 +965,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} @@ -974,7 +974,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 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 cd7a896ee49b5ef1d5f8328e7b6206e8d0bf6ced Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Oct 2018 13:33:12 -0500 Subject: Move options to root CMakeLists.txt --- 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 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 6e846573146b714049c36b42da79f7f044190040 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Oct 2018 14:03:51 -0500 Subject: TRILAB-81 Coverity fix --- tools/src/misc/h5clear.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index 5724e1b..ae57031 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -82,7 +82,7 @@ static struct long_options l_opts[] = { }; - + /*------------------------------------------------------------------------- * Function: usage * @@ -119,7 +119,7 @@ static void usage(const char *prog) HDfprintf(stdout, " Set the EOA to the maximum of (EOA, EOF) + 512 for the file .\n"); } /* usage() */ - + /*------------------------------------------------------------------------- * Function: parse_command_line * @@ -170,9 +170,12 @@ parse_command_line(int argc, const char **argv) case 'i': increment_eoa_eof = TRUE; - if(opt_arg != NULL && (increment = HDatoi(opt_arg)) < 0) { - usage(h5tools_getprogname()); - goto done; + if(opt_arg != NULL) { + if (HDatoi(opt_arg) < 0) { + usage(h5tools_getprogname()); + goto done; + } + increment = HDatoi(opt_arg); } break; @@ -217,7 +220,7 @@ leave(int ret) } /* leave() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -231,14 +234,14 @@ leave(int ret) * so the file is opened with write access. * The --filesize option just prints the EOA and EOF, so the file * is opened with read access. - * + * * The -s option will activate the private property: - * --H5F_ACS_CLEAR_STATUS_FLAGS_NAME + * --H5F_ACS_CLEAR_STATUS_FLAGS_NAME * The --increment option will active these two private properties: - * --H5F_ACS_NULL_FSM_ADDR_NAME - * --H5F_ACS_SKIP_EOF_CHECK_NAME + * --H5F_ACS_NULL_FSM_ADDR_NAME + * --H5F_ACS_SKIP_EOF_CHECK_NAME * The --filesize will activate the private property: - * --H5F_ACS_SKIP_EOF_CHECK_NAME + * --H5F_ACS_SKIP_EOF_CHECK_NAME * * Return: Success: 0 * Failure: 1 @@ -280,7 +283,7 @@ main (int argc, const char *argv[]) } /* Cannot combine the --filesize option with other options */ - if(print_filesize && + if(print_filesize && (clear_status_flags || remove_cache_image || increment_eoa_eof)) { error_msg("Cannot combine --filesize with other options\n"); h5tools_setstatus(EXIT_FAILURE); @@ -298,7 +301,7 @@ main (int argc, const char *argv[]) } /* -s option */ - if(clear_status_flags) { + if(clear_status_flags) { /* Set to clear the status_flags in the file's superblock */ /* Activate this private property */ if(H5Pset(fapl, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear_status_flags) < 0) { @@ -309,7 +312,7 @@ main (int argc, const char *argv[]) } /* --increment option */ - if(increment_eoa_eof) { + if(increment_eoa_eof) { /* Activate this private property */ if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &increment_eoa_eof) < 0) { error_msg("H5Pset\n"); @@ -325,7 +328,7 @@ main (int argc, const char *argv[]) } /* --filesize option; open the file read-only */ - if(print_filesize) { + if(print_filesize) { /* Activate this private property */ if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &print_filesize) < 0) { error_msg("H5Pset\n"); @@ -333,7 +336,7 @@ main (int argc, const char *argv[]) goto done; } flags = H5F_ACC_RDONLY; - } + } /* Open the file */ if((fid = h5tools_fopen(fname, flags, fapl, NULL, NULL, (size_t)0)) < 0) { @@ -367,7 +370,7 @@ main (int argc, const char *argv[]) } /* -m option */ - if(remove_cache_image) { + if(remove_cache_image) { if(H5Fget_mdc_image_info(fid, &image_addr, &image_len) < 0) { error_msg("H5Fget_mdc_image_info\n"); h5tools_setstatus(EXIT_FAILURE); @@ -375,7 +378,7 @@ main (int argc, const char *argv[]) } if(image_addr == HADDR_UNDEF && image_len == 0) warn_msg("No cache image in the file\n"); - } + } h5tools_setstatus(EXIT_SUCCESS); -- cgit v0.12 From cce1727525ac395e87c85e89d7a60ad4acd9a1cb Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Oct 2018 14:45:04 -0500 Subject: TRILAB-81 check for func success before using value --- tools/lib/h5tools_str.c | 58 ++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 3d595ca..3e8f1fe 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1045,43 +1045,47 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } else { - unsigned nmembs; - unsigned j; + int retvalue; - nmembs = (unsigned)H5Tget_nmembers(type); - h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); + retvalue = H5Tget_nmembers(type); + if (retvalue >= 0) { + unsigned j; + unsigned nmembs = (unsigned)retvalue; - ctx->indent_level++; + h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); - for(j = 0; j < nmembs; j++) { - if(j) - h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK)); - else - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + ctx->indent_level++; - if(info->arr_linebreak) - h5tools_str_indent(str, info, ctx); + for(j = 0; j < nmembs; j++) { + if(j) + h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK)); + else + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - /* The name */ - name = H5Tget_member_name(type, j); - h5tools_str_append(str, OPT(info->cmpd_name, ""), name); - H5free_memory(name); + if(info->arr_linebreak) + h5tools_str_indent(str, info, ctx); - /* The value */ - offset = H5Tget_member_offset(type, j); - memb = H5Tget_member_type(type, j); + /* The name */ + name = H5Tget_member_name(type, j); + h5tools_str_append(str, OPT(info->cmpd_name, ""), name); + H5free_memory(name); - h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx); + /* The value */ + offset = H5Tget_member_offset(type, j); + memb = H5Tget_member_type(type, j); - H5Tclose(memb); - } - ctx->indent_level--; + h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx); - if(info->arr_linebreak) { - h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - h5tools_str_indent(str, info, ctx); + H5Tclose(memb); + } + ctx->indent_level--; + + if(info->arr_linebreak) { + h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); + h5tools_str_indent(str, info, ctx); + } + h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); } - h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); } break; -- cgit v0.12 From 9838dba4a402f0d6375fc6aba405ff74a5c73db8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Oct 2018 14:53:18 -0500 Subject: TRILAB-81 Output error if filename length is greater then 255 --- tools/src/h5import/h5import.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index ea40322..42ce317 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -88,6 +88,7 @@ int main(int argc, char *argv[]) const char *err7 = "Invalid type of data - %s.\n"; const char *err8 = "Invalid size of data - %s.\n"; const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n"; + const char *err10 = "Length of output file name limited to 255 chars.\n"; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); @@ -155,6 +156,10 @@ int main(int argc, char *argv[]) break; case 5: /* get outfile found */ + if (HDstrlen(argv[i]) > 255) { + (void) HDfprintf(stderr, err10, argv[i]); + goto err; + } (void) HDstrcpy(opt.outfile, argv[i]); outfile_named = TRUE; break; -- 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 From f8b5d40c7652f6ecdb2b491204e8288e8e01ab4b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 23 Oct 2018 10:15:03 -0500 Subject: Update windows test machine info --- release_docs/RELEASE.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 4ae69f0..85435f2 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -589,10 +589,9 @@ Supported Platforms Windows 7 Visual Studio 2015 w/ Intel Fortran 16 (cmake) - Windows 7 x64 Visual Studio 2012 w/ Intel Fortran 15 (cmake) - Visual Studio 2013 w/ Intel Fortran 15 (cmake) + Windows 7 x64 Visual Studio 2013 Visual Studio 2015 w/ Intel Fortran 16 (cmake) - Visual Studio 2015 w/ Intel C, Fortran 2017 (cmake) + Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake) Visual Studio 2015 w/ MSMPI 8 (cmake) Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake) -- cgit v0.12 From ee54368066dd1a39b683689dd22e0e1f6eb11697 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 24 Oct 2018 14:55:16 -0500 Subject: TRILAB-82 fixed errors found in review --- tools/src/h5import/h5import.c | 122 ++++++++++++++--------------- tools/src/h5import/h5import.h | 4 +- tools/test/h5format_convert/h5fc_gentest.c | 2 + 3 files changed, 65 insertions(+), 63 deletions(-) diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 42ce317..3989c29 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) break; case 5: /* get outfile found */ - if (HDstrlen(argv[i]) > 255) { + if (HDstrlen(argv[i]) > MAX_PATH_NAME_LENGTH) { (void) HDfprintf(stderr, err10, argv[i]); goto err; } @@ -1371,9 +1371,9 @@ static int allocateFloatStorage(struct Input *in) static int processConfigurationFile(char *infile, struct Input *in) { FILE *strm = NULL; - char key[255]; + char key[MAX_PATH_NAME_LENGTH]; int kindex; - char temp[255]; + char temp[MAX_PATH_NAME_LENGTH]; int ival; int scanret; int retval = -1; @@ -1451,16 +1451,16 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } - scanret = fscanf(strm, "%s", key); + scanret = fscanf(strm, "%254s", key); if((scanret == 1) && !HDstrcmp("HDF5", key)) { #ifdef H5DEBUGIMPORT int pndx; HDprintf("\nh5dump file\n"); #endif in->h5dumpInput = 1; - scanret = fscanf(strm, "%s", temp); /* filename */ - scanret = fscanf(strm, "%s", temp); /* start bracket */ - scanret = fscanf(strm, "%s", key); /* DATASET */ + scanret = fscanf(strm, "%254s", temp); /* filename */ + scanret = fscanf(strm, "%254s", temp); /* start bracket */ + scanret = fscanf(strm, "%254s", key); /* DATASET */ while (scanret == 1) { if(!HDstrcmp("DATASET", key)) { /* PATH */ #ifdef H5DEBUGIMPORT @@ -1470,7 +1470,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err3a, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1482,7 +1482,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } in->configOptionVector[PATH] = 1; - scanret = fscanf(strm, "%s", temp); /* start bracket */ + scanret = fscanf(strm, "%254s", temp); /* start bracket */ #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASET %s found\n", temp); #endif @@ -1496,7 +1496,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1533,20 +1533,20 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATATYPE STRING found\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump DATATYPE STRING %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* string properties */ + if (fscanf(strm, "%254s", temp) != 1) { /* string properties */ (void) HDfprintf(stderr, "%s", err18); goto error; } while (get_next_prop) { if(!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */ - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err19); goto error; } @@ -1566,7 +1566,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } } else if(!HDstrcmp("STRPAD", temp)) { /* STRPAD */ - if (fscanf(strm, "%s", temp) != 1) { /* STRPAD type */ + if (fscanf(strm, "%254s", temp) != 1) { /* STRPAD type */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1575,7 +1575,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif } else if(!HDstrcmp("CSET", key)) { /* CSET */ - if (fscanf(strm, "%s", temp) != 1) { /* CSET type */ + if (fscanf(strm, "%254s", temp) != 1) { /* CSET type */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1585,7 +1585,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } else if(!HDstrcmp("CTYPE", temp)) { /* CTYPE */ - if (fscanf(strm, "%s", temp) != 1) { /* CTYPE type */ + if (fscanf(strm, "%254s", temp) != 1) { /* CTYPE type */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1593,7 +1593,7 @@ static int processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump DATATYPE STRING CTYPE %s found\n", temp); #endif } /* if(!HDstrcmp("CSET", key)) */ - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1612,7 +1612,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1628,14 +1628,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE found\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1646,7 +1646,7 @@ static int processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -1656,7 +1656,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1699,7 +1699,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err5b, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1710,7 +1710,7 @@ static int processConfigurationFile(char *infile, struct Input *in) if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { goto error; } - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1724,7 +1724,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE process max dim values\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* max dim with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -1743,7 +1743,7 @@ static int processConfigurationFile(char *infile, struct Input *in) char *more = temp; in->maxsizeOfDimension[i] = HDstrtoull(more, &more, 10); } - if (fscanf(strm, "%s", temp) != 1) { /* max dim or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -1774,7 +1774,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err16c, infile); goto error; } - scanret = fscanf(strm, "%s", temp); /* end bracket */ + scanret = fscanf(strm, "%254s", temp); /* end bracket */ #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif @@ -1789,14 +1789,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump STORAGE_LAYOUT key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* CHUNKED */ + if (fscanf(strm, "%254s", temp) != 1) { /* CHUNKED */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1808,7 +1808,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n"); goto error; } - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1819,7 +1819,7 @@ static int processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int icount = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -1829,7 +1829,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1861,7 +1861,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err5b, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { /* SIZE */ + if (fscanf(strm, "%254s", temp) != 1) { /* SIZE */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1878,7 +1878,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif } while (HDstrcmp("}", temp)) { - if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1893,14 +1893,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -1911,21 +1911,21 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION found\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* DEFLATE */ + if (fscanf(strm, "%254s", temp) != 1) { /* DEFLATE */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* bgin bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* bgin bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* LEVEL */ + if (fscanf(strm, "%254s", temp) != 1) { /* LEVEL */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1940,7 +1940,7 @@ static int processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival); #endif in->compressionParam = ival; - if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1962,7 +1962,7 @@ static int processConfigurationFile(char *infile, struct Input *in) #endif in->configOptionVector[COMPRESS] = 0; } - if (fscanf(strm, "%s", temp) != 1) { /* end bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1976,14 +1976,14 @@ static int processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump SUBSET key\n"); #endif - if (fscanf(strm, "%s", temp) != 1) { /* start bracket */ + if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void) HDfprintf(stderr, err20, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump SUBSET %s found\n", temp); #endif - if (fscanf(strm, "%s", temp) != 1) { /* SUBSET keyword */ + if (fscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */ (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -1993,7 +1993,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (get_next_prop) { if(!HDstrcmp("COUNT", temp)) { /* COUNT */ int icount = 0; - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -2004,7 +2004,7 @@ static int processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -2014,7 +2014,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -2049,7 +2049,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } /* if(!HDstrcmp("COUNT", temp)) COUNT */ if(!HDstrcmp("BLOCK", temp)) { /* BLOCK */ int icount = 0; - if (fscanf(strm, "%s", temp) != 1) { /* start paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -2060,7 +2060,7 @@ static int processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void) HDfprintf(stderr, err16c, infile); goto error; } @@ -2070,7 +2070,7 @@ static int processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */ + if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void) HDfprintf(stderr, err6b, infile); goto error; } @@ -2103,7 +2103,7 @@ static int processConfigurationFile(char *infile, struct Input *in) in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ } /* if(!HDstrcmp("BLOCK", temp)) BLOCK */ - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -2122,7 +2122,7 @@ static int processConfigurationFile(char *infile, struct Input *in) scanret = 0; break; } - scanret = fscanf(strm, "%s", key); + scanret = fscanf(strm, "%254s", key); } #ifdef H5DEBUGIMPORT HDprintf("h5dump path"); @@ -2163,7 +2163,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err3a, infile); goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -2180,7 +2180,7 @@ static int processConfigurationFile(char *infile, struct Input *in) goto error; } - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err18); goto error; } @@ -2208,7 +2208,7 @@ static int processConfigurationFile(char *infile, struct Input *in) (void) HDfprintf(stderr, err5a, infile); goto error; } - if (fscanf(strm, "%d", (&ival)) != 1) { + if (fscanf(strm, "%254d", (&ival)) != 1) { (void) HDfprintf(stderr, "%s", err19); goto error; } @@ -2405,7 +2405,7 @@ static int processConfigurationFile(char *infile, struct Input *in) default: break; } - scanret = fscanf(strm, "%s", key); + scanret = fscanf(strm, "%254s", key); } /* @@ -2576,7 +2576,7 @@ static int getOutputClass(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output class.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3469,7 +3469,7 @@ static int getInputByteOrder(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for input byte-order.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3600,7 +3600,7 @@ static int getOutputArchitecture(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output architecture.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3632,7 +3632,7 @@ static int getOutputByteOrder(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output byte-order.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3663,7 +3663,7 @@ static int getCompressionType(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for compression.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } @@ -3727,7 +3727,7 @@ static int getExternalFilename(struct Input *in, FILE *strm) char temp[255]; const char *err1 = "Unable to get 'string' value.\n"; - if (fscanf(strm, "%s", temp) != 1) { + if (fscanf(strm, "%254s", temp) != 1) { (void) HDfprintf(stderr, "%s", err1); return (-1); } diff --git a/tools/src/h5import/h5import.h b/tools/src/h5import/h5import.h index c55717d..00c41f6 100644 --- a/tools/src/h5import/h5import.h +++ b/tools/src/h5import/h5import.h @@ -102,8 +102,8 @@ struct Input struct infilesformat { - char datafile[255]; - char configfile[255]; + char datafile[MAX_PATH_NAME_LENGTH]; + char configfile[MAX_PATH_NAME_LENGTH]; struct Input in; int config; /* Configfile present? No - 0. Yes - 1 */ }; diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c index e112c9e..b482dee 100644 --- a/tools/test/h5format_convert/h5fc_gentest.c +++ b/tools/test/h5format_convert/h5fc_gentest.c @@ -440,6 +440,8 @@ gen_err_level(const char *fname) goto error; /* Closing */ + if(H5Pclose(fcpl) < 0) + goto error; if(H5Pclose(dcpl) < 0) goto error; if(H5Sclose(sid) < 0) -- cgit v0.12 From 29afe82e7912827ae1777049a34e04c3a1605eb0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 24 Oct 2018 15:39:09 -0500 Subject: TRILAB-81 fix typo --- tools/src/h5import/h5import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 3989c29..16c0d8c 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -1670,7 +1670,7 @@ static int processConfigurationFile(char *infile, struct Input *in) } else { /* Dimension */ icount++; - if (icount >+ MAX_NUM_DIMENSION) { + if (icount > MAX_NUM_DIMENSION) { (void) HDfprintf(stderr, "Invalid value for rank.\n"); goto error; } -- cgit v0.12 From 0df6e44a6e68da1614cf80b50ed7b208edaa5df7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 24 Oct 2018 23:52:47 -0500 Subject: Squashed commit of private branch changes to support stackable VOL plugins. modified: test/dsets.c --- MANIFEST | 1 + examples/h5_extlink.c | 4 +- examples/h5_vol_external_log_native.c | 95 +- src/CMakeLists.txt | 1 + src/H5A.c | 106 +- src/H5Adeprec.c | 20 +- src/H5Aint.c | 24 +- src/H5CX.c | 78 +- src/H5CXprivate.h | 2 + src/H5D.c | 76 +- src/H5Ddeprec.c | 16 +- src/H5Dint.c | 43 +- src/H5Dio.c | 8 +- src/H5Dvirtual.c | 1 + src/H5F.c | 176 +- src/H5FDtest.c | 5 +- src/H5Fint.c | 98 +- src/H5Fmount.c | 28 +- src/H5Fpkg.h | 14 +- src/H5Fprivate.h | 3 +- src/H5Fquery.c | 2 +- src/H5Ftest.c | 34 + src/H5G.c | 53 +- src/H5Gdeprec.c | 43 +- src/H5Gint.c | 20 +- src/H5Gname.c | 21 +- src/H5Gprivate.h | 2 +- src/H5Gtraverse.c | 10 +- src/H5I.c | 178 +- src/H5L.c | 199 +- src/H5Lexternal.c | 12 +- src/H5O.c | 161 +- src/H5Ocopy.c | 14 +- src/H5Odeprec.c | 20 +- src/H5Oflush.c | 28 +- src/H5Oint.c | 10 +- src/H5Olink.c | 2 +- src/H5Pfapl.c | 336 ++-- src/H5Pprivate.h | 1 - src/H5Ppublic.h | 3 +- src/H5R.c | 32 +- src/H5Rdeprec.c | 6 +- src/H5Rint.c | 14 +- src/H5T.c | 10 +- src/H5Tcommit.c | 79 +- src/H5Tdeprec.c | 12 +- src/H5Tprivate.h | 1 + src/H5Tvlen.c | 6 +- src/H5VL.c | 1357 ++++++++------ src/H5VLcallback.c | 1890 +++++++++++++++++++ src/H5VLint.c | 1926 +++----------------- src/H5VLnative.c | 1121 +++++++----- src/H5VLnative.h | 6 +- src/H5VLprivate.h | 50 +- src/H5VLpublic.h | 232 +-- src/H5Z.c | 2 + src/H5private.h | 11 +- src/H5trace.c | 6 +- src/Makefile.am | 2 +- test/dsets.c | 15 +- test/dtypes.c | 16 +- test/file_image.c | 3 +- test/objcopy.c | 12 +- test/ohdr.c | 2 +- test/testfiles/error_test_1 | 2 +- test/tfile.c | 5 +- test/tmisc.c | 2 +- test/vol.c | 54 +- tools/test/h5dump/errfiles/filter_fail.err | 2 +- tools/test/h5dump/errfiles/tall-1.err | 2 +- tools/test/h5dump/errfiles/tall-2A.err | 2 +- tools/test/h5dump/errfiles/tall-2A0.err | 2 +- tools/test/h5dump/errfiles/tall-2B.err | 2 +- tools/test/h5dump/errfiles/tarray1_big.err | 6 +- tools/test/h5dump/errfiles/tattr-3.err | 2 +- tools/test/h5dump/errfiles/tattrregR.err | 4 +- tools/test/h5dump/errfiles/tcomp-3.err | 2 +- tools/test/h5dump/errfiles/tdataregR.err | 4 +- tools/test/h5dump/errfiles/tdset-2.err | 4 +- tools/test/h5dump/errfiles/textlink.err | 4 +- tools/test/h5dump/errfiles/textlinkfar.err | 2 +- tools/test/h5dump/errfiles/textlinksrc.err | 2 +- tools/test/h5dump/errfiles/tgroup-2.err | 2 +- tools/test/h5dump/errfiles/torderlinks1.err | 2 +- tools/test/h5dump/errfiles/torderlinks2.err | 2 +- tools/test/h5dump/errfiles/tperror.err | 4 +- tools/test/h5dump/errfiles/tslink-D.err | 2 +- ...h5repack_layout.h5-dset2_chunk_20x10-errstk.tst | 2 +- 88 files changed, 5266 insertions(+), 3610 deletions(-) create mode 100644 src/H5VLcallback.c diff --git a/MANIFEST b/MANIFEST index b820622..b0da5d1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -889,6 +889,7 @@ ./src/H5TS.c ./src/H5TSprivate.h ./src/H5VL.c +./src/H5VLcallback.c ./src/H5VLint.c ./src/H5VLmodule.h ./src/H5VLnative.c diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index 1a07656..229e465 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -208,7 +208,7 @@ static void extlink_prefix_example(void) * that a path was supplied in the udata. */ static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group, - const void *udata, size_t udata_size, hid_t lapl_id); + const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id); static void soft_link_example(void) { @@ -277,7 +277,7 @@ static void soft_link_example(void) */ static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group, - const void *udata, size_t udata_size, hid_t lapl_id) + const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id) { const char *target = (const char *) udata; hid_t ret_value; diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index 945588a..3f819e7 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -7,7 +7,7 @@ #define LOG 502 static herr_t H5VL_log_init(hid_t vipl_id); -static herr_t H5VL_log_term(hid_t vtpl_id); +static herr_t H5VL_log_term(void); /* Datatype callbacks */ static void *H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); @@ -40,17 +40,23 @@ static herr_t H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req); static void *H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); static herr_t H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -hid_t native_driver_id = -1; +hid_t native_plugin_id = -1; static const H5VL_class_t H5VL_log_g = { - 0, - LOG, - "log", /* name */ + 0, /* VOL class struct version */ + LOG, /* ID of plugin */ + "log", /* Name of plugin */ + 0, /* capability flags */ H5VL_log_init, /* initialize */ H5VL_log_term, /* terminate */ - sizeof(hid_t), - NULL, - NULL, + sizeof(hid_t), /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* free_wrap_ctx */ + NULL, /* wrap_object */ { /* attribute_cls */ NULL, //H5VL_log_attr_create, /* create */ NULL, //H5VL_log_attr_open, /* open */ @@ -130,7 +136,7 @@ visit_cb(hid_t oid, const char *name, char n[25]; if(H5Iget_type(oid) == H5I_GROUP) { - len = H5VLget_driver_name(oid, n, 50); + len = H5VLget_plugin_name(oid, n, 50); printf ("Visiting GROUP VOL name = %s %d\n", n, len); } if(H5Iget_type(oid) == H5I_DATASET) @@ -152,7 +158,7 @@ int main(int argc, char **argv) { hid_t datasetId; hid_t acc_tpl; hid_t under_fapl; - hid_t vol_id, vol_id2; + hid_t vol_id; hid_t int_id; hid_t attr; hid_t space; @@ -168,41 +174,37 @@ int main(int argc, char **argv) { H5Pset_fapl_native(under_fapl); assert(H5VLis_registered("native") == 1); - vol_id = H5VLregister (&H5VL_log_g); + vol_id = H5VLregister (&H5VL_log_g, H5P_DEFAULT); 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); + native_plugin_id = H5VLget_plugin_id("native"); + assert(native_plugin_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); + len = H5VLget_plugin_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); + len = H5VLget_plugin_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); + len = H5VLget_plugin_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); + len = H5VLget_plugin_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); + len = H5VLget_plugin_name(int_id, name, 50); printf ("DT OOPEN name = %s %d\n", name, len); len = H5Fget_name(file_id, name, 50); @@ -220,7 +222,7 @@ int main(int argc, char **argv) { datasetId = H5Dcreate2(file_id,fullpath,H5T_NATIVE_INT,dataspaceId,H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); H5Sclose(dataspaceId); - len = H5VLget_driver_name(datasetId, name, 50); + len = H5VLget_plugin_name(datasetId, name, 50); printf ("DSET name = %s %d\n", name, len); H5Dwrite(datasetId, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); @@ -236,13 +238,13 @@ int main(int argc, char **argv) { attr = H5Acreate2(group_id, "attr1", int_id, space, H5P_DEFAULT, H5P_DEFAULT); int_id = H5Aget_type(attr); - len = H5VLget_driver_name(int_id, name, 50); + len = H5VLget_plugin_name(int_id, name, 50); printf ("DT OPEN name = %s %d\n", name, len); H5Aclose (attr); int_id = H5Oopen(file_id,"int",H5P_DEFAULT); - len = H5VLget_driver_name(int_id, name, 50); + len = H5VLget_plugin_name(int_id, name, 50); printf ("DT OOPEN name = %s %d\n", name, len); H5Oclose(int_id); @@ -256,8 +258,7 @@ int main(int argc, char **argv) { H5Pclose(acc_tpl); H5Pclose(under_fapl); - H5VLclose(native_driver_id); - H5VLterminate(vol_id, H5P_DEFAULT); + H5VLunregister(native_plugin_id); H5VLunregister (vol_id); assert(H5VLis_registered("log") == 0); return 0; @@ -269,7 +270,7 @@ static herr_t H5VL_log_init(hid_t vipl_id) return 0; } -static herr_t H5VL_log_term(hid_t vtpl_id) +static herr_t H5VL_log_term(void) { printf("------- LOG TERM\n"); return 0; @@ -278,12 +279,12 @@ static herr_t H5VL_log_term(hid_t vtpl_id) static void * H5VL_log_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) { - hid_t under_fapl; + hid_t under_fapl = -1; H5VL_log_t *file; file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - under_fapl = *((hid_t *)H5Pget_vol_info(fapl_id)); + H5Pget_vol_info(fapl_id, &under_fapl); file->under_object = H5VLfile_create(name, flags, fcpl_id, under_fapl, dxpl_id, req); printf("------- LOG H5Fcreate\n"); @@ -293,12 +294,12 @@ H5VL_log_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl static void * H5VL_log_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) { - hid_t under_fapl; + hid_t under_fapl = -1; H5VL_log_t *file; file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - under_fapl = *((hid_t *)H5Pget_vol_info(fapl_id)); + H5Pget_vol_info(fapl_id, &under_fapl); file->under_object = H5VLfile_open(name, flags, under_fapl, dxpl_id, req); printf("------- LOG H5Fopen\n"); @@ -310,7 +311,7 @@ H5VL_log_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **re { H5VL_log_t *f = (H5VL_log_t *)file; - H5VLfile_get(f->under_object, native_driver_id, get_type, dxpl_id, req, arguments); + H5VLfile_get(f->under_object, native_plugin_id, get_type, dxpl_id, req, arguments); printf("------- LOG H5Fget %d\n", get_type); return 1; @@ -320,7 +321,7 @@ H5VL_log_file_close(void *file, hid_t dxpl_id, void **req) { H5VL_log_t *f = (H5VL_log_t *)file; - H5VLfile_close(f->under_object, native_driver_id, dxpl_id, req); + H5VLfile_close(f->under_object, native_plugin_id, dxpl_id, req); free(f); printf("------- LOG H5Fclose\n"); @@ -336,7 +337,7 @@ H5VL_log_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, group = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - group->under_object = H5VLgroup_create(o->under_object, loc_params, native_driver_id, name, gcpl_id, gapl_id, dxpl_id, req); + group->under_object = H5VLgroup_create(o->under_object, loc_params, native_plugin_id, name, gcpl_id, gapl_id, dxpl_id, req); printf("------- LOG H5Gcreate\n"); return (void *)group; @@ -347,7 +348,7 @@ H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req) { H5VL_log_t *g = (H5VL_log_t *)grp; - H5VLgroup_close(g->under_object, native_driver_id, dxpl_id, req); + H5VLgroup_close(g->under_object, native_plugin_id, dxpl_id, req); free(g); printf("------- LOG H5Gclose\n"); @@ -363,7 +364,7 @@ H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *na dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dt->under_object = H5VLdatatype_commit(o->under_object, loc_params, native_driver_id, name, + dt->under_object = H5VLdatatype_commit(o->under_object, loc_params, native_plugin_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); printf("------- LOG H5Tcommit\n"); @@ -377,7 +378,7 @@ H5VL_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dt->under_object = H5VLdatatype_open(o->under_object, loc_params, native_driver_id, name, tapl_id, dxpl_id, req); + dt->under_object = H5VLdatatype_open(o->under_object, loc_params, native_plugin_id, name, tapl_id, dxpl_id, req); printf("------- LOG H5Topen\n"); return (void *)dt; @@ -389,7 +390,7 @@ H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, voi H5VL_log_t *o = (H5VL_log_t *)dt; herr_t ret_value; - ret_value = H5VLdatatype_get(o->under_object, native_driver_id, get_type, dxpl_id, req, arguments); + ret_value = H5VLdatatype_get(o->under_object, native_plugin_id, get_type, dxpl_id, req, arguments); printf("------- LOG datatype get\n"); return ret_value; @@ -402,7 +403,7 @@ H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req) assert(type->under_object); - H5VLdatatype_close(type->under_object, native_driver_id, dxpl_id, req); + H5VLdatatype_close(type->under_object, native_plugin_id, dxpl_id, req); free(type); printf("------- LOG H5Tclose\n"); @@ -417,7 +418,7 @@ H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened new_obj = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - new_obj->under_object = H5VLobject_open(o->under_object, loc_params, native_driver_id, opened_type, dxpl_id, req); + new_obj->under_object = H5VLobject_open(o->under_object, loc_params, native_plugin_id, opened_type, dxpl_id, req); printf("------- LOG H5Oopen\n"); return (void *)new_obj; @@ -429,7 +430,7 @@ H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_sp { H5VL_log_t *o = (H5VL_log_t *)obj; - H5VLobject_specific(o->under_object, loc_params, native_driver_id, specific_type, dxpl_id, req, arguments); + H5VLobject_specific(o->under_object, loc_params, native_plugin_id, specific_type, dxpl_id, req, arguments); printf("------- LOG Object specific\n"); return 1; @@ -443,7 +444,7 @@ H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *nam dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dset->under_object = H5VLdataset_create(o->under_object, loc_params, native_driver_id, name, dcpl_id, dapl_id, dxpl_id, req); + dset->under_object = H5VLdataset_create(o->under_object, loc_params, native_plugin_id, name, dcpl_id, dapl_id, dxpl_id, req); printf("------- LOG H5Dcreate\n"); return (void *)dset; @@ -457,7 +458,7 @@ H5VL_log_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dset->under_object = H5VLdataset_open(o->under_object, loc_params, native_driver_id, name, dapl_id, dxpl_id, req); + dset->under_object = H5VLdataset_open(o->under_object, loc_params, native_plugin_id, name, dapl_id, dxpl_id, req); printf("------- LOG H5Dopen\n"); return (void *)dset; @@ -469,7 +470,7 @@ H5VL_log_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, { H5VL_log_t *d = (H5VL_log_t *)dset; - H5VLdataset_read(d->under_object, native_driver_id, mem_type_id, mem_space_id, file_space_id, + H5VLdataset_read(d->under_object, native_plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); printf("------- LOG H5Dread\n"); @@ -481,7 +482,7 @@ H5VL_log_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, { H5VL_log_t *d = (H5VL_log_t *)dset; - H5VLdataset_write(d->under_object, native_driver_id, mem_type_id, mem_space_id, file_space_id, + H5VLdataset_write(d->under_object, native_plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); printf("------- LOG H5Dwrite\n"); @@ -492,7 +493,7 @@ H5VL_log_dataset_close(void *dset, hid_t dxpl_id, void **req) { H5VL_log_t *d = (H5VL_log_t *)dset; - H5VLdataset_close(d->under_object, native_driver_id, dxpl_id, req); + H5VLdataset_close(d->under_object, native_plugin_id, dxpl_id, req); free(d); printf("------- LOG H5Dclose\n"); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7045012..287292a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -662,6 +662,7 @@ IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SOURCES}" ) set (H5VL_SOURCES ${HDF5_SRC_DIR}/H5VL.c + ${HDF5_SRC_DIR}/H5VLcallback.c ${HDF5_SRC_DIR}/H5VLint.c ${HDF5_SRC_DIR}/H5VLnative.c ) diff --git a/src/H5A.c b/src/H5A.c index 3ac7ca2..225c315 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -296,18 +296,18 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name, + if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -402,18 +402,18 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name, + if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close (attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -442,7 +442,7 @@ done: hid_t H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { - void *attr = NULL; /* attr token from VOL driver */ + void *attr = NULL; /* attr token from VOL plugin */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -471,18 +471,18 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -514,7 +514,7 @@ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id) { - void *attr = NULL; /* attr token from VOL driver */ + void *attr = NULL; /* attr token from VOL plugin */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -554,18 +554,18 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close (attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -646,18 +646,18 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -702,7 +702,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Write the attribute data */ - if((ret_value = H5VL_attr_write(vol_obj->data, vol_obj->driver->cls, + if((ret_value = H5VL_attr_write(vol_obj->data, vol_obj->plugin->cls, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") @@ -745,7 +745,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") /* Read the attribute data */ - if((ret_value = H5VL_attr_read(vol_obj->data, vol_obj->driver->cls, + if((ret_value = H5VL_attr_read(vol_obj->data, vol_obj->plugin->cls, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") @@ -784,7 +784,7 @@ H5Aget_space(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the dataspace */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_SPACE, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute") @@ -812,7 +812,8 @@ done: hid_t H5Aget_type(hid_t attr_id) { - H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -822,12 +823,21 @@ H5Aget_type(hid_t attr_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Get the datatype */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_TYPE, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* H5Aget_type() */ @@ -867,7 +877,7 @@ H5Aget_create_plist(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the acpl */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_ACPL, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute") @@ -918,7 +928,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) loc_params.obj_type = H5I_get_type(attr_id); /* Get the attribute name */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, buf_size, buf, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") @@ -985,7 +995,7 @@ H5Aget_name_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 name */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name") @@ -1025,7 +1035,7 @@ H5Aget_storage_size(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") /* Get the storage size */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_STORAGE_SIZE, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl") @@ -1065,7 +1075,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) loc_params.obj_type = H5I_get_type(attr_id); /* Get the attribute information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") @@ -1122,7 +1132,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") @@ -1186,7 +1196,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") @@ -1238,7 +1248,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Rename the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } @@ -1299,7 +1309,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Rename the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } @@ -1356,6 +1366,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1376,13 +1387,22 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* H5Aiterate2() */ @@ -1437,6 +1457,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1466,13 +1487,22 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed"); done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* H5Aiterate_by_name() */ @@ -1522,7 +1552,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1581,7 +1611,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1652,7 +1682,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute through the VOL */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1731,7 +1761,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) loc_params.obj_type = H5I_get_type(obj_id); /* Check if the attribute exists */ - if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS, + if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") @@ -1786,7 +1816,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Check existence of attribute */ - if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS, + if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 47983ea..eb4f447 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -156,18 +156,18 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, + if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -222,18 +222,18 @@ H5Aopen_name(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if (NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if (NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -291,18 +291,18 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -346,7 +346,7 @@ H5Aget_num_attrs(hid_t loc_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the number of attributes for the object */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object") diff --git a/src/H5Aint.c b/src/H5Aint.c index 80a3e98..af5e479 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.h" /* Native VOL plugin */ /****************/ @@ -924,7 +924,15 @@ H5A__get_type(H5A_t *attr) * two level IDs, where the VOL object is a copy of the * returned datatype */ - if ((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") } else { @@ -1156,7 +1164,7 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj) HDassert(attr_vol_obj); /* Close the attribute */ - if((ret_value = H5VL_attr_close(attr_vol_obj->data, attr_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_close(attr_vol_obj->data, attr_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute") /* Free the VOL object */ @@ -2648,7 +2656,15 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5 HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object"); /* Get an ID for the object */ - if((obj_loc_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype"); /* Call internal attribute iteration routine */ diff --git a/src/H5CX.c b/src/H5CX.c index e08ca2f..1d9cf3d 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -125,7 +125,6 @@ (*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \ } /* end if */ \ } -#endif /* H5_HAVE_PARALLEL */ /* Macro for the duplicated code to test and set properties for a property list */ #define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \ @@ -140,6 +139,7 @@ if(H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting filter mask xfer property") \ } /* end if */ +#endif /* H5_HAVE_PARALLEL */ /******************/ @@ -267,6 +267,10 @@ typedef struct H5CX_t { /* Cached LAPL properties */ size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */ hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */ + + /* Cached VOL properties */ + void *vol_wrap_ctx; /* VOL plugin's "wrap context" for creating IDs */ + hbool_t vol_wrap_ctx_valid; /* Whether VOL plugin's "wrap context" for creating IDs is valid */ } H5CX_t; /* Typedef for nodes on the API context stack */ @@ -918,6 +922,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_set_vol_wrap_ctx + * + * Purpose: Sets the VOL object wrapping context for an operation. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * October 14, 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(head && *head); + + /* Set the API context value */ + (*head)->ctx.vol_wrap_ctx = vol_wrap_ctx; + + /* Mark the value as valid */ + (*head)->ctx.vol_wrap_ctx_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_set_vol_wrap_ctx() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_dxpl * * Purpose: Retrieves the DXPL ID for the current API call context. @@ -970,6 +1008,42 @@ H5CX_get_lapl(void) /*------------------------------------------------------------------------- + * Function: H5CX_get_vol_wrap_ctx + * + * Purpose: Retrieves the VOL object wrapping context for an operation. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * October 14, 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_wrap_ctx); + HDassert(head && *head); + + /* Check for value that was set */ + if((*head)->ctx.vol_wrap_ctx_valid) + /* Get the value */ + *vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx; + else + *vol_wrap_ctx = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_vol_wrap_ctx() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_tag * * Purpose: Retrieves the object tag for the current API call context. @@ -2501,7 +2575,9 @@ H5CX__pop_common(void) ret_value = (*head); (*head) = (*head)->next; +#ifdef H5_HAVE_PARALLEL done: +#endif /* H5_HAVE_PARALLEL */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX__pop_common() */ diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 44a4067..57ca5cd 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -63,10 +63,12 @@ H5_DLL void H5CX_set_lapl(hid_t lapl_id); H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t loc_id, hbool_t is_collective); H5_DLL herr_t H5CX_set_loc(hid_t loc_id); +H5_DLL herr_t H5CX_set_vol_wrap_ctx(void *wrap_ctx); /* "Getter" routines for API context info */ H5_DLL hid_t H5CX_get_dxpl(void); H5_DLL hid_t H5CX_get_lapl(void); +H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx); H5_DLL haddr_t H5CX_get_tag(void); H5_DLL H5AC_ring_t H5CX_get_ring(void); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5D.c b/src/H5D.c index 9f56197..c1218e2 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -107,6 +107,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist = NULL; /* Property list pointer */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -157,18 +158,27 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -250,19 +260,19 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close (dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close (dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -290,6 +300,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) void *dset = NULL; /* dset token from VOL plugin */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -313,18 +324,27 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, + if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -391,7 +411,7 @@ H5Dget_space(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataspace */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") @@ -423,7 +443,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Get dataspace status */ - if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE_STATUS, + if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") @@ -449,6 +469,7 @@ hid_t H5Dget_type(hid_t dset_id) { H5VL_object_t *vol_obj; /* Dataset structure */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -458,12 +479,21 @@ H5Dget_type(hid_t dset_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* get the datatype */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_TYPE, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Dget_type() */ @@ -498,7 +528,7 @@ H5Dget_create_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset creation property list */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DCPL, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") @@ -554,7 +584,7 @@ H5Dget_access_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset access property list */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DAPL, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") @@ -592,7 +622,7 @@ H5Dget_storage_size(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") /* Get the storage size */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_STORAGE_SIZE, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") @@ -626,7 +656,7 @@ H5Dget_offset(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") /* Get the offset */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_OFFSET, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") @@ -840,7 +870,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, vlen_bufsize.mspace_id = H5I_INVALID_HID; /* Get a copy of the dataset's dataspace */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") @@ -922,7 +952,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set the extent */ - if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT, + if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") @@ -961,7 +991,7 @@ H5Dflush(hid_t dset_id) * XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t * callback needs it and that's in the public API. */ - if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_FLUSH, + if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") @@ -997,7 +1027,7 @@ H5Drefresh(hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Refresh the dataset object */ - if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_REFRESH, + if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") @@ -1041,7 +1071,7 @@ H5Dformat_convert(hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the dataset */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") @@ -1078,7 +1108,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") /* Get the chunk indexing type */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") @@ -1120,7 +1150,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") /* Get the dataset creation property list */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 4abba93..4206e23 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -161,17 +161,17 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, dcpl_id, + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: if (H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -221,17 +221,17 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, + if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -275,7 +275,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* Get the dataspace pointer for the dataset */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace") if(H5I_INVALID_HID == sid) @@ -306,7 +306,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Increase size */ - if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT, + if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset") diff --git a/src/H5Dint.c b/src/H5Dint.c index 3436105..413de33 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -21,17 +21,17 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative.h" /* Native VOL plugin */ /****************/ @@ -301,7 +301,7 @@ H5D__close_cb(H5VL_object_t *dset_vol_obj) HDassert(dset_vol_obj); /* Close the dataset */ - if(H5VL_dataset_close(dset_vol_obj->data, dset_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_close(dset_vol_obj->data, dset_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset"); done: @@ -975,7 +975,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Get the dataset's datatype */ if(NULL == (dt = (const H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") - /* If this is a named datatype, get the pointer via the VOL driver */ + /* If this is a named datatype, get the pointer via the VOL plugin */ type = (const H5T_t *)H5T_get_actual_type(dt); /* Check if the datatype is "sensible" for use in a dataset */ @@ -2460,7 +2460,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ - if(H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls, + if(H5VL_dataset_read(vol_obj->data, vol_obj->plugin->cls, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) @@ -3402,13 +3402,20 @@ H5D__get_type(const H5D_t *dset) * two-level IDs, where the VOL object is a copy of the * returned datatype. */ - if((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") - } - else { + } /* end if */ + else if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") - } done: if(ret_value < 0) diff --git a/src/H5Dio.c b/src/H5Dio.c index b6d4f1b..b30e0c9 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -191,7 +191,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Read the data */ - if ((ret_value = H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id, + if ((ret_value = H5VL_dataset_read(vol_obj->data, vol_obj->plugin->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") @@ -243,7 +243,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil H5CX_set_dxpl(dxpl_id); /* Read the raw chunk */ - if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id, + if (H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") @@ -315,7 +315,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Write the data */ - if ((ret_value = H5VL_dataset_write(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id, + if ((ret_value = H5VL_dataset_write(vol_obj->data, vol_obj->plugin->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") @@ -373,7 +373,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of H5CX_set_dxpl(dxpl_id); /* Write chunk */ - if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id, + if (H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 89974b2..8af4379 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2973,6 +2973,7 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) HDassert(dset && *dset); /* Get the native VOL driver's ID */ +/* XXX (VOL MERGE): Need a better solution than this */ if((native_vol_id = H5VL_native_get_driver_id()) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get native VOL driver ID") diff --git a/src/H5F.c b/src/H5F.c index 2dcafb9..762c772 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -199,7 +199,7 @@ H5F__close_cb(H5VL_object_t *file_vol_obj) HDassert(file_vol_obj); /* Close the file */ - if(H5VL_file_close(file_vol_obj->data, file_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_file_close(file_vol_obj->data, file_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); /* Free the VOL object */ @@ -239,7 +239,7 @@ H5Fget_create_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file creation property list */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FCPL, + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") @@ -280,7 +280,7 @@ H5Fget_access_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FAPL, + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") @@ -350,7 +350,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id") /* Get the count */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_COUNT, + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_OBJ_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)") } @@ -462,7 +462,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the IDs */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_IDS, + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") } @@ -536,7 +536,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") @@ -614,9 +614,9 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) void *new_file = NULL; /* file struct for new file */ H5P_genplist_t *plist; /* Property list pointer */ - H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */ - H5VL_t *driver = NULL; /* VOL driver struct */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */ + H5VL_t *plugin = NULL; /* VOL plugin struct */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -650,10 +650,10 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get vol driver info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL plugin info") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL plugin ID") /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for @@ -668,16 +668,16 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") - /* Setup VOL driver struct */ - if(NULL == (driver = H5FL_CALLOC(H5VL_t))) + /* Setup VOL plugin struct */ + if(NULL == (plugin = H5FL_CALLOC(H5VL_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct") - driver->cls = cls; - driver->id = driver_prop.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") + plugin->cls = cls; + plugin->id = plugin_prop.plugin_id; + if(H5I_inc_ref(plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") /* Get an atom for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, new_file, driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_FILE, new_file, plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -709,9 +709,9 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { void *new_file = NULL; /* file struct for new file */ H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ H5VL_class_t *cls = NULL; /* VOL class structure for callback info */ - H5VL_t *driver = NULL; /* VOL driver struct */ + H5VL_t *plugin = NULL; /* VOL plugin struct */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -739,25 +739,25 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) /* Get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL driver info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL driver ID") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL plugin info") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL plugin ID") /* Open the file through the VOL layer */ if(NULL == (new_file = H5VL_file_open(cls, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Setup VOL driver struct */ - if(NULL == (driver = H5FL_CALLOC(H5VL_t))) + /* Setup VOL plugin struct */ + if(NULL == (plugin = H5FL_CALLOC(H5VL_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct") - driver->cls = cls; - driver->id = driver_prop.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") + plugin->cls = cls; + plugin->id = plugin_prop.plugin_id; + if(H5I_inc_ref(plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") /* Get an ID for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, new_file, driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_FILE, new_file, plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -798,7 +798,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Flush the object */ - if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_FLUSH, + if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") @@ -863,7 +863,7 @@ hid_t H5Freopen(hid_t file_id) { H5VL_object_t *vol_obj = NULL; - void *file; /* File token from VOL driver */ + void *file; /* File token from VOL plugin */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -874,16 +874,16 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Reopen the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_REOPEN, &file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL driver") + if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_REOPEN, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL plugin") /* Make sure that worked */ if(NULL == file) 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_id(H5I_FILE, file, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -919,7 +919,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the flags */ - if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_INTENT, + if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags") } @@ -954,7 +954,7 @@ H5Fget_freespace(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the amount of free space in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") @@ -990,7 +990,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the file size */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") @@ -1052,7 +1052,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") /* Get the file image */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") @@ -1093,7 +1093,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") @@ -1127,7 +1127,7 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") @@ -1164,7 +1164,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the current hit rate */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") @@ -1202,7 +1202,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the size data */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") @@ -1242,7 +1242,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") @@ -1292,7 +1292,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the filename via the VOL */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_NAME, + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name") @@ -1338,7 +1338,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") @@ -1375,7 +1375,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") @@ -1415,7 +1415,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") @@ -1449,7 +1449,7 @@ H5Fclear_elink_file_cache(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Release the EFC */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") @@ -1510,7 +1510,7 @@ H5Fstart_swmr_write(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* start SWMR writing */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") @@ -1543,7 +1543,7 @@ H5Fstart_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") @@ -1577,7 +1577,7 @@ H5Fstop_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") @@ -1612,7 +1612,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") @@ -1633,13 +1633,10 @@ done: * *------------------------------------------------------------------------- */ -/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional' - */ herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) { H5VL_object_t *vol_obj; /* File as VOL object */ - H5F_t *f; /* File */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1648,15 +1645,15 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) /* Check args */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") - f = (H5F_t *)(vol_obj->data); /* Set up collective metadata if appropriate */ if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal set_libver_bounds function */ - if(H5F__set_libver_bounds(f, low, high) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + /* Set the library's version bounds */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: FUNC_LEAVE_API(ret_value) @@ -1692,7 +1689,7 @@ H5Fformat_convert(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the format */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") @@ -1724,7 +1721,7 @@ H5Freset_page_buffering_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") @@ -1760,7 +1757,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2 HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats") /* Get the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") @@ -1820,29 +1817,23 @@ done: herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa) { - H5F_t *file; /* File object for file ID */ - haddr_t rel_eoa; /* Relative address of EOA */ + H5VL_object_t *vol_obj; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*a", file_id, eoa); /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") - /* This public routine will work only for drivers with this feature enabled.*/ - /* We might introduce a new feature flag in the future */ - if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") - - /* The real work */ - if(HADDR_UNDEF == (rel_eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed") + /* Only do work if valid pointer to fill in */ + if(eoa) { + /* Retrieve the EOA for the file */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_EOA, eoa) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") + } /* end if */ - /* (Note compensating for base address subtraction in internal routine) */ - if(eoa) - *eoa = rel_eoa + H5FD_get_base_addr(file->shared->lf); done: FUNC_LEAVE_API(ret_value) } /* H5Fget_eoa() */ @@ -1859,30 +1850,19 @@ done: herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment) { - H5F_t *file; /* File object for file ID */ - haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ih", file_id, increment); /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") - /* This public routine will work only for drivers with this feature enabled.*/ - /* We might introduce a new feature flag in the future */ - if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") - - /* Get the maximum of EOA and EOF */ - if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") - - /* Set EOA to the maximum value + increment */ - /* H5FD_set_eoa() will add base_addr to max_eof_eoa */ - if(H5FD_set_eoa(file->shared->lf, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + /* Increment the file size */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_INCR_FILESIZE, increment) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5FDtest.c b/src/H5FDtest.c index 080223c..dec0818 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -104,11 +104,10 @@ H5FD__supports_swmr_test(const char *vfd_name) FUNC_ENTER_NOAPI_NOINIT_NOERR - if(!vfd_name || !HDstrcmp(vfd_name, "")) + if(!vfd_name || !HDstrcmp(vfd_name, "") || !HDstrcmp(vfd_name, "nomatch")) ret_value = TRUE; else - ret_value = !HDstrcmp(vfd_name, "log") - || !HDstrcmp(vfd_name, "sec2"); + ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2"); FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fint.c b/src/H5Fint.c index 230a744..7edd985 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -37,9 +37,8 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL drivers */ - -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLnative.h" /* Native VOL plugin */ /****************/ @@ -2167,7 +2166,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5F_get_id(H5F_t *file, hbool_t app_ref) +H5F_get_id(H5F_t *file) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -2177,15 +2176,15 @@ H5F_get_id(H5F_t *file, hbool_t app_ref) if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) { /* resurrect the ID - Register an ID with the native driver */ - if((ret_value = H5VL_native_register(H5I_FILE, file, app_ref)) < 0) + if((ret_value = H5VL_native_register(H5I_FILE, file, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") file->id_exists = TRUE; - } + } /* end if */ else { /* Increment reference count on existing ID */ - if(H5I_inc_ref(ret_value, app_ref) < 0) + if(H5I_inc_ref(ret_value, FALSE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -3000,6 +2999,7 @@ H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr) HDassert(f->shared); /* Dispatch to driver */ + /* (H5FD_set_eoa() will add base_addr to addr) */ if(H5FD_set_eoa(f->shared->lf, type, addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") @@ -3235,7 +3235,7 @@ H5F__start_swmr_write(H5F_t *f) H5G_name_t *obj_paths = NULL; /* Group hierarchy path */ size_t u; /* Local index variable */ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ - H5VL_t *vol_driver = NULL; /* VOL driver for the file */ + H5VL_t *vol_plugin = NULL; /* VOL plugin for the file */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -3299,15 +3299,15 @@ H5F__start_swmr_write(H5F_t *f) if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") - /* Save the VOL driver for the refresh step */ + /* Save the VOL plugin for the refresh step */ if(grp_dset_count > 0) { H5VL_object_t *vol_obj = NULL; if(NULL == (vol_obj = H5VL_get_object(obj_ids[0]))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - vol_driver = vol_obj->driver; - } + vol_plugin = vol_obj->plugin; + } /* end if */ /* Refresh opened objects (groups, datasets) in the file */ for(u = 0; u < grp_dset_count; u++) { @@ -3370,10 +3370,9 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict file's cached information") /* Refresh (reopen) the objects (groups & datasets) in the file */ - for(u = 0; u < grp_dset_count; u++) { - if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_driver, TRUE) < 0) + for(u = 0; u < grp_dset_count; u++) + if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_plugin, TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") - } /* Unlock the file */ if(H5FD_unlock(f->shared->lf) < 0) @@ -3483,3 +3482,72 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__format_convert() */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_file_id + * + * Purpose: The private version of H5Iget_file_id(), obtains the file + * ID given an object ID. + * + * Return: Success: The file ID associated with the object + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5F_get_file_id(hid_t obj_id, H5I_type_t type) +{ + H5VL_object_t *vol_obj; + void *file = NULL; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Get the file through the VOL */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_FILE, type, &file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file") + if(NULL == file) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file through the VOL") + + /* Check if the file's ID already exists */ + if(H5I_find_id(file, H5I_FILE, &ret_value) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") + + /* If the ID does not exist, register it with the VOL plugin */ + if(H5I_INVALID_HID == ret_value) { +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if ((ret_value = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + } /* end if */ + else { + /* Increment ref count on existing ID */ + if(H5I_inc_ref(ret_value, TRUE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + } /* end else */ + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_get_file_id() */ + diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 310edd4..0e3c06d 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -443,6 +443,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) H5VL_object_t *child_vol_obj = NULL; /* Child object */ H5I_type_t loc_type; /* ID type of location */ H5I_type_t child_type; /* ID type of child */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -478,15 +479,24 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object") /* Check if both objects are associated with the same VOL plugin */ - if(loc_vol_obj->driver->cls->value != child_vol_obj->driver->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL driver") + if(loc_vol_obj->plugin->cls->value != child_vol_obj->plugin->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL plugin") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(loc_vol_obj->data, loc_vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; /* Perform the mount operation */ - if(H5VL_file_specific(loc_vol_obj->data, loc_vol_obj->driver->cls, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_specific(loc_vol_obj->data, loc_vol_obj->plugin->cls, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Fmount() */ @@ -512,6 +522,7 @@ H5Funmount(hid_t loc_id, const char *name) { H5VL_object_t *vol_obj = NULL; /* Parent object */ H5I_type_t loc_type; /* ID type of location */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -534,12 +545,21 @@ H5Funmount(hid_t loc_id, const char *name) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Perform the unmount operation */ - if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_UNMOUNT, + if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Funmount() */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index e97144f..7f67226 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -385,12 +385,12 @@ typedef enum H5VL_file_optional_t { H5VL_FILE_GET_FREE_SECTIONS, /* file free selections */ H5VL_FILE_GET_FREE_SPACE, /* file freespace */ H5VL_FILE_GET_INFO, /* file info */ - H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */ - H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */ + H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */ + H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */ H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */ H5VL_FILE_GET_SIZE, /* file size */ H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */ - H5VL_FILE_REOPEN, /* reopen the file */ + H5VL_FILE_GET_FILE, /* retrieve or resurrect file of object */ H5VL_FILE_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */ H5VL_FILE_SET_MDC_CONFIG, /* set metadata cache configuration */ H5VL_FILE_GET_METADATA_READ_RETRY_INFO, @@ -398,12 +398,13 @@ typedef enum H5VL_file_optional_t { H5VL_FILE_START_MDC_LOGGING, H5VL_FILE_STOP_MDC_LOGGING, H5VL_FILE_GET_MDC_LOGGING_STATUS, - H5VL_FILE_SET_LATEST_FORMAT, H5VL_FILE_FORMAT_CONVERT, H5VL_FILE_RESET_PAGE_BUFFERING_STATS, H5VL_FILE_GET_PAGE_BUFFERING_STATS, - H5VL_FILE_GET_MDC_IMAGE_INFO - + H5VL_FILE_GET_MDC_IMAGE_INFO, + H5VL_FILE_GET_EOA, + H5VL_FILE_INCR_FILESIZE, + H5VL_FILE_SET_LIBVER_BOUNDS } H5VL_file_optional_t; /* User data for traversal routine to get ID counts */ @@ -506,6 +507,7 @@ H5_DLL herr_t H5F__get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t H5_DLL herr_t H5F__check_cached_stab_test(hid_t file_id); H5_DLL herr_t H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); H5_DLL herr_t H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); +H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2); #endif /* H5F_TESTING */ #endif /* _H5Fpkg_H */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 6595677..b611f44 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -716,6 +716,7 @@ typedef enum H5F_prefix_open_t { /* Private functions */ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); +H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); @@ -734,7 +735,7 @@ H5_DLL H5F_t *H5F_get_parent(const H5F_t *f); H5_DLL unsigned H5F_get_nmounts(const H5F_t *f); H5_DLL unsigned H5F_get_read_attempts(const H5F_t *f); H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref); -H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref); +H5_DLL hid_t H5F_get_id(H5F_t *file); H5_DLL herr_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL herr_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index b036974..3147e95 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -904,7 +904,7 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) /* Dispatch to driver */ if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 1183284..49a2a22 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -233,3 +233,37 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__get_sbe_addr_test() */ + +/*------------------------------------------------------------------------- + * Function: H5F__same_file_test + * + * Purpose: Check if two file IDs refer to the same underlying file. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Oct 13, 2018 + * + *------------------------------------------------------------------------- + */ +htri_t +H5F__same_file_test(hid_t file_id1, hid_t file_id2) +{ + H5F_t *file1, *file2; /* File info */ + htri_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + if(NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + + /* If they are using the same underlying "shared" file struct, they are the same file */ + ret_value = (file1->shared == file2->shared); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__same_file_test() */ + diff --git a/src/H5G.c b/src/H5G.c index 772d567..8c4cfe8 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -278,7 +278,7 @@ H5G__close_cb(H5VL_object_t *grp_vol_obj) HDassert(grp_vol_obj); /* Close the group */ - if(H5VL_group_close(grp_vol_obj->data, grp_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_group_close(grp_vol_obj->data, grp_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") /* Free the VOL object */ @@ -321,6 +321,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -364,18 +365,27 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, + if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -445,18 +455,18 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, NULL, + if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -484,6 +494,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) void *grp = NULL; /* Group opened */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -506,17 +517,27 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) /* Open the group */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -550,7 +571,7 @@ H5Gget_create_plist(hid_t group_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID") /* Get the group creation property list for the group */ - if(H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_GCPL, + if(H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_GCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") @@ -593,7 +614,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info) /* Retrieve the group's information */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = id_type; - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, + if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") @@ -646,7 +667,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, + if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") @@ -707,7 +728,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, + if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") @@ -779,7 +800,7 @@ H5Gflush(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Flush group's metadata to file */ - if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_FLUSH, + if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") @@ -818,7 +839,7 @@ H5Grefresh(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Refresh group's metadata */ - if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_REFRESH, + if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index ab73e7e..80f91a1 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -235,12 +235,12 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, tmp_gcpl, + if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: @@ -249,7 +249,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -297,17 +297,17 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the group */ - if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, H5P_DEFAULT, + if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -372,7 +372,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->driver->cls, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->plugin->cls, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } @@ -394,7 +394,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } @@ -469,7 +469,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->driver->cls, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->plugin->cls, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } @@ -496,7 +496,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } @@ -544,7 +544,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->driver->cls, + if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->plugin->cls, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") @@ -601,7 +601,7 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link */ if((ret_value = H5VL_link_move(vol_obj1->data, loc_params1, vol_obj2->data, loc_params2, - vol_obj1->driver->cls, H5P_DEFAULT, H5P_DEFAULT, + vol_obj1->plugin->cls, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") @@ -645,7 +645,7 @@ H5Gunlink(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") @@ -690,7 +690,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, + if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value") @@ -825,8 +825,10 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, { H5G_loc_t loc; /* Location of object */ H5G_link_iterate_t lnk_op; /* Link operator */ + H5VL_object_t *vol_obj; hsize_t last_obj; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -850,6 +852,15 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Call private function */ if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") @@ -859,6 +870,10 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, *idx_p = (int)last_obj; done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Giterate() */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 88ef82b..ef5007f 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -808,7 +808,15 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, */ if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Set up user data for callback */ @@ -1069,8 +1077,16 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} /* Register an ID for the starting group */ - if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) + if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Get the location of the starting group */ diff --git a/src/H5Gname.c b/src/H5Gname.c index b6b0c20..f6ddeeb 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -584,21 +584,9 @@ H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, *cached = TRUE; } /* end if */ else if(!loc->path->obj_hidden) { - hid_t file; - - /* Retrieve file ID for name search */ - if((file = H5F_get_id(loc->oloc->file, FALSE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get file ID") - /* Search for name of object */ - if((len = H5G_get_name_by_addr(file, loc->oloc, name, size)) < 0) { - H5I_dec_ref(file); + if((len = H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name") - } /* end if */ - - /* Close file ID used for search */ - if(H5I_dec_ref(file) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCLOSEFILE, FAIL, "can't determine name") /* Indicate that the name is _not_ cached, if requested */ /* (Currently only used for testing - QAK, 2010/07/26) */ @@ -1282,8 +1270,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, - char *name, size_t size) +H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size) { H5G_gnba_iter_t udata; /* User data for iteration */ H5G_loc_t root_loc; /* Root group's location */ @@ -1296,8 +1283,8 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, FUNC_ENTER_NOAPI((-1)) - /* Construct the link info for the file's root group */ - if(H5G_loc(file, &root_loc) < 0) + /* Construct a group location for root group of the file */ + if(H5G_root_loc(f, &root_loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get root group's location") /* Check for root group being the object looked for */ diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index f4f04bc..dc8146c 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -261,7 +261,7 @@ H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_dept H5_DLL herr_t H5G_name_free(H5G_name_t *name); H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, hbool_t *cached); -H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, const struct H5O_loc_t *loc, +H5_DLL ssize_t H5G_get_name_by_addr(H5F_t *f, const struct H5O_loc_t *loc, char* name, size_t size); H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name); diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index a103f53..6ac74b0 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -198,7 +198,15 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, /* Create a group ID to pass to the user-defined callback */ if(NULL == (grp = H5G_open(&grp_loc_copy))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((cur_grp = H5VL_native_register(H5I_GROUP, grp, FALSE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((cur_grp = H5VL_wrap_register(H5I_GROUP, grp, FALSE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") /* User-defined callback function */ diff --git a/src/H5I.c b/src/H5I.c index 7d445a5..ec58ce2 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -33,8 +33,9 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ #include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Gprivate.h" /* Groups */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -130,6 +131,7 @@ H5FL_DEFINE_STATIC(H5I_class_t); H5FL_EXTERN(H5VL_object_t); /*--------------------- Local function prototypes ---------------------------*/ +static void *H5I__unwrap(void *obj_ptr, H5I_type_t type); static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); static int H5I__destroy_type(H5I_type_t type); static void *H5I__remove_verify(hid_t id, H5I_type_t id_type); @@ -139,7 +141,6 @@ static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); -static hid_t H5I__get_file_id(hid_t obj_id, H5I_type_t id_type); static int H5I__find_id_cb(void *_item, void *_key, void *_udata); static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); @@ -452,6 +453,51 @@ done: /*------------------------------------------------------------------------- + * Function: H5I__unwrap + * + * Purpose: Unwraps the object pointer for the 'item' that corresponds + * to an ID. + * + * Return: Pointer to the unwrapped pointer (can't fail) + * + * Programmer: Quincey Koziol + * Friday, October 19, 2018 + * + *------------------------------------------------------------------------- + */ +static void * +H5I__unwrap(void *obj_ptr, H5I_type_t type) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(obj_ptr); + + /* The stored object pointer might be an H5VL_object_t, in which + * case we'll need to get the wrapped object struct (H5F_t *, etc.). + */ + if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + const H5VL_object_t *vol_obj; + + vol_obj = (const H5VL_object_t *)obj_ptr; + ret_value = H5VL_object_data(vol_obj); + } /* end if */ + else if(H5I_DATATYPE == type) { + const H5T_t *dt; + + dt = (const H5T_t *)obj_ptr; + ret_value = (void *)H5T_get_actual_type(dt); + } /* end if */ + else + ret_value = obj_ptr; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__unwrap() */ + + +/*------------------------------------------------------------------------- * Function: H5Iclear_type * * Purpose: Removes all objects from the type, calling the free @@ -547,6 +593,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(id); HDassert(udata); HDassert(udata->type_ptr); @@ -556,8 +603,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) */ if(udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) { /* Check for a 'free' function and call it, if it exists */ - /* (Casting away const OK -QAK) */ - if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { + if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */ if(udata->force) { #ifdef H5I_DEBUG if(H5DEBUG(I)) { @@ -778,7 +824,7 @@ done: *------------------------------------------------------------------------- */ 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_with_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref, hid_t id) { H5VL_object_t *new_vol_obj = NULL; /* pointer to new VOL object */ H5I_id_type_t *type_ptr; /* ptr to the type */ @@ -789,7 +835,7 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t /* Check arguments */ HDassert(object); - HDassert(vol_driver); + HDassert(vol_plugin); /* Make sure ID is not already in use */ if(NULL != (id_ptr = H5I__find_id(id))) @@ -816,11 +862,11 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t /* 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->plugin = vol_plugin; new_vol_obj->data = object; - /* Bump the reference count on the VOL driver */ - vol_driver->nrefs++; + /* Bump the reference count on the VOL plugin */ + vol_plugin->nrefs++; /* Create the struct & insert requested ID */ id_ptr->id = id; @@ -1996,16 +2042,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /* The stored object pointer might be an H5VL_object_t, in which * case we'll need to get the wrapped object struct (H5F_t *, etc.). */ - if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; - } - else if(H5I_DATATYPE == type) { - const H5T_t *dt = (const H5T_t *)item->obj_ptr; - obj_ptr = (void *)H5T_get_actual_type(dt); - } - else - obj_ptr = item->obj_ptr; + obj_ptr = H5I__unwrap(item->obj_ptr, type); /* Invoke callback function */ cb_ret_val = (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ @@ -2127,7 +2164,7 @@ done: * * Failure: -1 * - * NOTE: Not safe for arbitrary VOL drivers as it relies on + * NOTE: Not safe for arbitrary VOL plugins as it relies on * private H5G calls. * * Comments: Public function @@ -2145,7 +2182,9 @@ done: ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size) { + H5VL_object_t *vol_obj; H5G_loc_t loc; /* Object location */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) @@ -2155,11 +2194,24 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_get_object(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve object's name */ if((ret_value = H5G_get_name(&loc, name, size, NULL)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Iget_name() */ @@ -2190,9 +2242,9 @@ H5Iget_file_id(hid_t obj_id) /* Call internal function */ if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - if ((ret_value = H5I__get_file_id(obj_id, type)) < 0) + if ((ret_value = H5F_get_file_id(obj_id, type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") - } + } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object") @@ -2202,56 +2254,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__get_file_id - * - * Purpose: The private version of H5Iget_file_id(), obtains the file - * ID given an object ID. - * - * Return: Success: The file ID associated with the object - * Failure: H5I_INVALID_HID - * - *------------------------------------------------------------------------- - */ -static hid_t -H5I__get_file_id(hid_t obj_id, H5I_type_t type) -{ - H5VL_object_t *vol_obj = NULL; - void *file = NULL; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_STATIC - - /* Get the object pointer */ - if (NULL == (vol_obj = H5VL_get_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") - - /* Get the file through the VOL */ - if (H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, &file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file") - if (NULL == file) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file through the VOL") - - /* Check if the file's ID already exists */ - if (H5I_find_id(file, H5I_FILE, &ret_value) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") - - /* 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) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") - } - else { - /* Increment ref count on existing ID */ - if (H5I_inc_ref(ret_value, TRUE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__get_file_id() */ - - -/*------------------------------------------------------------------------- * Function: H5I__find_id_cb * * Purpose: Callback for searching for an ID with a specific pointer @@ -2276,23 +2278,14 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) HDassert(item); HDassert(udata); - /* Get a pointer to the VOL driver's data */ - if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; - } - else if (H5I_DATATYPE == type) { - const H5T_t *dt = (const H5T_t *)item->obj_ptr; - obj_ptr = (void *)H5T_get_actual_type(dt); - } - else - obj_ptr = item->obj_ptr; + /* Get a pointer to the VOL plugin's data */ + obj_ptr = H5I__unwrap(item->obj_ptr, type); /* Check for a match */ if (obj_ptr == udata->object) { udata->ret_id = item->id; ret_value = H5_ITER_STOP; - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__find_id_cb() */ @@ -2340,7 +2333,7 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") *id = udata.ret_id; - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -2362,7 +2355,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ H5G_name_t *path = NULL; /* Path to file object */ - const void *obj_ptr = NULL; /* Pointer to VOL driver object */ + const void *obj_ptr = NULL; /* Pointer to VOL plugin object */ FUNC_ENTER_STATIC_NOERR @@ -2376,22 +2369,24 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; + obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->driver->cls->value) + if(H5_VOL_NATIVE == vol_obj->plugin->cls->value) path = H5G_nameof((H5G_t *)obj_ptr); break; } + case H5I_DATASET: { const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; + obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->driver->cls->value) + if(H5_VOL_NATIVE == vol_obj->plugin->cls->value) path = H5D_nameof((H5D_t *)obj_ptr); break; } + case H5I_DATATYPE: { const H5T_t *dt = (const H5T_t *)item->obj_ptr; @@ -2401,6 +2396,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) path = H5T_nameof((H5T_t *)obj_ptr); break; } + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: diff --git a/src/H5L.c b/src/H5L.c index 656edec..6f37123 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -279,6 +279,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5VL_loc_params_t loc_params1; H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ H5VL_loc_params_t loc_params2; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -316,31 +317,42 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; loc_params2.obj_type = H5I_get_type(dst_loc_id); - if (H5L_SAME_LOC != src_loc_id) { + if (H5L_SAME_LOC != src_loc_id) /* Get the location object */ if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if (H5L_SAME_LOC != dst_loc_id) { + if (H5L_SAME_LOC != dst_loc_id) /* Get the location object */ if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - /* Make sure that the VOL drivers are the same */ - if (vol_obj1 && vol_obj2) { - if (vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) + /* Make sure that the VOL plugins are the same */ + if (vol_obj1 && vol_obj2) + if (vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + + /* Set wrapper info in API context */ + { + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + + vol_obj = (vol_obj1 ? vol_obj1 : vol_obj2); + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; } /* Move the link */ if (H5VL_link_move((vol_obj1 ? vol_obj1->data : NULL), loc_params1, (vol_obj2 ? vol_obj2->data : NULL), loc_params2, - (vol_obj1 ? vol_obj1->driver->cls : vol_obj2->driver->cls), + (vol_obj1 ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lmove() */ @@ -367,6 +379,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5VL_loc_params_t loc_params1; H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ H5VL_loc_params_t loc_params2; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -405,31 +418,42 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; loc_params2.obj_type = H5I_get_type(dst_loc_id); - if(H5L_SAME_LOC != src_loc_id) { + if(H5L_SAME_LOC != src_loc_id) /* Get the location object */ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != dst_loc_id) { + if(H5L_SAME_LOC != dst_loc_id) /* Get the location object */ if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } /* Make sure that the VOL plugins are the same */ - if(vol_obj1 && vol_obj2) { - if(vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) + if(vol_obj1 && vol_obj2) + if(vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + + /* Set wrapper info in API context */ + { + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + + vol_obj = (vol_obj1 ? vol_obj1 : vol_obj2); + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; } /* Copy the link */ if(H5VL_link_copy((vol_obj1 ? vol_obj1->data : NULL), loc_params1, (vol_obj2 ? vol_obj2->data : NULL), loc_params2, - (vol_obj1 ? vol_obj1->driver->cls : vol_obj2->driver->cls), + (vol_obj1 ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lcopy() */ @@ -459,6 +483,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist = NULL; /* Property list pointer */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -504,12 +529,21 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Create the link */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls, + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_soft() */ @@ -578,22 +612,19 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, loc_params2.loc_data.loc_by_name.name = new_name; loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; - if(H5L_SAME_LOC != cur_loc_id) { + 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))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != new_loc_id) { + 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))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - /* Make sure that the VOL drivers are the same */ - if(vol_obj1 && vol_obj2) { - if(vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL drivers and can't be linked") - } + /* Make sure that the VOL plugins are the same */ + if(vol_obj1 && vol_obj2) + if(vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") /* Get the link creation plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -607,7 +638,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, /* Create the link */ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, (vol_obj2 ? (vol_obj2->data) : NULL), loc_params2, - (vol_obj1 != NULL ? vol_obj1->driver->cls : vol_obj2->driver->cls), + (vol_obj1 != NULL ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link") @@ -647,6 +678,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -688,12 +720,21 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Create external link */ - if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->driver->cls, + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_ud() */ @@ -720,6 +761,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -743,12 +785,21 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Unlink */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Ldelete() */ @@ -808,7 +859,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") @@ -865,7 +916,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) @@ -930,7 +981,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value") @@ -982,7 +1033,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check for the existence of the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_EXISTS, + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") @@ -1011,6 +1062,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1033,12 +1085,21 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_INFO, + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lget_info() */ @@ -1064,6 +1125,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1094,12 +1156,21 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_INFO, + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lget_info_by_idx() */ @@ -1292,7 +1363,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_NAME, + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name") @@ -1326,6 +1397,7 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1350,13 +1422,22 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(group_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Literate() */ @@ -1423,7 +1504,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") @@ -1467,6 +1548,7 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1491,13 +1573,22 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lvisit() */ @@ -1536,6 +1627,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1568,13 +1660,22 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.name = group_name; loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Visit the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lvisit_by_name() */ @@ -1949,7 +2050,15 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group") /* Make callback */ @@ -2734,7 +2843,15 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID") if(udata->copy) { diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index d9cc7a3..eb732ee 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -242,8 +242,16 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, if(NULL == (ext_obj = H5O_open_name(&root_loc, obj_name, &opened_type))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} /* Get an ID for the external link's object */ - if((ext_obj_id = H5VL_native_register(opened_type, ext_obj, TRUE)) < 0) + if((ext_obj_id = H5VL_wrap_register(opened_type, ext_obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object") /* Set return value */ @@ -414,7 +422,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") /* Create an external link */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link") diff --git a/src/H5O.c b/src/H5O.c index 77b9498..058a5e1 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -104,6 +104,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) @@ -129,15 +130,25 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oopen() */ @@ -203,11 +214,11 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &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_id(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: @@ -271,12 +282,12 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, &opened_type, + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: @@ -348,21 +359,19 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, loc_params2.loc_data.loc_by_name.name = new_name; loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; - if(H5L_SAME_LOC != obj_id) { + if(H5L_SAME_LOC != obj_id) /* get the location object */ if(NULL == (vol_obj1 = H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != new_loc_id) { + if(H5L_SAME_LOC != new_loc_id) /* get the location object */ if(NULL == (vol_obj2 = H5VL_get_object(new_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } + /* Make sure that the VOL plugins are the same */ - if(vol_obj1 && vol_obj2) { - if (vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) + if(vol_obj1 && vol_obj2) + if (vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") - } /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -376,7 +385,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, /* Create a link to the object */ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, - (vol_obj1 != NULL ? vol_obj1->driver->cls : vol_obj2->driver->cls), + (vol_obj1 != NULL ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") @@ -427,7 +436,7 @@ H5Oincr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_CHANGE_REF_COUNT, + if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -478,7 +487,7 @@ H5Odecr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_CHANGE_REF_COUNT, + if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -505,6 +514,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -530,12 +540,21 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Check if the object exists */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_EXISTS, + if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oexists_by_name() */ @@ -559,6 +578,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -578,12 +598,21 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oget_info2() */ @@ -608,6 +637,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -637,12 +667,21 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_name2() */ @@ -669,6 +708,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -703,12 +743,21 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_idx2() */ @@ -735,6 +784,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -752,12 +802,21 @@ H5Oset_comment(hid_t obj_id, const char *comment) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oset_comment() */ @@ -785,6 +844,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -808,12 +868,21 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oset_comment_by_name() */ @@ -839,6 +908,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) @@ -852,12 +922,21 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve the object's comment */ - if (H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if (H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oget_comment() */ @@ -884,6 +963,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) @@ -907,12 +987,21 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oget_comment_by_name() */ @@ -958,6 +1047,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -981,13 +1071,22 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Ovisit2() */ @@ -1033,6 +1132,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1067,13 +1167,22 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Ovisit_by_name2() */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index c03c352..d6c1406 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -204,6 +204,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5VL_loc_params_t loc_params1; H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */ H5VL_loc_params_t loc_params2; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -246,13 +247,22 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.type = H5VL_OBJECT_BY_SELF; loc_params2.obj_type = H5I_get_type(dst_loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj1->data, vol_obj1->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Copy the object */ - if((ret_value = H5VL_object_copy(vol_obj1->data, loc_params1, vol_obj1->driver->cls, src_name, - vol_obj2->data, loc_params2, vol_obj2->driver->cls, dst_name, + if((ret_value = H5VL_object_copy(vol_obj1->data, loc_params1, vol_obj1->plugin->cls, src_name, + vol_obj2->data, loc_params2, vol_obj2->plugin->cls, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Ocopy() */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index ead2028..3d09b33 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -109,7 +109,7 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") @@ -161,7 +161,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) @@ -223,7 +223,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") @@ -270,6 +270,7 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -291,13 +292,22 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Ovisit1() */ @@ -373,7 +383,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 84095d9..2ef5ab8 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -92,7 +92,7 @@ H5Oflush(hid_t obj_id) loc_params.obj_type = H5I_get_type(obj_id); /* Flush the object */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") @@ -257,7 +257,7 @@ H5Orefresh(hid_t oid) loc_params.obj_type = H5I_get_type(oid); /* Refresh the object */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") @@ -301,7 +301,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) H5O_loc_t obj_oloc; H5G_name_t obj_path; H5O_shared_t cached_H5O_shared; - H5VL_t *driver = NULL; + H5VL_t *plugin = NULL; /* Create empty object location */ obj_loc.oloc = &obj_oloc; @@ -319,29 +319,29 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) if(H5T_save_refresh_state(oid, &cached_H5O_shared) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state") - /* Get the VOL object from the ID and cache a pointer to the driver. + /* Get the VOL object from the ID and cache a pointer to the plugin. * 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))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - driver = vol_obj->driver; + plugin = vol_obj->plugin; - /* Bump the number of references on the VOL driver. - * If you don't do this, VDS refreshes can accidentally close the driver. + /* Bump the number of references on the VOL plugin. + * If you don't do this, VDS refreshes can accidentally close the plugin. */ - driver->nrefs++; + plugin->nrefs++; /* Close object & evict its metadata */ if((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Re-open the object, re-fetching its metadata */ - if((H5O_refresh_metadata_reopen(oid, &obj_loc, driver, FALSE)) < 0) + if((H5O_refresh_metadata_reopen(oid, &obj_loc, plugin, FALSE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") - /* Restore the number of references on the VOL driver */ - driver->nrefs--; + /* Restore the number of references on the VOL plugin */ + plugin->nrefs--; /* Restore important datatype state */ if(H5I_get_type(oid) == H5I_DATATYPE) @@ -444,7 +444,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, hbool_t start_swmr) +H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_plugin, hbool_t start_swmr) { void *object = NULL; /* Object for this operation */ H5I_type_t type; /* Type of object for the ID */ @@ -454,7 +454,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h /* Sanity check */ HDassert(obj_loc); - HDassert(vol_driver); + HDassert(vol_plugin); /* Get object's type */ type = H5I_get_type(oid); @@ -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((H5I_register_with_id(type, object, vol_plugin, TRUE, oid)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh") done: diff --git a/src/H5Oint.c b/src/H5Oint.c index c569226..61a913c 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -2658,7 +2658,15 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Get an ID for the visited object */ - if((obj_id = H5VL_native_register(opened_type, obj, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((obj_id = H5VL_wrap_register(opened_type, obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register visited object") /* Make callback for starting object */ diff --git a/src/H5Olink.c b/src/H5Olink.c index 6447936..961c619 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -648,7 +648,7 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) hid_t file_id; /* ID for the file the link is located in (passed to user callback) */ /* Get a file ID for the file the link is in */ - if((file_id = H5F_get_id(f, FALSE)) < 0) + if((file_id = H5F_get_id(f)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID") /* Call user-defined link's 'delete' callback */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 0340b67..0e40603 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -39,7 +39,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory Management */ #include "H5Ppkg.h" /* Property lists */ -#include "H5VLprivate.h" /* VOL drivers */ +#include "H5VLprivate.h" /* VOL plugins */ /* Includes needed to set as default file driver */ #include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ @@ -48,8 +48,8 @@ #include "H5FDwindows.h" /* Win32 I/O */ #endif -/* Includes needed to set the default VOL driver */ -#include "H5VLnative.h" /* Native HDF5 file VOL driver */ +/* Includes needed to set the default VOL plugin */ +#include "H5VLnative.h" /* Native HDF5 file VOL plugin */ /****************/ @@ -262,8 +262,8 @@ #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF 0 #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC H5P__encode_unsigned #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC H5P__decode_unsigned -/* Definition for file VOL driver properties (ID, etc.) */ -#define H5F_ACS_VOL_SIZE sizeof(H5VL_driver_prop_t) +/* Definition for file VOL plugin properties (ID, etc.) */ +#define H5F_ACS_VOL_SIZE sizeof(H5VL_plugin_prop_t) #define H5F_ACS_VOL_DEF {H5_DEFAULT_VOL, NULL} #define H5F_ACS_VOL_CRT H5P__facc_vol_create #define H5F_ACS_VOL_SET H5P__facc_vol_set @@ -334,7 +334,7 @@ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_c static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); -/* VOL driver callbacks */ +/* VOL plugin callbacks */ static herr_t H5P__facc_vol_create(const char *name, size_t size, void *value); static herr_t H5P__facc_vol_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__facc_vol_get(hid_t prop_id, const char *name, size_t size, void *value); @@ -437,7 +437,7 @@ static herr_t H5P__facc_reg_prop(H5P_genclass_t *pclass) { const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */ - const H5VL_driver_prop_t def_vol_prop = H5F_ACS_VOL_DEF; /* Default VOL driver ID & info (initialized from a variable) */ + const H5VL_plugin_prop_t def_vol_prop = H5F_ACS_VOL_DEF; /* Default VOL plugin ID & info (initialized from a variable) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -668,7 +668,7 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the file VOL driver ID & info */ + /* Register the file VOL plugin ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ if(H5P__register_real(pclass, H5F_ACS_VOL_DRV_NAME, H5F_ACS_VOL_SIZE, &def_vol_prop, H5F_ACS_VOL_CRT, H5F_ACS_VOL_SET, H5F_ACS_VOL_GET, NULL, NULL, @@ -4974,10 +4974,10 @@ done: /*------------------------------------------------------------------------- * Function: H5P_set_vol * - * Purpose: Set the VOL driver for a file access property list - * (PLIST_ID). The vol properties will + * Purpose: Set the VOL plugin for a file access property list + * (PLIST_ID). The VOL properties will * be copied into the property list and the reference count on - * the vol will be incremented. + * the VOL will be incremented. * * Return: SUCCEED/FAIL * @@ -4991,19 +4991,19 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) FUNC_ENTER_NOAPI(FAIL) if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5VL_driver_prop_t vol_prop; /* Property for VOL ID & info */ + H5VL_plugin_prop_t vol_prop; /* Property for VOL ID & info */ - /* Prepare the VOL driver property */ - vol_prop.driver_id = vol_id; - vol_prop.driver_info = vol_info; + /* Prepare the VOL plugin property */ + vol_prop.plugin_id = vol_id; + vol_prop.plugin_info = vol_info; - /* Set the driver ID & info property */ + /* Set the plugin ID & info property */ if(H5P_set(plist, H5F_ACS_VOL_DRV_NAME, &vol_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL driver ID & info") - } + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL plugin ID & info") + } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); @@ -5015,7 +5015,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_vol * - * Purpose: Set the file VOL driver (VOL_ID) for a file access + * Purpose: Set the file VOL plugin (VOL_ID) for a file access * property list (PLIST_ID) * * Return: Success: Non-negative @@ -5036,11 +5036,11 @@ H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info) if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if(NULL == H5I_object_verify(new_vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file vol ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file VOL ID") - /* Set the vol */ + /* Set the VOL */ if(H5P_set_vol(plist, new_vol_id, new_vol_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL") done: FUNC_LEAVE_API(ret_value) @@ -5048,75 +5048,103 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_vol_info + * Function: H5Pget_vol_id * - * Purpose: Returns a pointer directly to the file vol-specific - * information of a file access property list. + * Purpose: Returns the ID of the current VOL plugin. + * This ID should be closed with H5VLclose(). * - * Return: Success: Ptr to *uncopied* vol specific data - * structure if any. - * - * Failure: NULL. Null is also returned if the vol has - * not registered any vol-specific properties - * although no error is pushed on the stack in - * this case. + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5P_get_vol_info(H5P_genplist_t *plist) +herr_t +H5Pget_vol_id(hid_t plist_id, hid_t *vol_id) { - void *ret_value = NULL; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*i", plist_id, vol_id); + + /* Get property list for ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - /* Get the current vol info */ + /* Get the current VOL ID */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + + /* Get the plugin property */ + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") - ret_value = (void *)driver_prop.driver_info; - } else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + /* Increment the VOL ID's ref count */ + if(H5I_inc_ref(plugin_prop.plugin_id, TRUE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin ID") + + /* Set the plugin ID to return */ + *vol_id = plugin_prop.plugin_id; + } /* end if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_vol_info() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_vol_id() */ /*------------------------------------------------------------------------- * Function: H5Pget_vol_info * - * Purpose: Returns a pointer directly to the file vol-specific - * information of a file access property list. - * - * XXX (VOL MERGE): This API call seems like a REALLY bad idea - DER - * - * Return: Success: Ptr to *uncopied* vol specific data - * structure if any. + * Purpose: Returns a copy of the VOL info for a plugin. + * This information should be freed with H5VLfree_plugin_info. * - * Failure: NULL. Null is also returned if the vol has - * not registered any vol-specific properties - * although no error is pushed on the stack in - * this case. + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5Pget_vol_info(hid_t plist_id) +herr_t +H5Pget_vol_info(hid_t plist_id, void **vol_info) { - H5P_genplist_t *plist; /* Property list pointer */ - void *ret_value; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(NULL) - H5TRACE1("*x", "i", plist_id); + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i**x", plist_id, vol_info); + /* Get property list for ID */ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get the current VOL info */ + if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + void *new_plugin_info = NULL; /* Copy of plugin info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ - if(NULL == (ret_value = H5P_get_vol_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol info") + /* Get the plugin property */ + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") + + /* Copy plugin info, if it exists */ + if(plugin_prop.plugin_info) { + H5VL_class_t *plugin; /* Pointer to plugin */ + + /* Retrieve the plugin for the ID */ + if(NULL == (plugin = (H5VL_class_t *)H5I_object(plugin_prop.plugin_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Allocate and copy plugin info */ + if(H5VL_copy_plugin_info(plugin, &new_plugin_info, plugin_prop.plugin_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "plugin info copy failed") + } /* end if */ + + /* Set the plugin info */ + *vol_info = new_plugin_info; + } /* end if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") done: FUNC_LEAVE_API(ret_value) @@ -5126,7 +5154,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__vol_copy * - * Purpose: Copy VOL driver ID & info. + * Purpose: Copy VOL plugin ID & info. * * Note: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine @@ -5145,41 +5173,32 @@ H5P__vol_copy(void *value) FUNC_ENTER_STATIC if(value) { - H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */ + H5VL_plugin_prop_t *plugin_prop = (H5VL_plugin_prop_t *)value; /* Driver ID & info struct */ - /* Copy the driver ID & info, if there is one */ - if(info->driver_id > 0) { - /* Increment the reference count on driver ID and copy driver info */ - if(H5I_inc_ref(info->driver_id, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL driver ID") + /* Copy the plugin ID & info, if there is one */ + if(plugin_prop->plugin_id > 0) { + /* Increment the reference count on plugin ID and copy plugin info */ + if(H5I_inc_ref(plugin_prop->plugin_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin ID") - /* Copy driver info, if it exists */ - if(info->driver_info) { - H5VL_class_t *driver; /* Pointer to driver */ - void *new_driver; /* Copy of driver info */ + /* Copy plugin info, if it exists */ + if(plugin_prop->plugin_info) { + H5VL_class_t *plugin; /* Pointer to plugin */ + void *new_plugin_info = NULL; /* Copy of plugin info */ - /* Retrieve the driver for the ID */ - if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID") + /* Retrieve the plugin for the ID */ + if(NULL == (plugin = (H5VL_class_t *)H5I_object(plugin_prop->plugin_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Allow the driver to copy or do it ourselves */ - if(driver->fapl_copy) { - if(NULL == (new_driver = (driver->fapl_copy)(info->driver_info))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver info copy failed") - } - else if(driver->fapl_size > 0) { - if(NULL == (new_driver = H5MM_malloc(driver->fapl_size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed") - HDmemcpy(new_driver, info->driver_info, driver->fapl_size); - } - else - HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info") + /* Allocate and copy plugin info */ + if(H5VL_copy_plugin_info(plugin, &new_plugin_info, plugin_prop->plugin_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "plugin info copy failed") - /* Set the driver info for the copy */ - info->driver_info = new_driver; - } - } - } + /* Set the plugin info to the copy */ + plugin_prop->plugin_info = new_plugin_info; + } /* end if */ + } /* end if */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -5189,7 +5208,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__vol_free * - * Purpose: Free VOL driver ID & info. + * Purpose: Free VOL plugin ID & info. * * Return: Success: Non-negative * Failure: Negative @@ -5204,31 +5223,27 @@ H5P__vol_free(void *value) FUNC_ENTER_STATIC if(value) { - H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */ + H5VL_plugin_prop_t *info = (H5VL_plugin_prop_t *)value; /* Driver ID & info struct */ - /* Free the driver info (if it exists) and decrement the ID */ - if(info->driver_id > 0) { - if(info->driver_info) { - H5VL_class_t *driver; /* Pointer to driver */ + /* Free the plugin info (if it exists) and decrement the ID */ + if(info->plugin_id > 0) { + if(info->plugin_info) { + H5VL_class_t *plugin; /* Pointer to plugin */ - /* Retrieve the driver for the ID */ - if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID") + /* Retrieve the plugin for the ID */ + if(NULL == (plugin = (H5VL_class_t *)H5I_object(info->plugin_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Allow the driver to free info or do it ourselves */ - if(driver->fapl_free) { - if((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */ - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") - } - else - H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */ - } + /* Free the plugin info */ + if(H5VL_free_plugin_info(plugin, (void *)info->plugin_info) < 0) /* Casting away const OK - QAK */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin info object") + } /* end if */ - /* Decrement reference count for driver ID */ - if(H5I_dec_ref(info->driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID") - } - } + /* Decrement reference count for plugin ID */ + if(H5I_dec_ref(info->plugin_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for plugin ID") + } /* end if */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -5238,7 +5253,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_create * - * Purpose: Create callback for the VOL driver ID & info property. + * Purpose: Create callback for the VOL plugin ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5252,9 +5267,9 @@ H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size FUNC_ENTER_STATIC - /* Make copy of the VOL driver */ + /* Make copy of the VOL plugin */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5264,7 +5279,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_set * - * Purpose: Copies a VOL driver property when it's set for a property list + * Purpose: Copies a VOL plugin property when it's set for a property list * * Return: Success: Non-negative * Failure: Negative @@ -5282,9 +5297,9 @@ H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, /* Sanity check */ HDassert(value); - /* Make copy of VOL driver ID & info */ + /* Make copy of VOL plugin ID & info */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5294,7 +5309,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_get * - * Purpose: Copies a VOL driver property when it's retrieved from a property list + * Purpose: Copies a VOL plugin property when it's retrieved from a property list * * Return: Success: Non-negative * Failure: Negative @@ -5312,9 +5327,9 @@ H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, /* Sanity check */ HDassert(value); - /* Make copy of VOL driver */ + /* Make copy of VOL plugin */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5324,7 +5339,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_del * - * Purpose: Frees memory used to store the VOL driver ID & info property + * Purpose: Frees memory used to store the VOL plugin ID & info property * * Return: Success: Non-negative * Failure: Negative @@ -5338,9 +5353,9 @@ H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, FUNC_ENTER_STATIC - /* Free the VOL driver ID & info */ + /* Free the VOL plugin ID & info */ if(H5P__vol_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5350,7 +5365,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_copy * - * Purpose: Copy callback for the VOL driver ID & info property. + * Purpose: Copy callback for the VOL plugin ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5364,9 +5379,9 @@ H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC - /* Make copy of VOL driver */ + /* Make copy of VOL plugin */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5376,7 +5391,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_cmp * - * Purpose: Callback routine which is called whenever the VOL driver + * Purpose: Callback routine which is called whenever the VOL plugin * ID & info property in the file access property list * is compared. * @@ -5389,48 +5404,39 @@ done: static int H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED size) { - const H5VL_driver_prop_t *info1 = (const H5VL_driver_prop_t *)_info1; /* Create local aliases for values */ - const H5VL_driver_prop_t *info2 = (const H5VL_driver_prop_t *)_info2; + const H5VL_plugin_prop_t *info1 = (const H5VL_plugin_prop_t *)_info1; /* Create local aliases for values */ + const H5VL_plugin_prop_t *info2 = (const H5VL_plugin_prop_t *)_info2; H5VL_class_t *cls1, *cls2; /* Driver class for each property */ int cmp_value; /* Value from comparison */ - herr_t ret_value = 0; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(info1); HDassert(info2); - HDassert(size == sizeof(H5VL_driver_prop_t)); + HDassert(size == sizeof(H5VL_plugin_prop_t)); - /* Compare drivers */ - if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->driver_id))) + /* Compare plugins */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->plugin_id))) HGOTO_DONE(-1) - if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->driver_id))) + if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->plugin_id))) HGOTO_DONE(1) - if(cls1->name == NULL && cls2->name != NULL) - HGOTO_DONE(-1); - if(cls1->name != NULL && cls2->name == NULL) - HGOTO_DONE(1); - if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) + if(0 != (cmp_value = H5VL_cmp_plugin_cls(cls1, cls2))) HGOTO_DONE(cmp_value); - /* Compare driver info */ - if(cls1->fapl_size < cls2->fapl_size) - HGOTO_DONE(-1) - if(cls1->fapl_size > cls2->fapl_size) - HGOTO_DONE(1) - HDassert(cls1->fapl_size == cls2->fapl_size); + /* At this point, we should be able to assume that we are dealing with + * the same plugin class struct (or a copies of the same class struct) + */ - if(info1->driver_info == NULL && info2->driver_info != NULL) - HGOTO_DONE(-1); - if(info1->driver_info != NULL && info2->driver_info == NULL) - HGOTO_DONE(1); - if(info1->driver_info) { - HDassert(cls1->fapl_size > 0); - if(0 != (cmp_value = HDmemcmp(info1->driver_info, info2->driver_info, cls1->fapl_size))) - HGOTO_DONE(cmp_value); - } + /* Use one of the classes (cls1) info comparison routines to compare the + * info objects + */ + HDassert(cls1->info_cmp == cls2->info_cmp); + if(0 != (cmp_value = H5VL_cmp_plugin_info(cls1, info1->plugin_info, info2->plugin_info))) + HGOTO_DONE(cmp_value); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_vol_cmp() */ @@ -5439,7 +5445,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_close * - * Purpose: Close callback for the VOL driver ID & info property. + * Purpose: Close callback for the VOL plugin ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5453,9 +5459,9 @@ H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC - /* Free the VOL driver */ + /* Free the VOL plugin */ if(H5P__vol_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index cd749cb..866f088 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -178,7 +178,6 @@ H5_DLL const void *H5P_peek_driver_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info); H5_DLL herr_t H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info); -H5_DLL void * H5P_get_vol_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 77d8ebb..86c6687 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -314,7 +314,8 @@ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, H5_DLL hid_t H5Pget_driver(hid_t plist_id); H5_DLL const void *H5Pget_driver_info(hid_t plist_id); H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); -H5_DLL void *H5Pget_vol_info(hid_t plist_id); +H5_DLL herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id); +H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info); H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset); H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type); diff --git a/src/H5R.c b/src/H5R.c index 3e6517f..a52f35b 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -93,6 +93,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -126,13 +127,22 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Create reference */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_CREATE, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, ref_type, space_id)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Rcreate() */ @@ -200,11 +210,11 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &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_id(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: @@ -260,7 +270,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Get the dataspace with the correct region selected */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_REGION, + if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") @@ -318,7 +328,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the object type */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, + if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") @@ -367,6 +377,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) @@ -386,13 +397,22 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Get name */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_NAME, + if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Rget_name() */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 9c1fcc5..83d2783 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -126,7 +126,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier") /* Get the object information */ - if (H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_TYPE, + if (H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type") @@ -183,12 +183,12 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if (NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, &opened_type, + if (NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: diff --git a/src/H5Rint.c b/src/H5Rint.c index 52a4ee1..7142d54 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -692,9 +692,9 @@ done: REVISION LOG --------------------------------------------------------------------------*/ ssize_t -H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_t size) +H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, + char *name, size_t size) { - hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */ H5O_loc_t oloc; /* Object location describing object for reference */ ssize_t ret_value = -1; /* Return value */ @@ -747,19 +747,11 @@ H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, (-1), "internal error (unknown reference type)") } /* end switch */ - /* Retrieve file ID for name search */ - if ((file_id = H5F_get_id(f, FALSE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get file ID") - /* Get name, length, etc. */ - if ((ret_value = H5G_get_name_by_addr(file_id, &oloc, name, size)) < 0) + if ((ret_value = H5G_get_name_by_addr(f, &oloc, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name") done: - /* Close file ID used for search */ - if (file_id > 0 && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_name() */ diff --git a/src/H5T.c b/src/H5T.c index d0b1c0a..e539ea5 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1609,12 +1609,12 @@ H5T__close_cb(H5T_t *dt) HDassert(dt->shared); /* If this datatype is VOL-managed (i.e.: has a VOL object), - * close it through the VOL driver. + * close it through the VOL plugin. */ if(NULL != dt->vol_obj) { - /* Close the driver-managed datatype data */ - if(H5VL_datatype_close(dt->vol_obj->data, dt->vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + /* Close the plugin-managed datatype data */ + if(H5VL_datatype_close(dt->vol_obj->data, dt->vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); /* Free the VOL object */ @@ -3672,7 +3672,7 @@ done: * Purpose: Frees a datatype and all associated memory. * * Note: Does _not_ deal with open named datatypes, etc. so this - * should never see a type managed by a VOL driver. + * should never see a type managed by a VOL plugin. * * Return: Non-negative on success/Negative on failure * @@ -5194,7 +5194,7 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) H5VL_object_t *vol_obj = dt->vol_obj; /* Close the datatype through the VOL*/ - if ((ret_value = H5VL_datatype_close(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if ((ret_value = H5VL_datatype_close(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); /* Free the datatype and set the VOL object pointer to NULL */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 8f7b4de..8389352 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -108,6 +108,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -149,8 +150,13 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Commit the type */ - if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") @@ -158,14 +164,18 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* Set up VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->driver = vol_obj->driver; - new_obj->driver->nrefs ++; + new_obj->plugin = vol_obj->plugin; + new_obj->plugin->nrefs ++; new_obj->data = data; - /* Set the committed type object to the VOL driver pointer in the H5T_t struct */ + /* Set the committed type object to the VOL plugin pointer in the H5T_t struct */ dt->vol_obj = new_obj; done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Tcommit2() */ @@ -305,7 +315,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Commit the datatype */ - if(NULL == (dt = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (dt = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") @@ -313,11 +323,11 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) /* Setup VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->driver = vol_obj->driver; - new_obj->driver->nrefs ++; + new_obj->plugin = vol_obj->plugin; + new_obj->plugin->nrefs ++; new_obj->data = dt; - /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */ + /* Set the committed type object to the VOL plugin pointer in the H5T_t struct */ type->vol_obj = new_obj; done: @@ -568,9 +578,10 @@ done: hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) { - void *dt = NULL; /* datatype token created by VOL driver */ + void *dt = NULL; /* datatype token created by VOL plugin */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -594,19 +605,28 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Open the datatype */ - if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_DATATYPE, dt, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + /* Cleanup on error */ if(H5I_INVALID_HID == ret_value) - if(dt && H5VL_datatype_close(dt, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dt && H5VL_datatype_close(dt, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") FUNC_LEAVE_API(ret_value) @@ -664,7 +684,7 @@ H5Tget_create_plist(hid_t dtype_id) H5VL_object_t *vol_obj = type->vol_obj; /* Get the property list through the VOL */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_TCPL, + if(H5VL_datatype_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATATYPE_GET_TCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") } @@ -707,7 +727,7 @@ H5Tflush(hid_t type_id) /* Flush metadata for named datatype */ if(dt->vol_obj) - if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->driver->cls, H5VL_DATATYPE_FLUSH, + if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->plugin->cls, H5VL_DATATYPE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") @@ -749,7 +769,7 @@ H5Trefresh(hid_t type_id) /* Refresh the datatype's metadata */ if(dt->vol_obj) - if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->driver->cls, H5VL_DATATYPE_REFRESH, + if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->plugin->cls, H5VL_DATATYPE_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") @@ -1106,7 +1126,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI(NULL) /* get required buf size for encoding the datatype */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_BINARY, + if(H5VL_datatype_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size") @@ -1115,7 +1135,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") /* get binary description of the datatype */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_BINARY, + if(H5VL_datatype_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype") @@ -1161,7 +1181,7 @@ H5T_get_named_type(const H5T_t *dt) /*------------------------------------------------------------------------- * Function: H5T_get_actual_type * - * Purpose: Returns underlying native datatype created by native driver + * Purpose: Returns underlying native datatype created by native plugin * if datatype is committed, otherwise return the datatype * object associate with the ID. * @@ -1181,7 +1201,7 @@ H5T_get_actual_type(H5T_t *dt) if(NULL == dt->vol_obj) ret_value = dt; else - ret_value = (H5T_t *)dt->vol_obj->data; + ret_value = (H5T_t *)H5VL_object_data(dt->vol_obj); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_get_actual_type() */ @@ -1268,3 +1288,24 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_restore_refresh_state() */ + +/*------------------------------------------------------------------------- + * Function: H5T_already_vol_managed + * + * Purpose: Check if the committed datatype is already VOL managed + * + * Return: TRUE / FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +H5T_already_vol_managed(const H5T_t *dt) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(dt); + + FUNC_LEAVE_NOAPI( dt->vol_obj != NULL ) +} /* end H5T_already_vol_managed() */ + diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 1b59c6b..2244f20 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -137,7 +137,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Commit the datatype */ - if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) @@ -146,8 +146,8 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) /* Set up VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->driver = vol_obj->driver; - new_obj->driver->nrefs ++; + new_obj->plugin = vol_obj->plugin; + new_obj->plugin->nrefs ++; new_obj->data = data; /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */ @@ -197,19 +197,19 @@ H5Topen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the datatype */ - if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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_id(H5I_DATATYPE, dt, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ if(H5I_INVALID_HID == ret_value) - if(dt && H5VL_datatype_close(dt, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dt && H5VL_datatype_close(dt, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype") FUNC_LEAVE_API(ret_value) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index c0a6d8d..a14eb8a 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -144,6 +144,7 @@ H5_DLL H5VL_object_t *H5T_get_named_type(const H5T_t *dt); H5_DLL H5T_t *H5T_get_actual_type(H5T_t *dt); H5_DLL herr_t H5T_save_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); H5_DLL herr_t H5T_restore_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); +H5_DLL hbool_t H5T_already_vol_managed(const H5T_t *dt); /* Reference specific functions */ H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 467847f..841637d 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -531,7 +531,7 @@ H5T_vlen_str_mem_getlen(const void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const char *s=*(const char * const *)_vl; /* Pointer to the user's string information */ #else - const char *s; /* Pointer to the user's string information */ + const char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -566,7 +566,7 @@ H5T_vlen_str_mem_getptr(void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s=*(char **)_vl; /* Pointer to the user's string information */ #else - char *s; /* Pointer to the user's string information */ + char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -601,7 +601,7 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s=*(char **)_vl; /* Pointer to the user's string information */ #else - char *s; /* Pointer to the user's string information */ + char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5VL.c b/src/H5VL.c index 24e558c..ff76d0a 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -45,21 +45,21 @@ /* Local Typedefs */ /******************/ -/* Information needed for iterating over the registered VOL driver hid_t IDs. - * The name of the new VOL driver that is being registered is stored in the +/* Information needed for iterating over the registered VOL plugin hid_t IDs. + * The name of the new VOL plugin that is being registered is stored in the * name field and the found_id field is initialized to H5I_INVALID_HID (-1). - * If we find a VOL driver with the same name, we set the found_id field to + * If we find a VOL plugin with the same name, we set the found_id field to * the existing ID for return to the function. */ typedef struct { - const char *name; /* The name of the VOL driver to check */ + const char *name; /* The name of the VOL plugin to check */ hid_t found_id; /* The library ID if we found a match */ -} H5VL_get_driver_ud_t; +} H5VL_get_plugin_ud_t; /********************/ /* Local Prototypes */ /********************/ -static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data); +static int H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data); /*********************/ /* Package Variables */ @@ -75,7 +75,7 @@ static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data); /*------------------------------------------------------------------------- - * Function: H5VL__get_driver_cb + * Function: H5VL__get_plugin_cb * * Purpose: Callback routine to search through registered VOLs * @@ -87,9 +87,9 @@ static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data); *------------------------------------------------------------------------- */ static int -H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data) +H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) { - H5VL_get_driver_ud_t *op_data = (H5VL_get_driver_ud_t *)_op_data; /* User data for callback */ + H5VL_get_plugin_ud_t *op_data = (H5VL_get_plugin_ud_t *)_op_data; /* User data for callback */ H5VL_class_t *cls = (H5VL_class_t *)obj; int ret_value = H5_ITER_CONT; /* Callback return value */ @@ -101,113 +101,17 @@ H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data) } FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__get_driver_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLinitialize - * - * Purpose: Calls the driver-specific callback to initialize the driver. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLinitialize(hid_t driver_id, hid_t vipl_id) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ii", driver_id, vipl_id); - - /* Check args */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if (cls->initialize && cls->initialize(vipl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not initialize") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLinitialize() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLterminate - * - * Purpose: Calls the driver-specific callback to terminate the driver. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLterminate(hid_t driver_id, hid_t vtpl_id) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ii", driver_id, vtpl_id); - - /* Check args */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if (cls->terminate && cls->terminate(vtpl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not terminate cleanly") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLterminate() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLclose - * - * Purpose: Closes the specified VOL driver. The VOL ID will no longer - * be valid for accessing the VOL. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLclose(hid_t vol_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", vol_id); - - /* Check args */ - if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close VOL driver ID") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLclose() */ +} /* end H5VL__get_plugin_cb() */ /*------------------------------------------------------------------------- * Function: H5VLregister * - * Purpose: Registers a new VOL driver as a member of the virtual object + * Purpose: Registers a new VOL plugin as a member of the virtual object * layer class. * - * Return: Success: A VOL driver ID which is good until the - * library is closed or the driver is + * Return: Success: A VOL plugin ID which is good until the + * library is closed or the plugin is * unregistered. * * Failure: A negative value (H5I_INVALID_HID). @@ -215,39 +119,44 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLregister(const H5VL_class_t *cls) +H5VLregister(const H5VL_class_t *cls, hid_t vipl_id) { - H5VL_get_driver_ud_t op_data; + H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(FAIL) - H5TRACE1("i", "*x", cls); + H5TRACE2("i", "*xi", cls, vipl_id); /* Check arguments */ if (!cls) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL driver class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL plugin class pointer cannot be NULL") if (!cls->name) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver class name cannot be the NULL pointer"); - /* XXX: Should probably come up with a max length so we can use strnlen()? */ + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin class name cannot be the NULL pointer") if (0 == HDstrlen(cls->name)) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver class name cannot be the empty string"); + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin class name cannot be the empty string") + if (cls->info_copy && !cls->info_free) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin must provide free callback for VOL info objects when a copy callback is provided") + if (cls->get_wrap_ctx && !cls->free_wrap_ctx) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin must provide free callback for object wrapping contexts when a get callback is provided") op_data.found_id = H5I_INVALID_HID; op_data.name = cls->name; - /* check if driver is already registered */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + /* check if plugin is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs") - /* XXX: Does this need to be an error? Users probably don't care as long - * as their VOL driver is available. - */ - if (op_data.found_id != H5I_INVALID_HID) - 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) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver") + /* Increment the ref count on the existing VOL plugin ID, if it's already registered */ + if(op_data.found_id != H5I_INVALID_HID) { + if (H5I_inc_ref(op_data.found_id, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") + ret_value = op_data.found_id; + } /* end if */ + else { + /* Create a new class ID */ + if ((ret_value = H5VL_register(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin") + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -257,11 +166,11 @@ done: /*------------------------------------------------------------------------- * Function: H5VLregister_by_name * - * Purpose: Registers a new VOL driver as a member of the virtual object + * Purpose: Registers a new VOL plugin as a member of the virtual object * layer class. * - * Return: Success: A VOL driver ID which is good until the - * library is closed or the driver is + * Return: Success: A VOL plugin ID which is good until the + * library is closed or the plugin is * unregistered. * * Failure: A negative value. @@ -269,46 +178,46 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLregister_by_name(const char *name) +H5VLregister_by_name(const char *name, hid_t vipl_id) { - H5VL_get_driver_ud_t op_data; - hid_t ret_value = H5I_INVALID_HID; + H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(FAIL) - H5TRACE1("i", "*s", name); + H5TRACE2("i", "*si", name, vipl_id); /* Check arguments */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL driver name is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL plugin name is disallowed") if (0 == HDstrlen(name)) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL driver name is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL plugin name is disallowed") op_data.found_id = H5I_INVALID_HID; op_data.name = name; - /* Check if driver is already registered */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + /* Check if plugin is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") + /* If plugin alread registered, increment ref count on ID and return ID */ if (op_data.found_id != H5I_INVALID_HID) { - /* If driver alread registered, increment ref count on ID and return ID */ if (H5I_inc_ref(op_data.found_id, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") ret_value = op_data.found_id; - } + } /* end if */ else { H5PL_key_t key; const H5VL_class_t *cls; - /* Try loading the driver */ + /* Try loading the plugin */ key.name = name; if (NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, key))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL driver") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL plugin") - /* Register the driver we loaded */ - if ((ret_value = H5VL_register(cls, sizeof(H5VL_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID") - } + /* Register the plugin we loaded */ + if ((ret_value = H5VL_register(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin ID") + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -316,12 +225,46 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLclose + * + * Purpose: Closes a VOL plugin ID. This in no way affects + * file access property lists which have been defined to use + * this VOL plugin or files which are already opened under with + * this plugin. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLclose(hid_t vol_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", vol_id); + + /* Check args */ + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin") + + /* Decrement the ref count on the ID, possibly releasing the VOL plugin */ + if(H5I_dec_app_ref(vol_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL plugin ID") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLclose() */ + + +/*------------------------------------------------------------------------- * Function: H5VLunregister * - * Purpose: Removes a vol driver ID from the library. This in no way affects + * Purpose: Removes a VOL plugin 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 driver. + * this VOL plugin or files which are already opened under with + * this plugin. * * Return: Success: Non-negative * @@ -332,19 +275,18 @@ done: herr_t H5VLunregister(hid_t vol_id) { - H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", vol_id); /* Check arguments */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(vol_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a vol driver") + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin") /* The H5VL_class_t struct will be freed by this function */ if (H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister vol driver") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL plugin") done: FUNC_LEAVE_API(ret_value) @@ -367,8 +309,8 @@ done: htri_t H5VLis_registered(const char *name) { - H5VL_get_driver_ud_t op_data; - htri_t ret_value = FALSE; /* Return value */ + H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "*s", name); @@ -377,7 +319,7 @@ H5VLis_registered(const char *name) op_data.name = name; /* Check arguments */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids") if (op_data.found_id != H5I_INVALID_HID) @@ -389,9 +331,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLget_driver_id + * Function: H5VLget_plugin_id * - * Purpose: Retrieves the ID for a registered VOL driver. + * Purpose: Retrieves the ID for a registered VOL plugin. * * Return: Positive if the VOL class has been registered * Negative on error (if the class is not a valid class or not registered) @@ -399,10 +341,10 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLget_driver_id(const char *name) +H5VLget_plugin_id(const char *name) { - H5VL_get_driver_ud_t op_data; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*s", name); @@ -411,47 +353,120 @@ H5VLget_driver_id(const char *name) op_data.name = name; /* Check arguments */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL driver IDs") + if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL plugin IDs") if (op_data.found_id != H5I_INVALID_HID) { if (H5I_inc_ref(op_data.found_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") - + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") ret_value = op_data.found_id; - } + } /* end if */ done: FUNC_LEAVE_API(ret_value) -} /* end H5VLget_driver_id() */ +} /* end H5VLget_plugin_id() */ /*------------------------------------------------------------------------- - * Function: H5VLget_driver_name + * Function: H5VLget_plugin_name * - * Purpose: Returns the driver name for the VOL associated with the + * Purpose: Returns the plugin name for the VOL associated with the * object or file ID * - * Return: Success: The length of the driver name + * Return: Success: The length of the plugin name * * Failure: Negative * *------------------------------------------------------------------------- */ ssize_t -H5VLget_driver_name(hid_t obj_id, char *name/*out*/, size_t size) +H5VLget_plugin_name(hid_t obj_id, char *name/*out*/, size_t size) { ssize_t ret_value = -1; FUNC_ENTER_API(FAIL) H5TRACE3("Zs", "ixz", obj_id, name, size); - if ((ret_value = H5VL_get_driver_name(obj_id, name, size)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get driver name") + if ((ret_value = H5VL_get_plugin_name(obj_id, name, size)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get plugin name") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLget_plugin_name() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcmp_plugin_cls + * + * Purpose: Compares two plugin classes + * + * Return: Success: Non-negative, with *cmp set to positive if + * plugin_id1 is greater than plugin_id2, negative if plugin_id2 + * is greater than plugin_id1 and zero if plugin_id1 and plugin_id2 + * are equal. + * + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcmp_plugin_cls(int *cmp, hid_t plugin_id1, hid_t plugin_id2) +{ + H5VL_class_t *cls1, *cls2; /* Plugins for IDs */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "*Isii", cmp, plugin_id1, plugin_id2); + + /* Check args and get class pointers */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Compare the two VOL plugin classes */ + *cmp = H5VL_cmp_plugin_cls(cls1, cls2); done: FUNC_LEAVE_API(ret_value) -} /* end H5VLget_driver_name() */ +} /* H5VLcmp_plugin_cls() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcmp_plugin_info + * + * Purpose: Compares two plugin info objects + * + * Note: Both info objects must be from the same VOL plugin class + * + * Return: Success: Non-negative, with *cmp set to positive if + * info1 is greater than info2, negative if info2 + * is greater than info1 and zero if info1 and info2 + * are equal. + * + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, const void *info2) +{ + H5VL_class_t *cls; /* Plugins for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*Isi*x*x", cmp, plugin_id, info1, info2); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Compare the two VOL plugin info objects */ + *cmp = H5VL_cmp_plugin_info(cls, info1, info2); + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLcmp_plugin_info() */ /*--------------------------------------------------------------------------- @@ -467,18 +482,18 @@ done: *--------------------------------------------------------------------------- */ hid_t -H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t driver_id) +H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t plugin_id) { hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) - H5TRACE3("i", "*xIti", obj, obj_type, driver_id); + H5TRACE3("i", "*xIti", obj, obj_type, plugin_id); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object to register") - 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_object_register(obj, obj_type, plugin_id, TRUE)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "unable to register object") done: FUNC_LEAVE_API(ret_value) @@ -514,40 +529,306 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5VLobject() */ +/*------------------------------------------------------------------------- + * Routines below this are public wrappers for stackable VOL plugins, and + * should not be called by applications. + *-----------------------------------------------------------------------*/ + + +/*------------------------------------------------------------------------- + * Function: H5VLinitialize + * + * Purpose: Calls the plugin-specific callback to initialize the plugin. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLinitialize(hid_t plugin_id, hid_t vipl_id) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "ii", plugin_id, vipl_id); + + /* Check args */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if (cls->initialize && cls->initialize(vipl_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not initialize") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLinitialize() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLterminate + * + * Purpose: Calls the plugin-specific callback to terminate the plugin. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLterminate(hid_t plugin_id) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE1("e", "i", plugin_id); + + /* Check args */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if (cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not terminate cleanly") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLterminate() */ + /*--------------------------------------------------------------------------- - * Function: H5VLget_object + * Function: H5VLget_cap_flags + * + * Purpose: Retrieves the capability flag for a plugin + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_cap_flags(hid_t plugin_id, unsigned *cap_flags) +{ + H5VL_class_t *cls; /* Plugin class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + H5TRACE2("e", "i*Iu", plugin_id, cap_flags); + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Retrieve capability flags */ + if(cap_flags) + *cap_flags = cls->cap_flags; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_cap_flags */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcopy_plugin_info * - * Purpose: Retrieves the object pointer associated with the ID. This - * also optionally returns the H5VL_t struct that this ID - * belongs to, if the user passes a valid pointer value. + * Purpose: Copies a VOL plugin's info object * * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcopy_plugin_info(hid_t plugin_id, void **dst_vol_info, void *src_vol_info) +{ + H5VL_class_t *cls; /* Plugins for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + H5TRACE3("e", "i**x*x", plugin_id, dst_vol_info, src_vol_info); + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Copy the VOL plugin's info object */ + if(H5VL_copy_plugin_info(cls, dst_vol_info, src_vol_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL plugin info object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLcopy_plugin_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLfree_plugin_info + * + * Purpose: Free VOL plugin info object * + * Return: Success: Non-negative * Failure: Negative * *--------------------------------------------------------------------------- */ herr_t -H5VLget_object(hid_t obj_id, void **obj) +H5VLfree_plugin_info(hid_t plugin_id, void *info) { - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* Plugins for ID */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i**x", obj_id, obj); + FUNC_ENTER_API_NOINIT + + H5TRACE2("e", "i*x", plugin_id, info); + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Free the VOL plugin info object */ + if(H5VL_free_plugin_info(cls, info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin info object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_plugin_info() */ + +/*--------------------------------------------------------------------------- + * Function: H5VLget_object + * + * Purpose: Retrieves an underlying object. + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLget_object(void *obj, hid_t plugin_id) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; + + FUNC_ENTER_API_NOINIT + + H5TRACE2("*x", "*xi", obj, plugin_id); /* Check args */ - if (!obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object pointer") + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - if (NULL == (*obj = H5VL_get_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain a valid object") + /* Check for 'get_object' callback in plugin */ + if(cls->get_object) + ret_value = (cls->get_object)(obj); + else + ret_value = obj; done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* H5VLget_object */ +/*--------------------------------------------------------------------------- + * Function: H5VLget_wrap_ctx + * + * Purpose: Get a VOL plugin's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_wrap_ctx(void *obj, hid_t plugin_id, void **wrap_ctx) +{ + H5VL_class_t *cls; /* Plugins for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + H5TRACE3("e", "*xi**x", obj, plugin_id, wrap_ctx); + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Get the VOL plugin's object wrapper */ + if(H5VL_get_wrap_ctx(cls, obj, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL plugin object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLfree_wrap_ctx + * + * Purpose: Release a VOL plugin's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLfree_wrap_ctx(void *wrap_ctx, hid_t plugin_id) +{ + H5VL_class_t *cls; /* Plugins for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + H5TRACE2("e", "*xi", wrap_ctx, plugin_id); + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Release the VOL plugin's object wrapper */ + if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLwrap_object + * + * Purpose: Asks a plugin to wrap an underlying object. + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLwrap_object(void *obj, hid_t plugin_id, void *wrap_ctx) +{ + H5VL_class_t *cls; /* VOL plugin class */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + + H5TRACE3("*x", "*xi*x", obj, plugin_id, wrap_ctx); + /* Check args */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Wrap the object */ + if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLwrap_object */ + + /*------------------------------------------------------------------------- * Function: H5VLattr_create * @@ -560,27 +841,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_API(NULL) - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, acpl_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, acpl_id, aapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create attribute") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_create() */ @@ -596,27 +877,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, aapl_id, + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, aapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open attribute") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_open() */ @@ -631,23 +912,23 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VLattr_read(void *attr, hid_t driver_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) +herr_t H5VLattr_read(void *attr, hid_t plugin_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API_NOINIT if (NULL == attr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_attr_read(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_read() */ @@ -662,23 +943,23 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VLattr_write(void *attr, hid_t driver_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) +herr_t H5VLattr_write(void *attr, hid_t plugin_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API_NOINIT if (NULL == attr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_attr_write(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write attribute") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_write() */ @@ -694,35 +975,35 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_get(void *obj, hid_t driver_id, H5VL_attr_get_t get_type, +H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVai**xx", obj, driver_id, get_type, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVai**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr get' method") if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_get() */ /*------------------------------------------------------------------------- * Function: H5VLattr_specific * - * Purpose: Performs a driver-specific operation on an attribute + * Purpose: Performs a plugin-specific operation on an attribute * * Return: Success: Non-negative * @@ -731,37 +1012,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, +H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, driver_id, specific_type, + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, plugin_id, specific_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr specific' method") if((ret_value = (cls->attr_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_specific() */ /*------------------------------------------------------------------------- * Function: H5VLattr_optional * - * Purpose: Performs an optional driver-specific operation on an attribute + * Purpose: Performs an optional plugin-specific operation on an attribute * * Return: Success: Non-negative * @@ -770,27 +1051,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Have to bypass the H5VLint layer due to unknown val_list arguments */ if(NULL == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr optional' method") if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_optional() */ @@ -806,24 +1087,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_close(void *attr, hid_t driver_id, hid_t dxpl_id, void **req) +H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", attr, driver_id, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", attr, plugin_id, dxpl_id, req); if (NULL == attr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_attr_close(attr, cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close attribute") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_close() */ @@ -839,27 +1120,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_API(NULL) - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, dcpl_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, dcpl_id, dapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create dataset") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_create() */ @@ -875,26 +1156,26 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, dapl_id, + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, dapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open dataset") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_open() */ @@ -910,27 +1191,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_read(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, +H5VLdataset_read(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE8("e", "*xiiiii*x**x", dset, driver_id, mem_type_id, mem_space_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); if (NULL == dset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_dataset_read(dset, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_read() */ @@ -946,27 +1227,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_write(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, +H5VLdataset_write(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE8("e", "*xiiiii*x**x", dset, driver_id, mem_type_id, mem_space_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); if (NULL == dset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_dataset_write(dset, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_write() */ @@ -982,35 +1263,35 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_get(void *dset, hid_t driver_id, H5VL_dataset_get_t get_type, +H5VLdataset_get(void *dset, hid_t plugin_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVci**xx", dset, driver_id, get_type, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVci**xx", dset, plugin_id, get_type, dxpl_id, req, arguments); if (NULL == dset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset get' method") if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_get() */ /*------------------------------------------------------------------------- * Function: H5VLdataset_specific * - * Purpose: Performs a driver-specific operation on a dataset + * Purpose: Performs a plugin-specific operation on a dataset * * Return: Success: Non-negative * @@ -1019,36 +1300,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_specific(void *obj, hid_t driver_id, H5VL_dataset_specific_t specific_type, +H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVdi**xx", obj, driver_id, specific_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVdi**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset specific' method") if((ret_value = (cls->dataset_cls.specific) (obj, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_specific() */ /*------------------------------------------------------------------------- * Function: H5VLdataset_optional * - * Purpose: Performs an optional driver-specific operation on a dataset + * Purpose: Performs an optional plugin-specific operation on a dataset * * Return: Success: Non-negative * @@ -1057,26 +1338,26 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset optional' method") if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_optional() */ @@ -1092,24 +1373,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_close(void *dset, hid_t driver_id, hid_t dxpl_id, void **req) +H5VLdataset_close(void *dset, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", dset, driver_id, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", dset, plugin_id, dxpl_id, req); if (NULL == dset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_dataset_close(dset, cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close dataset") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_close() */ @@ -1129,28 +1410,28 @@ H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) { H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) + FUNC_ENTER_API_NOINIT H5TRACE6("*x", "*sIuiii**x", name, flags, fcpl_id, fapl_id, dxpl_id, req); /* get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL plugin info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_create() */ @@ -1169,27 +1450,27 @@ void * H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) { H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) + FUNC_ENTER_API_NOINIT H5TRACE5("*x", "*sIuii**x", name, flags, fapl_id, dxpl_id, req); /* get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL plugin info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_open() */ @@ -1205,35 +1486,35 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_get(void *file, hid_t driver_id, H5VL_file_get_t get_type, +H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVgi**xx", file, driver_id, get_type, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVgi**xx", file, plugin_id, get_type, dxpl_id, req, arguments); if(NULL == file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file get' method") if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute file get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_get() */ /*------------------------------------------------------------------------- * Function: H5VLfile_specific * - * Purpose: Performs a driver-specific operation on a file + * Purpose: Performs a plugin-specific operation on a file * * Return: Success: Non-negative * @@ -1242,19 +1523,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_specific(void *file, hid_t driver_id, H5VL_file_specific_t specific_type, +H5VLfile_specific(void *file, hid_t plugin_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVhi**xx", file, driver_id, specific_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVhi**xx", file, plugin_id, specific_type, dxpl_id, req, arguments); if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ hid_t fapl_id; fapl_id = va_arg (arguments, hid_t); @@ -1263,38 +1544,36 @@ H5VLfile_specific(void *file, hid_t driver_id, H5VL_file_specific_t specific_typ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol driver info") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) + if((ret_value = (cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - } + } /* end if */ else { if(NULL == file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file specific' method") - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file specific' method") + if((ret_value = (cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file specific callback") - } + } /* end else */ done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_specific() */ /*------------------------------------------------------------------------- * Function: H5VLfile_optional * - * Purpose: Performs an optional driver-specific operation on a file + * Purpose: Performs an optional plugin-specific operation on a file * * Return: Success: Non-negative * @@ -1303,26 +1582,26 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *file, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLfile_optional(void *file, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", file, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", file, plugin_id, dxpl_id, req, arguments); if(NULL == file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file optional' method") if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_optional() */ @@ -1338,24 +1617,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_close(void *file, hid_t driver_id, hid_t dxpl_id, void **req) +H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", file, driver_id, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", file, plugin_id, dxpl_id, req); if(NULL == file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_file_close(file, cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close file") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_close() */ @@ -1371,27 +1650,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, gcpl_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, gcpl_id, gapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_create() */ @@ -1407,27 +1686,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, gapl_id, + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, gapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_open() */ @@ -1443,35 +1722,35 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_get(void *obj, hid_t driver_id, H5VL_group_get_t get_type, +H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVii**xx", obj, driver_id, get_type, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVii**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group get' method") if((ret_value = (cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute group get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_get() */ /*------------------------------------------------------------------------- * Function: H5VLgroup_specific * - * Purpose: Performs a driver-specific operation on a group + * Purpose: Performs a plugin-specific operation on a group * * Return: Success: Non-negative * @@ -1480,36 +1759,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_specific(void *obj, hid_t driver_id, H5VL_group_specific_t specific_type, +H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVji**xx", obj, driver_id, specific_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVji**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group specific' method") if((ret_value = (cls->group_cls.specific) (obj, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_specific() */ /*------------------------------------------------------------------------- * Function: H5VLgroup_optional * - * Purpose: Performs an optional driver-specific operation on a group + * Purpose: Performs an optional plugin-specific operation on a group * * Return: Success: Non-negative * @@ -1518,26 +1797,26 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group optional' method") if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_optional() */ @@ -1553,24 +1832,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_close(void *grp, hid_t driver_id, hid_t dxpl_id, void **req) +H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", grp, driver_id, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", grp, plugin_id, dxpl_id, req); if(NULL == grp) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_group_close(grp, cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close group") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_close() */ @@ -1579,6 +1858,8 @@ done: * * Purpose: Creates a hard link * + * Note: The 'obj' parameter is allowed to be NULL + * * Return: Success: Non-negative * * Failure: Negative @@ -1587,25 +1868,23 @@ done: */ herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - hid_t driver_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) + hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, driver_id, lcpl_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, plugin_id, lcpl_id, lapl_id, dxpl_id, req); - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to create link") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_create() */ @@ -1614,6 +1893,8 @@ done: * * Purpose: Copies a link to a new location * + * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL + * * Return: Success: Non-negative * * Failure: Negative @@ -1622,27 +1903,25 @@ done: */ herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t driver_id, + H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API_NOINIT H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, - driver_id, lcpl_id, lapl_id, dxpl_id, req); + plugin_id, lcpl_id, lapl_id, dxpl_id, req); - if(NULL == src_obj || NULL == dst_obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_copy() */ @@ -1651,6 +1930,8 @@ done: * * Purpose: Moves a link to another location * + * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL + * * Return: Success: Non-negative * * Failure: Negative @@ -1659,27 +1940,25 @@ done: */ herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t driver_id, + H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API_NOINIT H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, - driver_id, lcpl_id, lapl_id, dxpl_id, req); + plugin_id, lcpl_id, lapl_id, dxpl_id, req); - if(NULL == src_obj || NULL == dst_obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_move() */ @@ -1695,36 +1974,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_get_t get_type, +H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVli**xx", obj, loc_params, driver_id, get_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVli**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, arguments); if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link get' method") if((ret_value = (cls->link_cls.get) (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_get() */ /*------------------------------------------------------------------------- * Function: H5VLlink_specific * - * Purpose: Performs a driver-specific operation on a link + * Purpose: Performs a plugin-specific operation on a link * * Return: Success: Non-negative * @@ -1733,37 +2012,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, +H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, driver_id, specific_type, + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, plugin_id, specific_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link specific' method") if((ret_value = (cls->link_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_specific() */ /*------------------------------------------------------------------------- * Function: H5VLlink_optional * - * Purpose: Performs an optional driver-specific operation on a link + * Purpose: Performs an optional plugin-specific operation on a link * * Return: Success: Non-negative * @@ -1772,27 +2051,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Have to bypass the H5VLint layer due to unknown val_list arguments */ if(NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link optional' method") if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_optional() */ @@ -1808,25 +2087,25 @@ done: *------------------------------------------------------------------------- */ void * -H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t driver_id, H5I_type_t *opened_type, +H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t plugin_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE6("*x", "*xxi*Iti**x", obj, params, driver_id, opened_type, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE6("*x", "*xxi*Iti**x", obj, params, plugin_id, opened_type, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_object_open(obj, params, cls, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLobject_open() */ @@ -1842,33 +2121,33 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t driver_id1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id2, const char *dst_name, +H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t plugin_id1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls1 = NULL; H5VL_class_t *cls2 = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, driver_id1, - src_name, dst_obj, loc_params2, driver_id2, dst_name, ocpypl_id, + FUNC_ENTER_API_NOINIT + H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, plugin_id1, + src_name, dst_obj, loc_params2, plugin_id2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req); if(NULL == src_obj || NULL == dst_obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(driver_id1, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(driver_id2, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_object_copy(src_obj, loc_params1, cls1, src_name, dst_obj, loc_params2, cls2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to move object") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLobject_copy() */ @@ -1884,36 +2163,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_get_t get_type, +H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVni**xx", obj, loc_params, driver_id, get_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVni**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, arguments); if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object get' method") if((ret_value = (cls->object_cls.get) (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLobject_get() */ /*------------------------------------------------------------------------- * Function: H5VLobject_specific * - * Purpose: Performs a driver-specific operation on an object + * Purpose: Performs a plugin-specific operation on an object * * Return: Success: Non-negative * @@ -1922,37 +2201,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, +H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, driver_id, specific_type, + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, plugin_id, specific_type, dxpl_id, req, arguments); if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object specific' method") if((ret_value = (cls->object_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLobject_specific() */ /*------------------------------------------------------------------------- * Function: H5VLobject_optional * - * Purpose: Performs an optional driver-specific operation on an object + * Purpose: Performs an optional plugin-specific operation on an object * * Return: Success: Non-negative * @@ -1961,27 +2240,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Have to bypass the H5VLint layer due to unknown val_list arguments */ if(NULL == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object optional' method") if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLobject_optional() */ @@ -1997,27 +2276,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, driver_id, name, type_id, + FUNC_ENTER_API_NOINIT + H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, plugin_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to commit datatype") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_commit() */ @@ -2033,34 +2312,34 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, tapl_id, + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, tapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open datatype") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_open() */ /*------------------------------------------------------------------------- * Function: H5VLdatatype_specific * - * Purpose: Performs a driver-specific operation on a datatype + * Purpose: Performs a plugin-specific operation on a datatype * * Return: Success: Non-negative * @@ -2069,36 +2348,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_specific(void *obj, hid_t driver_id, H5VL_datatype_specific_t specific_type, +H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVfi**xx", obj, driver_id, specific_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVfi**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype specific' method") if((ret_value = (cls->datatype_cls.specific) (obj, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_specific() */ /*------------------------------------------------------------------------- * Function: H5VLdatatype_optional * - * Purpose: Performs an optional driver-specific operation on a datatype + * Purpose: Performs an optional plugin-specific operation on a datatype * * Return: Success: Non-negative * @@ -2107,26 +2386,26 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype optional' method") if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_optional() */ @@ -2142,28 +2421,28 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_get(void *obj, hid_t driver_id, H5VL_datatype_get_t get_type, +H5VLdatatype_get(void *obj, hid_t plugin_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVei**xx", obj, driver_id, get_type, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVei**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype get' method") if((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute datatype get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_get() */ @@ -2179,24 +2458,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_close(void *dt, hid_t driver_id, hid_t dxpl_id, void **req) +H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", dt, driver_id, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", dt, plugin_id, dxpl_id, req); if (NULL == dt) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_datatype_close(dt, cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close datatype") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_close() */ @@ -2212,22 +2491,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_cancel(void **req, hid_t driver_id, H5ES_status_t *status) +H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**xi*Es", req, driver_id, status); + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "**xi*Es", req, plugin_id, status); - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if ((ret_value = H5VL_request_cancel(req, cls, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLrequest_cancel() */ @@ -2243,22 +2522,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_test(void **req, hid_t driver_id, H5ES_status_t *status) +H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**xi*Es", req, driver_id, status); + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "**xi*Es", req, plugin_id, status); - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if ((ret_value = H5VL_request_test(req, cls, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to test request") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLrequest_test() */ @@ -2274,23 +2553,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_wait(void **req, hid_t driver_id, H5ES_status_t *status) +H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**xi*Es", req, driver_id, status); + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "**xi*Es", req, plugin_id, status); - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if ((ret_value = H5VL_request_wait(req, cls, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") - done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLrequest_wait() */ - diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c new file mode 100644 index 0000000..d7c1f5a --- /dev/null +++ b/src/H5VLcallback.c @@ -0,0 +1,1890 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The Virtual Object Layer as described in documentation. + * The pupose is to provide an abstraction on how to access the + * underlying HDF5 container, whether in a local file with + * a specific file format, or remotely on other machines, etc... + */ + + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5VLmodule.h" /* This source code file is part of the H5VL module */ + + +/***********/ +/* Headers */ +/***********/ + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLpkg.h" /* Virtual Object Layer */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5VL_copy_plugin_info + * + * Purpose: Copy the VOL info for a plugin + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_copy_plugin_info(const H5VL_class_t *plugin, void **dst_info, + const void *src_info) +{ + void *new_plugin_info = NULL; /* Copy of plugin info */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plugin); + + /* Check for actual source info */ + if(src_info) { + /* Allow the plugin to copy or do it ourselves */ + if(plugin->info_copy) { + if(NULL == (new_plugin_info = (plugin->info_copy)(src_info))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "plugin info copy callback failed") + } /* end if */ + else if(plugin->info_size > 0) { + if(NULL == (new_plugin_info = H5MM_malloc(plugin->info_size))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "plugin info allocation failed") + HDmemcpy(new_plugin_info, src_info, plugin->info_size); + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy plugin info") + } /* end if */ + + /* Set the plugin info for the copy */ + *dst_info = new_plugin_info; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_copy_plugin_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_cmp_plugin_info + * + * Purpose: Compare VOL info for a plugin + * + * Return: Positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + *------------------------------------------------------------------------- + */ +int +H5VL_cmp_plugin_info(const H5VL_class_t *plugin, const void *info1, + const void *info2) +{ + int cmp_value; /* Value from comparison */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plugin); + + /* Use the class's info comparison routine to compare the info objects, + * if there is a a callback, otherwise just compare the info objects as + * memory buffers + */ + if(plugin->info_cmp) { + if(0 != (cmp_value = (plugin->info_cmp)(info1, info2))) + HGOTO_DONE(cmp_value); + } /* end if */ + else { + if(info1 == NULL && info2 != NULL) + HGOTO_DONE(-1); + if(info1 != NULL && info2 == NULL) + HGOTO_DONE(1); + if(info1) { + HDassert(plugin->info_size > 0); + if(0 != (cmp_value = HDmemcmp(info1, info2, plugin->info_size))) + HGOTO_DONE(cmp_value); + } /* end if */ + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_cmp_plugin_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_plugin_info + * + * Purpose: Free VOL info for a plugin + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_plugin_info(const H5VL_class_t *plugin, void *info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plugin); + + /* Only free info object, if it's non-NULL */ + if(info) { + /* Allow the plugin to free info or do it ourselves */ + if(plugin->info_free) { + if((plugin->info_free)(info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "plugin info free request failed") + } /* end if */ + else + H5MM_xfree(info); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_plugin_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_get_wrap_ctx + * + * Purpose: Retrieve the VOL object wrapping context for a plugin + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_get_wrap_ctx(const H5VL_class_t *plugin, void *obj, void **wrap_ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plugin); + HDassert(obj); + HDassert(wrap_ctx); + + /* Allow the plugin to copy or do it ourselves */ + if(plugin->get_wrap_ctx) { + /* Sanity check */ + HDassert(plugin->free_wrap_ctx); + + /* Invoke plugin's callback */ + if((plugin->get_wrap_ctx)(obj, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "plugin wrap context callback failed") + } /* end if */ + else + *wrap_ctx = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_get_wrap_ctx() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_wrap_ctx + * + * Purpose: Free object wrapping context for a plugin + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_wrap_ctx(const H5VL_class_t *plugin, void *wrap_ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plugin); + + /* Only free wrap context, if it's non-NULL */ + if(wrap_ctx) { + /* Free the plugin's object wrapping context */ + if((plugin->free_wrap_ctx)(wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "plugin wrap context free request failed") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_plugin_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_wrap_object + * + * Purpose: Wrap an object with plugin + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_wrap_object(const H5VL_class_t *plugin, void *wrap_ctx, void *obj) +{ + void *ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Sanity checks */ + HDassert(plugin); + HDassert(obj); + + /* Only wrap object if there's a wrap context */ + if(wrap_ctx) { + /* Ask the plugin to wrap the object */ + if(NULL == (ret_value = (plugin->wrap_object)(obj, wrap_ctx))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") + } /* end if */ + else + ret_value = obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_wrap_object() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_create + * + * Purpose: Creates an attribute through the VOL + * + * Return: Success: pointer to the new attribute + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if (NULL == cls->attr_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'attr create' method") + + /* call the corresponding VOL create callback */ + if (NULL == (ret_value = (cls->attr_cls.create) + (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_open + * + * Purpose: Opens an attribute through the VOL + * + * Return: Success: pointer to the new attr. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t aapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the type specific corresponding VOL open callback exists */ + if(NULL == cls->attr_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'attr open' method") + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->attr_cls.open) + (obj, loc_params, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_read + * + * Purpose: Reads data from attr through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr read' method") + if((ret_value = (cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_write + * + * Purpose: Writes data to attr through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr write' method") + if((ret_value = (cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_get + * + * Purpose: Get specific information about the attribute through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr get' method") + + va_start (arguments, req); + if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_specific + * + * Purpose: specific operation on attributes through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr specific' method") + + va_start (arguments, req); + if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr optional' method") + + va_start (arguments, req); + if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_close + * + * Purpose: Closes an attribute through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + HDassert(attr); + HDassert(cls); + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->attr_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr close' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->attr_cls.close)(attr, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_create + * + * Purpose: Creates a dataset through the VOL + * + * Return: Success: pointer to dataset + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->dataset_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'dataset create' method") + + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->dataset_cls.create) + (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_open + * + * Purpose: Opens a dataset through the VOL + * + * Return: Success: pointer to dataset + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the type specific corresponding VOL open callback exists */ + if(NULL == cls->dataset_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'dset open' method") + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->dataset_cls.open) + (obj, loc_params, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_read + * + * Purpose: Reads data from dataset through the VOL +* + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, + void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset read' method") + if((ret_value = (cls->dataset_cls.read)(dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_write + * + * Purpose: Writes data from dataset through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset write' method") + if((ret_value = (cls->dataset_cls.write) + (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_get + * + * Purpose: Get specific information about the dataset through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset get' method") + + va_start (arguments, req); + if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_specific + * + * Purpose: specific operation on datasets through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset specific' method") + + va_start (arguments, req); + if((ret_value = (cls->dataset_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset optional' method") + + va_start (arguments, req); + if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_close + * + * Purpose: Closes a dataset through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(dset); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->dataset_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dset close' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->dataset_cls.close)(dset, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + +done: + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_create + * + * Purpose: Creates a file through the VOL + * + * Return: Success: pointer to file. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->file_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'file create' method") + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_open + * + * Purpose: Opens a file through the VOL. + * + * Return: Success: pointer to file. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->file_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'file open' method") + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file get' method") + + va_start(arguments, req); + if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end(arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_specific + * + * Purpose: perform File specific operations through the VOL + * + * Return: Success: non negative + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + va_list tmp_args; /* argument list passed from the API call */ + hid_t fapl_id; + + va_start (tmp_args, req); + fapl_id = va_arg (tmp_args, hid_t); + va_end (tmp_args); + + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") + + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + va_start (arguments, req); + if((ret_value = (cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + va_end (arguments); + } + else { + if(NULL == cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file specific' method") + + va_start (arguments, req); + if((ret_value = (cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + va_end (arguments); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_optional + * + * Purpose: perform a plugin specific operation + * + * Return: Success: non negative + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file optional' method") + + va_start (arguments, req); + if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_close + * + * Purpose: Closes a file through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(file); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->file_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file close' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->file_cls.close)(file, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_create + * + * Purpose: Creates a group through the VOL + * + * Return: Success: pointer to new group. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->group_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'group create' method") + + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->group_cls.create) + (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_open + * + * Purpose: Opens a group through the VOL + * + * Return: Success: pointer to new group. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t gapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + if(NULL == cls->group_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'group open' method") + + if(NULL == (ret_value = (cls->group_cls.open) + (obj, loc_params, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_get + * + * Purpose: Get specific information about the group through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group get' method") + + va_start (arguments, req); + if((ret_value = (cls->group_cls.get) + (obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_specific + * + * Purpose: specific operation on groups through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group specific' method") + + va_start (arguments, req); + if((ret_value = (cls->group_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group optional' method") + + va_start (arguments, req); + if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_close + * + * Purpose: Closes a group through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + HDassert(grp); + HDassert(cls); + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->group_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group close' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->group_cls.close)(grp, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_create + * + * Purpose: Creates a hard link through the VOL + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->link_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link create' method") + /* call the corresponding VOL create callback */ + if((ret_value = (cls->link_cls.create) + (create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_copy + * + * Purpose: Copys a link from src to dst. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check if the corresponding VOL copy callback exists */ + if(NULL == cls->link_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link copy' method") + + /* call the corresponding VOL copy callback */ + if((ret_value = (cls->link_cls.copy) + (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, + lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_move + * + * Purpose: Moves a link from src to dst. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check if the corresponding VOL move callback exists */ + if(NULL == cls->link_cls.move) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link move' method") + + /* call the corresponding VOL move callback */ + if((ret_value = (cls->link_cls.move) + (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, + lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link move failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_get + * + * Purpose: Get specific information about the link through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link get' method") + + va_start (arguments, req); + if((ret_value = (cls->link_cls.get) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_specific + * + * Purpose: specific operation on links through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link specific' method") + + va_start (arguments, req); + if((ret_value = (cls->link_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link optional' method") + + va_start (arguments, req); + if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_open + * + * Purpose: Opens a object through the VOL + * + * Return: Success: User ID of the new object. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL open callback exists */ + if(NULL == cls->object_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'object open' method") + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->object_cls.open) + (obj, params, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_copy + * + * Purpose: Copies an object to another destination through the VOL + * + * Return: Success: Non Negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Make sure that the VOL plugins are the same */ + if (cls1->value != cls2->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + + if(NULL == cls1->object_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object copy' method") + + if((ret_value = (cls1->object_cls.copy) + (src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id, + lcpl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_get + * + * Purpose: Get specific information about the object through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object get' method") + + va_start (arguments, req); + if((ret_value = (cls->object_cls.get) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_specific + * + * Purpose: specific operation on objects through the VOL + * + * Return: Success: non negative + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object specific' method") + + va_start (arguments, req); + if((ret_value = (cls->object_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->object_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object optional' method") + + va_start (arguments, req); + if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: Positive + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL commit callback exists */ + if(NULL == cls->datatype_cls.commit) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'datatype commit' method") + + /* call the corresponding VOL commit callback */ + if(NULL == (ret_value = (cls->datatype_cls.commit) + (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "commit failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_open + * + * Purpose: Opens a named datatype through the VOL + * + * Return: Success: User ID of the datatype. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t tapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the type specific corresponding VOL open callback exists */ + if(NULL == cls->datatype_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback") + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->datatype_cls.open) + (obj, loc_params, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_get + * + * Purpose: Get specific information about the datatype through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype get' method") + va_start (arguments, req); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_specific + * + * Purpose: specific operation on datatypes through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->datatype_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype specific' method") + + va_start (arguments, req); + if((ret_value = (cls->datatype_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->datatype_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype optional' method") + + va_start (arguments, req); + if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_close + * + * Purpose: Closes a datatype through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->datatype_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype close' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->datatype_cls.close)(dt, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_cancel + * + * Purpose: Cancels an asynchronous request through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->async_cls.cancel) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async cancel' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->async_cls.cancel)(req, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_test + * + * Purpose: Tests an asynchronous request through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->async_cls.test) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async test' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->async_cls.test)(req, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request test failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_test() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_wait + * + * Purpose: Waits on an asychronous request through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->async_cls.wait) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async wait' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->async_cls.wait)(req, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_wait() */ + + diff --git a/src/H5VLint.c b/src/H5VLint.c index 78ba6d9..fcc7fa7 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -30,11 +30,11 @@ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ #include "H5Tprivate.h" /* Datatypes */ #include "H5VLpkg.h" /* Virtual Object Layer */ @@ -47,6 +47,13 @@ /* Local Typedefs */ /******************/ +/* Object wrapping context info */ +typedef struct H5VL_wrap_ctx_t { + const H5VL_t *plugin; /* VOL plugin for "outermost" class to start wrap */ + void *obj_wrap_ctx; /* "wrap context" for outermost plugin */ +} H5VL_wrap_ctx_t; + + /********************/ /* Package Typedefs */ /********************/ @@ -54,8 +61,8 @@ /********************/ /* Local Prototypes */ /********************/ - -static herr_t H5VL_free_cls(H5VL_class_t *cls); +static herr_t H5VL__free_cls(H5VL_class_t *cls); +static void *H5VL__object(hid_t id, H5I_type_t obj_type); /*********************/ /* Package Variables */ @@ -77,15 +84,22 @@ static const H5I_class_t H5I_VOL_CLS[1] = {{ H5I_VOL, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5VL_free_cls /* Callback routine for closing objects of this class */ + (H5I_free_t)H5VL__free_cls /* Callback routine for closing objects of this class */ }}; +/* Declare a free list to manage the H5VL_class_t struct */ +H5FL_DEFINE_STATIC(H5VL_class_t); + /* Declare a free list to manage the H5VL_t struct */ H5FL_DEFINE(H5VL_t); /* Declare a free list to manage the H5VL_object_t struct */ H5FL_DEFINE(H5VL_object_t); +/* Declare a free list to manage the H5VL_wrap_ctx_t struct */ +H5FL_DEFINE_STATIC(H5VL_wrap_ctx_t); + + /*------------------------------------------------------------------------- * Function: H5VL_init @@ -132,7 +146,7 @@ H5VL__init_package(void) /* Initialize the atom group for the VL IDs */ if (H5I_register_type(H5I_VOL_CLS) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface"); + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface") done: FUNC_LEAVE_NOAPI(ret_value) @@ -163,7 +177,7 @@ H5VL_term_package(void) n++; } else { - /* Destroy the VOL driver ID group */ + /* Destroy the VOL plugin ID group */ n += (H5I_dec_type_ref(H5I_VOL) > 0); /* Mark interface as closed */ @@ -177,7 +191,7 @@ H5VL_term_package(void) /*------------------------------------------------------------------------- - * Function: H5VL_free_cls + * Function: H5VL__free_cls * * Purpose: Frees a file VOL class struct and returns an indication of * success. This function is used as the free callback for the @@ -189,34 +203,32 @@ H5VL_term_package(void) *------------------------------------------------------------------------- */ static herr_t -H5VL_free_cls(H5VL_class_t *cls) +H5VL__free_cls(H5VL_class_t *cls) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(cls); - /* XXX: Need to retrieve the VOL termination property list for the - * terminate operation - JTH - */ - if (cls->terminate && cls->terminate(H5P_DEFAULT) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not terminate cleanly"); + /* Shut down the VOL plugin */ + if(cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not terminate cleanly") /* XXX (VOL MERGE): We'll leak memory if the name string was dynamically allocated. */ - H5MM_xfree(cls); + H5FL_FREE(H5VL_class_t, cls); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_free_cls() */ +} /* end H5VL__free_cls() */ /*------------------------------------------------------------------------- * Function: H5VL_register_id * * Purpose: Wrapper to register an object ID with a VOL aux struct - * and increment ref count on VOL driver ID + * and increment ref count on VOL plugin ID * * Return: Success: A valid HDF5 ID * Failure: H5I_INVALID_HID @@ -224,7 +236,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref) +H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref) { H5VL_object_t *new_obj = NULL; hid_t ret_value = H5I_INVALID_HID; @@ -233,30 +245,33 @@ H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ /* Check arguments */ HDassert(object); - HDassert(vol_driver); + HDassert(vol_plugin); - /* setup VOL object */ + /* Setup VOL object */ if (NULL == (new_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; + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate top object structure") + new_obj->plugin = vol_plugin; new_obj->data = object; - vol_driver->nrefs++; + /* Increment ref count, for new object */ + vol_plugin->nrefs++; + /* Special wrapper for named datatypes */ if (H5I_DATATYPE == type) { + H5T_t *dt; - H5T_t *dt = NULL; - + /* Wrap "real" (non-named) datatype around VOL object, so it's compatible with H5T interface */ if (NULL == (dt = H5T_construct_datatype(new_obj))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object"); + 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) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle"); - } + /* New object is _actually_ the datatype */ + new_obj = (H5VL_object_t *)dt; + } /* end if */ + + /* Register VOL object as _object_ type, for future object API calls */ + /* (Except for named datatypes, as above) */ + if ((ret_value = H5I_register(type, new_obj, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle") done: FUNC_LEAVE_NOAPI(ret_value) @@ -267,7 +282,7 @@ done: * Function: H5VL_free_object * * Purpose: Wrapper to unregister an object ID with a VOL aux struct - * and decrement ref count on VOL driver ID + * and decrement ref count on VOL plugin ID * * Return: SUCCEED/FAIL * @@ -283,13 +298,13 @@ H5VL_free_object(H5VL_object_t *vol_obj) /* Check arguments */ HDassert(vol_obj); - vol_obj->driver->nrefs --; + vol_obj->plugin->nrefs --; - if (0 == vol_obj->driver->nrefs) { - if (H5I_dec_ref(vol_obj->driver->id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL driver"); - vol_obj->driver = H5FL_FREE(H5VL_t, vol_obj->driver); - } + if(0 == vol_obj->plugin->nrefs) { + if(H5I_dec_ref(vol_obj->plugin->id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") + vol_obj->plugin = H5FL_FREE(H5VL_t, vol_obj->plugin); + } /* end if */ vol_obj = H5FL_FREE(H5VL_object_t, vol_obj); @@ -301,18 +316,18 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_register * - * Purpose: Registers a new VOL driver as a member of the virtual object + * Purpose: Registers a new VOL plugin as a member of the virtual object * layer class. * - * Return: Success: A VOL driver ID which is good until the - * library is closed or the driver is unregistered. + * Return: Success: A VOL plugin ID which is good until the + * library is closed or the plugin is unregistered. * * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VL_register(const void *_cls, size_t size, hbool_t app_ref) +H5VL_register(const void *_cls, hbool_t app_ref, hid_t vipl_id) { const H5VL_class_t *cls = (const H5VL_class_t *)_cls; H5VL_class_t *saved = NULL; @@ -324,18 +339,22 @@ H5VL_register(const void *_cls, size_t size, hbool_t app_ref) HDassert(cls); /* Copy the class structure so the caller can reuse or free it */ - if (NULL == (saved = (H5VL_class_t *)H5MM_calloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for VOL driver class struct"); - HDmemcpy(saved, cls, size); + if (NULL == (saved = H5FL_CALLOC(H5VL_class_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for VOL plugin class struct") + HDmemcpy(saved, cls, sizeof(H5VL_class_t)); + + /* Initialize the VOL plugin */ + if(cls->initialize && cls->initialize(vipl_id) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL plugin") /* Create the new class ID */ if ((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID"); + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin ID") done: if (ret_value < 0) if (saved) - H5MM_xfree(saved); + H5FL_FREE(H5VL_class_t, saved); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_register() */ @@ -353,28 +372,28 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t driver_id, hbool_t app_ref) +H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t plugin_id, hbool_t app_ref) { H5VL_class_t *cls = NULL; - H5VL_t *driver = NULL; /* VOL driver struct */ + H5VL_t *plugin = NULL; /* VOL plugin 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"); + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL plugin 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"); + if (NULL == (plugin = H5FL_CALLOC(H5VL_t))) + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VOL info struct") + plugin->cls = cls; + plugin->id = plugin_id; + if (H5I_inc_ref(plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") /* 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"); + if ((ret_value = H5VL_register_id(obj_type, obj, plugin, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: FUNC_LEAVE_NOAPI(ret_value) @@ -382,17 +401,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_get_driver_name + * Function: H5VL_get_plugin_name * - * Purpose: Private version of H5VLget_driver_name + * Purpose: Private version of H5VLget_plugin_name * - * Return: Success: The length of the driver name + * Return: Success: The length of the plugin name * Failure: Negative * *------------------------------------------------------------------------- */ ssize_t -H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size) +H5VL_get_plugin_name(hid_t id, char *name /*out*/, size_t size) { H5VL_object_t *vol_obj = NULL; const H5VL_class_t *cls = NULL; @@ -403,23 +422,23 @@ H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size) /* get the object pointer */ if (NULL == (vol_obj = H5VL_get_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - cls = vol_obj->driver->cls; + cls = vol_obj->plugin->cls; len = HDstrlen(cls->name); - if (name) { - HDstrncpy(name, cls->name, MIN(len + 1,size)); - if (len >= size) - name[size-1]='\0'; - } + if(name) { + HDstrncpy(name, cls->name, MIN(len + 1, size)); + if(len >= size) + name[size - 1] = '\0'; + } /* end if */ /* Set the return value for the API call */ ret_value = (ssize_t)len; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_get_driver_name() */ +} /* end H5VL_get_plugin_name() */ /*------------------------------------------------------------------------- @@ -439,145 +458,105 @@ H5VL_object_t * H5VL_get_object(hid_t id) { void *obj = NULL; - H5I_type_t obj_type = H5I_get_type(id); + H5I_type_t obj_type; H5VL_object_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) + obj_type = H5I_get_type(id); if (H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type || - H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) { - /* get the object */ + H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) { + /* Get the object */ if (NULL == (obj = H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") /* if this is a datatype, get the VOL object attached to the H5T_t struct */ - if (H5I_DATATYPE == obj_type) { + if (H5I_DATATYPE == obj_type) if (NULL == (obj = H5T_get_named_type((H5T_t *)obj))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); - } - } + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") + } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function") ret_value = (H5VL_object_t *)obj; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_get_object() */ /*------------------------------------------------------------------------- - * Function: H5VL_object + * Function: H5VL_object_data * - * Purpose: Utility function to return the VOL object pointer associated with - * a hid_t. + * Purpose: Correctly retrieve the 'data' field for a VOL object (H5VL_object), + * even for nested / stacked VOL plugins. * - * Return: Success: object pointer - * Failure: NULL + * Return: Success: object pointer + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_object(hid_t id) +H5VL_object_data(const H5VL_object_t *vol_obj) { - H5VL_object_t *vol_obj = NULL; - void *ret_value = NULL; - - FUNC_ENTER_NOAPI(NULL) - - /* Get the symbol table entry */ - switch (H5I_get_type(id)) { - case H5I_GROUP: - case H5I_DATASET: - case H5I_FILE: - case H5I_ATTR: - /* get the object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); - - ret_value = vol_obj->data; - break; - case H5I_DATATYPE: - { - H5T_t *dt = NULL; + void *ret_value = NULL; - /* get the object */ - if (NULL == (dt = (H5T_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Get the actual datatype object that should be the vol_obj */ - if (NULL == (vol_obj = H5T_get_named_type(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); + /* Check for 'get_object' callback in plugin */ + if(vol_obj->plugin->cls->get_object) + ret_value = (vol_obj->plugin->cls->get_object)(vol_obj->data); + else + ret_value = vol_obj->data; - ret_value = vol_obj->data; - break; - } - case H5I_UNINIT: - case H5I_BADID: - case H5I_DATASPACE: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_VOL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type"); - } -done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object() */ +} /* end H5VL_object_data() */ /*------------------------------------------------------------------------- - * Function: H5VL_object_verify + * Function: H5VL__object * - * Purpose: Utility function to return the VOL object pointer associated - * with an identifier. + * Purpose: Internal function to return the VOL object pointer associated + * with an hid_t. * * Return: Success: object pointer * Failure: NULL * *------------------------------------------------------------------------- */ -void * -H5VL_object_verify(hid_t id, H5I_type_t obj_type) +static void * +H5VL__object(hid_t id, H5I_type_t obj_type) { H5VL_object_t *vol_obj = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC - /* Get the symbol table entry */ - switch (obj_type) { + /* Get the underlying object */ + switch(obj_type) { case H5I_GROUP: case H5I_DATASET: case H5I_FILE: case H5I_ATTR: /* get the object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(id, obj_type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); - - ret_value = vol_obj->data; + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") break; + case H5I_DATATYPE: { H5T_t *dt = NULL; /* get the object */ - if (NULL == (dt = (H5T_t *)H5I_object_verify(id, obj_type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + if (NULL == (dt = (H5T_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") /* Get the actual datatype object that should be the vol_obj */ if (NULL == (vol_obj = H5T_get_named_type(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); - - ret_value = vol_obj->data; + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") break; } + case H5I_UNINIT: case H5I_BADID: case H5I_DATASPACE: @@ -592,1601 +571,276 @@ H5VL_object_verify(hid_t id, H5I_type_t obj_type) case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type") - } -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_verify() */ - + } /* end switch */ -/* XXX (VOL MERGE): This could be a macro like in H5F */ -void * -H5VL_driver_object(H5VL_object_t *vol_obj) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Set the return value */ + ret_value = H5VL_object_data(vol_obj); - FUNC_LEAVE_NOAPI(vol_obj->data) -} /* end H5VL_driver_object() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_create - * - * Purpose: Creates an attribute through the VOL + * Function: H5VL_object * - * Return: Success: pointer to the new attribute + * Purpose: Utility function to return the VOL object pointer associated with + * a hid_t. * - * Failure: NULL + * Return: Success: object pointer + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +H5VL_object(hid_t id) { - void *ret_value; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) - /* check if the corresponding VOL create callback exists */ - if (NULL == cls->attr_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'attr create' method") - - /* call the corresponding VOL create callback */ - if (NULL == (ret_value = (cls->attr_cls.create) - (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + /* Get the underlying object */ + if(NULL == (ret_value = H5VL__object(id, H5I_get_type(id)))) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_create() */ +} /* end H5VL_object() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_open - * - * Purpose: Opens an attribute through the VOL + * Function: H5VL_object_verify * - * Return: Success: pointer to the new attr. + * Purpose: Utility function to return the VOL object pointer associated + * with an identifier. * - * Failure: NULL + * Return: Success: object pointer + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t aapl_id, hid_t dxpl_id, void **req) +H5VL_object_verify(hid_t id, H5I_type_t obj_type) { - void *ret_value; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == cls->attr_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'attr open' method") - - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->attr_cls.open) - (obj, loc_params, name, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_read - * - * Purpose: Reads data from attr through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, - hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) + /* Check of ID of correct type */ + if(obj_type != H5I_get_type(id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") - if(NULL == cls->attr_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr read' method") - if((ret_value = (cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "read failed") + /* Get the underlying object */ + if(NULL == (ret_value = H5VL__object(id, obj_type))) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_read() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_write - * - * Purpose: Writes data to attr through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, - hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->attr_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr write' method") - if((ret_value = (cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "write failed") +} /* end H5VL_object_verify() */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_write() */ - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_get - * - * Purpose: Get specific information about the attribute through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, - hid_t dxpl_id, void **req, ...) +/* XXX (VOL MERGE): This could be a macro like in H5F */ +void * +H5VL_plugin_object(H5VL_object_t *vol_obj) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr get' method") - - va_start (arguments, req); - if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); + FUNC_ENTER_NOAPI_NOINIT_NOERR -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_get() */ + FUNC_LEAVE_NOAPI(vol_obj->data) +} /* end H5VL_plugin_object() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_specific + * Function: H5VL_cmp_plugin_cls * - * Purpose: specific operation on attributes through the VOL + * Purpose: Compare VOL class for a plugin * - * Return: Success: non negative - * - * Failure: negative + * Return: Positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. * *------------------------------------------------------------------------- */ -herr_t -H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) +int +H5VL_cmp_plugin_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls2) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + int cmp_value; /* Value from comparison */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr specific' method") - - va_start (arguments, req); - if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_specific() */ + /* Sanity checks */ + HDassert(cls1); + HDassert(cls1); - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + /* Compare plugin "values" */ + if(cls1->value < cls2->value) + HGOTO_DONE(-1) + if(cls1->value > cls2->value) + HGOTO_DONE(1) + HDassert(cls1->value == cls2->value); - FUNC_ENTER_NOAPI(FAIL) + /* Compare plugin names */ + if(cls1->name == NULL && cls2->name != NULL) + HGOTO_DONE(-1); + if(cls1->name != NULL && cls2->name == NULL) + HGOTO_DONE(1); + if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) + HGOTO_DONE(cmp_value); - if(NULL == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr optional' method") + /* Compare plugin VOL API versions */ + if(cls1->version < cls2->version) + HGOTO_DONE(-1) + if(cls1->version > cls2->version) + HGOTO_DONE(1) + HDassert(cls1->version == cls2->version); - va_start (arguments, req); - if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") - va_end (arguments); + /* Compare plugin info */ + if(cls1->info_size < cls2->info_size) + HGOTO_DONE(-1) + if(cls1->info_size > cls2->info_size) + HGOTO_DONE(1) + HDassert(cls1->info_size == cls2->info_size); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_optional() */ +} /* end H5VL_cmp_plugin_cls() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_close + * Function: H5VL_set_vol_wrapper * - * Purpose: Closes an attribute through the VOL + * Purpose: Set up object wrapping context for current VOL plugin * - * Return: SUCCEED/FAIL + * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ herr_t -H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +H5VL_set_vol_wrapper(void *obj, const H5VL_t *plugin) { - herr_t ret_value = SUCCEED; - - HDassert(attr); - HDassert(cls); + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *obj_wrap_ctx = NULL; /* VOL plugin's wrapping context */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->attr_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->attr_cls.close)(attr, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_create - * - * Purpose: Creates a dataset through the VOL - * - * Return: Success: pointer to dataset - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->dataset_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'dataset create' method") - - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->dataset_cls.create) - (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_open - * - * Purpose: Opens a dataset through the VOL - * - * Return: Success: pointer to dataset - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t dapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == cls->dataset_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'dset open' method") + /* Sanity checks */ + HDassert(obj); + HDassert(plugin); - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->dataset_cls.open) - (obj, loc_params, name, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + /* Check if the plugin can create a wrap context */ + if(plugin->cls->get_wrap_ctx) { + /* Sanity check */ + HDassert(plugin->cls->free_wrap_ctx); -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_open() */ + /* Get the wrap context from the plugin */ + if((plugin->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL plugin's object wrap context") + } /* end if */ - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_read - * - * Purpose: Reads data from dataset through the VOL -* - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, void **req) -{ - herr_t ret_value = SUCCEED; + /* Allocate VOL object wrapper context */ + if(NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context") - FUNC_ENTER_NOAPI(FAIL) + /* Set up VOL object wrapper context */ + vol_wrap_ctx->plugin = plugin; + vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx; - if(NULL == cls->dataset_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset read' method") - if((ret_value = (cls->dataset_cls.read) - (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "read failed") + /* Save the wrapper context */ + if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_read() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_write - * - * Purpose: Writes data from dataset through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) + if(ret_value < 0 && vol_wrap_ctx) + /* Release object wrapping context */ + H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); - if(NULL == cls->dataset_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset write' method") - if((ret_value = (cls->dataset_cls.write) - (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") - -done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_write() */ +} /* end H5VL_set_vol_wrapper() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_get + * Function: H5VL_reset_vol_wrapper * - * Purpose: Get specific information about the dataset through the VOL + * Purpose: Reset object wrapping context for current VOL plugin * - * Return: Success: non negative - * - * Failure: negative + * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, - hid_t dxpl_id, void **req, ...) +H5VL_reset_vol_wrapper(void) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset get' method") + /* Retrieve the VOL object wrap context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") + + /* If there is a VOL plugin object wrapping context, release it */ + if(vol_wrap_ctx->obj_wrap_ctx) { + /* Release the VOL plugin's object wrapping context */ + if((*vol_wrap_ctx->plugin->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release plugin's object wrapping context") + } /* end if */ - va_start (arguments, req); - if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); + /* Release object wrapping context */ + H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_get() */ +} /* end H5VL_reset_vol_wrapper() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_specific + * Function: H5VL_wrap_register * - * Purpose: specific operation on datasets through the VOL + * Purpose: Wrap an object and register an ID for it * - * Return: Success: non negative - * - * Failure: negative + * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ -herr_t -H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, - hid_t dxpl_id, void **req, ...) +hid_t +H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset specific' method") + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *new_obj; /* Newly wrapped object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - va_start (arguments, req); - if((ret_value = (cls->dataset_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") - va_end (arguments); + FUNC_ENTER_NOAPI(H5I_INVALID_HID) -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_specific() */ + /* Sanity check */ + HDassert(obj); - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset optional' method") - - va_start (arguments, req); - if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_close - * - * Purpose: Closes a dataset through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(dset); - HDassert(cls); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->dataset_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dset close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->dataset_cls.close)(dset, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); - -done: - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_create - * - * Purpose: Creates a file through the VOL - * - * Return: Success: pointer to file. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->file_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'file create' method") - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_open - * - * Purpose: Opens a file through the VOL. - * - * Return: Success: pointer to file. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, - hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->file_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'file open' method") - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_get - * - * Purpose: Get specific information about the file through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file get' method") - - va_start(arguments, req); - if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end(arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_specific - * - * Purpose: perform File specific operations through the VOL - * - * Return: Success: non negative - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for VOL driver ID & info */ - va_list tmp_args; /* argument list passed from the API call */ - hid_t fapl_id; - - va_start (tmp_args, req); - fapl_id = va_arg (tmp_args, hid_t); - va_end (tmp_args); - - /* get the VOL info from the fapl */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL driver info") - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - va_start (arguments, req); - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); - } - else { - if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file specific' method") - - va_start (arguments, req); - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_optional - * - * Purpose: perform a driver specific operation - * - * Return: Success: non negative - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file optional' method") - - va_start (arguments, req); - if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_close - * - * Purpose: Closes a file through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(file); - HDassert(cls); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->file_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->file_cls.close)(file, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_create - * - * Purpose: Creates a group through the VOL - * - * Return: Success: pointer to new group. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->group_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'group create' method") - - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->group_cls.create) - (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_open - * - * Purpose: Opens a group through the VOL - * - * Return: Success: pointer to new group. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t gapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - if(NULL == cls->group_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'group open' method") - - if(NULL == (ret_value = (cls->group_cls.open) - (obj, loc_params, name, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_get - * - * Purpose: Get specific information about the group through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group get' method") - - va_start (arguments, req); - if((ret_value = (cls->group_cls.get) - (obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_specific - * - * Purpose: specific operation on groups through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group specific' method") - - va_start (arguments, req); - if((ret_value = (cls->group_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group optional' method") - - va_start (arguments, req); - if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_close - * - * Purpose: Closes a group through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - HDassert(grp); - HDassert(cls); - - FUNC_ENTER_NOAPI(FAIL) - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->group_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->group_cls.close)(grp, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_create - * - * Purpose: Creates a hard link through the VOL - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->link_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link create' method") - /* call the corresponding VOL create callback */ - if((ret_value = (cls->link_cls.create) - (create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_copy - * - * Purpose: Copys a link from src to dst. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check if the corresponding VOL copy callback exists */ - if(NULL == cls->link_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link copy' method") - - /* call the corresponding VOL copy callback */ - if((ret_value = (cls->link_cls.copy) - (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, - lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link copy failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_move - * - * Purpose: Moves a link from src to dst. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check if the corresponding VOL move callback exists */ - if(NULL == cls->link_cls.move) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link move' method") - - /* call the corresponding VOL move callback */ - if((ret_value = (cls->link_cls.move) - (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, - lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link move failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_move() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_get - * - * Purpose: Get specific information about the link through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link get' method") - - va_start (arguments, req); - if((ret_value = (cls->link_cls.get) - (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_specific - * - * Purpose: specific operation on links through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link specific' method") - - va_start (arguments, req); - if((ret_value = (cls->link_cls.specific) - (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link optional' method") - - va_start (arguments, req); - if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_open - * - * Purpose: Opens a object through the VOL - * - * Return: Success: User ID of the new object. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, - hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL open callback exists */ - if(NULL == cls->object_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'object open' method") - - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->object_cls.open) - (obj, params, opened_type, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_copy - * - * Purpose: Copies an object to another destination through the VOL - * - * Return: Success: Non Negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Make sure that the VOL drivers are the same */ - if (cls1->value != cls2->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL drivers and can't be linked") - - if(NULL == cls1->object_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object copy' method") - - if((ret_value = (cls1->object_cls.copy) - (src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id, - lcpl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "copy failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_get - * - * Purpose: Get specific information about the object through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object get' method") - - va_start (arguments, req); - if((ret_value = (cls->object_cls.get) - (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_specific - * - * Purpose: specific operation on objects through the VOL - * - * Return: Success: non negative - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object specific' method") - - va_start (arguments, req); - if((ret_value = (cls->object_cls.specific) - (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object optional' method") - - va_start (arguments, req); - if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_commit - * - * Purpose: Commits a datatype to the file through the VOL - * - * Return: Success: Positive - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -void * -H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, - hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL commit callback exists */ - if(NULL == cls->datatype_cls.commit) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'datatype commit' method") - - /* call the corresponding VOL commit callback */ - if(NULL == (ret_value = (cls->datatype_cls.commit) - (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "commit failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_commit() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_open - * - * Purpose: Opens a named datatype through the VOL - * - * Return: Success: User ID of the datatype. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t tapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == cls->datatype_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback"); - - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->datatype_cls.open) - (obj, loc_params, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_get - * - * Purpose: Get specific information about the datatype through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype get' method"); - va_start (arguments, req); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed"); - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_specific - * - * Purpose: specific operation on datatypes through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype specific' method") - - va_start (arguments, req); - if((ret_value = (cls->datatype_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype optional' method") - - va_start (arguments, req); - if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_close - * - * Purpose: Closes a datatype through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->datatype_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->datatype_cls.close)(dt, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_request_cancel - * - * Purpose: Cancels an asynchronous request through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(req); - HDassert(cls); - HDassert(status); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.cancel) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async cancel' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.cancel)(req, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_cancel() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_request_test - * - * Purpose: Tests an asynchronous request through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(req); - HDassert(cls); - HDassert(status); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.test) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async test' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.test)(req, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request test failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_test() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_request_wait - * - * Purpose: Waits on an asychronous request through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(req); - HDassert(cls); - HDassert(status); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.wait) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async wait' method"); + /* If the datatype is already VOL-managed, the datatype's vol_obj + * field will get clobbered later, so disallow this. + */ + if(type == H5I_DATATYPE) + if(TRUE == H5T_already_vol_managed((const H5T_t *)obj)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype") + + /* Retrieve the VOL object wrap context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") + + /* If there is a VOL object wrapping context, wrap the object */ + if(vol_wrap_ctx) { + /* Wrap object */ + if(NULL == (new_obj = H5VL_wrap_object(vol_wrap_ctx->plugin->cls, vol_wrap_ctx->obj_wrap_ctx, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't wrap object") + } /* end if */ + else + new_obj = obj; - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.wait)(req, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed"); + /* Get an ID for the object */ + if((ret_value = H5VL_object_register(new_obj, type, vol_wrap_ctx->plugin->id, app_ref)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_wait() */ +} /* end H5VL_wrap_register() */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index acfceed..d071b3a 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: The native VOL driver where access is to a single HDF5 file + * Purpose: The native VOL plugin where access is to a single HDF5 file * using HDF5 VFDs. */ @@ -40,151 +40,157 @@ #include "H5Rpkg.h" /* References */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tpkg.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL drivers */ -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLnative.h" /* Native VOL plugin */ /* - * The VOL driver identification number. + * The VOL plugin identification number. */ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; /* Prototypes */ -static H5F_t *H5VL_native_get_file(void *obj, H5I_type_t type); +static H5F_t *H5VL__native_get_file(void *obj, H5I_type_t type); static herr_t H5VL__native_term(void); /* Atrribute callbacks */ -static void *H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_attr_close(void *attr, hid_t dxpl_id, void **req); +static void *H5VL__native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req); /* Dataset callbacks */ -static void *H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, +static void *H5VL__native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); -static herr_t H5VL_native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, +static herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -static herr_t H5VL_native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_dataset_close(void *dset, hid_t dxpl_id, void **req); +static herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req); /* File callbacks */ -static void *H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_file_close(void *file, hid_t dxpl_id, void **req); +static void *H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */ -static void *H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_group_specific(void *dset, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_group_close(void *grp, hid_t dxpl_id, void **req); +static void *H5VL__native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_specific(void *dset, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req); /* Link callbacks */ -static herr_t H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, +static herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, +static herr_t H5VL__native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, +static herr_t H5VL__native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); /* Object callbacks */ -static void *H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -static herr_t H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, +static void *H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL__native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Datatype callbacks */ -static void *H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_datatype_close(void *dt, hid_t dxpl_id, void **req); +static void *H5VL__native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); -/* Native VOL driver class struct */ +/* Native VOL plugin class struct */ static H5VL_class_t H5VL_native_cls_g = { H5VL_NATIVE_VERSION, /* version */ H5VL_NATIVE_VALUE, /* value */ H5VL_NATIVE_NAME, /* name */ + 0, /* capability flags */ NULL, /* initialize */ - NULL, /* terminate */ - (size_t)0, /* fapl size */ - NULL, /* fapl copy */ - NULL, /* fapl free */ + H5VL__native_term, /* terminate */ + (size_t)0, /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* free_wrap_ctx */ + NULL, /* wrap_object */ { /* attribute_cls */ - H5VL_native_attr_create, /* create */ - H5VL_native_attr_open, /* open */ - H5VL_native_attr_read, /* read */ - H5VL_native_attr_write, /* write */ - H5VL_native_attr_get, /* get */ - H5VL_native_attr_specific, /* specific */ + H5VL__native_attr_create, /* create */ + H5VL__native_attr_open, /* open */ + H5VL__native_attr_read, /* read */ + H5VL__native_attr_write, /* write */ + H5VL__native_attr_get, /* get */ + H5VL__native_attr_specific, /* specific */ NULL, /* optional */ - H5VL_native_attr_close /* close */ + H5VL__native_attr_close /* close */ }, { /* dataset_cls */ - H5VL_native_dataset_create, /* create */ - H5VL_native_dataset_open, /* open */ - H5VL_native_dataset_read, /* read */ - H5VL_native_dataset_write, /* write */ - H5VL_native_dataset_get, /* get */ - H5VL_native_dataset_specific, /* specific */ - H5VL_native_dataset_optional, /* optional */ - H5VL_native_dataset_close /* close */ + H5VL__native_dataset_create, /* create */ + H5VL__native_dataset_open, /* open */ + H5VL__native_dataset_read, /* read */ + H5VL__native_dataset_write, /* write */ + H5VL__native_dataset_get, /* get */ + H5VL__native_dataset_specific, /* specific */ + H5VL__native_dataset_optional, /* optional */ + H5VL__native_dataset_close /* close */ }, { /* datatype_cls */ - H5VL_native_datatype_commit, /* commit */ - H5VL_native_datatype_open, /* open */ - H5VL_native_datatype_get, /* get */ - H5VL_native_datatype_specific, /* specific */ + H5VL__native_datatype_commit, /* commit */ + H5VL__native_datatype_open, /* open */ + H5VL__native_datatype_get, /* get */ + H5VL__native_datatype_specific, /* specific */ NULL, /* optional */ - H5VL_native_datatype_close /* close */ + H5VL__native_datatype_close /* close */ }, { /* file_cls */ - H5VL_native_file_create, /* create */ - H5VL_native_file_open, /* open */ - H5VL_native_file_get, /* get */ - H5VL_native_file_specific, /* specific */ - H5VL_native_file_optional, /* optional */ - H5VL_native_file_close /* close */ + H5VL__native_file_create, /* create */ + H5VL__native_file_open, /* open */ + H5VL__native_file_get, /* get */ + H5VL__native_file_specific, /* specific */ + H5VL__native_file_optional, /* optional */ + H5VL__native_file_close /* close */ }, { /* group_cls */ - H5VL_native_group_create, /* create */ - H5VL_native_group_open, /* open */ - H5VL_native_group_get, /* get */ - H5VL_native_group_specific, /* specific */ + H5VL__native_group_create, /* create */ + H5VL__native_group_open, /* open */ + H5VL__native_group_get, /* get */ + H5VL__native_group_specific, /* specific */ NULL, /* optional */ - H5VL_native_group_close /* close */ + H5VL__native_group_close /* close */ }, { /* link_cls */ - H5VL_native_link_create, /* create */ - H5VL_native_link_copy, /* copy */ - H5VL_native_link_move, /* move */ - H5VL_native_link_get, /* get */ - H5VL_native_link_specific, /* specific */ + H5VL__native_link_create, /* create */ + H5VL__native_link_copy, /* copy */ + H5VL__native_link_move, /* move */ + H5VL__native_link_get, /* get */ + H5VL__native_link_specific, /* specific */ NULL /* optional */ }, { /* object_cls */ - H5VL_native_object_open, /* open */ - H5VL_native_object_copy, /* copy */ - H5VL_native_object_get, /* get */ - H5VL_native_object_specific, /* specific */ - H5VL_native_object_optional /* optional */ + H5VL__native_object_open, /* open */ + H5VL__native_object_copy, /* copy */ + H5VL__native_object_get, /* get */ + H5VL__native_object_specific, /* specific */ + H5VL__native_object_optional /* optional */ }, { /* async_cls */ NULL, /* cancel */ @@ -198,27 +204,25 @@ static H5VL_class_t H5VL_native_cls_g = { /*------------------------------------------------------------------------- * Function: H5VL_native_init * - * Purpose: Initialize this VOL driver by registering it with the + * Purpose: Initialize this VOL plugin by registering it with the * library. * - * Return: Success: The ID for the native driver + * Return: Success: The ID for the native plugin * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VL_native_init(void) +H5VL_native_init(hid_t vipl_id) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) - /* 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, - sizeof(H5VL_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL driver") - } + /* Register the native VOL plugin, 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, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL plugin") /* Set return value */ ret_value = H5VL_NATIVE_ID_g; @@ -231,6 +235,7 @@ done: hid_t H5VL_native_get_driver_id(void) { +HDassert(0 && "H5VL_native_get_driver_id"); return H5VL_NATIVE_ID_g; } @@ -260,7 +265,7 @@ H5VL__native_term(void) * Function: H5Pset_fapl_native * * Purpose: Modify the file access property list to use the H5VL_NATIVE - * driver defined in this source file. + * plugin defined in this source file. * * Return: SUCCEED/FAIL * @@ -286,10 +291,10 @@ done: /*--------------------------------------------------------------------------- - * Function: H5VL_native_get_file + * Function: H5VL__native_get_file * * Purpose: Utility routine to get file struct for an object via the - * native VOL driver. + * native VOL plugin. * * Returns: SUCCESS: A pointer to the H5F_t struct for the file * associated with the object. @@ -298,17 +303,18 @@ done: *--------------------------------------------------------------------------- */ static H5F_t * -H5VL_native_get_file(void *obj, H5I_type_t type) +H5VL__native_get_file(void *obj, H5I_type_t type) { H5F_t *ret_value = NULL; /* File pointer */ H5O_loc_t *oloc = NULL; /* Object location for ID */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(type) { case H5I_FILE: ret_value = (H5F_t *)obj; break; + case H5I_GROUP: { H5G_t *grp; @@ -316,6 +322,7 @@ H5VL_native_get_file(void *obj, H5I_type_t type) oloc = H5G_oloc(grp); break; } + case H5I_DATATYPE: { H5T_t *dt; @@ -323,6 +330,7 @@ H5VL_native_get_file(void *obj, H5I_type_t type) oloc = H5T_oloc(dt); break; } + case H5I_DATASET: { H5D_t *dset; @@ -338,6 +346,7 @@ H5VL_native_get_file(void *obj, H5I_type_t type) oloc = H5A_oloc(attr); break; } + case H5I_UNINIT: case H5I_BADID: case H5I_DATASPACE: @@ -364,13 +373,13 @@ H5VL_native_get_file(void *obj, H5I_type_t type) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5VL_native_get_file */ +} /* H5VL__native_get_file */ /*--------------------------------------------------------------------------- * Function: H5VL_native_register * - * Purpose: Utility routine to register an ID with the native VOL driver + * Purpose: Utility routine to register an ID with the native VOL plugin * as an auxilary object. * * Returns: Success: An ID for the object @@ -383,7 +392,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) { hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI(H5I_INVALID_HID) HDassert(obj); @@ -394,6 +403,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) if(((H5T_t *)obj)->vol_obj != NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype") +HDassert(0 && "H5VL_native_register"); /* Get an ID for the object */ if((ret_value = H5VL_object_register(obj, type, H5VL_NATIVE_ID_g, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") @@ -403,39 +413,8 @@ done: } /* end H5VL_native_register() */ -/*--------------------------------------------------------------------------- - * Function: H5VL_native_unregister - * - * Purpose: Utility routine to decrement ref count on Native VOL driver - * objects. - * - * Returns: SUCCEED/FAIL - * - *--------------------------------------------------------------------------- - */ -herr_t -H5VL_native_unregister(hid_t obj_id) -{ - H5VL_object_t *vol_obj = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* get the driver pointer */ - if(NULL == (vol_obj = (H5VL_object_t *)H5VL_get_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid ID") - - /* free object */ - if(H5VL_free_object(vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_unregister() */ - - /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_create + * Function: H5VL__native_attr_create * * Purpose: Creates an attribute on an object. * @@ -445,8 +424,9 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, - hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Object location */ H5G_loc_t obj_loc; /* Location used to open group */ @@ -458,7 +438,7 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att H5A_t *attr = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) @@ -477,7 +457,7 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") - /* If this is a named datatype, get the driver pointer to the datatype */ + /* If this is a named datatype, get the plugin's pointer to the datatype */ type = H5T_get_actual_type(dt); if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) @@ -488,27 +468,28 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Acreate_by_name */ if(NULL == (attr = H5A__create_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name, type, space, acpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute create parameters") - } + ret_value = (void *)attr; done: /* Release resources */ if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location") + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_create() */ +} /* end H5VL__native_attr_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_open + * Function: H5VL__native_attr_open * * Purpose: Opens a attr inside a native h5 file. * @@ -521,14 +502,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, - hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) @@ -539,13 +520,13 @@ H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_ /* Open the attribute */ if(NULL == (attr = H5A__open(&loc, attr_name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name) - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aopen_by_name */ /* Open the attribute on the object header */ if(NULL == (attr = H5A__open_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") - } + } /* end else-if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Aopen_by_idx */ /* Open the attribute in the object header */ @@ -554,20 +535,19 @@ H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_ loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute open parameters") - } ret_value = (void *)attr; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_open() */ +} /* end H5VL__native_attr_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_read + * Function: H5VL__native_attr_read * * Purpose: Reads in data from attribute. * @@ -579,26 +559,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *mem_type; /* Memory datatype */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + /* Go write the actual data to the attribute */ if((ret_value = H5A__read((H5A_t*)attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_read() */ +} /* end H5VL__native_attr_read() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_write + * Function: H5VL__native_attr_write * * Purpose: Writes out data to attribute. * @@ -610,26 +592,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *mem_type; /* Memory datatype */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + /* Go write the actual data to the attribute */ if((ret_value = H5A__write((H5A_t*)attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_write() */ +} /* end H5VL__native_attr_write() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_get + * Function: H5VL__native_attr_get * * Purpose: Gets certain information about an attribute * @@ -642,11 +626,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Aget_space */ @@ -659,6 +644,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") break; } + /* H5Aget_type */ case H5VL_ATTR_GET_TYPE: { @@ -669,6 +655,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") break; } + /* H5Aget_create_plist */ case H5VL_ATTR_GET_ACPL: { @@ -680,6 +667,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d break; } + /* H5Aget_name */ case H5VL_ATTR_GET_NAME: { @@ -721,13 +709,14 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d /* Release resources */ if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") } else HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") break; } + /* H5Aget_info */ case H5VL_ATTR_GET_INFO: { @@ -759,7 +748,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d /* Release resources */ if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") } else if(H5VL_OBJECT_BY_IDX == loc_params.type) { H5G_loc_t loc; @@ -781,13 +770,14 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d /* Release resources */ if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") } else HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") break; } + case H5VL_ATTR_GET_STORAGE_SIZE: { hsize_t *ret = va_arg(arguments, hsize_t *); @@ -797,17 +787,18 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = attr->shared->data_size; break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_get() */ +} /* end H5VL__native_attr_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_specific + * Function: H5VL__native_attr_specific * * Purpose: Specific operations for attributes * @@ -820,18 +811,17 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get location for passed-in object */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* XXX: Do I need to clean this up? */ switch(specific_type) { case H5VL_ATTR_DELETE: @@ -843,24 +833,25 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe /* Delete the attribute from the location */ if(H5O__attr_remove(loc.oloc, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } + } /* end if */ else if(H5VL_OBJECT_BY_NAME == loc_params.type) { /* H5Adelete_by_name */ /* Delete the attribute */ if(H5A__delete_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } + } /* end else-if */ else if(H5VL_OBJECT_BY_IDX == loc_params.type) { /* H5Adelete_by_idx */ /* Delete the attribute from the location */ if(H5A__delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters") break; } + case H5VL_ATTR_EXISTS: { const char *attr_name = va_arg(arguments, const char *); @@ -870,16 +861,17 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe /* Check if the attribute exists */ if((*ret = H5O__attr_exists(loc.oloc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */ /* Check if the attribute exists */ if((*ret = H5A__exists_by_name(loc, loc_params.loc_data.loc_by_name.name, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") break; } + case H5VL_ATTR_ITER: { H5_index_t idx_type = va_arg(arguments, H5_index_t); @@ -889,21 +881,20 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe void *op_data = va_arg(arguments, void *); if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */ - /* Iterate over attributes */ if((ret_value = H5A__iterate(&loc, ".", idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */ - /* Iterate over attributes by name */ if((ret_value = H5A__iterate(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed"); - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") break; } + /* H5Arename/rename_by_name */ case H5VL_ATTR_RENAME: { @@ -914,26 +905,28 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe /* Call attribute rename routine */ if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */ /* Call attribute rename routine */ if(H5A__rename_by_name(loc, loc_params.loc_data.loc_by_name.name, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_specific() */ +} /* end H5VL__native_attr_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_close + * Function: H5VL__native_attr_close * * Purpose: Closes an attribute. * @@ -946,22 +939,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5A__close((H5A_t*)attr) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close attribute") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_close() */ +} /* end H5VL__native_attr_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_create + * Function: H5VL__native_dataset_create * * Purpose: Creates a dataset in a native HDF5 file * @@ -971,8 +964,9 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, - hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_create(void *obj, H5VL_loc_params_t loc_params, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ H5G_loc_t loc; /* Object location to insert dataset into */ @@ -983,7 +977,7 @@ H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char * const H5S_t *space; /* Dataspace for dataset */ void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) @@ -1010,14 +1004,14 @@ H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char * /* build and open the new dataset */ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") - } + } /* end if */ /* H5Dcreate2 */ else { /* Create the new dataset & get its ID */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, - dcpl_id, dapl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") - } + } /* end else */ + ret_value = (void *)dset; done: @@ -1033,14 +1027,15 @@ done: /* Decrement refcount on dataset's object header in memory */ if(H5O_dec_rc_by_loc(oloc) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") - } - } + } /* end if */ + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_create() */ +} /* end H5VL__native_dataset_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_open + * Function: H5VL__native_dataset_open * * Purpose: Opens a dataset in a native HDF5 file. * @@ -1050,14 +1045,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, - hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") @@ -1070,11 +1065,11 @@ H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *na done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_open() */ +} /* end H5VL__native_dataset_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_read + * Function: H5VL__native_dataset_read * * Purpose: Reads raw data from a dataset into a buffer. * @@ -1083,15 +1078,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf, + void H5_ATTR_UNUSED **req) { H5D_t *dset = (H5D_t *)obj; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ if(NULL == dset->oloc.file) @@ -1109,11 +1105,11 @@ H5VL_native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_read() */ +} /* end H5VL__native_dataset_read() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_write + * Function: H5VL__native_dataset_write * * Purpose: Writes raw data from a buffer into a dataset. * @@ -1122,15 +1118,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf, + void H5_ATTR_UNUSED **req) { H5D_t *dset = (H5D_t *)obj; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ if(NULL == dset->oloc.file) @@ -1148,11 +1145,11 @@ H5VL_native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_write() */ +} /* end H5VL__native_dataset_write() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_get + * Function: H5VL__native_dataset_get * * Purpose: Gets certain information about a dataset * @@ -1161,13 +1158,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = (H5D_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Dget_space */ @@ -1180,7 +1177,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_space_statuc */ + + /* H5Dget_space_statuc */ case H5VL_DATASET_GET_SPACE_STATUS: { H5D_space_status_t *allocation = va_arg(arguments, H5D_space_status_t *); @@ -1191,7 +1189,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_type */ + + /* H5Dget_type */ case H5VL_DATASET_GET_TYPE: { hid_t *ret_id = va_arg(arguments, hid_t *); @@ -1201,7 +1200,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_create_plist */ + + /* H5Dget_create_plist */ case H5VL_DATASET_GET_DCPL: { hid_t *ret_id = va_arg(arguments, hid_t *); @@ -1211,7 +1211,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_access_plist */ + + /* H5Dget_access_plist */ case H5VL_DATASET_GET_DAPL: { hid_t *ret_id = va_arg(arguments, hid_t *); @@ -1221,7 +1222,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_storage_size */ + + /* H5Dget_storage_size */ case H5VL_DATASET_GET_STORAGE_SIZE: { hsize_t *ret = va_arg(arguments, hsize_t *); @@ -1231,7 +1233,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") break; } - /* H5Dget_offset */ + + /* H5Dget_offset */ case H5VL_DATASET_GET_OFFSET: { haddr_t *ret = va_arg(arguments, haddr_t *); @@ -1242,17 +1245,18 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN *ret = HADDR_UNDEF; break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_get() */ +} /* end H5VL__native_dataset_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_specific + * Function: H5VL__native_dataset_specific * * Purpose: Specific operations for datasets * @@ -1261,13 +1265,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = (H5D_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { /* H5Dspecific_space */ @@ -1279,6 +1283,7 @@ H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset") break; } + case H5VL_DATASET_FLUSH: { hid_t dset_id = va_arg(arguments, hid_t); @@ -1289,6 +1294,7 @@ H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, break; } + case H5VL_DATASET_REFRESH: { hid_t dset_id = va_arg(arguments, hid_t); @@ -1299,32 +1305,34 @@ H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_specific() */ +} /* end H5VL__native_dataset_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_optional + * Function: H5VL__native_dataset_optional * - * Purpose: Perform a driver specific operation on a native dataset + * Purpose: Perform a plugin-specific operation on a native dataset * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = NULL; /* Dataset */ H5VL_dataset_optional_t optional_type = va_arg(arguments, H5VL_dataset_optional_t); herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(optional_type) { case H5VL_DATASET_FORMAT_CONVERT: @@ -1361,6 +1369,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_GET_CHUNK_INDEX_TYPE: { H5D_chunk_index_t *idx_type = va_arg(arguments, H5D_chunk_index_t *); @@ -1376,6 +1385,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_GET_CHUNK_STORAGE_SIZE: { hsize_t *offset = va_arg(arguments, hsize_t *); @@ -1393,6 +1403,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_CHUNK_READ: { const hsize_t *offset = va_arg(arguments, hsize_t *); @@ -1420,6 +1431,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_CHUNK_WRITE: { uint32_t filters = va_arg(arguments, uint32_t); @@ -1448,17 +1460,18 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_optional() */ +} /* end H5VL__native_dataset_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_close + * Function: H5VL__native_dataset_close * * Purpose: Closes a dataset. * @@ -1468,22 +1481,23 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5D_close((H5D_t*)dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close dataset") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_close() */ +} /* end H5VL__native_dataset_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_create + * Function: H5VL__native_file_create * * Purpose: Creates a file as a native HDF5 file. * @@ -1494,13 +1508,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5F_t *new_file = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for @@ -1521,12 +1535,13 @@ done: if(NULL == ret_value && new_file) if(H5F__close(new_file) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_create() */ +} /* end H5VL__native_file_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_open + * Function: H5VL__native_file_open * * Purpose: Opens a file as a native HDF5 file. * @@ -1537,12 +1552,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5F_t *new_file = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Open the file */ if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) @@ -1554,12 +1570,13 @@ H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5_ done: if(NULL == ret_value && new_file && H5F_try_close(new_file, NULL) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_open() */ +} /* end H5VL__native_file_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_get + * Function: H5VL__native_file_get * * Purpose: Gets certain data about a file * @@ -1568,12 +1585,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5F_t *f = NULL; /* File struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Fget_access_plist */ @@ -1592,6 +1610,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") break; } + /* H5Fget_create_plist */ case H5VL_FILE_GET_FCPL: { @@ -1608,6 +1627,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d break; } + /* H5Fget_obj_count */ case H5VL_FILE_GET_OBJ_COUNT: { @@ -1624,6 +1644,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = (ssize_t)obj_count; break; } + /* H5Fget_obj_ids */ case H5VL_FILE_GET_OBJ_IDS: { @@ -1642,6 +1663,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = (ssize_t)obj_count; break; } + /* H5Fget_intent */ case H5VL_FILE_GET_INTENT: { @@ -1670,6 +1692,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d break; } + /* H5Fget_name */ case H5VL_FILE_GET_NAME: { @@ -1679,7 +1702,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d ssize_t *ret = va_arg(arguments, ssize_t *); size_t len; - if(NULL == (f = H5VL_native_get_file(obj, type))) + if(NULL == (f = H5VL__native_get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") len = HDstrlen(H5F_OPEN_NAME(f)); @@ -1694,28 +1717,18 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = (ssize_t)len; break; } - /* H5Iget_file_id */ - case H5VL_OBJECT_GET_FILE: - { - H5I_type_t type = va_arg(arguments, H5I_type_t); - void **ret = va_arg(arguments, void **); - if(NULL == (f = H5VL_native_get_file(obj, type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - f->id_exists = TRUE; - *ret = (void*)f; - break; - } default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information") } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_get() */ +} /* end H5VL__native_file_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_specific + * Function: H5VL__native_file_specific * * Purpose: Perform an operation * @@ -1724,12 +1737,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { /* H5Fflush */ @@ -1740,7 +1753,7 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H H5F_t *f = NULL; /* File to flush */ /* Get the file for the object */ - if(NULL == (f = H5VL_native_get_file(obj, type))) + if(NULL == (f = H5VL__native_get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Nothing to do if the file is read only. This determination is @@ -1764,6 +1777,21 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H } break; } + + /* H5Freopen */ + case H5VL_FILE_REOPEN: + { + void **ret = va_arg(arguments, void **); + H5F_t *new_file = NULL; + + /* Reopen the file through the VOL plugin */ + if(NULL == (new_file = H5F__reopen((H5F_t *)obj))) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + new_file->id_exists = TRUE; + *ret = (void *)new_file; + break; + } + /* H5Fmount */ case H5VL_FILE_MOUNT: { @@ -1782,6 +1810,7 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H break; } + /* H5Funmount */ case H5VL_FILE_UNMOUNT: { @@ -1798,6 +1827,7 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H break; } + /* H5Fis_accessible */ case H5VL_FILE_IS_ACCESSIBLE: { @@ -1810,33 +1840,35 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "error in HDF5 file check") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_specific() */ +} /* end H5VL__native_file_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_optional + * Function: H5VL__native_file_optional * - * Purpose: Perform a driver specific operation on a native file + * Purpose: Perform a plugin-specific operation on a native file * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5F_t *f = NULL; /* File */ H5VL_file_optional_t optional_type = va_arg(arguments, H5VL_file_optional_t); herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + f = (H5F_t *)obj; switch(optional_type) { /* H5Fget_filesize */ case H5VL_FILE_GET_SIZE: @@ -1845,8 +1877,6 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ haddr_t base_addr; /* Base address for the file */ hsize_t *size = va_arg(arguments, hsize_t *); - f = (H5F_t *)obj; - /* Go get the actual file size */ if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") @@ -1858,6 +1888,7 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + /* H5Fget_file_image */ case H5VL_FILE_GET_FILE_IMAGE: { @@ -1865,25 +1896,25 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ ssize_t *ret = va_arg(arguments, ssize_t *); size_t buf_len = va_arg(arguments, size_t ); - f = (H5F_t *)obj; /* Do the actual work */ if((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed") break; } + /* H5Fget_freespace */ case H5VL_FILE_GET_FREE_SPACE: { hsize_t tot_space; /* Amount of free space in the file */ hssize_t *ret = va_arg(arguments, hssize_t *); - f = (H5F_t *)obj; /* Go get the actual amount of free space in the file */ if(H5MF_get_freespace(f, &tot_space, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") *ret = (hssize_t)tot_space; break; } + case H5VL_FILE_GET_FREE_SECTIONS: { H5F_sect_info_t *sect_info = va_arg(arguments, H5F_sect_info_t *); @@ -1891,12 +1922,12 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ H5F_mem_t type = va_arg(arguments, H5F_mem_t); size_t nsects = va_arg(arguments, size_t); - f = (H5F_t *)obj; /* Go get the free-space section information in the file */ if((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") break; } + /* H5Fget_info2 */ case H5VL_FILE_GET_INFO: { @@ -1906,7 +1937,7 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ /* Get the file struct. This call is careful to not return the file pointer * for the top file in a mount hierarchy. */ - if(NULL == (f = H5VL_native_get_file(obj, type))) + if(NULL == (f = H5VL__native_get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct") /* Get the file info */ @@ -1915,28 +1946,29 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + /* H5Fget_mdc_config */ case H5VL_FILE_GET_MDC_CONF: { H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *); - f = (H5F_t *)obj; /* Go get the resize configuration */ if(H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") break; } + /* H5Fget_mdc_hit_rate */ case H5VL_FILE_GET_MDC_HR: { double *hit_rate_ptr = va_arg(arguments, double *); - f = (H5F_t *)obj; /* Go get the current hit rate */ if(H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") break; } + /* H5Fget_mdc_size */ case H5VL_FILE_GET_MDC_SIZE: { @@ -1946,7 +1978,6 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ int *cur_num_entries_ptr = va_arg(arguments, int *); uint32_t cur_num_entries; - f = (H5F_t *)obj; /* Go get the size data */ if(H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) @@ -1956,138 +1987,120 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ *cur_num_entries_ptr = (int)cur_num_entries; break; } + /* H5Fget_vfd_handle */ case H5VL_FILE_GET_VFD_HANDLE: { void **file_handle = va_arg(arguments, void **); hid_t fapl_id = va_arg(arguments, hid_t); - f = (H5F_t *)obj; - /* Retrieve the VFD handle for the file */ if(H5F_get_vfd_handle(f, fapl_id, file_handle) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") break; } + + /* H5Iget_file_id */ + case H5VL_FILE_GET_FILE: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + void **ret = va_arg(arguments, void **); + + if(NULL == (f = H5VL__native_get_file(obj, type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + f->id_exists = TRUE; + *ret = (void*)f; + break; + } + /* H5Fclear_elink_file_cache */ case H5VL_FILE_CLEAR_ELINK_CACHE: { - f = (H5F_t *)obj; - /* Release the EFC */ if(f->shared->efc) if(H5F__efc_release(f->shared->efc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") break; } - /* H5Freopen */ - case H5VL_FILE_REOPEN: - { - void **ret = va_arg(arguments, void **); - H5F_t *new_file = NULL; - f = (H5F_t *)obj; - - /* Reopen the file through the VOL driver */ - if(NULL == (new_file = H5F__reopen(f))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") - - new_file->id_exists = TRUE; - - *ret = (void *)new_file; - break; - } /* H5Freset_mdc_hit_rate_stats */ case H5VL_FILE_RESET_MDC_HIT_RATE: { - f = (H5F_t *)obj; /* Reset the hit rate statistic */ if(H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") break; } + case H5VL_FILE_SET_MDC_CONFIG: { H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *); - f = (H5F_t *)obj; /* set the resize configuration */ if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed") break; } + case H5VL_FILE_GET_METADATA_READ_RETRY_INFO: { H5F_retry_info_t *info = va_arg(arguments, H5F_retry_info_t *); - f = (H5F_t *)obj; - if(H5F_get_metadata_read_retry_info(f, info) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get metadata read retry info") break; } + case H5VL_FILE_START_SWMR_WRITE: { - f = (H5F_t *)obj; - if(H5F__start_swmr_write(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write") break; } + case H5VL_FILE_START_MDC_LOGGING: { - f = (H5F_t *)obj; - /* Call mdc logging function */ if(H5C_start_logging(f->shared->cache) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") break; } + case H5VL_FILE_STOP_MDC_LOGGING: { - f = (H5F_t *)obj; - /* Call mdc logging function */ if(H5C_stop_logging(f->shared->cache) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") break; } + case H5VL_FILE_GET_MDC_LOGGING_STATUS: { hbool_t *is_enabled = va_arg(arguments, hbool_t *); hbool_t *is_currently_logging = va_arg(arguments, hbool_t *); - f = (H5F_t *)obj; - /* Call mdc logging function */ if(H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") break; } - case H5VL_FILE_SET_LATEST_FORMAT: - { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") - break; - } + case H5VL_FILE_FORMAT_CONVERT: { - f = (H5F_t *)obj; - /* Convert the format */ if(H5F__format_convert(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") break; } + case H5VL_FILE_RESET_PAGE_BUFFERING_STATS: { - f = (H5F_t *)obj; - /* Sanity check */ if(NULL == f->shared->page_buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") @@ -2098,6 +2111,7 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + case H5VL_FILE_GET_PAGE_BUFFERING_STATS: { unsigned *accesses = va_arg(arguments, unsigned *); @@ -2106,8 +2120,6 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ unsigned *evictions = va_arg(arguments, unsigned *); unsigned *bypasses = va_arg(arguments, unsigned *); - f = (H5F_t *)obj; - /* Sanity check */ if(NULL == f->shared->page_buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") @@ -2118,23 +2130,81 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + case H5VL_FILE_GET_MDC_IMAGE_INFO: { HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") break; } + case H5VL_FILE_GET_EOA: + { + haddr_t *eoa = va_arg(arguments, haddr_t *); + haddr_t rel_eoa; /* Relative address of EOA */ + + /* Sanity check */ + HDassert(eoa); + + /* This routine will work only for drivers with this feature enabled.*/ + /* We might introduce a new feature flag in the future */ + if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") + + /* The real work */ + if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed") + + /* Set return value */ + /* (Note compensating for base address subtraction in internal routine) */ + *eoa = rel_eoa + H5F_get_base_addr(f); + + break; + } + + case H5VL_FILE_INCR_FILESIZE: + { + hsize_t increment = va_arg(arguments, hsize_t); + haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */ + + /* This public routine will work only for drivers with this feature enabled.*/ + /* We might introduce a new feature flag in the future */ + if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") + + /* Get the maximum of EOA and EOF */ + if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") + + /* Set EOA to the maximum value + increment */ + if(H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + + break; + } + + case H5VL_FILE_SET_LIBVER_BOUNDS: + { + H5F_libver_t low = va_arg(arguments, H5F_libver_t); + H5F_libver_t high = va_arg(arguments, H5F_libver_t); + + /* Call internal set_libver_bounds function */ + if(H5F__set_libver_bounds(f, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_optional() */ +} /* end H5VL__native_file_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_close + * Function: H5VL__native_file_close * * Purpose: Closes a file. * @@ -2143,14 +2213,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { int nref; H5F_t *f = (H5F_t *)file; hid_t file_id = H5I_INVALID_HID; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* This routine should only be called when a file ID's ref count drops to zero */ HDassert(H5F_ID_EXISTS(f)); @@ -2164,13 +2235,14 @@ H5VL_native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UN /* Get the file ID corresponding to the H5F_t struct */ if(H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "invalid atom") + /* Get the number of references outstanding for this file ID */ if((nref = H5I_get_ref(file_id, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") if(nref == 1) if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") - } + } /* end if */ /* Close the file */ if(H5F__close(f) < 0) @@ -2178,11 +2250,11 @@ H5VL_native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UN done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_close() */ +} /* end H5VL__native_file_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_create + * Function: H5VL__native_group_create * * Purpose: Creates a group inside a native h5 file. * @@ -2193,8 +2265,9 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, - hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ H5G_loc_t loc; /* Location to create group */ @@ -2202,7 +2275,7 @@ H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *na hid_t lcpl_id; void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the property list structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) @@ -2228,13 +2301,14 @@ H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *na /* Create the new group & get its ID */ if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") - } + } /* end if */ /* otherwise it's from H5Gcreate */ else { /* Create the new group & get its ID */ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") - } + } /* end else */ + ret_value = (void *)grp; done: @@ -2250,14 +2324,15 @@ done: /* Decrement refcount on group's object header in memory */ if(H5O_dec_rc_by_loc(oloc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") - } - } + } /* end if */ + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_create() */ +} /* end H5VL__native_group_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_open + * Function: H5VL__native_group_open * * Purpose: Opens a group inside a native h5 file. * @@ -2268,14 +2343,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, - hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Location to open group */ H5G_t *grp = NULL; /* New group opend */ void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set up the location */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) @@ -2289,11 +2364,11 @@ H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_open() */ +} /* end H5VL__native_group_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_get + * Function: H5VL__native_group_get * * Purpose: Gets data about a group * @@ -2302,11 +2377,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Gget_create_plist */ @@ -2319,6 +2395,7 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group") break; } + /* H5Gget_info */ case H5VL_GROUP_GET_INFO: { @@ -2335,14 +2412,14 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED /* Retrieve the group's information */ if(H5G__obj_info(loc.oloc, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } + } /* end if */ else if (loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Gget_info_by_name */ /* Retrieve the group's information */ if(H5G__get_info_by_name(&loc, loc_params.loc_data.loc_by_name.name, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } + } /* end else-if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Gget_info_by_idx */ @@ -2350,23 +2427,23 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED if(H5G__get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") - } break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_get() */ +} /* end H5VL__native_group_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_specific + * Function: H5VL__native_group_specific * * Purpose: Specific operations for groups * @@ -2375,13 +2452,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_group_specific(void *obj, H5VL_group_specific_t specific_type, +H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_t *grp = (H5G_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { case H5VL_GROUP_FLUSH: @@ -2394,6 +2471,7 @@ H5VL_native_group_specific(void *obj, H5VL_group_specific_t specific_type, break; } + case H5VL_GROUP_REFRESH: { hid_t group_id = va_arg(arguments, hid_t); @@ -2404,17 +2482,18 @@ H5VL_native_group_specific(void *obj, H5VL_group_specific_t specific_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_specific() */ +} /* end H5VL__native_group_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_close + * Function: H5VL__native_group_close * * Purpose: Closes a group. * @@ -2423,22 +2502,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_close((H5G_t *)grp) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_close() */ +} /* end H5VL__native_group_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_create + * Function: H5VL__native_link_create * * Purpose: Creates an hard/soft/UD/external links. * @@ -2450,13 +2529,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, + H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -2498,14 +2578,15 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc if((ret_value = H5L_create_hard(cur_loc_p, cur_params.loc_data.loc_by_name.name, link_loc_p, loc_params.loc_data.loc_by_name.name, lcpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end if */ else { /* H5Olink */ /* Link to the object */ if(H5L_link(&link_loc, loc_params.loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end else */ break; } + case H5VL_LINK_CREATE_SOFT: { char *target_name; @@ -2522,6 +2603,7 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; } + case H5VL_LINK_CREATE_UD: { H5G_loc_t link_loc; /* Group location for new link */ @@ -2545,16 +2627,18 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; } + default: HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call") - } + } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_create() */ +} /* end H5VL__native_link_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_copy + * Function: H5VL__native_link_copy * * Purpose: Renames an object within an HDF5 file and copies it to a new * group. The original name SRC is unlinked from the group graph @@ -2571,15 +2655,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, - hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, + hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -2602,11 +2687,11 @@ H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_copy() */ +} /* end H5VL__native_link_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_move + * Function: H5VL__native_link_move * * Purpose: Renames an object within an HDF5 file and moves it to a new * group. The original name SRC is unlinked from the group graph @@ -2623,15 +2708,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, - hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, + hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -2654,11 +2740,11 @@ H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_move() */ +} /* end H5VL__native_link_move() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_get + * Function: H5VL__native_link_get * * Purpose: Gets certain data about a link * @@ -2671,13 +2757,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -2703,6 +2789,7 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") break; } + /* H5Lget_name_by_idx */ case H5VL_LINK_GET_NAME: { @@ -2717,6 +2804,7 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge break; } + /* H5Lget_val/H5Lget_val_by_idx */ case H5VL_LINK_GET_VAL: { @@ -2739,17 +2827,18 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_get() */ +} /* end H5VL__native_link_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_specific + * Function: H5VL__native_link_specific * * Purpose: Specific operations with links * @@ -2762,12 +2851,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { case H5VL_LINK_EXISTS: @@ -2783,6 +2872,7 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info") break; } + case H5VL_LINK_ITER: { H5G_loc_t loc; @@ -2803,31 +2893,31 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe /* H5Lvisit */ if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") - } + } /* end if */ else { /* H5Literate */ if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") - } - } + } /* end else */ + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { if(recursive) { /* H5Lvisit_by_name */ if((ret_value = H5G_visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") - } + } /* end if */ else { /* H5Literate_by_name */ if((ret_value = H5L_iterate(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") - } - } - else{ + } /* end else */ + } /* end else-if */ + else HGOTO_ERROR(H5E_LINK, H5E_UNSUPPORTED, FAIL, "unknown link iterate params") - } break; } + case H5VL_LINK_DELETE: { H5G_loc_t loc; @@ -2839,28 +2929,28 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ if(H5L_delete(&loc, loc_params.loc_data.loc_by_name.name) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ - if(H5L_delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") - } + } /* end else-if */ else HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_specific() */ +} /* end H5VL__native_link_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_open + * Function: H5VL__native_object_open * * Purpose: Opens a object inside a native h5 file. * @@ -2873,13 +2963,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") @@ -2892,6 +2982,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name") break; } + case H5VL_OBJECT_BY_IDX: { /* Open the object */ @@ -2900,6 +2991,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index") break; } + case H5VL_OBJECT_BY_ADDR: { /* Open the object */ @@ -2907,6 +2999,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address") break; } + case H5VL_OBJECT_BY_REF: { hid_t temp_id = H5I_INVALID_HID; @@ -2923,21 +3016,22 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope *opened_type = H5I_get_type(temp_id); if(NULL == (ret_value = H5I_remove(temp_id))) - HDONE_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object") break; } + case H5VL_OBJECT_BY_SELF: default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown open parameters") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_open() */ +} /* end H5VL__native_object_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_copy + * Function: H5VL__native_object_copy * * Purpose: Copys a object inside a native h5 file. * @@ -2950,15 +3044,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t src_loc; /* Source object group location */ H5G_loc_t dst_loc; /* Destination group location */ herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* get location for objects */ if(H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) @@ -2966,16 +3060,17 @@ H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char if(H5G_loc_real(dst_obj, loc_params2.obj_type, &dst_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* Open the object */ + /* Copy the object */ if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object") + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_copy() */ +} /* end H5VL__native_object_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_get + * Function: H5VL__native_object_get * * Purpose: Gets certain data about an object * @@ -2987,13 +3082,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ H5G_loc_t loc; /* Location of group */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -3017,6 +3112,7 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ break; } + /* H5Rget_obj_type2 */ case H5VL_REF_GET_TYPE: { @@ -3029,6 +3125,7 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") break; } + /* H5Rget_name */ case H5VL_REF_GET_NAME: { @@ -3043,31 +3140,33 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") - } + } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_get() */ +} /* end H5VL__native_object_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_specific + * Function: H5VL__native_object_specific * - * Purpose: Perform a driver specific operation for an objectibute + * Purpose: Perform a plugin-specific operation for an objectibute * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -3084,6 +3183,7 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + /* H5Oexists_by_name */ case H5VL_OBJECT_EXISTS: { @@ -3092,14 +3192,13 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* Check if the object exists */ if((*ret = H5G_loc_exists(&loc, loc_params.loc_data.loc_by_name.name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", - loc_params.loc_data.loc_by_name.name) - } - else { + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", loc_params.loc_data.loc_by_name.name) + } /* end if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters") - } break; } + case H5VL_OBJECT_VISIT: { H5_index_t idx_type = va_arg(arguments, H5_index_t); @@ -3113,16 +3212,17 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object /* H5Ovisit */ if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ovisit_by_name */ if((ret_value = H5O__visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params"); break; } + case H5VL_OBJECT_FLUSH: { hid_t oid = va_arg(arguments, hid_t); @@ -3133,6 +3233,7 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + case H5VL_OBJECT_REFRESH: { hid_t oid = va_arg(arguments, hid_t); @@ -3144,6 +3245,7 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + case H5VL_REF_CREATE: { void *ref = va_arg(arguments, void *); @@ -3161,19 +3263,20 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_specific() */ +} /* end H5VL__native_object_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_optional + * Function: H5VL__native_object_optional * - * Purpose: Perform a driver specific operation for an objectibute + * Purpose: Perform a plugin-specific operation for an objectibute * * Return: Success: 0 * Failure: -1 @@ -3184,14 +3287,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) { H5VL_object_optional_t optional_type = va_arg(arguments, H5VL_object_optional_t); H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -3207,12 +3311,12 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT /* Retrieve the object's information */ if(H5G_loc_info(&loc, ".", obj_info, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ /* Retrieve the object's information */ if(H5G_loc_info(&loc, loc_params.loc_data.loc_by_name.name, obj_info, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end else-if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ @@ -3234,17 +3338,17 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT if(H5O_get_info(obj_loc.oloc, obj_info, fields) < 0) { H5G_loc_free(&obj_loc); HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") - } + } /* end if */ /* Release the object location */ if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - } - else { + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") - } break; } + /* H5Oget_comment / H5Oget_comment_by_name */ case H5VL_OBJECT_GET_COMMENT: { @@ -3256,16 +3360,16 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */ if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */ if((*ret = H5G_loc_get_comment(&loc, loc_params.loc_data.loc_by_name.name, comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") - } break; } + /* H5Oset_comment */ case H5VL_OBJECT_SET_COMMENT: { @@ -3275,28 +3379,28 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, ".", comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */ /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, loc_params.loc_data.loc_by_name.name, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") - } break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object"); - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_optional() */ +} /* end H5VL__native_object_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_commit + * Function: H5VL__native_datatype_commit * * Purpose: Commits a datatype inside a native h5 file. * @@ -3309,15 +3413,16 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, - hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Location to commit datatype */ H5T_t *dt; /* Datatype for ID */ H5T_t *type = NULL; /* copy of the original type which will be committed */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) @@ -3351,23 +3456,25 @@ H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char /* H5Tcommit */ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") - } + } /* end if */ else { /* H5Tcommit_anon */ if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") - } + } /* end else */ + ret_value = (void *)type; done: if(NULL == ret_value && type) H5T_close(type); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_commit() */ +} /* end H5VL__native_datatype_commit() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_open + * Function: H5VL__native_datatype_open * * Purpose: Opens a named datatype inside a native h5 file. * @@ -3377,14 +3484,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, - hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *type = NULL; /* Datatype opened in file */ H5G_loc_t loc; /* Group location of object to open */ void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") @@ -3399,11 +3506,11 @@ H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *n done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_open() */ +} /* end H5VL__native_datatype_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_get + * Function: H5VL__native_datatype_get * * Purpose: Gets certain information about a datatype * @@ -3416,13 +3523,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_datatype_get(void *obj, H5VL_datatype_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5T_t *dt = (H5T_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch (get_type) { case H5VL_DATATYPE_GET_BINARY: @@ -3437,6 +3544,7 @@ H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, *nalloc = (ssize_t) size; break; } + /* H5Tget_create_plist */ case H5VL_DATATYPE_GET_TCPL: { @@ -3447,17 +3555,18 @@ H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_get() */ +} /* end H5VL__native_datatype_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_specific + * Function: H5VL__native_datatype_specific * * Purpose: Specific operations for datatype * @@ -3466,13 +3575,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, +H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5T_t *dt = (H5T_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { case H5VL_DATATYPE_FLUSH: @@ -3485,6 +3594,7 @@ H5VL_native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, break; } + case H5VL_DATATYPE_REFRESH: { hid_t type_id = va_arg(arguments, hid_t); @@ -3495,17 +3605,18 @@ H5VL_native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_specific() */ +} /* end H5VL__native_datatype_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_close + * Function: H5VL__native_datatype_close * * Purpose: Closes an datatype. * @@ -3518,16 +3629,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5T_close((H5T_t*)dt) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close datatype") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_close() */ +} /* end H5VL__native_datatype_close() */ diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 4e33e8a..6751601 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -18,7 +18,7 @@ #define _H5VLnative_H /* Initializer function for native VOL driver */ -#define H5VL_NATIVE (H5VL_native_init()) +#define H5VL_NATIVE (H5VL_native_init(H5P_DEFAULT)) /* Characteristics of the native VOL driver */ #define H5VL_NATIVE_NAME "native" @@ -33,12 +33,12 @@ extern "C" { /* 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_init(hid_t vipl_id); H5_DLL hid_t H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref); -H5_DLL herr_t H5VL_native_unregister(hid_t obj_id); #ifdef __cplusplus } #endif #endif /* _H5VLnative_H */ + diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 98be308..1da5a43 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -26,24 +26,24 @@ /* Library Private Typedefs */ /****************************/ -/* Internal struct to track VOL driver information for objects */ +/* Internal struct to track VOL plugin information for objects */ typedef struct H5VL_t { - const H5VL_class_t *cls; /* Pointer to driver class struct */ + const H5VL_class_t *cls; /* Pointer to plugin class struct */ int64_t nrefs; /* Number of references by objects using this struct */ - hid_t id; /* Identifier for the VOL driver */ + hid_t id; /* Identifier for the VOL plugin */ } H5VL_t; /* Internal vol object structure returned to the API */ typedef struct H5VL_object_t { - void *data; /* Pointer to driver-managed data for this object */ - H5VL_t *driver; /* Pointer to VOL driver struct */ + void *data; /* Pointer to plugin-managed data for this object */ + H5VL_t *plugin; /* Pointer to VOL plugin struct */ } H5VL_object_t; -/* Internal structure to hold the driver ID & info for FAPLs */ -typedef struct H5VL_driver_prop_t { - hid_t driver_id; /* VOL driver's ID */ - const void *driver_info; /* VOL driver info, for open callbacks */ -} H5VL_driver_prop_t; +/* Internal structure to hold the plugin ID & info for FAPLs */ +typedef struct H5VL_plugin_prop_t { + hid_t plugin_id; /* VOL plugin's ID */ + const void *plugin_info; /* VOL plugin info, for open callbacks */ +} H5VL_plugin_prop_t; /*****************************/ /* Library Private Variables */ @@ -55,15 +55,34 @@ typedef struct H5VL_driver_prop_t { /* Common 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 hid_t H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, 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); -H5_DLL ssize_t H5VL_get_driver_name(hid_t id, char *name/*out*/, size_t size); +H5_DLL hid_t H5VL_register(const void *cls, hbool_t app_ref, hid_t vipl_id); +H5_DLL hid_t H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t plugin_id, hbool_t app_ref); +H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref); +H5_DLL ssize_t H5VL_get_plugin_name(hid_t id, char *name/*out*/, size_t size); H5_DLL H5VL_object_t *H5VL_get_object(hid_t id); H5_DLL void *H5VL_object(hid_t id); +H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj); 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_plugin_object(H5VL_object_t *obj); +H5_DLL int H5VL_cmp_plugin_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls); +H5_DLL int H5VL_copy_plugin_info(const H5VL_class_t *plugin, void **dst_info, + const void *src_info); +H5_DLL int H5VL_cmp_plugin_info(const H5VL_class_t *plugin, const void *info1, + const void *info2); +H5_DLL herr_t H5VL_free_plugin_info(const H5VL_class_t *plugin, void *info); +H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *plugin, void *obj, + void **wrap_ctx); +H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *plugin, void *wrap_ctx); +H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_plugin); +H5_DLL herr_t H5VL_reset_vol_wrapper(void); +H5_DLL void * H5VL_wrap_object(const H5VL_class_t *plugin, void *wrap_ctx, + void *obj); + +/****************************** + * VOL plugin callback wrappers + *****************************/ /* 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); @@ -128,5 +147,6 @@ H5_DLL herr_t H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_ H5_DLL herr_t H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status); H5_DLL herr_t H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status); H5_DLL herr_t H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status); + #endif /* _H5VLprivate_H */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index d118bcc..e345c2a 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -52,7 +52,7 @@ /* Group creation property names */ #define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id" -/* Default VOL driver value */ +/* Default VOL plugin value */ #define H5VL_VOL_DEFAULT 0 @@ -112,17 +112,17 @@ typedef enum H5VL_datatype_specific_t { typedef enum H5VL_file_get_t { H5VL_FILE_GET_FAPL, /* file access property list */ H5VL_FILE_GET_FCPL, /* file creation property list */ - H5VL_FILE_GET_INTENT, /* file intent */ + H5VL_FILE_GET_INTENT, /* file intent */ H5VL_FILE_GET_NAME, /* file name */ H5VL_FILE_GET_OBJ_COUNT, /* object count in file */ - H5VL_FILE_GET_OBJ_IDS, /* object ids in file */ - H5VL_OBJECT_GET_FILE /* retrieve or resurrect file of object */ + H5VL_FILE_GET_OBJ_IDS /* object ids in file */ } H5VL_file_get_t; /* types for file SPECIFIC callback */ typedef enum H5VL_file_specific_t { H5VL_FILE_FLUSH, /* Flush file */ H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */ + H5VL_FILE_REOPEN, /* Reopen the file */ H5VL_FILE_MOUNT, /* Mount a file */ H5VL_FILE_UNMOUNT /* Un-Mount a file */ } H5VL_file_specific_t; @@ -328,57 +328,56 @@ typedef struct H5VL_object_class_t { herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); } H5VL_object_class_t; -/* H5AO routines */ +/* Async operation routines */ typedef struct H5VL_async_class_t { herr_t (*cancel)(void **, H5ES_status_t *); herr_t (*test) (void **, H5ES_status_t *); herr_t (*wait) (void **, H5ES_status_t *); } H5VL_async_class_t; -/* VOL category (internal, external, etc.) - * XXX: This is intended to replace the H5VL_class_value_t struct, which seems - * difficult to manage. It's currently unused so I don't break struct - * compatibility with existing VOLs. - */ -typedef enum H5VL_category_t { - H5VL_INTERNAL, /* Internal VOL driver */ - H5VL_EXTERNAL /* External VOL driver (plugin) */ -} H5VL_category_t; -/* enum value to identify the class of a VOL driver (mostly for comparison purposes) */ +/* enum value to identify the class of a VOL plugin (mostly for comparison purposes) */ typedef enum H5VL_class_value_t { H5_VOL_NATIVE = 0, /* This should be first */ H5_VOL_MAX_LIB_VALUE = 128 /* This should be last */ } H5VL_class_value_t; -/* Class information for each VOL driver */ + +/* Capability flags for plugins */ +#define H5VL_CAP_FLAG_NONE 0 /* No special plugin capabilities */ +#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Plugin is threadsafe */ + + +/* Class information for each VOL plugin */ /* XXX: We should consider adding a UUID/GUID field to this struct * as well as a H5VLregister_by_uuid() API call for people who - * really care about getting a particular VOL driver. + * really care about getting a particular VOL plugin. * XXX: We should also consider adding enough information so that - * files can be opened without specifying the VOL driver. + * files can be opened without specifying the VOL plugin. * e.g.: If we stored a UUID and version, we could search for - * a matching VOL driver so a user did not have to make any + * a matching VOL plugin so a user did not have to make any * H5VL calls. */ typedef struct H5VL_class_t { - /* XXX: How do we identify unique VOL drivers? + /* XXX: How do we identify unique VOL plugin? * This is unclear, but for now we'll keep * all the ID fields from the original VOL * branch. */ - unsigned int version; /* VOL driver version # - * XXX: Is this supposed to be a VOL driver - * version number or a VOL API version - * number? Maybe we need both? - */ - H5VL_class_value_t value; /* value to identify driver */ + unsigned int version; /* VOL plugin API version # */ + H5VL_class_value_t value; /* value to identify plugin */ const char *name; /* Plugin name (MUST be unique!) */ + unsigned cap_flags; /* capability flags for plugin */ herr_t (*initialize)(hid_t vipl_id); /* Plugin initialization callback */ - herr_t (*terminate)(hid_t vtpl_id); /* Plugin termination callback */ - size_t fapl_size; /* size of the vol info in the fapl property */ - void * (*fapl_copy)(const void *info); /* callback to create a copy of the vol info */ - herr_t (*fapl_free)(void *info); /* callback to release the vol info copy */ + herr_t (*terminate)(void); /* Plugin termination callback */ + size_t info_size; /* size of the vol info */ + void * (*info_copy)(const void *info); /* callback to create a copy of the vol info */ + int (*info_cmp)(const void *info1, const void *info2); /* callback to compare vol info */ + herr_t (*info_free)(void *info); /* callback to release the vol info copy */ + void * (*get_object)(const void *obj); /* callback to retrieve underlying object */ + herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* callback to retrieve the object wrapping context for the plugin */ + herr_t (*free_wrap_ctx)(void *wrap_ctx); /* callback to release the object wrapping context for the plugin */ + void* (*wrap_object)(void *obj, void *wrap_ctx); /* callback to wrap an object */ /* Data Model */ H5VL_attr_class_t attr_cls; /* attribute class callbacks */ @@ -390,7 +389,9 @@ typedef struct H5VL_class_t { H5VL_object_class_t object_cls; /* object class callbacks */ /* Services */ - H5VL_async_class_t async_cls; /* asynchronous class callbacks */ + H5VL_async_class_t async_cls; /* asynchronous class callbacks */ + + /* Catch-all */ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ } H5VL_class_t; @@ -407,92 +408,113 @@ typedef struct H5VL_class_t { extern "C" { #endif -/* VOL Driver/Plugin Functionality */ -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); +/* VOL Plugin Functionality */ +H5_DLL hid_t H5VLregister(const H5VL_class_t *cls, hid_t vipl_id); +H5_DLL hid_t H5VLregister_by_name(const char *plugin_name, hid_t vipl_id); H5_DLL htri_t H5VLis_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 H5VLget_plugin_id(const char *name); +H5_DLL ssize_t H5VLget_plugin_name(hid_t id, char *name/*out*/, size_t size); +H5_DLL herr_t H5VLclose(hid_t plugin_id); +H5_DLL herr_t H5VLunregister(hid_t plugin_id); + + +/************************************************************************** + * VOL callback wrappers and helper routines, for VOL plugin authors only * + * (Not part of the public API for application developers) * + **************************************************************************/ + +/* Helper routines for VOL plugin authors */ +H5_DLL hid_t H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t plugin_id); H5_DLL void *H5VLobject(hid_t id); -H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj); - -/* Attributes */ -H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_read(void *attr, hid_t driver_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_write(void *attr, hid_t driver_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_get(void *obj, hid_t driver_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_close(void *attr, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Datasets */ -H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdataset_read(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); -H5_DLL herr_t H5VLdataset_write(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -H5_DLL herr_t H5VLdataset_get(void *dset, hid_t driver_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t driver_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_close(void *dset, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Files */ +H5_DLL herr_t H5VLcmp_plugin_cls(int *cmp, hid_t plugin_id1, hid_t plugin_id2); +H5_DLL herr_t H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, + const void *info2); + + +/* Public wrappers for generic callbacks */ +H5_DLL herr_t H5VLinitialize(hid_t plugin_id, hid_t vipl_id); +H5_DLL herr_t H5VLterminate(hid_t plugin_id); +H5_DLL herr_t H5VLget_cap_flags(hid_t plugin_id, unsigned *cap_flags); +H5_DLL herr_t H5VLcopy_plugin_info(hid_t plugin_id, void **dst_vol_info, void *src_vol_info); +H5_DLL herr_t H5VLfree_plugin_info(hid_t plugin_id, void *vol_info); +H5_DLL void *H5VLget_object(void *obj, hid_t plugin_id); +H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t plugin_id, void **wrap_ctx); +H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t plugin_id); +H5_DLL void *H5VLwrap_object(void *obj, hid_t plugin_id, void *wrap_ctx); + +/* Public wrappers for attribute callbacks */ +H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_read(void *attr, hid_t plugin_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_write(void *attr, hid_t plugin_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req); + +/* Public wrappers for dataset callbacks */ +H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdataset_read(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VLdataset_write(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VLdataset_get(void *dset, hid_t plugin_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_close(void *dset, hid_t plugin_id, hid_t dxpl_id, void **req); + +/* Public wrappers for file callbacks */ H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLfile_get(void *file, hid_t driver_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_specific(void *obj, hid_t driver_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_close(void *file, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Groups */ -H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLgroup_get(void *obj, hid_t driver_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t driver_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_close(void *grp, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Links */ -H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_specific(void *obj, hid_t plugin_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req); + +/* Public wrappers for group callbacks */ +H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req); + +/* Public wrappers for link callbacks */ +H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); - -/* Objects */ -H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t driver_id1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id2, const char *dst_name, +H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); + +/* Public wrappers for object callbacks */ +H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t plugin_id1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); - -/* Datatypes */ -H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t driver_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t driver_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Asynchronous Requests */ -H5_DLL herr_t H5VLrequest_cancel(void **req, hid_t driver_id, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_test(void **req, hid_t driver_id, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_wait(void **req, hid_t driver_id, H5ES_status_t *status); +H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); + +/* Public wrappers for named datatype callbacks */ +H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t plugin_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req); + +/* Public wrappers for asynchronous request callbacks */ +H5_DLL herr_t H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status); #ifdef __cplusplus } #endif #endif /* _H5VLpublic_H */ + diff --git a/src/H5Z.c b/src/H5Z.c index 9dc358c..aeb7602 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -586,7 +586,9 @@ static int H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) { H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ +#ifdef H5_HAVE_PARALLEL H5Z_object_t *object = (H5Z_object_t *)key; +#endif /* H5_HAVE_PARALLEL */ int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5private.h b/src/H5private.h index 63f6858..b654bae 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2086,10 +2086,11 @@ H5_DLL herr_t H5CX_pop(void); /* * Use this macro for API functions that shouldn't perform _any_ initialization * of the library or an interface, just perform tracing, etc. Examples - * are: H5allocate_memory, H5is_library_threadsafe, etc. + * are: H5allocate_memory, H5is_library_threadsafe, public VOL callback + * wrappers (e.g. H5VLfile_create, H5VLdataset_read, etc.), etc. * */ -#define FUNC_ENTER_API_NOINIT {{ \ +#define FUNC_ENTER_API_NOINIT {{{ \ FUNC_ENTER_API_COMMON \ H5_PUSH_FUNC \ BEGIN_MPE_LOG \ @@ -2102,7 +2103,7 @@ H5_DLL herr_t H5CX_pop(void); * are: H5close, H5check_version, etc. * */ -#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \ +#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{{{ \ FUNC_ENTER_API_VARS \ FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ FUNC_ENTER_API_THREADSAFE; \ @@ -2289,14 +2290,14 @@ H5_DLL herr_t H5CX_pop(void); (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ return(ret_value); \ -}} /*end scope from beginning of FUNC_ENTER*/ +}}} /*end scope from beginning of FUNC_ENTER*/ /* Use this macro to match the FUNC_ENTER_API_NOINIT_NOERR_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ FUNC_LEAVE_API_COMMON(ret_value); \ FUNC_LEAVE_API_THREADSAFE \ return(ret_value); \ -}} /*end scope from beginning of FUNC_ENTER*/ +}}}} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI(ret_value) \ ; \ diff --git a/src/H5trace.c b/src/H5trace.c index 08db09a..a63bdfa 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2711,9 +2711,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_GET_OBJ_IDS: HDfprintf(out, "H5VL_FILE_GET_OBJ_IDS"); break; - case H5VL_OBJECT_GET_FILE: - HDfprintf(out, "H5VL_OBJECT_GET_FILE"); - break; default: HDfprintf(out, "%ld", (long)get); break; @@ -2734,6 +2731,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_FLUSH: HDfprintf(out, "H5VL_FILE_FLUSH"); break; + case H5VL_FILE_REOPEN: + HDfprintf(out, "H5VL_FILE_REOPEN"); + break; case H5VL_FILE_MOUNT: HDfprintf(out, "H5VL_FILE_MOUNT"); break; diff --git a/src/Makefile.am b/src/Makefile.am index 7889e10..6dc24c2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -114,7 +114,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Topaque.c \ H5Torder.c \ H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ - H5VL.c H5VLint.c H5VLnative.c \ + H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \ H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ H5Zscaleoffset.c H5Zszip.c H5Ztrans.c diff --git a/test/dsets.c b/test/dsets.c index 050bd8f..5cd376a 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -826,7 +826,7 @@ test_compact_io(hid_t fapl) **************************************/ /* Create a copy of file access property list */ - if((new_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR + if((new_fapl = new_fapl = h5_fileaccess()) < 0) TEST_ERROR /* Loop through all the combinations of low/high library format bounds, skipping invalid combinations. @@ -1334,6 +1334,19 @@ test_conv_buffer(hid_t fid) return 0; error: + H5E_BEGIN_TRY { + H5Pclose(xfer_list); + H5Sclose(space); + H5Tclose(arr_type1); + H5Tclose(arr_type2); + H5Tclose(arr_type3); + H5Tclose(ctype1); + H5Tclose(ctype2); + H5Tclose(arr_type4); + H5Tclose(arr_type5); + H5Dclose(dataset); + } H5E_END_TRY; + return -1; } diff --git a/test/dtypes.c b/test/dtypes.c index 3253d6c..7e5a992 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -6957,13 +6957,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ dset_fid = H5Iget_file_id(dset); - if(dset_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(dset_fid, filea1)) TEST_ERROR H5Fclose(dset_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Dget_type(dset); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); @@ -6979,13 +6979,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ dset_fid = H5Iget_file_id(dset); - if(dset_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(dset_fid, filea1)) TEST_ERROR H5Fclose(dset_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Dget_type(dset); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); @@ -7007,13 +7007,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ attr_fid = H5Iget_file_id(attr); - if(attr_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(attr_fid, filea1)) TEST_ERROR H5Fclose(attr_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Aget_type(attr); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); @@ -7029,13 +7029,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ attr_fid = H5Iget_file_id(attr); - if(attr_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(attr_fid, filea1)) TEST_ERROR H5Fclose(attr_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Aget_type(attr); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); diff --git a/test/file_image.c b/test/file_image.c index 12f0a18..0dba236 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -579,7 +579,8 @@ test_core(void) reset_udata(udata); file = H5Fopen(copied_filename, H5F_ACC_RDONLY, fapl); VERIFY(file >= 0, "H5Fopen failed"); - VERIFY(udata->used_callbacks == MALLOC, "opening a core file used the wrong callbacks"); + VERIFY((udata->used_callbacks == MALLOC) || + (udata->used_callbacks == MALLOC | UDATA_COPY | UDATA_FREE), "opening a core file used the wrong callbacks"); VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN, "Malloc callback came from wrong sourc in core open"); /* Close file */ diff --git a/test/objcopy.c b/test/objcopy.c index f13537e..6ee2f72 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2151,7 +2151,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) buf[i][j] = 10000 + 100*i+j; /* Create a file access property list for destination file */ - if ((fapl_dst = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR + if ((fapl_dst = h5_fileaccess()) < 0) TEST_ERROR /* Initialize the filenames */ h5_fixname(FILENAME[4], fapl_src, src_fname, sizeof src_fname); @@ -7854,6 +7854,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t src_fapl = -1; /* Source file FAPL ID */ const char *src_filename = H5_get_srcdir_filename(FILE_OLD_LAYOUT); /* Corrected test file name */ char dst_filename[NAME_BUF_SIZE]; @@ -7869,8 +7870,14 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) /* Reset file address checking info */ addr_reset(); + /* Setup */ + if((src_fapl = h5_fileaccess()) < 0) TEST_ERROR + /* open source file (read-only) */ - if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR + + /* Close source FAPL */ + if(H5Pclose(src_fapl) < 0) TEST_ERROR /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR @@ -7914,6 +7921,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) error: H5E_BEGIN_TRY { + H5Pclose(src_fapl); H5Dclose(did2); H5Dclose(did); H5Fclose(fid_dst); diff --git a/test/ohdr.c b/test/ohdr.c index 2b57ada..cca7e7e 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -486,7 +486,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) FAIL_STACK_ERROR /* Open FILE_BOGUS */ - if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Set up location ID depending on bogus_id */ diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index 473c53e..7838c9c 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -44,7 +44,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_read(): read failed major: Virtual Object Layer minor: Read failed - #002: (file name) line (number) in H5VL_native_dataset_read(): can't read data + #002: (file name) line (number) in H5VL__native_dataset_read(): can't read data major: Dataset minor: Read failed #003: (file name) line (number) in H5D__read(): can't read data diff --git a/test/tfile.c b/test/tfile.c index 12a0eca..f7ac243 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -4165,10 +4165,7 @@ test_file_freespace(const char *env_h5_drvr) /* Check that there is the right amount of free space in the file */ free_space = H5Fget_freespace(file); CHECK(free_space, FAIL, "H5Fget_freespace"); - if(new_format) - VERIFY(free_space, expected_fs_del, "H5Fget_freespace"); - else - VERIFY(free_space, expected_fs_del, "H5Fget_freespace"); + VERIFY(free_space, expected_fs_del, "H5Fget_freespace"); /* Close file */ ret = H5Fclose(file); diff --git a/test/tmisc.c b/test/tmisc.c index 9eed5db..c7fb4a9 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -3488,7 +3488,7 @@ test_misc19(void) CHECK(vol_cls, NULL, "h5_get_dummy_vol_class"); /* Register a virtual object driver */ - volid = H5VLregister(vol_cls); + volid = H5VLregister(vol_cls, H5P_DEFAULT); CHECK(volid, FAIL, "H5VLregister"); /* Check the reference count */ diff --git a/test/vol.c b/test/vol.c index 3152a93..0de7d88 100644 --- a/test/vol.c +++ b/test/vol.c @@ -43,11 +43,17 @@ static const H5VL_class_t fake_vol_g = { 0, /* version */ (H5VL_class_value_t)999, /* value */ FAKE_VOL_NAME, /* name */ + 0, /* capability flags */ NULL, /* initialize */ NULL, /* terminate */ - (size_t)0, /* fapl size */ - NULL, /* fapl copy */ - NULL, /* fapl free */ + (size_t)0, /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* free_wrap_ctx */ + NULL, /* wrap_object */ { /* attribute_cls */ NULL, /* create */ NULL, /* open */ @@ -120,7 +126,7 @@ static const H5VL_class_t fake_vol_g = { * Function: test_vol_registration() * * Purpose: Tests if we can load, register, and close a simple - * VOL driver. + * VOL plugin. * * Return: SUCCEED/FAIL * @@ -130,28 +136,48 @@ static herr_t test_vol_registration(void) { htri_t is_registered; - hid_t vol_id = -1; + hid_t vol_id = -1, vol_id2 = -1; TESTING("VOL registration"); - /* The test/fake VOL driver should not be registered at the start of the test */ + /* The test/fake VOL plugin should not be registered at the start of the test */ if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (is_registered > 0) - FAIL_PUTS_ERROR("native VOL driver is inappropriately registered"); + FAIL_PUTS_ERROR("native VOL plugin is inappropriately registered"); - /* Load a VOL interface */ - if ((vol_id = H5VLregister(&fake_vol_g)) < 0) + /* Register a VOL plugin */ + if ((vol_id = H5VLregister(&fake_vol_g, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; - /* The test/fake VOL driver should be registered now */ + /* The test/fake VOL plugin should be registered now */ if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) - FAIL_PUTS_ERROR("native VOL driver is un-registered"); + FAIL_PUTS_ERROR("native VOL plugin is un-registered"); + + /* Re-register a VOL plugin */ + if ((vol_id2 = H5VLregister(&fake_vol_g, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* The test/fake VOL plugin should still be registered now */ + if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0) + FAIL_STACK_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL plugin is un-registered"); + + /* Unregister the second test/fake VOL ID */ + if (H5VLunregister(vol_id2) < 0) + FAIL_STACK_ERROR; + + /* The test/fake VOL plugin should still be registered now */ + if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0) + FAIL_STACK_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL plugin is un-registered"); - /* Close the VOL interface */ - if (H5VLclose(vol_id) < 0) + /* Unregister the original test/fake VOL ID */ + if (H5VLunregister(vol_id) < 0) FAIL_STACK_ERROR; PASSED(); @@ -159,7 +185,7 @@ test_vol_registration(void) error: H5E_BEGIN_TRY { - H5VLclose(vol_id); + H5VLunregister(vol_id); } H5E_END_TRY; return FAIL; diff --git a/tools/test/h5dump/errfiles/filter_fail.err b/tools/test/h5dump/errfiles/filter_fail.err index 6c936b7..f6d38b1 100644 --- a/tools/test/h5dump/errfiles/filter_fail.err +++ b/tools/test/h5dump/errfiles/filter_fail.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_read(): read failed major: Virtual Object Layer minor: Read failed - #002: (file name) line (number) in H5VL_native_dataset_read(): can't read data + #002: (file name) line (number) in H5VL__native_dataset_read(): can't read data major: Dataset minor: Read failed #003: (file name) line (number) in H5D__read(): can't read data diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index 64d5aca..faa0c50 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object #003: (file name) line (number) in H5O_open_name(): object not found diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index 64d5aca..faa0c50 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object #003: (file name) line (number) in H5O_open_name(): object not found diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index 64d5aca..faa0c50 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object #003: (file name) line (number) in H5O_open_name(): object not found diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index 64d5aca..faa0c50 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object #003: (file name) line (number) in H5O_open_name(): object not found diff --git a/tools/test/h5dump/errfiles/tarray1_big.err b/tools/test/h5dump/errfiles/tarray1_big.err index b2cc6b7..c008c06 100644 --- a/tools/test/h5dump/errfiles/tarray1_big.err +++ b/tools/test/h5dump/errfiles/tarray1_big.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer @@ -18,7 +18,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer @@ -31,7 +31,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer diff --git a/tools/test/h5dump/errfiles/tattr-3.err b/tools/test/h5dump/errfiles/tattr-3.err index 3190c3d..2df0b01 100644 --- a/tools/test/h5dump/errfiles/tattr-3.err +++ b/tools/test/h5dump/errfiles/tattr-3.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_attr_open(): attribute open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_attr_open(): unable to open attribute: 'attr' + #002: (file name) line (number) in H5VL__native_attr_open(): unable to open attribute: 'attr' major: Attribute minor: Can't open object #003: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' diff --git a/tools/test/h5dump/errfiles/tattrregR.err b/tools/test/h5dump/errfiles/tattrregR.err index d89b053..bd57b22 100644 --- a/tools/test/h5dump/errfiles/tattrregR.err +++ b/tools/test/h5dump/errfiles/tattrregR.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer @@ -18,7 +18,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer diff --git a/tools/test/h5dump/errfiles/tcomp-3.err b/tools/test/h5dump/errfiles/tcomp-3.err index 3462761..5601cb9 100644 --- a/tools/test/h5dump/errfiles/tcomp-3.err +++ b/tools/test/h5dump/errfiles/tcomp-3.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_datatype_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_datatype_open(): unable to open named datatype + #002: (file name) line (number) in H5VL__native_datatype_open(): unable to open named datatype major: Datatype minor: Can't open object #003: (file name) line (number) in H5T__open_name(): not found diff --git a/tools/test/h5dump/errfiles/tdataregR.err b/tools/test/h5dump/errfiles/tdataregR.err index d89b053..bd57b22 100644 --- a/tools/test/h5dump/errfiles/tdataregR.err +++ b/tools/test/h5dump/errfiles/tdataregR.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer @@ -18,7 +18,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err index b2a60cd..1fd7edb 100644 --- a/tools/test/h5dump/errfiles/tdset-2.err +++ b/tools/test/h5dump/errfiles/tdset-2.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_dataset_open(): unable to open dataset + #002: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset major: Dataset minor: Can't open object #003: (file name) line (number) in H5D__open_name(): not found @@ -30,7 +30,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_link_get(): get failed major: Virtual Object Layer minor: Can't get value - #002: (file name) line (number) in H5VL_native_link_get(): unable to get link info + #002: (file name) line (number) in H5VL__native_link_get(): unable to get link info major: Links minor: Object not found #003: (file name) line (number) in H5L_get_info(): name doesn't exist diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index f516638..abeef52 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object #003: (file name) line (number) in H5O_open_name(): object not found @@ -39,7 +39,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object #003: (file name) line (number) in H5O_open_name(): object not found diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err index ba06406..43ab092 100644 --- a/tools/test/h5dump/errfiles/textlinkfar.err +++ b/tools/test/h5dump/errfiles/textlinkfar.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object #003: (file name) line (number) in H5O_open_name(): object not found diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err index ba06406..43ab092 100644 --- a/tools/test/h5dump/errfiles/textlinksrc.err +++ b/tools/test/h5dump/errfiles/textlinksrc.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object #003: (file name) line (number) in H5O_open_name(): object not found diff --git a/tools/test/h5dump/errfiles/tgroup-2.err b/tools/test/h5dump/errfiles/tgroup-2.err index af220b8..6ffb426 100644 --- a/tools/test/h5dump/errfiles/tgroup-2.err +++ b/tools/test/h5dump/errfiles/tgroup-2.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_group_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_group_open(): unable to open group + #002: (file name) line (number) in H5VL__native_group_open(): unable to open group major: Symbol table minor: Can't open object #003: (file name) line (number) in H5G__open_name(): group not found diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index 1336de5..cd47d90 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object #003: (file name) line (number) in H5O_open_name(): object not found diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index 1336de5..cd47d90 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_object_open(): open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object #003: (file name) line (number) in H5O_open_name(): object not found diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err index 4df7265..cf4127d 100644 --- a/tools/test/h5dump/errfiles/tperror.err +++ b/tools/test/h5dump/errfiles/tperror.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_dataset_open(): unable to open dataset + #002: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset major: Dataset minor: Can't open object #003: (file name) line (number) in H5D__open_name(): not found @@ -30,7 +30,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_link_get(): get failed major: Virtual Object Layer minor: Can't get value - #002: (file name) line (number) in H5VL_native_link_get(): unable to get link info + #002: (file name) line (number) in H5VL__native_link_get(): unable to get link info major: Links minor: Object not found #003: (file name) line (number) in H5L_get_info(): name doesn't exist diff --git a/tools/test/h5dump/errfiles/tslink-D.err b/tools/test/h5dump/errfiles/tslink-D.err index ded6719..6d2be80 100644 --- a/tools/test/h5dump/errfiles/tslink-D.err +++ b/tools/test/h5dump/errfiles/tslink-D.err @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_dataset_open(): unable to open dataset + #002: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset major: Dataset minor: Can't open object #003: (file name) line (number) in H5D__open_name(): not found diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst index 6009723..7c01137 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst @@ -5,7 +5,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_create(): create failed major: Virtual Object Layer minor: Unable to initialize object - #002: (file name) line (number) in H5VL_native_dataset_create(): unable to create dataset + #002: (file name) line (number) in H5VL__native_dataset_create(): unable to create dataset major: Dataset minor: Unable to initialize object #003: (file name) line (number) in H5D__create_named(): unable to create and link to dataset -- cgit v0.12 From 305997501dd4c44cb46adfc0159489ae84c5fad4 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 26 Oct 2018 00:54:29 -0500 Subject: Updates after merging changes from develop. --- src/H5Dint.c | 2 +- src/H5Dprivate.h | 2 +- src/H5Gdeprec.c | 2 +- src/H5Gint.c | 2 +- src/H5Gprivate.h | 2 +- src/H5I.c | 16 +++++------ src/H5L.c | 70 ++++++++++++++++++++++++++++++++++-------------- src/H5T.c | 2 +- src/H5Tprivate.h | 2 +- src/H5VL.c | 14 +++++----- src/H5VLint.c | 18 ++++++------- src/H5VLnative.c | 2 +- src/H5VLnative_private.h | 2 +- src/H5VLprivate.h | 5 ++-- test/h5test.c | 10 +++---- test/vol.c | 14 +++++----- 16 files changed, 97 insertions(+), 68 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index a9ac7ac..44a9d88 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1961,7 +1961,7 @@ H5D_oloc(H5D_t *dataset) *------------------------------------------------------------------------- */ H5G_name_t * -H5D_nameof(H5D_t *dataset) +H5D_nameof(const H5D_t *dataset) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index cbee0de..4e9cda8 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -158,7 +158,7 @@ H5_DLL herr_t H5D_close(H5D_t *dataset); H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id); H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); -H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset); +H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset); H5_DLL H5T_t *H5D_typeof(const H5D_t *dset); H5_DLL herr_t H5D_flush_all(const H5F_t *f); H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset); diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 15fd7e8..d207bc1 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -853,7 +853,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_func.op_old = op; /* Get the object pointer */ - if(NULL == (vol_obj = H5VL_get_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") /* Set wrapper info in API context */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 7b028e2..8f9e908 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -578,7 +578,7 @@ H5G_oloc(H5G_t *grp) *------------------------------------------------------------------------- */ H5G_name_t * -H5G_nameof(H5G_t *grp) +H5G_nameof(const H5G_t *grp) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index dc8146c..f149f29 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -187,7 +187,7 @@ typedef struct H5G_entry_t H5G_entry_t; * call. */ H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp); -H5_DLL H5G_name_t * H5G_nameof(H5G_t *grp); +H5_DLL H5G_name_t * H5G_nameof(const H5G_t *grp); H5_DLL H5F_t *H5G_fileof(H5G_t *grp); H5_DLL H5G_t *H5G_open(const H5G_loc_t *loc); H5_DLL herr_t H5G_close(H5G_t *grp); diff --git a/src/H5I.c b/src/H5I.c index 263f51d..aef5cc5 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -485,9 +485,8 @@ H5I__unwrap(void *obj_ptr, H5I_type_t type) ret_value = H5VL_object_data(vol_obj); } /* end if */ else if(H5I_DATATYPE == type) { - const H5T_t *dt; + H5T_t *dt = (H5T_t *)obj_ptr; - dt = (const H5T_t *)obj_ptr; ret_value = (void *)H5T_get_actual_type(dt); } /* end if */ else @@ -904,8 +903,7 @@ H5I_subst(hid_t id, const void *new_object) HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count") /* Get the old object pointer to return */ - /* (Casting away const OK -QAK) */ - ret_value = (void *)id_ptr->obj_ptr; + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ /* Set the new object pointer for the ID */ id_ptr->obj_ptr = new_object; @@ -2026,7 +2024,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /* The stored object pointer might be an H5VL_object_t, in which * case we'll need to get the wrapped object struct (H5F_t *, etc.). */ - obj_ptr = H5I__unwrap(item->obj_ptr, type); + obj_ptr = H5I__unwrap((void *)item->obj_ptr, type); /* Invoke callback function */ cb_ret_val = (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ @@ -2179,7 +2177,7 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") /* Get the object pointer */ - if(NULL == (vol_obj = H5VL_get_object(id))) + if(NULL == (vol_obj = H5VL_vol_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") /* Set wrapper info in API context */ @@ -2356,7 +2354,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) obj_ptr = H5VL_object_data(vol_obj); if(H5_VOL_NATIVE == vol_obj->plugin->cls->value) - path = H5G_nameof((H5G_t *)obj_ptr); + path = H5G_nameof(obj_ptr); break; } @@ -2367,7 +2365,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) obj_ptr = H5VL_object_data(vol_obj); if(H5_VOL_NATIVE == vol_obj->plugin->cls->value) - path = H5D_nameof((H5D_t *)obj_ptr); + path = H5D_nameof(obj_ptr); break; } @@ -2377,7 +2375,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) obj_ptr = (void *)H5T_get_actual_type(dt); - path = H5T_nameof((H5T_t *)obj_ptr); + path = H5T_nameof(obj_ptr); break; } diff --git a/src/H5L.c b/src/H5L.c index 3850285..37561d3 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -337,7 +337,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, vol_obj = (vol_obj1 ? vol_obj1 : vol_obj2); if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; } @@ -351,7 +351,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Lmove() */ @@ -438,7 +438,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, vol_obj = (vol_obj1 ? vol_obj1 : vol_obj2); if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; } @@ -452,7 +452,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Lcopy() */ @@ -531,7 +531,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Create the link */ @@ -542,7 +542,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_soft() */ @@ -722,7 +722,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Create external link */ @@ -733,7 +733,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_ud() */ @@ -787,7 +787,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Unlink */ @@ -798,7 +798,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Ldelete() */ @@ -893,6 +893,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -915,12 +916,21 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Get the link value */ if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lget_val() */ @@ -1007,6 +1017,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1032,12 +1043,21 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Check for the existence of the link */ if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lexists() */ @@ -1087,7 +1107,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Get the link information */ @@ -1098,7 +1118,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Lget_info() */ @@ -1158,7 +1178,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Get the link information */ @@ -1169,7 +1189,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Lget_info_by_idx() */ @@ -1424,7 +1444,7 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Iterate over the links */ @@ -1436,7 +1456,7 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Literate() */ @@ -1471,6 +1491,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1503,12 +1524,21 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, loc_params.loc_data.loc_by_name.name = group_name; loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Iterate over the links */ if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Literate_by_name() */ @@ -1575,7 +1605,7 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Iterate over the links */ @@ -1587,7 +1617,7 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Lvisit() */ @@ -1662,7 +1692,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Visit the links */ @@ -1674,7 +1704,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Lvisit_by_name() */ diff --git a/src/H5T.c b/src/H5T.c index e539ea5..08f689c 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -5070,7 +5070,7 @@ done: *------------------------------------------------------------------------- */ H5G_name_t * -H5T_nameof(H5T_t *dt) +H5T_nameof(const H5T_t *dt) { H5G_name_t *ret_value = NULL; diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index a14eb8a..6b6446f 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -119,7 +119,7 @@ H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc); H5_DLL H5T_t *H5T_decode(size_t buf_size, const unsigned char *buf); H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream); H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt); -H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt); +H5_DLL H5G_name_t *H5T_nameof(const H5T_t *dt); H5_DLL htri_t H5T_is_immutable(const H5T_t *dt); H5_DLL htri_t H5T_is_named(const H5T_t *dt); H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f); diff --git a/src/H5VL.c b/src/H5VL.c index 3d4c04a..5c2d113 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -160,7 +160,7 @@ H5VLregister_plugin(const H5VL_class_t *cls, hid_t vipl_id) done: FUNC_LEAVE_API(ret_value) -} /* end H5VLregister_driver() */ +} /* end H5VLregister_plugin() */ /*------------------------------------------------------------------------- @@ -221,7 +221,7 @@ H5VLregister_plugin_by_name(const char *name, hid_t vipl_id) done: FUNC_LEAVE_API(ret_value) -} /* end H5VLregister_driver_by_name() */ +} /* end H5VLregister_plugin_by_name() */ /*------------------------------------------------------------------------- @@ -273,7 +273,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLunregister_driver(hid_t vol_id) +H5VLunregister_plugin(hid_t vol_id) { herr_t ret_value = SUCCEED; /* Return value */ @@ -290,11 +290,11 @@ H5VLunregister_driver(hid_t vol_id) done: FUNC_LEAVE_API(ret_value) -} /* end H5VLunregister_driver() */ +} /* end H5VLunregister_plugin() */ /*------------------------------------------------------------------------- - * Function: H5VLis_driver_registered + * Function: H5VLis_plugin_registered * * Purpose: Tests whether a VOL class has been registered or not * @@ -307,7 +307,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5VLis_driver_registered(const char *name) +H5VLis_plugin_registered(const char *name) { H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ htri_t ret_value = FALSE; /* Return value */ @@ -327,7 +327,7 @@ H5VLis_driver_registered(const char *name) done: FUNC_LEAVE_API(ret_value) -} /* end H5VLis_driver_registered() */ +} /* end H5VLis_plugin_registered() */ /*------------------------------------------------------------------------- diff --git a/src/H5VLint.c b/src/H5VLint.c index 3899ba2..11deed9 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -237,7 +237,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_plugin, hbool_t app_ref) +H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref) { H5VL_object_t *vol_obj = NULL; hid_t ret_value = H5I_INVALID_HID; @@ -298,7 +298,7 @@ done: *------------------------------------------------------------------------- */ 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_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, 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 */ @@ -308,7 +308,7 @@ H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_drive /* Check arguments */ HDassert(object); - HDassert(vol_driver); + HDassert(vol_plugin); /* Make sure type number is valid */ if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP) @@ -317,11 +317,11 @@ H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_drive /* 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->plugin = vol_plugin; new_vol_obj->data = object; - /* Bump the reference count on the VOL driver */ - vol_driver->nrefs++; + /* Bump the reference count on the VOL plugin */ + vol_plugin->nrefs++; /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */ if(H5I_DATATYPE == type) { @@ -353,7 +353,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_register_using_vol_id(H5I_type_t type, const void *obj, hid_t plugin_id, hbool_t app_ref) +H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t plugin_id, hbool_t app_ref) { H5VL_class_t *cls = NULL; H5VL_t *plugin = NULL; /* VOL plugin struct */ @@ -480,7 +480,7 @@ H5VL_get_plugin_name(hid_t id, char *name /*out*/, size_t size) H5VL_object_t *vol_obj; const H5VL_class_t *cls; size_t len; - ssize_t ret_value; + ssize_t ret_value = -1; FUNC_ENTER_NOAPI(FAIL) @@ -891,7 +891,7 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) new_obj = obj; /* Get an ID for the object */ - if((ret_value = H5VL_object_register(new_obj, type, vol_wrap_ctx->plugin->id, app_ref)) < 0) + if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->plugin->id, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") done: diff --git a/src/H5VLnative.c b/src/H5VLnative.c index b67caa6..22723a0 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -400,7 +400,7 @@ H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref) * field will get clobbered later, so disallow this. */ if(type == H5I_DATATYPE) - if(((H5T_t *)obj)->vol_obj != NULL) + if(((const H5T_t *)obj)->vol_obj != NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype") HDassert(0 && "H5VL_native_register"); diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 873557a..114ce8c 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -29,7 +29,7 @@ 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_init(hid_t vipl_id); H5_DLL hid_t H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref); #ifdef __cplusplus diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 1defb13..fd44c3b 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -78,6 +78,7 @@ H5_DLL ssize_t H5VL_get_plugin_name(hid_t id, char *name/*out*/, size_t size); /* Functions that manipulate VOL objects */ H5_DLL void *H5VL_object(hid_t id); +H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj); H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type); H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id); H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); @@ -92,9 +93,9 @@ H5_DLL void * H5VL_wrap_object(const H5VL_class_t *plugin, void *wrap_ctx, void *obj); /* ID registration functions */ -H5_DLL hid_t H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_plugin, hbool_t app_ref); +H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref); H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, 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 hid_t H5VL_register_using_vol_id(H5I_type_t type, 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); /****************************** diff --git a/test/h5test.c b/test/h5test.c index c1cc55b..3c02e4e 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1908,14 +1908,14 @@ error: * Purpose: Returns a disposable, generally non-functional, * VOL class struct. * - * In some of the test code, we need a disposable VOL driver + * In some of the test code, we need a disposable VOL plugin * but we don't want to mess with the real VFDs and we also - * don't have access to the internals of the real VOL drivers + * don't have access to the internals of the real VOL plugins * (which use static globals and functions) to easily duplicate - * them (e.g.: for testing VOL driver ID handling). + * them (e.g.: for testing VOL plugin ID handling). * * This API call will return a pointer to a VOL class that - * can be used to construct a test VOL using H5VLregister_driver(). + * can be used to construct a test VOL using H5VLregister_plugin(). * * Return: Success: A pointer to a VOL class struct * Failure: NULL @@ -1931,7 +1931,7 @@ h5_get_dummy_vol_class(void) if(NULL == (vol_class = (H5VL_class_t *)HDcalloc((size_t)1, sizeof(H5VL_class_t)))) TEST_ERROR; - /* Fill in the minimum parameters to make a VOL driver class that + /* Fill in the minimum parameters to make a VOL plugin class that * can be registered. */ vol_class->name = "dummy"; diff --git a/test/vol.c b/test/vol.c index 553a9cf..fc47087 100644 --- a/test/vol.c +++ b/test/vol.c @@ -147,7 +147,7 @@ test_vol_registration(void) FAIL_PUTS_ERROR("native VOL plugin is inappropriately registered"); /* Load a VOL interface */ - if ((vol_id = H5VLregister_plugin(&fake_vol_g)) < 0) + if ((vol_id = H5VLregister_plugin(&fake_vol_g, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; /* The test/fake VOL plugin should be registered now */ @@ -157,27 +157,27 @@ test_vol_registration(void) FAIL_PUTS_ERROR("native VOL plugin is un-registered"); /* Re-register a VOL plugin */ - if ((vol_id2 = H5VLregister(&fake_vol_g, H5P_DEFAULT)) < 0) + if ((vol_id2 = H5VLregister_plugin(&fake_vol_g, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; /* The test/fake VOL plugin should still be registered now */ - if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0) + if ((is_registered = H5VLis_plugin_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("native VOL plugin is un-registered"); /* Unregister the second test/fake VOL ID */ - if (H5VLunregister(vol_id2) < 0) + if (H5VLunregister_plugin(vol_id2) < 0) FAIL_STACK_ERROR; /* The test/fake VOL plugin should still be registered now */ - if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0) + if ((is_registered = H5VLis_plugin_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) FAIL_PUTS_ERROR("native VOL plugin is un-registered"); /* Unregister the original test/fake VOL ID */ - if (H5VLunregister(vol_id) < 0) + if (H5VLunregister_plugin(vol_id) < 0) FAIL_STACK_ERROR; PASSED(); @@ -185,7 +185,7 @@ test_vol_registration(void) error: H5E_BEGIN_TRY { - H5VLunregister(vol_id); + H5VLunregister_plugin(vol_id); } H5E_END_TRY; return FAIL; -- cgit v0.12 From 171deaa588183b5a3a9d27a5f3f407d398ba53db Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 26 Oct 2018 16:09:06 -0500 Subject: Checkpoint progress on stacking VOL plugins - all standalone regression tests in the 'test' directory appear to be working. --- src/H5D.c | 10 ++++ src/H5Fint.c | 61 ++++++++++++-------- src/H5I.c | 15 ++--- src/H5VLint.c | 183 ++++++++++++++++++++++++++++++++++++++++------------------ test/swmr.c | 6 +- 5 files changed, 181 insertions(+), 94 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index be3c1e0..2755993 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1013,6 +1013,7 @@ herr_t H5Drefresh(hid_t dset_id) { H5VL_object_t *vol_obj; /* Dataset for this operation */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1026,12 +1027,21 @@ H5Drefresh(hid_t dset_id) if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Refresh the dataset object */ if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Drefresh() */ diff --git a/src/H5Fint.c b/src/H5Fint.c index b53a83c..18b804b 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -307,11 +307,11 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id if(types & H5F_OBJ_LOCAL) { olist.file_info.local = TRUE; olist.file_info.ptr.file = f; - } + } /* end if */ else { olist.file_info.local = FALSE; olist.file_info.ptr.shared = f ? f->shared : NULL; - } + } /* end else */ /* Iterate through file IDs to count the number, and put their * IDs on the object list. */ @@ -319,7 +319,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id olist.obj_type = H5I_FILE; if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)") - } + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -330,8 +330,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id olist.obj_type = H5I_DATASET; if(H5I_iterate(H5I_DATASET, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)") - } - } + } /* end if */ + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -342,8 +342,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id olist.obj_type = H5I_GROUP; if(H5I_iterate(H5I_GROUP, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)") - } - } + } /* end if */ + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -354,8 +354,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id olist.obj_type = H5I_DATATYPE; if(H5I_iterate(H5I_DATATYPE, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)") - } - } + } /* end if */ + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -366,8 +366,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id olist.obj_type = H5I_ATTR; if(H5I_iterate(H5I_ATTR, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)") - } - } + } /* end if */ + } /* end if */ /* Set the number of objects currently open */ *obj_id_count_ptr = obj_id_count; @@ -409,8 +409,8 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) (!olist->file_info.ptr.shared || (olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared)))) { add_obj = TRUE; - } - } + } /* end if */ + } /* end if */ else { /* Either count opened object IDs or put the IDs on the list */ H5O_loc_t *oloc; /* Group entry info for object */ @@ -460,7 +460,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) (!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) || (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) { add_obj = TRUE; - } + } /* end if */ } /* end else */ if(add_obj) { @@ -468,7 +468,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) if(olist->obj_id_list) { olist->obj_id_list[olist->list_index] = obj_id; olist->list_index++; - } + } /* end if */ /* Increment the number of open objects */ if(olist->obj_id_count) @@ -481,7 +481,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) */ if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs) HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */ - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -3236,6 +3236,7 @@ H5F__start_swmr_write(H5F_t *f) size_t u; /* Local index variable */ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ H5VL_t *vol_plugin = NULL; /* VOL plugin for the file */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -3275,16 +3276,16 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Get the # of opened named datatypes and attributes */ - if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0) + if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE | H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") - if(nt_attr_count) + if(nt_attr_count > 0) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file") /* Get the # of opened datasets and groups */ - if(H5F_get_obj_count(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0) + if(H5F_get_obj_count(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") - if(grp_dset_count) { + if(grp_dset_count > 0) { /* Allocate space for group and object locations */ if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t") @@ -3299,17 +3300,25 @@ H5F__start_swmr_write(H5F_t *f) if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") - /* Save the VOL plugin for the refresh step */ + /* Save the VOL plugin and the object wrapping context for the refresh step */ if(grp_dset_count > 0) { - H5VL_object_t *vol_obj = NULL; + H5VL_object_t *vol_obj; + /* Get the VOL object for one of the IDs */ if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0]))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Get the (top) plugin for the ID */ vol_plugin = vol_obj->plugin; } /* end if */ - /* Refresh opened objects (groups, datasets) in the file */ + /* Gather information about opened objects (groups, datasets) in the file */ + /* (For refresh later on) */ for(u = 0; u < grp_dset_count; u++) { H5O_loc_t *oloc; /* object location */ H5G_loc_t tmp_loc; @@ -3379,6 +3388,10 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to unlock the file") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") + if(ret_value < 0 && setup) { /* Re-enable accumulator */ diff --git a/src/H5I.c b/src/H5I.c index aef5cc5..f8bb8c4 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2034,7 +2034,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) ret_value = H5_ITER_STOP; /* terminate iteration early */ else if(cb_ret_val < 0) ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__iterate_cb() */ @@ -2092,7 +2092,7 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re /* Iterate over IDs */ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -2352,9 +2352,8 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->plugin->cls->value) - path = H5G_nameof(obj_ptr); + path = H5G_nameof((const H5G_t *)obj_ptr); break; } @@ -2363,9 +2362,8 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->plugin->cls->value) - path = H5D_nameof(obj_ptr); + path = H5D_nameof((const H5D_t *)obj_ptr); break; } @@ -2373,9 +2371,8 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { const H5T_t *dt = (const H5T_t *)item->obj_ptr; - obj_ptr = (void *)H5T_get_actual_type(dt); - - path = H5T_nameof(obj_ptr); + obj_ptr = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */ + path = H5T_nameof((const H5T_t *)obj_ptr); break; } diff --git a/src/H5VLint.c b/src/H5VLint.c index 11deed9..f0a5253 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -43,6 +43,7 @@ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ @@ -58,12 +59,17 @@ typedef struct H5VL_wrap_ctx_t { /* Package Typedefs */ /********************/ + /********************/ /* Local Prototypes */ /********************/ static herr_t H5VL__free_cls(H5VL_class_t *cls); +static void *H5VL__wrap_obj(void *obj); +static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object, + H5VL_t *vol_plugin, hbool_t wrap_obj); static void *H5VL__object(hid_t id, H5I_type_t obj_type); + /*********************/ /* Package Variables */ /*********************/ @@ -71,6 +77,7 @@ static void *H5VL__object(hid_t id, H5I_type_t obj_type); /* Package initialization variable */ hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -225,6 +232,105 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__wrap_obj + * + * Purpose: Wraps a library object with possible VOL plugin wrappers, to + * match the VOL plugin stack for the file. + * + * Return: Success: Wrapped object pointer + * Failure: NULL + * + * Programmer: Quincey Koziol + * Friday, October 7, 2018 + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__wrap_obj(void *obj) +{ + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check arguments */ + HDassert(obj); + + /* Retrieve the VOL object wrapping context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL object wrap context") + + /* If there is a VOL object wrapping context, wrap the object */ + if(vol_wrap_ctx) { + /* Wrap object, using the VOL callback */ + if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->plugin->cls, vol_wrap_ctx->obj_wrap_ctx, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") + } /* end if */ + else + ret_value = obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__wrap_obj() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__new_vol_obj + * + * Purpose: Creates a new VOL object, to use when registering an ID. + * + * Return: Success: VOL object pointer + * Failure: NULL + * + * Programmer: Quincey Koziol + * Friday, October 7, 2018 + * + *------------------------------------------------------------------------- + */ +static H5VL_object_t * +H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t wrap_obj) +{ + H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */ + H5VL_object_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check arguments */ + HDassert(object); + HDassert(vol_plugin); + + /* 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_VOL, H5E_BADVALUE, NULL, "invalid type number") + + /* Create the new VOL object */ + if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object") + new_vol_obj->plugin = vol_plugin; + if(wrap_obj) { + if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object") + } /* end if */ + else + new_vol_obj->data = object; + + /* Bump the reference count on the VOL plugin */ + vol_plugin->nrefs++; + + /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */ + if(H5I_DATATYPE == type) { + if(NULL == (ret_value = (H5VL_object_t *)H5T_construct_datatype(new_vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't construct datatype object") + } /* end if */ + else + ret_value = (H5VL_object_t *)new_vol_obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__new_vol_obj() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_register * * Purpose: VOL-aware version of H5I_register. Constructs an H5VL_object_t @@ -239,8 +345,8 @@ done: hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref) { - H5VL_object_t *vol_obj = NULL; - hid_t ret_value = H5I_INVALID_HID; + H5VL_object_t *vol_obj = NULL; /* VOL object wrapper for library object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) @@ -248,30 +354,13 @@ H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref HDassert(object); HDassert(vol_plugin); - /* 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") - vol_obj->plugin = vol_plugin; - vol_obj->data = object; - - /* Increment ref count, for new object */ - vol_plugin->nrefs++; - - /* Datatypes need special handling under the VOL, since they have a non-VOL aspect */ - if (H5I_DATATYPE == type) { - H5T_t *dt; - - /* Wrap "real" (non-named) datatype around VOL object, so it's compatible with H5T interface */ - if (NULL == (dt = H5T_construct_datatype(vol_obj))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object") - - /* New object is _actually_ the datatype */ - vol_obj = (H5VL_object_t *)dt; - } /* end if */ + /* Set up VOL object for the passed-in data */ + /* (Does not wrap object, since it's from a VOL callback) */ + if(NULL == (vol_obj = H5VL__new_vol_obj(type, object, vol_plugin, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") /* Register VOL object as _object_ type, for future object API calls */ - /* (Except for named datatypes, as above) */ - if ((ret_value = H5I_register(type, vol_obj, app_ref)) < 0) + if((ret_value = H5I_register(type, vol_obj, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle") done: @@ -301,7 +390,6 @@ herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, 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) @@ -310,29 +398,13 @@ H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_plugi HDassert(object); HDassert(vol_plugin); - /* 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->plugin = vol_plugin; - new_vol_obj->data = object; - - /* Bump the reference count on the VOL plugin */ - vol_plugin->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; + /* Set up VOL object for the passed-in data */ + /* (Wraps object, since it's a library object) */ + if(NULL == (new_vol_obj = H5VL__new_vol_obj(type, object, vol_plugin, TRUE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") /* Call the underlying H5I function to complete the registration */ - if(H5I_register_using_existing_id(type, stored_obj, app_ref, existing_id) < 0) + if(H5I_register_using_existing_id(type, new_vol_obj, app_ref, existing_id) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID") done: @@ -875,20 +947,17 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) */ if(type == H5I_DATATYPE) if(TRUE == H5T_already_vol_managed((const H5T_t *)obj)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") - /* Retrieve the VOL object wrap context */ + /* Wrap the object with VOL plugin info */ + if(NULL == (new_obj = H5VL__wrap_obj(obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object") + + /* Retrieve the VOL object wrapping context */ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") - - /* If there is a VOL object wrapping context, wrap the object */ - if(vol_wrap_ctx) { - /* Wrap object */ - if(NULL == (new_obj = H5VL_wrap_object(vol_wrap_ctx->plugin->cls, vol_wrap_ctx->obj_wrap_ctx, obj))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't wrap object") - } /* end if */ - else - new_obj = obj; + if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->plugin) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its plugin is NULL???") /* Get an ID for the object */ if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->plugin->id, app_ref)) < 0) diff --git a/test/swmr.c b/test/swmr.c index 3b2af4e..bab91bd 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -6500,10 +6500,9 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) HDexit(EXIT_FAILURE); /* Wait for notification from parent process */ - while(child_notify != 1) { + while(child_notify != 1) if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) HDexit(EXIT_FAILURE); - } /* Open the file 2 times */ if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) @@ -6540,10 +6539,9 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) HDexit(EXIT_FAILURE); /* Wait for notification from parent process */ - while(child_notify != 3) { + while(child_notify != 3) if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) HDexit(EXIT_FAILURE); - } /* Refresh dataset via did1 */ if(H5Drefresh(child_did1) < 0) -- cgit v0.12 From ce3d1ec9ea5a7a0627d948687d64dc7e5e76f6cd Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 26 Oct 2018 17:27:10 -0500 Subject: Eliminate last call to H5VL_native_register, shifting everything over to the VOL plugin wrapping code. --- src/H5Fint.c | 10 +++++++++- src/H5Olink.c | 15 ++++++--------- src/H5VLnative.c | 37 ------------------------------------- src/H5VLnative_private.h | 1 - 4 files changed, 15 insertions(+), 48 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index 18b804b..0e35bea 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2176,7 +2176,15 @@ H5F_get_id(H5F_t *file) if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) { /* resurrect the ID - Register an ID with the native driver */ - if((ret_value = H5VL_native_register(H5I_FILE, file, FALSE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") file->id_exists = TRUE; } /* end if */ diff --git a/src/H5Olink.c b/src/H5Olink.c index 961c619..55e1aee 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -612,6 +612,7 @@ herr_t H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) { H5O_link_t *lnk = (H5O_link_t *)_mesg; + hid_t file_id = -1; /* ID for the file the link is located in (passed to user callback) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -645,25 +646,21 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) /* Check for delete callback */ if(link_class->del_func) { - hid_t file_id; /* ID for the file the link is located in (passed to user callback) */ - /* Get a file ID for the file the link is in */ if((file_id = H5F_get_id(f)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID") /* Call user-defined link's 'delete' callback */ - if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) { - H5I_dec_ref(file_id); + if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure") - } /* end if */ - - /* Release the file ID */ - if(H5I_dec_ref(file_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") } /* end if */ } /* end if */ done: + /* Release the file ID */ + if(file_id > 0 && H5I_dec_ref(file_id) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_link_delete() */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 22723a0..69b010b 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -376,43 +376,6 @@ done: } /* H5VL__native_get_file */ -/*--------------------------------------------------------------------------- - * Function: H5VL_native_register - * - * Purpose: Utility routine to register an ID with the native VOL plugin - * as an auxilary object. - * - * Returns: Success: An ID for the object - * Failure: H5I_INVALID_HID - * - *--------------------------------------------------------------------------- - */ -hid_t -H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref) -{ - hid_t ret_value = H5I_INVALID_HID; - - FUNC_ENTER_NOAPI(H5I_INVALID_HID) - - HDassert(obj); - - /* If the datatype is already VOL-managed, the datatype's vol_obj - * field will get clobbered later, so disallow this. - */ - if(type == H5I_DATATYPE) - if(((const H5T_t *)obj)->vol_obj != NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype") - -HDassert(0 && "H5VL_native_register"); - /* Get an ID for the object */ - 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: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_register() */ - - /*------------------------------------------------------------------------- * Function: H5VL__native_attr_create * diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 114ce8c..84df828 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -30,7 +30,6 @@ extern "C" { H5_DLL hid_t H5VL_native_get_driver_id(void); H5_DLL hid_t H5VL_native_init(hid_t vipl_id); -H5_DLL hid_t H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref); #ifdef __cplusplus } -- cgit v0.12 From 62b92ddf4096d9b8f6235587ec16f34f6c6fa119 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 26 Oct 2018 20:44:29 -0700 Subject: Makes the installed header files the same between the autotools and CMake. * CMake will no longer install private generated headers and tools library headers. * Several empty public header files (which represent internal packages) were removed. These were only installed by CMake. * Autotools installs will install H5FDwindows.h. Fixes HDFFV-10614. --- MANIFEST | 5 -- hl/src/CMakeLists.txt | 9 ++- release_docs/RELEASE.txt | 51 ++++++++++++++++- src/CMakeLists.txt | 139 +++++++++++++++++++++++++++++++---------------- src/H5B2private.h | 3 - src/H5B2public.h | 52 ------------------ src/H5Bprivate.h | 1 - src/H5Bpublic.h | 39 ------------- src/H5FSprivate.h | 3 - src/H5FSpublic.h | 52 ------------------ src/H5Fpkg.h | 2 +- src/H5HFprivate.h | 3 - src/H5HFpublic.h | 52 ------------------ src/H5HGprivate.h | 3 - src/H5HGpublic.h | 31 ----------- src/H5HLprivate.h | 3 - src/H5HLpublic.h | 37 ------------- src/Makefile.am | 2 +- tools/lib/CMakeLists.txt | 12 ---- 19 files changed, 149 insertions(+), 350 deletions(-) delete mode 100644 src/H5B2public.h delete mode 100644 src/H5Bpublic.h delete mode 100644 src/H5FSpublic.h delete mode 100644 src/H5HFpublic.h delete mode 100644 src/H5HGpublic.h delete mode 100644 src/H5HLpublic.h diff --git a/MANIFEST b/MANIFEST index a7df90c..a1b3dd3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -496,7 +496,6 @@ ./src/H5Bmodule.h ./src/H5Bpkg.h ./src/H5Bprivate.h -./src/H5Bpublic.h ./src/H5B2.c ./src/H5B2cache.c ./src/H5B2dbg.c @@ -507,7 +506,6 @@ ./src/H5B2module.h ./src/H5B2pkg.h ./src/H5B2private.h -./src/H5B2public.h ./src/H5B2stat.c ./src/H5B2test.c ./src/H5C.c @@ -692,7 +690,6 @@ ./src/H5HFmodule.h ./src/H5HFpkg.h ./src/H5HFprivate.h -./src/H5HFpublic.h ./src/H5HFsection.c ./src/H5HFspace.c ./src/H5HFstat.c @@ -704,7 +701,6 @@ ./src/H5HGmodule.h ./src/H5HGpkg.h ./src/H5HGprivate.h -./src/H5HGpublic.h ./src/H5HGquery.c ./src/H5HL.c ./src/H5HLcache.c @@ -715,7 +711,6 @@ ./src/H5HLpkg.h ./src/H5HLprfx.c ./src/H5HLprivate.h -./src/H5HLpublic.h ./src/H5HP.c ./src/H5HPprivate.h ./src/H5I.c diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index e339f11..bf0f6ff 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -21,7 +21,6 @@ set (HL_HEADERS ${HDF5_HL_SRC_SOURCE_DIR}/H5DOpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5DSpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5IMpublic.h - ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h ${HDF5_HL_SRC_SOURCE_DIR}/H5LTpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5PTpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5TBpublic.h @@ -29,7 +28,11 @@ set (HL_HEADERS ${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h ) -add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS}) +set (HL_PRIVATE_HEADERS + ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h +) + +add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) target_include_directories(${HDF5_HL_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" @@ -42,7 +45,7 @@ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF set (install_targets ${HDF5_HL_LIB_TARGET}) if (BUILD_SHARED_LIBS) - add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS}) + add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) target_include_directories(${HDF5_HL_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 4ae69f0..5b56252 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -110,6 +110,37 @@ New Features (ADB - 2018/07/16) + + - Incorrectly installed private header files were removed from + CMake installs. + + The CMake build files incorrectly flagged the following header files + as public and installed them. They are private and will no longer be + installed. + + H5Edefin.h + H5Einit.h + H5Eterm.h + H5LTparse.h + h5diff.h + h5tools_dump.h + h5tools.h + h5tools_ref.h + h5tools_str.h + h5tools_utils.h + h5trav.h + + (DER - 2018/10/26, HDFFV-10614) + + - Autotools installs now install H5FDwindows.h + + This is simply to align the installed header files between the + autotools and CMake. H5FDwindows.h has no functionality on + non-Windows systems. + + (DER - 2018/10/26, HDFFV-10614) + + Library: -------- - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used. @@ -120,7 +151,25 @@ New Features (ADB - 2018/09/18, HDFFV-10332) - Parallel Library: + - Several empty public header files where removed from the distribution + + The following files were empty placeholders. They are for internal + packages that are unlikely to ever have public functionality and have + thus been removed. + + H5Bpublic.h + H5B2public.h + H5FSpublic.h + H5HFpublic.h + H5HGpublic.h + H5HLpublic.h + + They were only installed in CMake builds. + + (DER - 2018/10/26, HDFFV-10614) + + + Parallel Library: ----------------- - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f82b8de..311f8b4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,7 +32,6 @@ set (H5A_SOURCES ) set (H5A_HDRS - ${HDF5_SRC_DIR}/H5Apkg.h ${HDF5_SRC_DIR}/H5Apublic.h ) IDE_GENERATED_PROPERTIES ("H5A" "${H5A_HDRS}" "${H5A_SOURCES}" ) @@ -46,7 +45,6 @@ set (H5AC_SOURCES ) set (H5AC_HDRS - ${HDF5_SRC_DIR}/H5ACpkg.h ${HDF5_SRC_DIR}/H5ACpublic.h ) IDE_GENERATED_PROPERTIES ("H5AC" "${H5AC_HDRS}" "${H5AC_SOURCES}" ) @@ -57,8 +55,6 @@ set (H5B_SOURCES ${HDF5_SRC_DIR}/H5Bdbg.c ) set (H5B_HDRS - ${HDF5_SRC_DIR}/H5Bpkg.h - ${HDF5_SRC_DIR}/H5Bpublic.h ) IDE_GENERATED_PROPERTIES ("H5B" "${H5B_HDRS}" "${H5B_SOURCES}" ) @@ -75,8 +71,6 @@ set (H5B2_SOURCES ${HDF5_SRC_DIR}/H5B2test.c ) set (H5B2_HDRS - ${HDF5_SRC_DIR}/H5B2pkg.h - ${HDF5_SRC_DIR}/H5B2public.h ) IDE_GENERATED_PROPERTIES ("H5B2" "${H5B2_HDRS}" "${H5B2_SOURCES}" ) @@ -94,7 +88,6 @@ set (H5C_SOURCES ${HDF5_SRC_DIR}/H5Ctest.c ) set (H5C_HDRS - ${HDF5_SRC_DIR}/H5Cpkg.h ${HDF5_SRC_DIR}/H5Cpublic.h ) IDE_GENERATED_PROPERTIES ("H5C" "${H5C_HDRS}" "${H5C_SOURCES}" ) @@ -143,7 +136,6 @@ set (H5D_SOURCES ) set (H5D_HDRS - ${HDF5_SRC_DIR}/H5Dpkg.h ${HDF5_SRC_DIR}/H5Dpublic.h ) IDE_GENERATED_PROPERTIES ("H5D" "${H5D_HDRS}" "${H5D_SOURCES}" ) @@ -155,12 +147,8 @@ set (H5E_SOURCES ) set (H5E_HDRS - #${HDF5_SRC_DIR}/H5Edefin.h - #${HDF5_SRC_DIR}/H5Einit.h - ${HDF5_SRC_DIR}/H5Epkg.h - #${HDF5_SRC_DIR}/H5Epubgen.h + ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Epublic.h - #${HDF5_SRC_DIR}/H5Eterm.h ) IDE_GENERATED_PROPERTIES ("H5E" "${H5E_HDRS}" "${H5E_SOURCES}" ) @@ -179,7 +167,6 @@ set (H5EA_SOURCES ${HDF5_SRC_DIR}/H5EAtest.c ) set (H5EA_HDRS - ${HDF5_SRC_DIR}/H5EApkg.h ) IDE_GENERATED_PROPERTIES ("H5EA" "${H5EA_HDRS}" "${H5EA_SOURCES}" ) @@ -213,7 +200,6 @@ set (H5F_SOURCES ) set (H5F_HDRS - ${HDF5_SRC_DIR}/H5Fpkg.h ${HDF5_SRC_DIR}/H5Fpublic.h ) IDE_GENERATED_PROPERTIES ("H5F" "${H5F_HDRS}" "${H5F_SOURCES}" ) @@ -231,7 +217,6 @@ set (H5FA_SOURCES ${HDF5_SRC_DIR}/H5FAtest.c ) set (H5FA_HDRS - ${HDF5_SRC_DIR}/H5FApkg.h ) IDE_GENERATED_PROPERTIES ("H5FA" "${H5FA_HDRS}" "${H5FA_SOURCES}" ) @@ -261,7 +246,6 @@ set (H5FD_HDRS ${HDF5_SRC_DIR}/H5FDmpi.h ${HDF5_SRC_DIR}/H5FDmpio.h ${HDF5_SRC_DIR}/H5FDmulti.h - ${HDF5_SRC_DIR}/H5FDpkg.h ${HDF5_SRC_DIR}/H5FDpublic.h ${HDF5_SRC_DIR}/H5FDsec2.h ${HDF5_SRC_DIR}/H5FDstdio.h @@ -297,8 +281,6 @@ set (H5FS_SOURCES ) set (H5FS_HDRS - ${HDF5_SRC_DIR}/H5FSpkg.h - ${HDF5_SRC_DIR}/H5FSpublic.h ) IDE_GENERATED_PROPERTIES ("H5FS" "${H5FS_HDRS}" "${H5FS_SOURCES}" ) @@ -324,7 +306,6 @@ set (H5G_SOURCES ) set (H5G_HDRS - ${HDF5_SRC_DIR}/H5Gpkg.h ${HDF5_SRC_DIR}/H5Gpublic.h ) IDE_GENERATED_PROPERTIES ("H5G" "${H5G_HDRS}" "${H5G_SOURCES}" ) @@ -349,8 +330,6 @@ set (H5HF_SOURCES ) set (H5HF_HDRS - ${HDF5_SRC_DIR}/H5HFpkg.h - ${HDF5_SRC_DIR}/H5HFpublic.h ) IDE_GENERATED_PROPERTIES ("H5HF" "${H5HF_HDRS}" "${H5HF_SOURCES}" ) @@ -362,8 +341,6 @@ set (H5HG_SOURCES ) set (H5HG_HDRS - ${HDF5_SRC_DIR}/H5HGpkg.h - ${HDF5_SRC_DIR}/H5HGpublic.h ) IDE_GENERATED_PROPERTIES ("H5HG" "${H5HG_HDRS}" "${H5HG_SOURCES}" ) @@ -377,8 +354,6 @@ set (H5HL_SOURCES ) set (H5HL_HDRS - ${HDF5_SRC_DIR}/H5HLpkg.h - ${HDF5_SRC_DIR}/H5HLpublic.h ) IDE_GENERATED_PROPERTIES ("H5HL" "${H5HL_HDRS}" "${H5HL_SOURCES}" ) @@ -396,7 +371,6 @@ set (H5I_SOURCES ${HDF5_SRC_DIR}/H5Itest.c ) set (H5I_HDRS - ${HDF5_SRC_DIR}/H5Ipkg.h ${HDF5_SRC_DIR}/H5Ipublic.h ) IDE_GENERATED_PROPERTIES ("H5I" "${H5I_HDRS}" "${H5I_SOURCES}" ) @@ -407,7 +381,6 @@ set (H5L_SOURCES ${HDF5_SRC_DIR}/H5Lexternal.c ) set (H5L_HDRS - ${HDF5_SRC_DIR}/H5Lpkg.h ${HDF5_SRC_DIR}/H5Lpublic.h ) IDE_GENERATED_PROPERTIES ("H5L" "${H5L_HDRS}" "${H5L_SOURCES}" ) @@ -440,7 +413,6 @@ set (H5MP_SOURCES ) set (H5MP_HDRS - ${HDF5_SRC_DIR}/H5MPpkg.h ) IDE_GENERATED_PROPERTIES ("H5MP" "${H5MP_HDRS}" "${H5MP_SOURCES}" ) @@ -485,9 +457,7 @@ set (H5O_SOURCES ) set (H5O_HDRS - ${HDF5_SRC_DIR}/H5Opkg.h ${HDF5_SRC_DIR}/H5Opublic.h - ${HDF5_SRC_DIR}/H5Oshared.h ) IDE_GENERATED_PROPERTIES ("H5O" "${H5O_HDRS}" "${H5O_SOURCES}" ) @@ -513,7 +483,6 @@ set (H5P_SOURCES ) set (H5P_HDRS - ${HDF5_SRC_DIR}/H5Ppkg.h ${HDF5_SRC_DIR}/H5Ppublic.h ) IDE_GENERATED_PROPERTIES ("H5P" "${H5P_HDRS}" "${H5P_SOURCES}" ) @@ -523,7 +492,6 @@ set (H5PB_SOURCES ) set (H5PB_HDRS - ${HDF5_SRC_DIR}/H5PBpkg.h ) IDE_GENERATED_PROPERTIES ("H5PB" "${H5PB_HDRS}" "${H5PB_SOURCES}" ) @@ -536,7 +504,6 @@ set (H5PL_SOURCES set (H5PL_HDRS ${HDF5_SRC_DIR}/H5PLextern.h - ${HDF5_SRC_DIR}/H5PLpkg.h ${HDF5_SRC_DIR}/H5PLpublic.h ) IDE_GENERATED_PROPERTIES ("H5PL" "${H5PL_HDRS}" "${H5PL_SOURCES}" ) @@ -548,7 +515,6 @@ set (H5R_SOURCES ${HDF5_SRC_DIR}/H5Rint.c ) set (H5R_HDRS - ${HDF5_SRC_DIR}/H5Rpkg.h ${HDF5_SRC_DIR}/H5Rpublic.h ) IDE_GENERATED_PROPERTIES ("H5R" "${H5R_HDRS}" "${H5R_SOURCES}" ) @@ -575,7 +541,6 @@ set (H5S_SOURCES ) set (H5S_HDRS - ${HDF5_SRC_DIR}/H5Spkg.h ${HDF5_SRC_DIR}/H5Spublic.h ) IDE_GENERATED_PROPERTIES ("H5S" "${H5S_HDRS}" "${H5S_SOURCES}" ) @@ -598,7 +563,6 @@ set (H5SM_SOURCES ) set (H5SM_HDRS - ${HDF5_SRC_DIR}/H5SMpkg.h ) IDE_GENERATED_PROPERTIES ("H5SM" "${H5SM_HDRS}" "${H5SM_SOURCES}" ) @@ -638,7 +602,6 @@ set (H5T_SOURCES ) set (H5T_HDRS - ${HDF5_SRC_DIR}/H5Tpkg.h ${HDF5_SRC_DIR}/H5Tpublic.h ) IDE_GENERATED_PROPERTIES ("H5T" "${H5T_HDRS}" "${H5T_SOURCES}" ) @@ -666,7 +629,6 @@ set (H5VL_SOURCES ${HDF5_SRC_DIR}/H5VLnative.c ) set (H5VL_HDRS - ${HDF5_SRC_DIR}/H5VLpkg.h ${HDF5_SRC_DIR}/H5VLnative.h ${HDF5_SRC_DIR}/H5VLpublic.h ) @@ -705,7 +667,6 @@ endif () set (H5Z_HDRS - ${HDF5_SRC_DIR}/H5Zpkg.h ${HDF5_SRC_DIR}/H5Zpublic.h ) IDE_GENERATED_PROPERTIES ("H5Z" "${H5Z_HDRS}" "${H5Z_SOURCES}" ) @@ -795,51 +756,127 @@ set (H5_PUBLIC_HEADERS set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5private.h + + ${HDF5_SRC_DIR}/H5Apkg.h ${HDF5_SRC_DIR}/H5Aprivate.h + + ${HDF5_SRC_DIR}/H5ACpkg.h ${HDF5_SRC_DIR}/H5ACprivate.h - ${HDF5_SRC_DIR}/H5B2private.h + + ${HDF5_SRC_DIR}/H5Bpkg.h ${HDF5_SRC_DIR}/H5Bprivate.h + + ${HDF5_SRC_DIR}/H5B2pkg.h + ${HDF5_SRC_DIR}/H5B2private.h + + ${HDF5_SRC_DIR}/H5Cpkg.h ${HDF5_SRC_DIR}/H5Cprivate.h + ${HDF5_SRC_DIR}/H5CSprivate.h + ${HDF5_SRC_DIR}/H5CXprivate.h + + ${HDF5_SRC_DIR}/H5Dpkg.h ${HDF5_SRC_DIR}/H5Dprivate.h + + ${HDF5_SRC_DIR}/H5Edefin.h + ${HDF5_SRC_DIR}/H5Einit.h + ${HDF5_SRC_DIR}/H5Epkg.h ${HDF5_SRC_DIR}/H5Eprivate.h + ${HDF5_SRC_DIR}/H5Eterm.h + + ${HDF5_SRC_DIR}/H5EApkg.h ${HDF5_SRC_DIR}/H5EAprivate.h + + ${HDF5_SRC_DIR}/H5Fpkg.h + ${HDF5_SRC_DIR}/H5Fprivate.h + + ${HDF5_SRC_DIR}/H5FApkg.h ${HDF5_SRC_DIR}/H5FAprivate.h + + ${HDF5_SRC_DIR}/H5FDpkg.h ${HDF5_SRC_DIR}/H5FDprivate.h - ${HDF5_SRC_DIR}/H5Fprivate.h + ${HDF5_SRC_DIR}/H5FLprivate.h + ${HDF5_SRC_DIR}/H5FOprivate.h - ${HDF5_SRC_DIR}/H5MFprivate.h - ${HDF5_SRC_DIR}/H5MMprivate.h - ${HDF5_SRC_DIR}/H5Cprivate.h + + ${HDF5_SRC_DIR}/H5FSpkg.h ${HDF5_SRC_DIR}/H5FSprivate.h + + ${HDF5_SRC_DIR}/H5Gpkg.h ${HDF5_SRC_DIR}/H5Gprivate.h + + ${HDF5_SRC_DIR}/H5HFpkg.h ${HDF5_SRC_DIR}/H5HFprivate.h + + ${HDF5_SRC_DIR}/H5HGpkg.h ${HDF5_SRC_DIR}/H5HGprivate.h + + ${HDF5_SRC_DIR}/H5HLpkg.h ${HDF5_SRC_DIR}/H5HLprivate.h + ${HDF5_SRC_DIR}/H5HPprivate.h + + ${HDF5_SRC_DIR}/H5Ipkg.h ${HDF5_SRC_DIR}/H5Iprivate.h + + ${HDF5_SRC_DIR}/H5Lpkg.h ${HDF5_SRC_DIR}/H5Lprivate.h + + ${HDF5_SRC_DIR}/H5MFprivate.h + + ${HDF5_SRC_DIR}/H5MMprivate.h + + ${HDF5_SRC_DIR}/H5MPpkg.h ${HDF5_SRC_DIR}/H5MPprivate.h + + ${HDF5_SRC_DIR}/H5Opkg.h ${HDF5_SRC_DIR}/H5Oprivate.h + ${HDF5_SRC_DIR}/H5Oshared.h + + ${HDF5_SRC_DIR}/H5Ppkg.h ${HDF5_SRC_DIR}/H5Pprivate.h + ${HDF5_SRC_DIR}/H5PBprivate.h + ${HDF5_SRC_DIR}/H5PBpkg.h + + ${HDF5_SRC_DIR}/H5PLpkg.h ${HDF5_SRC_DIR}/H5PLprivate.h - ${HDF5_SRC_DIR}/H5UCprivate.h + + ${HDF5_SRC_DIR}/H5Rpkg.h ${HDF5_SRC_DIR}/H5Rprivate.h + ${HDF5_SRC_DIR}/H5RSprivate.h + + ${HDF5_SRC_DIR}/H5Spkg.h + ${HDF5_SRC_DIR}/H5Sprivate.h + ${HDF5_SRC_DIR}/H5SLprivate.h + + ${HDF5_SRC_DIR}/H5SMpkg.h ${HDF5_SRC_DIR}/H5SMprivate.h - ${HDF5_SRC_DIR}/H5Sprivate.h + ${HDF5_SRC_DIR}/H5STprivate.h + + ${HDF5_SRC_DIR}/H5Tpkg.h ${HDF5_SRC_DIR}/H5Tprivate.h + ${HDF5_SRC_DIR}/H5TSprivate.h + + ${HDF5_SRC_DIR}/H5UCprivate.h + + ${HDF5_SRC_DIR}/H5VLpkg.h ${HDF5_SRC_DIR}/H5VLnative_private.h ${HDF5_SRC_DIR}/H5VLprivate.h + ${HDF5_SRC_DIR}/H5VMprivate.h + ${HDF5_SRC_DIR}/H5WBprivate.h + + ${HDF5_SRC_DIR}/H5Zpkg.h ${HDF5_SRC_DIR}/H5Zprivate.h + ${HDF5_SRC_DIR}/H5win32defs.h ) @@ -852,6 +889,12 @@ set (H5_GENERATED_HEADERS ${HDF5_SRC_DIR}/H5overflow.h ) +set (H5_PUBLIC_GENERATED_HEADERS + ${HDF5_SRC_DIR}/H5Epubgen.h + ${HDF5_SRC_DIR}/H5version.h + ${HDF5_SRC_DIR}/H5overflow.h +) + option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON) if (HDF5_GENERATE_HEADERS) set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE) @@ -1054,7 +1097,7 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT) install ( FILES ${H5_PUBLIC_HEADERS} - ${H5_GENERATED_HEADERS} + ${H5_PUBLIC_GENERATED_HEADERS} ${HDF5_BINARY_DIR}/H5pubconf.h DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} diff --git a/src/H5B2private.h b/src/H5B2private.h index 83a5272..0b64381 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -25,9 +25,6 @@ #ifndef _H5B2private_H #define _H5B2private_H -/* Include package's public header */ -#include "H5B2public.h" - /* Private headers needed by this file */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Fprivate.h" /* File access */ diff --git a/src/H5B2public.h b/src/H5B2public.h deleted file mode 100644 index 6e0b964..0000000 --- a/src/H5B2public.h +++ /dev/null @@ -1,52 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/*------------------------------------------------------------------------- - * - * Created: H5B2public.h - * Jan 31 2005 - * Quincey Koziol - * - * Purpose: Public declarations for the v2 B-tree package. - * - *------------------------------------------------------------------------- - */ - -#ifndef _H5B2public_H -#define _H5B2public_H - -/* Public headers needed by this file */ -#include "H5public.h" - -/*****************/ -/* Public Macros */ -/*****************/ - -/*******************/ -/* Public Typedefs */ -/*******************/ - -/**********************************/ -/* Public API Function Prototypes */ -/**********************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _H5B2public_H */ - diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index e203b87..5aa3628 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -27,7 +27,6 @@ #ifndef _H5Bprivate_H #define _H5Bprivate_H -#include "H5Bpublic.h" /*API prototypes */ /* Private headers needed by this file */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5Bpublic.h b/src/H5Bpublic.h deleted file mode 100644 index 1764f61..0000000 --- a/src/H5Bpublic.h +++ /dev/null @@ -1,39 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/*------------------------------------------------------------------------- - * - * Created: H5Bproto.h - * Jul 10 1997 - * Robb Matzke - * - * Purpose: Public declarations for the H5B package. - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -#ifndef _H5Bpublic_H -#define _H5Bpublic_H - -/* Public headers needed by this file */ -#include "H5public.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index de1b4c1..31fc63c 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -25,9 +25,6 @@ #ifndef _H5FSprivate_H #define _H5FSprivate_H -/* Include package's public header */ -#include "H5FSpublic.h" - /* Private headers needed by this file */ #include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free Lists */ diff --git a/src/H5FSpublic.h b/src/H5FSpublic.h deleted file mode 100644 index 3090d0d..0000000 --- a/src/H5FSpublic.h +++ /dev/null @@ -1,52 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/*------------------------------------------------------------------------- - * - * Created: H5FSpublic.h - * May 2 2006 - * Quincey Koziol - * - * Purpose: Public declarations for the file free space package. - * - *------------------------------------------------------------------------- - */ - -#ifndef _H5FSpublic_H -#define _H5FSpublic_H - -/* Public headers needed by this file */ -#include "H5public.h" - -/*****************/ -/* Public Macros */ -/*****************/ - -/*******************/ -/* Public Typedefs */ -/*******************/ - -/**********************************/ -/* Public API Function Prototypes */ -/**********************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _H5FSpublic_H */ - diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index e97144f..2098a77 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -30,12 +30,12 @@ #include "H5Fprivate.h" /* Other public headers needed by this file */ -#include "H5Bpublic.h" /* B-tree header (for H5B_NUM_BTREE_ID) */ #include "H5VLpublic.h" /* Virtual Object Layer */ /* Other private headers needed by this file */ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5Bprivate.h" /* B-trees */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FOprivate.h" /* File objects */ #include "H5FSprivate.h" /* File free space */ diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 587a8fc..4eec1c1 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -25,9 +25,6 @@ #ifndef _H5HFprivate_H #define _H5HFprivate_H -/* Include package's public header */ -#include "H5HFpublic.h" - /* Private headers needed by this file */ #include "H5Fprivate.h" /* File access */ #include "H5Oprivate.h" /* Object headers */ diff --git a/src/H5HFpublic.h b/src/H5HFpublic.h deleted file mode 100644 index 82cfc21..0000000 --- a/src/H5HFpublic.h +++ /dev/null @@ -1,52 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/*------------------------------------------------------------------------- - * - * Created: H5HFpublic.h - * Feb 24 2006 - * Quincey Koziol - * - * Purpose: Public declarations for the fractal heap package. - * - *------------------------------------------------------------------------- - */ - -#ifndef _H5HFpublic_H -#define _H5HFpublic_H - -/* Public headers needed by this file */ -#include "H5public.h" - -/*****************/ -/* Public Macros */ -/*****************/ - -/*******************/ -/* Public Typedefs */ -/*******************/ - -/**********************************/ -/* Public API Function Prototypes */ -/**********************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _H5HFpublic_H */ - diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index a7d7a80..1c609e2 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -18,9 +18,6 @@ #ifndef _H5HGprivate_H #define _H5HGprivate_H -/* Include package's public header */ -#include "H5HGpublic.h" - /* Private headers needed by this file. */ #include "H5Fprivate.h" /* File access */ diff --git a/src/H5HGpublic.h b/src/H5HGpublic.h deleted file mode 100644 index fcec593..0000000 --- a/src/H5HGpublic.h +++ /dev/null @@ -1,31 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Robb Matzke - * Friday, March 27, 1998 - */ -#ifndef _H5HGpublic_H -#define _H5HGpublic_H - -/* Public headers needed by this file */ -#include "H5public.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 4001ef1..7a53b25 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -24,9 +24,6 @@ #ifndef _H5HLprivate_H #define _H5HLprivate_H -/* Include package's public header */ -#include "H5HLpublic.h" - /* Private headers needed by this file. */ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ diff --git a/src/H5HLpublic.h b/src/H5HLpublic.h deleted file mode 100644 index 143bb78..0000000 --- a/src/H5HLpublic.h +++ /dev/null @@ -1,37 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/*------------------------------------------------------------------------- - * - * Created: H5HLpublic.h - * Jul 16 1997 - * Robb Matzke - * - * Purpose: Public declarations for the H5HL (local heap) package. - * - *------------------------------------------------------------------------- - */ -#ifndef _H5HLpublic_H -#define _H5HLpublic_H - -/* Public headers needed by this file */ -#include "H5public.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/Makefile.am b/src/Makefile.am index 7889e10..ffdf844 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -136,7 +136,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \ H5FDpublic.h H5FDcore.h H5FDdirect.h \ H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \ - H5FDmulti.h H5FDsec2.h H5FDstdio.h \ + H5FDmulti.h H5FDsec2.h H5FDstdio.h H5FDwindows.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index a03b60a..1596ea7 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -76,18 +76,6 @@ endif () ############################################################################## #----------------------------------------------------------------------------- -# Add file(s) to CMake Install -#----------------------------------------------------------------------------- -install ( - FILES - ${H5_TOOLS_LIB_HDRS} - DESTINATION - ${HDF5_INSTALL_INCLUDE_DIR} - COMPONENT - toolsheaders -) - -#----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) -- cgit v0.12 From 6e84fd8327138e48bd515665c1919bc8cf22dc9f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 27 Oct 2018 01:33:07 -0500 Subject: Remove virtual dataset refresh code's direct use of native VOL plugin's ID. --- src/H5Dvirtual.c | 21 ++++++++++++--------- src/H5VLnative.c | 8 -------- src/H5VLnative_private.h | 1 - test/vds_swmr_gen.c | 2 +- test/vds_swmr_reader.c | 9 ++++++++- test/vds_swmr_writer.c | 2 +- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 7d127c2..3dc44c5 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2963,7 +2963,6 @@ static herr_t H5D__virtual_refresh_source_dset(H5D_t **dset) { hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */ - hid_t native_vol_id = H5I_INVALID_HID; /* ID for the native VOL driver */ H5VL_object_t *vol_obj = NULL; /* VOL object stored with the ID */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2972,13 +2971,16 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) /* Sanity check */ HDassert(dset && *dset); - /* Get the native VOL driver's ID */ -/* XXX (VOL MERGE): Need a better solution than this */ - if((native_vol_id = H5VL_native_get_driver_id()) < 0) - 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_register_using_vol_id(H5I_DATASET, *dset, native_vol_id, FALSE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID") /* Refresh source dataset */ @@ -2988,7 +2990,8 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) /* Discard the identifier & replace the dataset */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID") - *dset = (H5D_t *)(vol_obj->data); + if(NULL == (*dset = (H5D_t *)H5VL_object_data(vol_obj))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object") vol_obj->data = NULL; done: @@ -2996,7 +2999,7 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__virtual_refresh_source_dsets() */ +} /* end H5D__virtual_refresh_source_dset() */ /*------------------------------------------------------------------------- diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 69b010b..4d4311f 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -231,14 +231,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_native_init() */ -/* XXX (VOL_MERGE): TEMPORARY */ -hid_t -H5VL_native_get_driver_id(void) -{ -HDassert(0 && "H5VL_native_get_driver_id"); - return H5VL_NATIVE_ID_g; -} - /*--------------------------------------------------------------------------- * Function: H5VL__native_term diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 84df828..397d496 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -28,7 +28,6 @@ extern "C" { #endif -H5_DLL hid_t H5VL_native_get_driver_id(void); H5_DLL hid_t H5VL_native_init(hid_t vipl_id); #ifdef __cplusplus diff --git a/test/vds_swmr_gen.c b/test/vds_swmr_gen.c index 24c6131..1cb9744 100644 --- a/test/vds_swmr_gen.c +++ b/test/vds_swmr_gen.c @@ -61,7 +61,7 @@ main(void) map_start = 0; /* All SWMR files need to use the latest file format */ - if((faplid = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((faplid = h5_fileaccess()) < 0) TEST_ERROR if(H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c index 16f3abe..d0ec77b 100644 --- a/test/vds_swmr_reader.c +++ b/test/vds_swmr_reader.c @@ -18,6 +18,7 @@ int main(void) { hid_t fid = -1; /* HDF5 file ID */ + hid_t faplid = -1; /* file access property list ID */ hid_t did = -1; /* dataset ID */ hid_t msid = -1; /* memory dataspace ID */ hid_t fsid = -1; /* file dataspace ID */ @@ -34,7 +35,9 @@ main(void) /* Open the VDS file and dataset */ - if((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, H5P_DEFAULT)) < 0) + if((faplid = h5_fileaccess()) < 0) + TEST_ERROR + if((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, faplid)) < 0) TEST_ERROR if((did = H5Dopen2(fid, VDS_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR @@ -103,6 +106,8 @@ main(void) } while (dims[0] < N_PLANES_TO_WRITE); /* Close file and dataset */ + if(H5Pclose(faplid) < 0) + TEST_ERROR if(H5Sclose(msid) < 0) TEST_ERROR if(H5Dclose(did) < 0) @@ -120,6 +125,8 @@ error: H5E_BEGIN_TRY { if(fid >= 0) (void)H5Fclose(fid); + if(faplid >= 0) + (void)H5Pclose(faplid); if(did >= 0) (void)H5Dclose(did); if(msid >= 0) diff --git a/test/vds_swmr_writer.c b/test/vds_swmr_writer.c index 7824aa0..d62ecaf 100644 --- a/test/vds_swmr_writer.c +++ b/test/vds_swmr_writer.c @@ -56,7 +56,7 @@ main(int argc, char *argv[]) /* Open the source file and dataset */ /* All SWMR files need to use the latest file format */ - if((faplid = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((faplid = h5_fileaccess()) < 0) TEST_ERROR if(H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR -- cgit v0.12 From 83e03772ebd3bc8dee8692fe9c11f2180d7b2c49 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 27 Oct 2018 01:55:31 -0500 Subject: Add VOL object wrapping to API context when refreshing groups, named datatypes and objects. --- src/H5D.c | 4 ++-- src/H5G.c | 10 ++++++++++ src/H5Oflush.c | 10 ++++++++++ src/H5Tcommit.c | 13 ++++++++++++- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index 2755993..f6afd93 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1029,7 +1029,7 @@ H5Drefresh(hid_t dset_id) /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Refresh the dataset object */ @@ -1040,7 +1040,7 @@ H5Drefresh(hid_t dset_id) done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") FUNC_LEAVE_API(ret_value) } /* end H5Drefresh() */ diff --git a/src/H5G.c b/src/H5G.c index 6caf6ed..3845c7e 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -825,6 +825,7 @@ herr_t H5Grefresh(hid_t group_id) { H5VL_object_t *vol_obj; /* Group for this operation */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -838,12 +839,21 @@ H5Grefresh(hid_t group_id) if(H5CX_set_loc(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Refresh group's metadata */ if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* H5Grefresh */ diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 5a27aff..887cc4c 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -239,6 +239,7 @@ H5Orefresh(hid_t oid) { H5VL_object_t *vol_obj = NULL; /* Object token */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -256,12 +257,21 @@ H5Orefresh(hid_t oid) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(oid); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Refresh the object */ if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Orefresh() */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 3e59c82..3eb9cd7 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -752,6 +752,7 @@ herr_t H5Trefresh(hid_t type_id) { H5T_t *dt; /* Datatype for this operation */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -768,12 +769,22 @@ H5Trefresh(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Refresh the datatype's metadata */ - if(dt->vol_obj) + if(dt->vol_obj) { + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(dt->vol_obj->data, dt->vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->plugin->cls, H5VL_DATATYPE_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") + } /* end if */ done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* H5Trefresh */ -- cgit v0.12 From 43ffc1deb5f0a5e1defe38870eccb068e61d87c4 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 27 Oct 2018 02:06:43 -0500 Subject: Remove some VOL-specific internal coding. --- src/H5F.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 134eca6..6fb323e 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -615,7 +615,6 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) H5P_genplist_t *plist; /* Property list pointer */ H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */ - H5VL_t *plugin = NULL; /* VOL plugin struct */ H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ hid_t ret_value; /* return value */ @@ -668,16 +667,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") - /* Setup VOL plugin struct */ - if(NULL == (plugin = H5FL_CALLOC(H5VL_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct") - plugin->cls = cls; - plugin->id = plugin_prop.plugin_id; - if(H5I_inc_ref(plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") - /* Get an atom for the file */ - if((ret_value = H5VL_register(H5I_FILE, new_file, plugin, TRUE)) < 0) + if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, plugin_prop.plugin_id, TRUE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -711,7 +702,6 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) H5P_genplist_t *plist; /* Property list pointer */ H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ H5VL_class_t *cls = NULL; /* VOL class structure for callback info */ - H5VL_t *plugin = NULL; /* VOL plugin struct */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -748,16 +738,8 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(NULL == (new_file = H5VL_file_open(cls, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Setup VOL plugin struct */ - if(NULL == (plugin = H5FL_CALLOC(H5VL_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct") - plugin->cls = cls; - plugin->id = plugin_prop.plugin_id; - if(H5I_inc_ref(plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") - /* Get an ID for the file */ - if((ret_value = H5VL_register(H5I_FILE, new_file, plugin, TRUE)) < 0) + if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, plugin_prop.plugin_id, TRUE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: -- cgit v0.12 From 9c7b96b42fa8f2a0f02c7ba72173c09424d740c3 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 27 Oct 2018 02:21:48 -0500 Subject: Move (final?) file operation from directly calling into library code to using the file_optional VOL callback. --- src/H5Cquery.c | 8 ++++---- src/H5F.c | 12 +++++------- src/H5VLnative.c | 8 +++++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/H5Cquery.c b/src/H5Cquery.c index 6c927b0..e4f3133 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -472,11 +472,11 @@ H5C_get_mdc_image_info(H5C_t * cache_ptr, haddr_t *image_addr, hsize_t *image_le if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry") - if(image_addr == NULL || image_len == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad image_addr or image_len on entry") - *image_addr = cache_ptr->image_addr; - *image_len = cache_ptr->image_len; + if(image_addr) + *image_addr = cache_ptr->image_addr; + if(image_len) + *image_len = cache_ptr->image_len; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5F.c b/src/H5F.c index 6fb323e..3cfd3eb 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1765,21 +1765,19 @@ done: herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*a*h", file_id, image_addr, image_len); /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(NULL == image_addr || NULL == image_len) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL image addr or image len") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Go get the address and size of the cache image */ - if(H5AC_get_mdc_image_info(file->shared->cache, image_addr, image_len) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 4d4311f..c6954bc 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -2088,7 +2088,13 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR case H5VL_FILE_GET_MDC_IMAGE_INFO: { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + haddr_t *image_addr = va_arg(arguments, haddr_t *); + hsize_t *image_len = va_arg(arguments, hsize_t *); + + /* Go get the address and size of the cache image */ + if(H5AC_get_mdc_image_info(f->shared->cache, image_addr, image_len) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + break; } -- cgit v0.12 From fb6ecf33b0e39b5568b648f9c6a59e7d95f5547c Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 27 Oct 2018 02:43:40 -0500 Subject: Fix names of VOL API routines. --- examples/h5_vol_external_log_native.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index 1a6685c..9c761a5 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -174,7 +174,7 @@ int main(int argc, char **argv) { H5Pset_fapl_native(under_fapl); assert(H5VLis_plugin_registered("native") == 1); - vol_id = H5VLregister_plugin(&H5VL_log_g); + vol_id = H5VLregister_plugin(&H5VL_log_g, H5P_DEFAULT); assert(vol_id > 0); assert(H5VLis_plugin_registered("log") == 1); @@ -242,7 +242,7 @@ int main(int argc, char **argv) { H5Pclose(under_fapl); H5VLclose(native_plugin_id); - H5VLunregister_driver(vol_id); + H5VLunregister_plugin(vol_id); assert(H5VLis_plugin_registered("log") == 0); return 0; } -- cgit v0.12 From 9bc6644ed194addfd528870de3f41fbd2d49e711 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 27 Oct 2018 16:15:39 -0500 Subject: Duplicate name of VOL plugin class, to avoid continuing to refer to the caller's string when making a copy of the class for internal use. --- src/H5VLint.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/H5VLint.c b/src/H5VLint.c index f0a5253..b00355d 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -178,11 +178,11 @@ H5VL_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR - if (H5_PKG_INIT_VAR) { + if(H5_PKG_INIT_VAR) { if (H5I_nmembers(H5I_VOL) > 0) { (void)H5I_clear_type(H5I_VOL, FALSE, FALSE); n++; - } + } /* end if */ else { /* Destroy the VOL plugin ID group */ n += (H5I_dec_type_ref(H5I_VOL) > 0); @@ -190,8 +190,8 @@ H5VL_term_package(void) /* Mark interface as closed */ if (0 == n) H5_PKG_INIT_VAR = FALSE; - } - } + } /* end else */ + } /* end if */ FUNC_LEAVE_NOAPI(n) } /* end H5VL_term_package() */ @@ -223,7 +223,8 @@ H5VL__free_cls(H5VL_class_t *cls) if(cls->terminate && cls->terminate() < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not terminate cleanly") - /* XXX (VOL MERGE): We'll leak memory if the name string was dynamically allocated. */ + /* Release the class */ + H5MM_xfree(cls->name); H5FL_FREE(H5VL_class_t, cls); done: @@ -516,8 +517,10 @@ H5VL_register_plugin(const void *_cls, hbool_t app_ref, hid_t vipl_id) /* Copy the class structure so the caller can reuse or free it */ if (NULL == (saved = H5FL_CALLOC(H5VL_class_t))) - HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for VOL plugin class struct") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL plugin class struct") HDmemcpy(saved, cls, sizeof(H5VL_class_t)); + if(NULL == (saved->name = H5MM_strdup(cls->name))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL plugin name") /* Initialize the VOL plugin */ if(cls->initialize && cls->initialize(vipl_id) < 0) -- cgit v0.12 From 50dd616eb5fda775d3b283be14229698eb937df2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 27 Oct 2018 17:38:32 -0500 Subject: Correct error with parsing of "FUNC_ENTER_API_NOINIT" --- bin/trace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/trace b/bin/trace index 1ed1678..fa7090b 100755 --- a/bin/trace +++ b/bin/trace @@ -315,7 +315,7 @@ sub rewrite_func ($$$$$) { # Ignored due to NO TRACE comment. } elsif ($body =~ s/((\n[ \t]*)H5TRACE\d+\s*\(.*?\);)\n/"$2$trace"/es) { # Replaced an H5TRACE macro. - } elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*\s*(\(.*?\))?;??)\n/"$1$2$trace"/es) { + } elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*[ \t]*(\(.*?\))?;??)\n/"$1$2$trace"/es) { # Added an H5TRACE macro after a FUNC_ENTER macro. } else { errmesg $file, $name, "unable to insert tracing information"; -- cgit v0.12 From 8ee361f185a8e95e1b7665703946796438ba5237 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 28 Oct 2018 01:31:28 -0500 Subject: Move all callback-related routines into the callback source file, standardizing their coding style --- src/H5F.c | 104 +- src/H5VL.c | 2182 +------------------------------ src/H5VLcallback.c | 3613 +++++++++++++++++++++++++++++++++++++++++---------- src/H5VLpublic.h | 4 +- test/ttsafe_error.c | 4 +- 5 files changed, 2987 insertions(+), 2920 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 3cfd3eb..75d6c04 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -465,7 +465,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") - } + } /* end if */ /* If we passed in the 'special' ID, get the count for everything open in the * library, iterating over all open files and getting the object count for each. * @@ -484,24 +484,24 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) if(types & H5F_OBJ_FILE) { if(H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed"); - } + } /* end if */ if(types & H5F_OBJ_DATASET) { if(H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed"); - } + } /* end if */ if(types & H5F_OBJ_GROUP) { if(H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed"); - } + } /* end if */ if(types & H5F_OBJ_DATATYPE) { if(H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed"); - } + } /* end if */ if(types & H5F_OBJ_ATTR) { if(H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed"); - } - } + } /* end if */ + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -536,8 +536,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: @@ -574,8 +573,7 @@ H5Fis_accessible(const char *name, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Check if file is accessible */ - if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) + if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") done: @@ -663,8 +661,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* Create a new file or truncate an existing file through the VOL */ - if(NULL == (new_file = H5VL_file_create(cls, filename, flags, fcpl_id, fapl_id, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (new_file = H5VL_file_create(cls, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ @@ -771,17 +768,15 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) /* Get the type of object we're flushing + sanity check */ obj_type = H5I_get_type(object_id); if(H5I_FILE != obj_type && H5I_GROUP != obj_type && H5I_DATATYPE != obj_type && - H5I_DATASET != obj_type && H5I_ATTR != obj_type) { + H5I_DATASET != obj_type && H5I_ATTR != obj_type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - } /* get the file object */ if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Flush the object */ - if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_FLUSH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) + if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") done: @@ -856,8 +851,7 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Reopen the file */ - if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_REOPEN, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) + if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL plugin") /* Make sure that worked */ @@ -901,10 +895,9 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the flags */ - if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_INTENT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) + if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags") - } + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -936,8 +929,7 @@ H5Fget_freespace(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the amount of free space in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") done: @@ -972,8 +964,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the file size */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") done: @@ -1023,8 +1014,8 @@ done: ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) { - H5VL_object_t *vol_obj; /* File object for file ID */ - ssize_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* File object for file ID */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len); @@ -1034,8 +1025,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") /* Get the file image */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: @@ -1075,8 +1065,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: @@ -1146,8 +1135,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the current hit rate */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: @@ -1184,9 +1172,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the size data */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, - max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") done: @@ -1224,8 +1210,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") done: @@ -1259,7 +1244,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) { H5VL_object_t *vol_obj = NULL; H5I_type_t type; - ssize_t ret_value = -1; + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", obj_id, name, size); @@ -1274,8 +1259,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the filename via the VOL */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_NAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name") done: @@ -1320,8 +1304,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_FILE_GET_INFO, type, finfo) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") done: @@ -1357,8 +1340,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") done: @@ -1397,8 +1379,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: @@ -1431,8 +1412,7 @@ H5Fclear_elink_file_cache(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Release the EFC */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") done: @@ -1491,9 +1471,8 @@ H5Fstart_swmr_write(hid_t file_id) if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* start SWMR writing */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) + /* Start SWMR writing */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: @@ -1559,8 +1538,7 @@ H5Fstop_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") done: @@ -1594,8 +1572,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") done: @@ -1633,8 +1610,7 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set the library's version bounds */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: @@ -1671,8 +1647,7 @@ H5Fformat_convert(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the format */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") done: @@ -1703,8 +1678,7 @@ H5Freset_page_buffering_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") done: @@ -1739,9 +1713,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2 HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats") /* Get the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, - accesses, hits, misses, evictions, bypasses) < 0) + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") done: diff --git a/src/H5VL.c b/src/H5VL.c index 5c2d113..225e983 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -98,7 +98,7 @@ H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) if (0 == HDstrcmp(cls->name, op_data->name)) { op_data->found_id = id; ret_value = H5_ITER_STOP; - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__get_plugin_cb() */ @@ -225,75 +225,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLclose - * - * Purpose: Closes a VOL plugin ID. This in no way affects - * file access property lists which have been defined to use - * this VOL plugin or files which are already opened under with - * this plugin. - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLclose(hid_t vol_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", vol_id); - - /* Check args */ - if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin") - - /* Decrement the ref count on the ID, possibly releasing the VOL plugin */ - if(H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL plugin ID") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLclose() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLunregister_plugin - * - * Purpose: Removes a VOL plugin ID from the library. This in no way affects - * file access property lists which have been defined to use - * this VOL plugin or files which are already opened under with - * this plugin. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLunregister_plugin(hid_t vol_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", vol_id); - - /* Check arguments */ - if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin") - - /* The H5VL_class_t struct will be freed by this function */ - if (H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL plugin") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLunregister_plugin() */ - - -/*------------------------------------------------------------------------- * Function: H5VLis_plugin_registered * * Purpose: Tests whether a VOL class has been registered or not @@ -395,121 +326,47 @@ done: } /* end H5VLget_plugin_name() */ -/*--------------------------------------------------------------------------- - * Function: H5VLcmp_plugin_cls - * - * Purpose: Compares two plugin classes - * - * Return: Success: Non-negative, with *cmp set to positive if - * plugin_id1 is greater than plugin_id2, negative if plugin_id2 - * is greater than plugin_id1 and zero if plugin_id1 and plugin_id2 - * are equal. - * - * Failure: Negative - * - *--------------------------------------------------------------------------- - */ -herr_t -H5VLcmp_plugin_cls(int *cmp, hid_t plugin_id1, hid_t plugin_id2) -{ - H5VL_class_t *cls1, *cls2; /* Plugins for IDs */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*Isii", cmp, plugin_id1, plugin_id2); - - /* Check args and get class pointers */ - if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Compare the two VOL plugin classes */ - *cmp = H5VL_cmp_plugin_cls(cls1, cls2); - -done: - FUNC_LEAVE_API(ret_value) -} /* H5VLcmp_plugin_cls() */ - - -/*--------------------------------------------------------------------------- - * Function: H5VLcmp_plugin_info - * - * Purpose: Compares two plugin info objects - * - * Note: Both info objects must be from the same VOL plugin class - * - * Return: Success: Non-negative, with *cmp set to positive if - * info1 is greater than info2, negative if info2 - * is greater than info1 and zero if info1 and info2 - * are equal. - * - * Failure: Negative - * - *--------------------------------------------------------------------------- - */ -herr_t -H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, const void *info2) -{ - H5VL_class_t *cls; /* Plugins for ID */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*Isi*x*x", cmp, plugin_id, info1, info2); - - /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Compare the two VOL plugin info objects */ - *cmp = H5VL_cmp_plugin_info(cls, info1, info2); - -done: - FUNC_LEAVE_API(ret_value) -} /* H5VLcmp_plugin_info() */ - -/*------------------------------------------------------------------------- - * Routines below this are public wrappers for stackable VOL plugins, and - * should not be called by applications. - *-----------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------- - * Function: H5VLinitialize + * Function: H5VLclose * - * Purpose: Calls the plugin-specific callback to initialize the plugin. + * Purpose: Closes a VOL plugin ID. This in no way affects + * file access property lists which have been defined to use + * this VOL plugin or files which are already opened under with + * this plugin. * * Return: Success: Non-negative - * * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VLinitialize(hid_t plugin_id, hid_t vipl_id) +H5VLclose(hid_t vol_id) { - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT - H5TRACE2("e", "ii", plugin_id, vipl_id); + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", vol_id); /* Check args */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin") - if (cls->initialize && cls->initialize(vipl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not initialize") + /* Decrement the ref count on the ID, possibly releasing the VOL plugin */ + if(H5I_dec_app_ref(vol_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL plugin ID") done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLinitialize() */ + FUNC_LEAVE_API(ret_value) +} /* end H5VLclose() */ /*------------------------------------------------------------------------- - * Function: H5VLterminate + * Function: H5VLunregister_plugin * - * Purpose: Calls the plugin-specific callback to terminate the plugin. + * Purpose: Removes a VOL plugin ID from the library. This in no way affects + * file access property lists which have been defined to use + * this VOL plugin or files which are already opened under with + * this plugin. * * Return: Success: Non-negative * @@ -518,1996 +375,59 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLterminate(hid_t plugin_id) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API_NOINIT - H5TRACE1("e", "i", plugin_id); - - /* Check args */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if (cls->terminate && cls->terminate() < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not terminate cleanly") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLterminate() */ - - -/*--------------------------------------------------------------------------- - * Function: H5VLget_cap_flags - * - * Purpose: Retrieves the capability flag for a plugin - * - * Return: Success: Non-NULL - * Failure: NULL - * - *--------------------------------------------------------------------------- - */ -herr_t -H5VLget_cap_flags(hid_t plugin_id, unsigned *cap_flags) +H5VLunregister_plugin(hid_t vol_id) { - H5VL_class_t *cls; /* Plugin class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", vol_id); - H5TRACE2("e", "i*Iu", plugin_id, cap_flags); - /* Check args */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + /* Check arguments */ + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin") - /* Retrieve capability flags */ - if(cap_flags) - *cap_flags = cls->cap_flags; + /* The H5VL_class_t struct will be freed by this function */ + if (H5I_dec_app_ref(vol_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL plugin") done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLget_cap_flags */ + FUNC_LEAVE_API(ret_value) +} /* end H5VLunregister_plugin() */ /*--------------------------------------------------------------------------- - * Function: H5VLcopy_plugin_info - * - * Purpose: Copies a VOL plugin's info object - * - * Return: Success: Non-negative - * Failure: Negative + * Function: H5VLcmp_plugin_cls * - *--------------------------------------------------------------------------- - */ -herr_t -H5VLcopy_plugin_info(hid_t plugin_id, void **dst_vol_info, void *src_vol_info) -{ - H5VL_class_t *cls; /* Plugins for ID */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API_NOINIT - - H5TRACE3("e", "i**x*x", plugin_id, dst_vol_info, src_vol_info); - /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Copy the VOL plugin's info object */ - if(H5VL_copy_plugin_info(cls, dst_vol_info, src_vol_info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL plugin info object") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLcopy_plugin_info() */ - - -/*--------------------------------------------------------------------------- - * Function: H5VLfree_plugin_info + * Purpose: Compares two plugin classes * - * Purpose: Free VOL plugin info object + * Return: Success: Non-negative, with *cmp set to positive if + * plugin_id1 is greater than plugin_id2, negative if plugin_id2 + * is greater than plugin_id1 and zero if plugin_id1 and plugin_id2 + * are equal. * - * Return: Success: Non-negative * Failure: Negative * *--------------------------------------------------------------------------- */ herr_t -H5VLfree_plugin_info(hid_t plugin_id, void *info) +H5VLcmp_plugin_cls(int *cmp, hid_t plugin_id1, hid_t plugin_id2) { - H5VL_class_t *cls; /* Plugins for ID */ + H5VL_class_t *cls1, *cls2; /* Plugins for IDs */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "*Isii", cmp, plugin_id1, plugin_id2); - H5TRACE2("e", "i*x", plugin_id, info); - /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + /* Check args and get class pointers */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Free the VOL plugin info object */ - if(H5VL_free_plugin_info(cls, info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin info object") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLfree_plugin_info() */ - - -/*--------------------------------------------------------------------------- - * Function: H5VLget_object - * - * Purpose: Retrieves an underlying object. - * - * Return: Success: Non-NULL - * Failure: NULL - * - *--------------------------------------------------------------------------- - */ -void * -H5VLget_object(void *obj, hid_t plugin_id) -{ - H5VL_class_t *cls; - void *ret_value = NULL; - - FUNC_ENTER_API_NOINIT - - H5TRACE2("*x", "*xi", obj, plugin_id); - - /* Check args */ - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - /* Check for 'get_object' callback in plugin */ - if(cls->get_object) - ret_value = (cls->get_object)(obj); - else - ret_value = obj; - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLget_object */ - - -/*--------------------------------------------------------------------------- - * Function: H5VLget_wrap_ctx - * - * Purpose: Get a VOL plugin's object wrapping context - * - * Return: Success: Non-negative - * Failure: Negative - * - *--------------------------------------------------------------------------- - */ -herr_t -H5VLget_wrap_ctx(void *obj, hid_t plugin_id, void **wrap_ctx) -{ - H5VL_class_t *cls; /* Plugins for ID */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API_NOINIT - - H5TRACE3("e", "*xi**x", obj, plugin_id, wrap_ctx); - /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Get the VOL plugin's object wrapper */ - if(H5VL_get_wrap_ctx(cls, obj, wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL plugin object wrap context") + /* Compare the two VOL plugin classes */ + *cmp = H5VL_cmp_plugin_cls(cls1, cls2); done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLget_wrap_ctx() */ - - -/*--------------------------------------------------------------------------- - * Function: H5VLfree_wrap_ctx - * - * Purpose: Release a VOL plugin's object wrapping context - * - * Return: Success: Non-negative - * Failure: Negative - * - *--------------------------------------------------------------------------- - */ -herr_t -H5VLfree_wrap_ctx(void *wrap_ctx, hid_t plugin_id) -{ - H5VL_class_t *cls; /* Plugins for ID */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API_NOINIT - - H5TRACE2("e", "*xi", wrap_ctx, plugin_id); - /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Release the VOL plugin's object wrapper */ - if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin object wrap context") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLfree_wrap_ctx() */ - - -/*--------------------------------------------------------------------------- - * Function: H5VLwrap_object - * - * Purpose: Asks a plugin to wrap an underlying object. - * - * Return: Success: Non-NULL - * Failure: NULL - * - *--------------------------------------------------------------------------- - */ -void * -H5VLwrap_object(void *obj, hid_t plugin_id, void *wrap_ctx) -{ - H5VL_class_t *cls; /* VOL plugin class */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API_NOINIT - - H5TRACE3("*x", "*xi*x", obj, plugin_id, wrap_ctx); - /* Check args */ - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - /* Wrap the object */ - if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLwrap_object */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_create - * - * Purpose: Creates an attribute - * - * Return: Success: Pointer to the new attribute - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, acpl_id, - aapl_id, dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, cls, name, - acpl_id, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create attribute") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLattr_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_open - * - * Purpose: Opens an attribute - * - * Return: Success: Pointer to the new attribute - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t aapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, aapl_id, - dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, cls, name, aapl_id, - dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open attribute") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLattr_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_read - * - * Purpose: Reads data from an attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t H5VLattr_read(void *attr, hid_t plugin_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - - if (NULL == attr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_attr_read(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLattr_read() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_write - * - * Purpose: Writes data to an attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t H5VLattr_write(void *attr, hid_t plugin_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - - if (NULL == attr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_attr_write(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write attribute") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLattr_write() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_get - * - * Purpose: Gets information about the attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVai**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr get' method") - if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLattr_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_specific - * - * Purpose: Performs a plugin-specific operation on an attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, - H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, plugin_id, specific_type, - dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr specific' method") - if((ret_value = (cls->attr_cls.specific) - (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLattr_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_optional - * - * Purpose: Performs an optional plugin-specific operation on an attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Have to bypass the H5VLint layer due to unknown val_list arguments */ - if(NULL == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr optional' method") - if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLattr_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_close - * - * Purpose: Closes an attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", attr, plugin_id, dxpl_id, req); - - if (NULL == attr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_attr_close(attr, cls, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close attribute") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLattr_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_create - * - * Purpose: Creates a dataset - * - * Return: Success: Pointer to the new dataset - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, dcpl_id, - dapl_id, dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, cls, name, - dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create dataset") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdataset_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_open - * - * Purpose: Opens a dataset - * - * Return: Success: Pointer to the new dataset - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t dapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, dapl_id, - dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open dataset") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdataset_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_read - * - * Purpose: Reads data from a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_read(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, - file_space_id, plist_id, buf, req); - - if (NULL == dset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_dataset_read(dset, cls, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdataset_read() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_write - * - * Purpose: Writes data to a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_write(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, - file_space_id, plist_id, buf, req); - - if (NULL == dset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_dataset_write(dset, cls, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdataset_write() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_get - * - * Purpose: Gets information about a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_get(void *dset, hid_t plugin_id, H5VL_dataset_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVci**xx", dset, plugin_id, get_type, dxpl_id, req, arguments); - - if (NULL == dset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset get' method") - if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdataset_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_specific - * - * Purpose: Performs a plugin-specific operation on a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVdi**xx", obj, plugin_id, specific_type, dxpl_id, req, - arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset specific' method") - if((ret_value = (cls->dataset_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdataset_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_optional - * - * Purpose: Performs an optional plugin-specific operation on a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset optional' method") - if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdataset_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_close - * - * Purpose: Closes a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_close(void *dset, hid_t plugin_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", dset, plugin_id, dxpl_id, req); - - if (NULL == dset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_dataset_close(dset, cls, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close dataset") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdataset_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_create - * - * Purpose: Creates a file - * - * Return: Success: Pointer to the new file - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, - hid_t dxpl_id, void **req) -{ - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API_NOINIT - H5TRACE6("*x", "*sIuiii**x", name, flags, fcpl_id, fapl_id, dxpl_id, req); - - /* get the VOL info from the fapl */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL plugin info") - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id, - dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLfile_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_open - * - * Purpose: Opens a file - * - * Return: Success: Pointer to the new file - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) -{ - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API_NOINIT - H5TRACE5("*x", "*sIuii**x", name, flags, fapl_id, dxpl_id, req); - - /* get the VOL info from the fapl */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL plugin info") - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLfile_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_get - * - * Purpose: Gets information about the file - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVgi**xx", file, plugin_id, get_type, dxpl_id, req, arguments); - - if(NULL == file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file get' method") - if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute file get callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLfile_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_specific - * - * Purpose: Performs a plugin-specific operation on a file - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLfile_specific(void *file, hid_t plugin_id, H5VL_file_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVhi**xx", file, plugin_id, specific_type, dxpl_id, req, - arguments); - - if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ - hid_t fapl_id; - - fapl_id = va_arg (arguments, hid_t); - - /* get the VOL info from the fapl */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = (cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - } /* end if */ - else { - if(NULL == file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file specific' method") - if((ret_value = (cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file specific callback") - } /* end else */ - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLfile_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_optional - * - * Purpose: Performs an optional plugin-specific operation on a file - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLfile_optional(void *file, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", file, plugin_id, dxpl_id, req, arguments); - - if(NULL == file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file optional' method") - if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLfile_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_close - * - * Purpose: Closes a file - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", file, plugin_id, dxpl_id, req); - - if(NULL == file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_file_close(file, cls, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close file") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLfile_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_create - * - * Purpose: Creates a group - * - * Return: Success: Pointer to the new group - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, gcpl_id, - gapl_id, dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_group_create(obj, loc_params, cls, name, - gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLgroup_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_open - * - * Purpose: Opens a group - * - * Return: Success: Pointer to the new group - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t gapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, gapl_id, - dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_group_open(obj, loc_params, cls, name, - gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLgroup_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_get - * - * Purpose: Gets information about the group - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVii**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group get' method") - if((ret_value = (cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute group get callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLgroup_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_specific - * - * Purpose: Performs a plugin-specific operation on a group - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVji**xx", obj, plugin_id, specific_type, dxpl_id, req, - arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group specific' method") - if((ret_value = (cls->group_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLgroup_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_optional - * - * Purpose: Performs an optional plugin-specific operation on a group - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if(NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group optional' method") - if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLgroup_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_close - * - * Purpose: Closes a group - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", grp, plugin_id, dxpl_id, req); - - if(NULL == grp) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_group_close(grp, cls, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close group") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLgroup_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_create - * - * Purpose: Creates a hard link - * - * Note: The 'obj' parameter is allowed to be NULL - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, plugin_id, lcpl_id, - lapl_id, dxpl_id, req); - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to create link") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLlink_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_copy - * - * Purpose: Copies a link to a new location - * - * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t plugin_id, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, - plugin_id, lcpl_id, lapl_id, dxpl_id, req); - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, - lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLlink_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_move - * - * Purpose: Moves a link to another location - * - * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t plugin_id, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, - plugin_id, lcpl_id, lapl_id, dxpl_id, req); - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, - lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLlink_move() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_get - * - * Purpose: Gets information about a link - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVli**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, - arguments); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if(NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link get' method") - if((ret_value = (cls->link_cls.get) - (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link get callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLlink_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_specific - * - * Purpose: Performs a plugin-specific operation on a link - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, - H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, plugin_id, specific_type, - dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link specific' method") - if((ret_value = (cls->link_cls.specific) - (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLlink_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_optional - * - * Purpose: Performs an optional plugin-specific operation on a link - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Have to bypass the H5VLint layer due to unknown val_list arguments */ - if(NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link optional' method") - if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLlink_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLobject_open - * - * Purpose: Opens an object - * - * Return: Success: Pointer to the new object - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t plugin_id, H5I_type_t *opened_type, - hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API_NOINIT - H5TRACE6("*x", "*xxi*Iti**x", obj, params, plugin_id, opened_type, dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_object_open(obj, params, cls, opened_type, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLobject_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLobject_copy - * - * Purpose: Copies an object to another location - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t plugin_id1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls1 = NULL; - H5VL_class_t *cls2 = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, plugin_id1, - src_name, dst_obj, loc_params2, plugin_id2, dst_name, ocpypl_id, - lcpl_id, dxpl_id, req); - - if(NULL == src_obj || NULL == dst_obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_object_copy(src_obj, loc_params1, cls1, src_name, - dst_obj, loc_params2, cls2, dst_name, - ocpypl_id, lcpl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to move object") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLobject_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLobject_get - * - * Purpose: Gets information about an object - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVni**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, - arguments); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if(NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object get' method") - if((ret_value = (cls->object_cls.get) - (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object get callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLobject_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLobject_specific - * - * Purpose: Performs a plugin-specific operation on an object - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, - H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, plugin_id, specific_type, - dxpl_id, req, arguments); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object specific' method") - if((ret_value = (cls->object_cls.specific) - (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLobject_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLobject_optional - * - * Purpose: Performs an optional plugin-specific operation on an object - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Have to bypass the H5VLint layer due to unknown val_list arguments */ - if(NULL == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object optional' method") - if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLobject_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_commit - * - * Purpose: Commits a datatype to the file - * - * Return: Success: Pointer to the new datatype - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API_NOINIT - H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, plugin_id, name, type_id, - lcpl_id, tcpl_id, tapl_id, dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, cls, name, type_id, - lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to commit datatype") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_commit() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_open - * - * Purpose: Opens a named datatype - * - * Return: Success: Pointer to the new datatype - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t tapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, tapl_id, - dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - - if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, cls, name, - tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open datatype") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_specific - * - * Purpose: Performs a plugin-specific operation on a datatype - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVfi**xx", obj, plugin_id, specific_type, dxpl_id, req, - arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype specific' method") - if((ret_value = (cls->datatype_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_optional - * - * Purpose: Performs an optional plugin-specific operation on a datatype - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if(NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype optional' method") - if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_get - * - * Purpose: Gets information about the datatype - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_get(void *obj, hid_t plugin_id, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVei**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype get' method") - if((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute datatype get callback") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_close - * - * Purpose: Closes a datatype - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", dt, plugin_id, dxpl_id, req); - - if (NULL == dt) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if((ret_value = H5VL_datatype_close(dt, cls, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close datatype") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLrequest_cancel - * - * Purpose: Cancels a request - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE3("e", "**xi*Es", req, plugin_id, status); - - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if ((ret_value = H5VL_request_cancel(req, cls, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLrequest_cancel() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLrequest_test - * - * Purpose: Tests a request - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE3("e", "**xi*Es", req, plugin_id, status); - - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if ((ret_value = H5VL_request_test(req, cls, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to test request") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLrequest_test() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLrequest_wait - * - * Purpose: Waits on a request - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API_NOINIT - H5TRACE3("e", "**xi*Es", req, plugin_id, status); - - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - if ((ret_value = H5VL_request_wait(req, cls, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLrequest_wait() */ + FUNC_LEAVE_API(ret_value) +} /* H5VLcmp_plugin_cls() */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index d7c1f5a..9845960 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -75,11 +75,108 @@ /*------------------------------------------------------------------------- + * Function: H5VLinitialize + * + * Purpose: Calls the plugin-specific callback to initialize the plugin. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLinitialize(hid_t plugin_id, hid_t vipl_id) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "ii", plugin_id, vipl_id); + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Invoke class' callback, if there is one */ + if(cls->initialize && cls->initialize(vipl_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not initialize") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLinitialize() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLterminate + * + * Purpose: Calls the plugin-specific callback to terminate the plugin. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLterminate(hid_t plugin_id) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE1("e", "i", plugin_id); + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Invoke class' callback, if there is one */ + if(cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not terminate cleanly") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLterminate() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLget_cap_flags + * + * Purpose: Retrieves the capability flag for a plugin + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_cap_flags(hid_t plugin_id, unsigned *cap_flags) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "i*Iu", plugin_id, cap_flags); + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Retrieve capability flags */ + if(cap_flags) + *cap_flags = cls->cap_flags; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_cap_flags */ + + +/*------------------------------------------------------------------------- * Function: H5VL_copy_plugin_info * * Purpose: Copy the VOL info for a plugin * - * Return: SUCCEED / FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -119,6 +216,38 @@ done: } /* end H5VL_copy_plugin_info() */ +/*--------------------------------------------------------------------------- + * Function: H5VLcopy_plugin_info + * + * Purpose: Copies a VOL plugin's info object + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcopy_plugin_info(hid_t plugin_id, void **dst_vol_info, void *src_vol_info) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "i**x*x", plugin_id, dst_vol_info, src_vol_info); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Copy the VOL plugin's info object */ + if(H5VL_copy_plugin_info(cls, dst_vol_info, src_vol_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL plugin info object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLcopy_plugin_info() */ + + /*------------------------------------------------------------------------- * Function: H5VL_cmp_plugin_info * @@ -167,12 +296,50 @@ done: } /* end H5VL_cmp_plugin_info() */ +/*--------------------------------------------------------------------------- + * Function: H5VLcmp_plugin_info + * + * Purpose: Compares two plugin info objects + * + * Note: Both info objects must be from the same VOL plugin class + * + * Return: Success: Non-negative, with *cmp set to positive if + * info1 is greater than info2, negative if info2 + * is greater than info1 and zero if info1 and info2 + * are equal. + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, const void *info2) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*Isi*x*x", cmp, plugin_id, info1, info2); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Compare the two VOL plugin info objects */ + if(cmp) + *cmp = H5VL_cmp_plugin_info(cls, info1, info2); + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLcmp_plugin_info() */ + + /*------------------------------------------------------------------------- * Function: H5VL_free_plugin_info * * Purpose: Free VOL info for a plugin * - * Return: SUCCEED / FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -202,12 +369,81 @@ done: } /* end H5VL_free_plugin_info() */ +/*--------------------------------------------------------------------------- + * Function: H5VLfree_plugin_info + * + * Purpose: Free VOL plugin info object + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLfree_plugin_info(hid_t plugin_id, void *info) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "i*x", plugin_id, info); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Free the VOL plugin info object */ + if(H5VL_free_plugin_info(cls, info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin info object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_plugin_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLget_object + * + * Purpose: Retrieves an underlying object. + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLget_object(void *obj, hid_t plugin_id) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("*x", "*xi", obj, plugin_id); + + /* Check args */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Check for 'get_object' callback in plugin */ + if(cls->get_object) + ret_value = (cls->get_object)(obj); + else + ret_value = obj; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_object */ + + /*------------------------------------------------------------------------- * Function: H5VL_get_wrap_ctx * * Purpose: Retrieve the VOL object wrapping context for a plugin * - * Return: SUCCEED / FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -240,12 +476,45 @@ done: } /* end H5VL_get_wrap_ctx() */ +/*--------------------------------------------------------------------------- + * Function: H5VLget_wrap_ctx + * + * Purpose: Get a VOL plugin's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_wrap_ctx(void *obj, hid_t plugin_id, void **wrap_ctx) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "*xi**x", obj, plugin_id, wrap_ctx); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Get the VOL plugin's object wrapper */ + if(H5VL_get_wrap_ctx(cls, obj, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL plugin object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_wrap_ctx() */ + + /*------------------------------------------------------------------------- * Function: H5VL_free_wrap_ctx * * Purpose: Free object wrapping context for a plugin * - * Return: SUCCEED / FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -271,12 +540,45 @@ done: } /* end H5VL_free_plugin_info() */ +/*--------------------------------------------------------------------------- + * Function: H5VLfree_wrap_ctx + * + * Purpose: Release a VOL plugin's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLfree_wrap_ctx(void *wrap_ctx, hid_t plugin_id) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "*xi", wrap_ctx, plugin_id); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Release the VOL plugin's object wrapper */ + if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_wrap_ctx() */ + + /*------------------------------------------------------------------------- * Function: H5VL_wrap_object * * Purpose: Wrap an object with plugin * - * Return: SUCCEED / FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ @@ -305,13 +607,46 @@ done: } /* end H5VL_wrap_object() */ +/*--------------------------------------------------------------------------- + * Function: H5VLwrap_object + * + * Purpose: Asks a plugin to wrap an underlying object. + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLwrap_object(void *obj, hid_t plugin_id, void *wrap_ctx) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("*x", "*xi*x", obj, plugin_id, wrap_ctx); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Wrap the object */ + if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLwrap_object */ + + /*------------------------------------------------------------------------- * Function: H5VL_attr_create * * Purpose: Creates an attribute through the VOL * - * Return: Success: pointer to the new attribute - * + * Return: Success: Pointer to the new attribute * Failure: NULL * *------------------------------------------------------------------------- @@ -325,13 +660,12 @@ H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cl FUNC_ENTER_NOAPI(NULL) /* check if the corresponding VOL create callback exists */ - if (NULL == cls->attr_cls.create) + if(NULL == cls->attr_cls.create) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'attr create' method") - /* call the corresponding VOL create callback */ - if (NULL == (ret_value = (cls->attr_cls.create) - (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + /* Call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "create failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -339,31 +673,65 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLattr_create + * + * Purpose: Creates an attribute + * + * Return: Success: Pointer to the new attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, acpl_id, + aapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_create() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_attr_open * * Purpose: Opens an attribute through the VOL * - * Return: Success: pointer to the new attr. - * + * Return: Success: Pointer to the attribute * Failure: NULL * *------------------------------------------------------------------------- */ void * H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t aapl_id, hid_t dxpl_id, void **req) + hid_t aapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) - /* check if the type specific corresponding VOL open callback exists */ + /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.open) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'attr open' method") - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->attr_cls.open) - (obj, loc_params, name, aapl_id, dxpl_id, req))) + /* Call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->attr_cls.open) (obj, loc_params, name, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") done: @@ -372,1194 +740,2635 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_attr_read - * - * Purpose: Reads data from attr through the VOL + * Function: H5VLattr_open * - * Return: Success: Non Negative + * Purpose: Opens an attribute * - * Failure: Negative + * Return: Success: Pointer to the attribute + * Failure: NULL * *------------------------------------------------------------------------- */ -herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, - hid_t dxpl_id, void **req) +void * +H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, + hid_t aapl_id, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, aapl_id, + dxpl_id, req); - if(NULL == cls->attr_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr read' method") - if((ret_value = (cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "read failed") + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open attribute") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_read() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_write - * - * Purpose: Writes data to attr through the VOL + * Function: H5VL_attr_read * - * Return: Success: Non Negative + * Purpose: Reads data from attr through the VOL * - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -herr_t H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, - hid_t dxpl_id, void **req) +herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->attr_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr write' method") - if((ret_value = (cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "write failed") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr read' method") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_write() */ +} /* end H5VL_attr_read() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_get - * - * Purpose: Get specific information about the attribute through the VOL + * Function: H5VLattr_read * - * Return: Success: non negative + * Purpose: Reads data from an attribute * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, - hid_t dxpl_id, void **req, ...) +H5VLattr_read(void *attr, hid_t plugin_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT - if(NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr get' method") + /* Check args and get class pointer */ + if(NULL == attr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - va_start (arguments, req); - if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); + /* Call the corresponding internal VOL routine */ + if(H5VL_attr_read(attr, cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_get() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_read() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_specific - * - * Purpose: specific operation on attributes through the VOL + * Function: H5VL_attr_write * - * Return: Success: non negative + * Purpose: Writes data to attr through the VOL * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) +H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr specific' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr write' method") - va_start (arguments, req); - if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") - va_end (arguments); + /* Call the corresponding VOL callback */ + if((cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_specific() */ +} /* end H5VL_attr_write() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_optional - * - * Purpose: optional operation specific to plugins. + * Function: H5VLattr_write * - * Return: Success: non negative + * Purpose: Writes data to an attribute * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +H5VLattr_write(void *attr, hid_t plugin_id, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT - if(NULL == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr optional' method") + /* Check args and get class pointer */ + if(NULL == attr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - va_start (arguments, req); - if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") - va_end (arguments); + /* Call the corresponding internal VOL routine */ + if(H5VL_attr_write(attr, cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_optional() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_write() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_close + * Function: H5VL_attr_get * - * Purpose: Closes an attribute through the VOL + * Purpose: Get specific information about the attribute through the VOL * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, ...) { - herr_t ret_value = SUCCEED; - - HDassert(attr); - HDassert(cls); + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - + /* Check if the corresponding VOL callback exists */ - if (NULL == cls->attr_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr close' method") + if(NULL == cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr get' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->attr_cls.close)(attr, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + va_start(arguments, req); + if((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_close() */ +} /* end H5VL_attr_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_create + * Function: H5VLattr_get * - * Purpose: Creates a dataset through the VOL - * - * Return: Success: pointer to dataset + * Purpose: Gets information about the attribute * - * Failure: NULL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * +herr_t +H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVai**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr get' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_specific + * + * Purpose: specific operation on attributes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr specific' method") + + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + va_end(arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_specific + * + * Purpose: Performs a plugin-specific operation on an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, plugin_id, specific_type, + dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Bypass the H5VLint layer */ + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr specific' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr optional' method") + + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->attr_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + va_end(arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_optional + * + * Purpose: Performs an optional plugin-specific operation on an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr optional' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->attr_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_close + * + * Purpose: Closes an attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + /* Sanity check */ + HDassert(attr); + HDassert(cls); + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr close' method") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.close)(attr, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_close + * + * Purpose: Closes an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", attr, plugin_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == attr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL_attr_close(attr, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_create + * + * Purpose: Creates a dataset through the VOL + * + * Return: Success: Pointer to new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'dataset create' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_create + * + * Purpose: Creates a dataset + * + * Return: Success: Pointer to the new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, dcpl_id, + dapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_open + * + * Purpose: Opens a dataset through the VOL + * + * Return: Success: Pointer to dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'dataset open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->dataset_cls.open)(obj, loc_params, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_open + * + * Purpose: Opens a dataset + * + * Return: Success: Pointer to the new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, dapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_read + * + * Purpose: Reads data from dataset through the VOL +* + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, + void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset read' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.read)(dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_read + * + * Purpose: Reads data from a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_read(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, + file_space_id, plist_id, buf, req); + + /* Check args and get class pointer */ + if(NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL_dataset_read(dset, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_write + * + * Purpose: Writes data from dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset write' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.write)(dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_write + * + * Purpose: Writes data to a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_write(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, + file_space_id, plist_id, buf, req); + + /* Check args and get class pointer */ + if(NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL_dataset_write(dset, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_get + * + * Purpose: Get specific information about the dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset get' method") + + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end(arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_get + * + * Purpose: Gets information about a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_get(void *dset, hid_t plugin_id, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVci**xx", dset, plugin_id, get_type, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset get' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_specific + * + * Purpose: specific operation on datasets through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset specific' method") + + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") + va_end(arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_specific + * + * Purpose: Performs a plugin-specific operation on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVdi**xx", obj, plugin_id, specific_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset specific' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset optional' method") + + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") + va_end(arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_optional + * + * Purpose: Performs an optional plugin-specific operation on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset optional' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_close + * + * Purpose: Closes a dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(dset); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dset close' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.close)(dset, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_close + * + * Purpose: Closes a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_close(void *dset, hid_t plugin_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", dset, plugin_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL_dataset_close(dset, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_create + * + * Purpose: Creates a file through the VOL + * + * Return: Success: Pointer to new file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'file create' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_create + * + * Purpose: Creates a file + * + * Return: Success: Pointer to the new file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, + hid_t dxpl_id, void **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("*x", "*sIuiii**x", name, flags, fcpl_id, fapl_id, dxpl_id, req); + + /* Get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL plugin info") + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create file") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_open + * + * Purpose: Opens a file through the VOL. + * + * Return: Success: Pointer to file. + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'file open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_open + * + * Purpose: Opens a file + * + * Return: Success: Pointer to the file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, + void **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("*x", "*sIuii**x", name, flags, fapl_id, dxpl_id, req); + + /* Get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL plugin info") + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open file") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file get' method") + + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->file_cls.get)(file, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end(arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_get + * + * Purpose: Gets information about the file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVgi**xx", file, plugin_id, get_type, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file get' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->file_cls.get)(file, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute file get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_specific + * + * Purpose: perform File specific operations through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Special treatment of file access check */ + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + va_list tmp_args; /* argument list passed from the API call */ + hid_t fapl_id; + + /* Get the file access property list */ + va_start(tmp_args, req); + fapl_id = va_arg(tmp_args, hid_t); + va_end(tmp_args); + + /* Get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL plugin info") + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + va_end(arguments); + } /* end if */ + else { + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file specific' method") + + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + va_end(arguments); + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_specific + * + * Purpose: Performs a plugin-specific operation on a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_specific(void *file, hid_t plugin_id, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVhi**xx", file, plugin_id, specific_type, dxpl_id, req, + arguments); + + /* Special treatment of file access check */ + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + hid_t fapl_id; + + fapl_id = va_arg(arguments, hid_t); + + /* Get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + } /* end if */ + else { + /* Check args and get class pointer */ + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file specific' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file specific callback") + } /* end else */ + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_optional + * + * Purpose: perform a plugin specific operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file optional' method") + + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->file_cls.optional)(file, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") + va_end(arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_optional + * + * Purpose: Performs an optional plugin-specific operation on a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_optional(void *file, hid_t plugin_id, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", file, plugin_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file optional' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->file_cls.optional)(file, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_close + * + * Purpose: Closes a file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(file); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file close' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.close)(file, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_close + * + * Purpose: Closes a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", file, plugin_id, dxpl_id, req); - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->dataset_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'dataset create' method") + /* Check args and get class pointer */ + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->dataset_cls.create) - (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + /* Call the corresponding internal VOL routine */ + if(H5VL_file_close(file, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_create() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_open - * - * Purpose: Opens a dataset through the VOL + * Function: H5VL_group_create * - * Return: Success: pointer to dataset + * Purpose: Creates a group through the VOL * + * Return: Success: Pointer to new group * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t dapl_id, hid_t dxpl_id, void **req) +H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == cls->dataset_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'dset open' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'group create' method") - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->dataset_cls.open) - (obj, loc_params, name, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_open() */ +} /* end H5VL_group_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_read + * Function: H5VLgroup_create * - * Purpose: Reads data from dataset through the VOL -* - * Return: Success: Non Negative + * Purpose: Creates a group * - * Failure: Negative + * Return: Success: Pointer to the new group + * Failure: NULL * *------------------------------------------------------------------------- */ -herr_t -H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, - hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, - void **req) +void * +H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, gcpl_id, + gapl_id, dxpl_id, req); - if(NULL == cls->dataset_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset read' method") - if((ret_value = (cls->dataset_cls.read)(dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "read failed") + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_read() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_write - * - * Purpose: Writes data from dataset through the VOL + * Function: H5VL_group_open * - * Return: Success: Non Negative + * Purpose: Opens a group through the VOL * - * Failure: Negative + * Return: Success: Pointer to group + * Failure: NULL * *------------------------------------------------------------------------- */ -herr_t -H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +void * +H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(NULL) - if(NULL == cls->dataset_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset write' method") - if((ret_value = (cls->dataset_cls.write) - (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'group open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->group_cls.open)(obj, loc_params, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_write() */ +} /* end H5VL_group_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_get + * Function: H5VLgroup_open * - * Purpose: Get specific information about the dataset through the VOL + * Purpose: Opens a group + * + * Return: Success: Pointer to the group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, + hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, gapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_get * - * Return: Success: non negative + * Purpose: Get specific information about the group through the VOL * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, - hid_t dxpl_id, void **req, ...) +H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, ...) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset get' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group get' method") - va_start (arguments, req); - if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_get() */ +} /* end H5VL_group_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_specific + * Function: H5VLgroup_get * - * Purpose: specific operation on datasets through the VOL + * Purpose: Gets information about the group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVii**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group get' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute group get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_specific * - * Return: Success: non negative + * Purpose: Specific operation on groups through the VOL * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, - hid_t dxpl_id, void **req, ...) +H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, ...) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset specific' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group specific' method") - va_start (arguments, req); - if((ret_value = (cls->dataset_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") - va_end (arguments); + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_specific() */ +} /* end H5VL_group_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_optional - * - * Purpose: optional operation specific to plugins. + * Function: H5VLgroup_specific * - * Return: Success: non negative + * Purpose: Performs a plugin-specific operation on a group * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVji**xx", obj, plugin_id, specific_type, dxpl_id, req, + arguments); - if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset optional' method") + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - va_start (arguments, req); - if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") - va_end (arguments); + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group specific' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_optional() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_close + * Function: H5VL_group_optional * - * Purpose: Closes a dataset through the VOL + * Purpose: Optional operation specific to plugins. * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, ...) { - herr_t ret_value = SUCCEED; + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(dset); - HDassert(cls); - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->dataset_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dset close' method") + if(NULL == cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group optional' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->dataset_cls.close)(dset, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + va_start(arguments, req); + if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") + va_end(arguments); done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_close() */ +} /* end H5VL_group_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_file_create - * - * Purpose: Creates a file through the VOL + * Function: H5VLgroup_optional * - * Return: Success: pointer to file. + * Purpose: Performs an optional plugin-specific operation on a group * - * Failure: NULL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, void **req) +herr_t +H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { - void *ret_value = NULL; /* Return value */ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->file_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'file create' method") - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group optional' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_create() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_file_open - * - * Purpose: Opens a file through the VOL. + * Function: H5VL_group_close * - * Return: Success: pointer to file. + * Purpose: Closes a group through the VOL * - * Failure: NULL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, - hid_t dxpl_id, void **req) +herr_t +H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + /* Sanity check */ + HDassert(grp); + HDassert(cls); - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->file_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'file open' method") - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group close' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.close)(grp, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_open() */ +} /* end H5VL_group_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_file_get - * - * Purpose: Get specific information about the file through the VOL + * Function: H5VLgroup_close * - * Return: Success: non negative + * Purpose: Closes a group * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, - hid_t dxpl_id, void **req, ...) +H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", grp, plugin_id, dxpl_id, req); - if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file get' method") + /* Check args and get class pointer */ + if(NULL == grp) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - va_start(arguments, req); - if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end(arguments); + /* Call the corresponding internal VOL routine */ + if(H5VL_group_close(grp, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_get() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_file_specific + * Function: H5VL_link_create * - * Purpose: perform File specific operations through the VOL + * Purpose: Creates a hard link through the VOL * - * Return: Success: non negative - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, - hid_t dxpl_id, void **req, ...) +H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ - va_list tmp_args; /* argument list passed from the API call */ - hid_t fapl_id; + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link create' method") - va_start (tmp_args, req); - fapl_id = va_arg (tmp_args, hid_t); - va_end (tmp_args); + /* Call the corresponding VOL callback */ + if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") - /* get the VOL info from the fapl */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_create() */ - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") + +/*------------------------------------------------------------------------- + * Function: H5VLlink_create + * + * Purpose: Creates a hard link + * + * Note: The 'obj' parameter is allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, plugin_id, lcpl_id, + lapl_id, dxpl_id, req); - va_start (arguments, req); - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); - } - else { - if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file specific' method") + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - va_start (arguments, req); - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); - } + /* Call the corresponding internal VOL routine */ + if(H5VL_link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_specific() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_file_optional + * Function: H5VL_link_copy * - * Purpose: perform a plugin specific operation + * Purpose: Copys a link from src to dst. * - * Return: Success: non negative - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -herr_t -H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +herr_t +H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file optional' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link copy' method") - va_start (arguments, req); - if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed") - va_end (arguments); + /* Call the corresponding VOL callback */ + if((cls->link_cls.copy)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_optional() */ +} /* end H5VL_link_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_file_close + * Function: H5VLlink_copy * - * Purpose: Closes a file through the VOL + * Purpose: Copies a link to a new location * - * Return: SUCCEED/FAIL + * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - HDassert(file); - HDassert(cls); + FUNC_ENTER_API_NOINIT + H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + plugin_id, lcpl_id, lapl_id, dxpl_id, req); - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->file_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file close' method") + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->file_cls.close)(file, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed") + /* Call the corresponding internal VOL routine */ + if(H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_close() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_group_create - * - * Purpose: Creates a group through the VOL + * Function: H5VL_link_move * - * Return: Success: pointer to new group. + * Purpose: Moves a link from src to dst. * - * Failure: NULL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +herr_t +H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI(FAIL) - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->group_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'group create' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.move) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link move' method") - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->group_cls.create) - (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + /* Call the corresponding VOL callback */ + if((cls->link_cls.move)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_create() */ +} /* end H5VL_link_move() */ /*------------------------------------------------------------------------- - * Function: H5VL_group_open + * Function: H5VLlink_move * - * Purpose: Opens a group through the VOL + * Purpose: Moves a link to another location * - * Return: Success: pointer to new group. + * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL * - * Failure: NULL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t gapl_id, hid_t dxpl_id, void **req) +herr_t +H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_API_NOINIT + H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + plugin_id, lcpl_id, lapl_id, dxpl_id, req); - if(NULL == cls->group_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'group open' method") + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == (ret_value = (cls->group_cls.open) - (obj, loc_params, name, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + /* Call the corresponding internal VOL routine */ + if(H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_open() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_move() */ /*------------------------------------------------------------------------- - * Function: H5VL_group_get - * - * Purpose: Get specific information about the group through the VOL + * Function: H5VL_link_get * - * Return: Success: non negative + * Purpose: Get specific information about the link through the VOL * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, - hid_t dxpl_id, void **req, ...) +H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, ...) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group get' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link get' method") - va_start (arguments, req); - if((ret_value = (cls->group_cls.get) - (obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_get() */ +} /* end H5VL_link_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_group_specific + * Function: H5VLlink_get * - * Purpose: specific operation on groups through the VOL + * Purpose: Gets information about a link * - * Return: Success: non negative - * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, - hid_t dxpl_id, void **req, ...) +H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVli**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, + arguments); - if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group specific' method") + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - va_start (arguments, req); - if((ret_value = (cls->group_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") - va_end (arguments); + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link get' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute link get callback") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_specific() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_group_optional - * - * Purpose: optional operation specific to plugins. + * Function: H5VL_link_specific * - * Return: Success: non negative + * Purpose: specific operation on links through the VOL * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group optional' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link specific' method") - va_start (arguments, req); - if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") - va_end (arguments); + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_optional() */ +} /* end H5VL_link_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_group_close + * Function: H5VLlink_specific * - * Purpose: Closes a group through the VOL + * Purpose: Performs a plugin-specific operation on a link * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - HDassert(grp); - HDassert(cls); + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, plugin_id, specific_type, + dxpl_id, req, arguments); - FUNC_ENTER_NOAPI(FAIL) + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Check if the corresponding VOL callback exists */ - if (NULL == cls->group_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group close' method") + if(NULL == cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link specific' method") - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->group_cls.close)(grp, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_close() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_link_create + * Function: H5VL_link_optional * - * Purpose: Creates a hard link through the VOL + * Purpose: optional operation specific to plugins. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, ...) { - herr_t ret_value = SUCCEED; /* Return value */ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->link_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link create' method") - /* call the corresponding VOL create callback */ - if((ret_value = (cls->link_cls.create) - (create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link create failed") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link optional' method") + + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_create() */ +} /* end H5VL_link_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_link_copy + * Function: H5VLlink_optional * - * Purpose: Copys a link from src to dst. + * Purpose: Performs an optional plugin-specific operation on a link * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -herr_t -H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +herr_t +H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - /* check if the corresponding VOL copy callback exists */ - if(NULL == cls->link_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link copy' method") + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* call the corresponding VOL copy callback */ - if((ret_value = (cls->link_cls.copy) - (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, - lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link copy failed") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link optional' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_copy() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_link_move + * Function: H5VL_object_open * - * Purpose: Moves a link from src to dst. + * Purpose: Opens a object through the VOL * - * Return: Non-negative on success/Negative on failure + * Return: Success: Pointer to the object + * Failure: NULL * *------------------------------------------------------------------------- */ -herr_t -H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +void * +H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, + hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(NULL) - /* check if the corresponding VOL move callback exists */ - if(NULL == cls->link_cls.move) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link move' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'object open' method") - /* call the corresponding VOL move callback */ - if((ret_value = (cls->link_cls.move) - (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, - lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link move failed") + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->object_cls.open)(obj, params, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_move() */ +} /* end H5VL_object_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_link_get - * - * Purpose: Get specific information about the link through the VOL + * Function: H5VLobject_open * - * Return: Success: non negative + * Purpose: Opens an object * - * Failure: negative + * Return: Success: Pointer to the object + * Failure: NULL * *------------------------------------------------------------------------- */ -herr_t -H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, - hid_t dxpl_id, void **req, ...) +void * +H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t plugin_id, H5I_type_t *opened_type, + hid_t dxpl_id, void **req) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT + H5TRACE6("*x", "*xxi*Iti**x", obj, params, plugin_id, opened_type, dxpl_id, req); - if(NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link get' method") + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - va_start (arguments, req); - if((ret_value = (cls->link_cls.get) - (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_object_open(obj, params, cls, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open object") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_get() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_link_specific - * - * Purpose: specific operation on links through the VOL + * Function: H5VL_object_copy * - * Return: Success: non negative + * Purpose: Copies an object to another destination through the VOL * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -herr_t -H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) +herr_t +H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, + const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, + const H5VL_class_t *cls2, const char *dst_name, hid_t ocpypl_id, + hid_t lcpl_id, hid_t dxpl_id, void **req) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link specific' method") + /* Make sure that the VOL plugins are the same */ + if(cls1->value != cls2->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") - va_start (arguments, req); - if((ret_value = (cls->link_cls.specific) - (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") - va_end (arguments); + /* Check if the corresponding VOL callback exists */ + if(NULL == cls1->object_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object copy' method") + + /* Call the corresponding VOL callback */ + if((cls1->object_cls.copy)(src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_specific() */ +} /* end H5VL_object_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_link_optional - * - * Purpose: optional operation specific to plugins. + * Function: H5VLobject_copy * - * Return: Success: non negative + * Purpose: Copies an object to another location * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t plugin_id1, + const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, + hid_t plugin_id2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, + hid_t dxpl_id, void **req) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_class_t *cls1; /* VOL plugin's class struct */ + H5VL_class_t *cls2; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT + H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, plugin_id1, + src_name, dst_obj, loc_params2, plugin_id2, dst_name, ocpypl_id, + lcpl_id, dxpl_id, req); - if(NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link optional' method") + /* Check args and get class pointers */ + if(NULL == src_obj || NULL == dst_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - va_start (arguments, req); - if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") - va_end (arguments); + /* Call the corresponding internal VOL routine */ + if(H5VL_object_copy(src_obj, loc_params1, cls1, src_name, dst_obj, loc_params2, cls2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_optional() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_object_open - * - * Purpose: Opens a object through the VOL + * Function: H5VL_object_get * - * Return: Success: User ID of the new object. + * Purpose: Get specific information about the object through the VOL * - * Failure: NULL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, - hid_t dxpl_id, void **req) +herr_t +H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...) { - void *ret_value = NULL; /* Return value */ + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI(FAIL) - /* check if the corresponding VOL open callback exists */ - if(NULL == cls->object_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'object open' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object get' method") - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->object_cls.open) - (obj, params, opened_type, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_open() */ +} /* end H5VL_object_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_object_copy + * Function: H5VLobject_get * - * Purpose: Copies an object to another destination through the VOL + * Purpose: Gets information about an object * - * Return: Success: Non Negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -herr_t -H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) +herr_t +H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVni**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, + arguments); - /* Make sure that the VOL plugins are the same */ - if (cls1->value != cls2->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == cls1->object_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object copy' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object get' method") - if((ret_value = (cls1->object_cls.copy) - (src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id, - lcpl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "copy failed") + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute object get callback") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_copy() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_object_get - * - * Purpose: Get specific information about the object through the VOL + * Function: H5VL_object_specific * - * Return: Success: non negative + * Purpose: specific operation on objects through the VOL * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, - hid_t dxpl_id, void **req, ...) +H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object get' method") + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object specific' method") - va_start (arguments, req); - if((ret_value = (cls->object_cls.get) - (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_get() */ +} /* end H5VL_object_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_object_specific + * Function: H5VLobject_specific * - * Purpose: specific operation on objects through the VOL + * Purpose: Performs a plugin-specific operation on an object * - * Return: Success: non negative - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) +H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, plugin_id, specific_type, + dxpl_id, req, arguments); + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ if(NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object specific' method") - va_start (arguments, req); - if((ret_value = (cls->object_cls.specific) - (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_specific() */ + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_specific() */ /*------------------------------------------------------------------------- @@ -1567,27 +3376,29 @@ done: * * Purpose: optional operation specific to plugins. * - * Return: Success: non negative - * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, ...) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Check if the corresponding VOL callback exists */ if(NULL == cls->object_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object optional' method") - va_start (arguments, req); - if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") - va_end (arguments); + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1595,33 +3406,69 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLobject_optional + * + * Purpose: Performs an optional plugin-specific operation on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object optional' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_datatype_commit * * Purpose: Commits a datatype to the file through the VOL * - * Return: Success: Positive - * - * Failure: Negative + * Return: Success: Pointer to the new datatype + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, - hid_t dxpl_id, void **req) +H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, + hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) - /* check if the corresponding VOL commit callback exists */ + /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.commit) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'datatype commit' method") - /* call the corresponding VOL commit callback */ - if(NULL == (ret_value = (cls->datatype_cls.commit) - (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "commit failed") + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->datatype_cls.commit)(obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1629,31 +3476,66 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLdatatype_commit + * + * Purpose: Commits a datatype to the file + * + * Return: Success: Pointer to the new datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, + const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, + hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, plugin_id, name, type_id, + lcpl_id, tcpl_id, tapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_commit() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_datatype_open * * Purpose: Opens a named datatype through the VOL * - * Return: Success: User ID of the datatype. - * - * Failure: NULL + * Return: Success: Pointer to the datatype + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t tapl_id, hid_t dxpl_id, void **req) +H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) - /* check if the type specific corresponding VOL open callback exists */ + /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.open) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback") - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->datatype_cls.open) - (obj, loc_params, name, tapl_id, dxpl_id, req))) + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->datatype_cls.open) (obj, loc_params, name, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") done: @@ -1662,32 +3544,69 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLdatatype_open + * + * Purpose: Opens a named datatype + * + * Return: Success: Pointer to the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, tapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_open() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_datatype_get * * Purpose: Get specific information about the datatype through the VOL * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, ...) + hid_t dxpl_id, void **req, ...) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check if the corresponding VOL callback exists */ - if (NULL == cls->datatype_cls.get) + if(NULL == cls->datatype_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype get' method") - va_start (arguments, req); /* Call the corresponding VOL callback */ - if ((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + va_start(arguments, req); + if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1695,33 +3614,72 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLdatatype_get + * + * Purpose: Gets information about the datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_get(void *obj, hid_t plugin_id, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVei**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype get' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute datatype get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_datatype_specific * * Purpose: specific operation on datatypes through the VOL * - * Return: Success: non negative - * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, - hid_t dxpl_id, void **req, ...) + hid_t dxpl_id, void **req, ...) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype specific' method") - va_start (arguments, req); - if((ret_value = (cls->datatype_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") - va_end (arguments); + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1729,31 +3687,73 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLdatatype_specific + * + * Purpose: Performs a plugin-specific operation on a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVfi**xx", obj, plugin_id, specific_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype specific' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_datatype_optional * * Purpose: optional operation specific to plugins. * - * Return: Success: non negative - * - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, ...) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + va_list arguments; /* Argument list passed from the API call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype optional' method") - va_start (arguments, req); - if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + /* Call the corresponding VOL callback */ + va_start(arguments, req); + if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") - va_end (arguments); + va_end(arguments); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1761,28 +3761,68 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLdatatype_optional + * + * Purpose: Performs an optional plugin-specific operation on a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype optional' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_datatype_close * * Purpose: Closes a datatype through the VOL * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check if the corresponding VOL callback exists */ - if (NULL == cls->datatype_cls.close) + if(NULL == cls->datatype_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype close' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->datatype_cls.close)(dt, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + if((cls->datatype_cls.close)(dt, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1790,31 +3830,67 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLdatatype_close + * + * Purpose: Closes a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", dt, plugin_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == dt) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL_datatype_close(dt, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_close() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_request_cancel * * Purpose: Cancels an asynchronous request through the VOL * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(req); HDassert(cls); HDassert(status); /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.cancel) + if(NULL == cls->async_cls.cancel) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async cancel' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.cancel)(req, status)) < 0) + if((cls->async_cls.cancel)(req, status) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") done: @@ -1823,32 +3899,66 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLrequest_cancel + * + * Purpose: Cancels a request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "**xi*Es", req, plugin_id, status); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL_request_cancel(req, cls, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_cancel() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_request_test * * Purpose: Tests an asynchronous request through the VOL * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity checks */ HDassert(req); HDassert(cls); HDassert(status); /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.test) + if(NULL == cls->async_cls.test) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async test' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.test)(req, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request test failed") + if((cls->async_cls.test)(req, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "request test failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1856,35 +3966,100 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLrequest_test + * + * Purpose: Tests a request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "**xi*Es", req, plugin_id, status); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL_request_test(req, cls, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to test request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_test() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_request_wait * * Purpose: Waits on an asychronous request through the VOL * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity checks */ HDassert(req); HDassert(cls); HDassert(status); /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.wait) + if(NULL == cls->async_cls.wait) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async wait' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.wait)(req, status)) < 0) + if((cls->async_cls.wait)(req, status) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_wait() */ + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_wait + * + * Purpose: Waits on a request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "**xi*Es", req, plugin_id, status); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL_request_wait(req, cls, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_wait() */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 2daa5d4..3cf3c79 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -425,8 +425,6 @@ H5_DLL herr_t H5VLunregister_plugin(hid_t plugin_id); /* Helper routines for VOL plugin authors */ H5_DLL herr_t H5VLcmp_plugin_cls(int *cmp, hid_t plugin_id1, hid_t plugin_id2); -H5_DLL herr_t H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, - const void *info2); /* Public wrappers for generic callbacks */ @@ -434,6 +432,8 @@ H5_DLL herr_t H5VLinitialize(hid_t plugin_id, hid_t vipl_id); H5_DLL herr_t H5VLterminate(hid_t plugin_id); H5_DLL herr_t H5VLget_cap_flags(hid_t plugin_id, unsigned *cap_flags); H5_DLL herr_t H5VLcopy_plugin_info(hid_t plugin_id, void **dst_vol_info, void *src_vol_info); +H5_DLL herr_t H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, + const void *info2); H5_DLL herr_t H5VLfree_plugin_info(hid_t plugin_id, void *vol_info); H5_DLL void *H5VLget_object(void *obj, hid_t plugin_id); H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t plugin_id, void **wrap_ctx); diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index e04ddf3..ddee1af 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -74,7 +74,7 @@ tts_error(void) expected_g[0].min_num = H5E_CANTINIT; expected_g[1].maj_num = H5E_VOL; - expected_g[1].min_num = H5E_CANTINIT; + expected_g[1].min_num = H5E_CANTCREATE; expected_g[2].maj_num = H5E_DATASET; expected_g[2].min_num = H5E_CANTINIT; @@ -121,7 +121,7 @@ tts_error(void) H5TS_wait_for_thread(threads[i]); if (error_flag_g) { - TestErrPrintf("At least one thread reported a value that was different from the exected value\n"); + TestErrPrintf("At least one thread reported a value that was different from the expected value\n"); HDprintf("(Update this test if the error stack changed!)\n"); } -- cgit v0.12 From 58202337dd849015f75babe33d34e5fbde18e5e3 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 28 Oct 2018 02:02:45 -0500 Subject: Minor coding style cleanups --- src/H5A.c | 11 +++-------- src/H5D.c | 52 +++++++++++++++++----------------------------------- src/H5Ddeprec.c | 12 ++++-------- 3 files changed, 24 insertions(+), 51 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 10b481c..7a6bd4c 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -829,8 +829,7 @@ H5Aget_type(hid_t attr_id) vol_wrapper_set = TRUE; /* Get the datatype */ - if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_TYPE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute") done: @@ -1393,9 +1392,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, vol_wrapper_set = TRUE; /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, idx, op, op_data)) < 0) + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: @@ -1493,9 +1490,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, vol_wrapper_set = TRUE; /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, idx, op, op_data)) < 0) + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed"); done: diff --git a/src/H5D.c b/src/H5D.c index f6afd93..04809cc 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -164,8 +164,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, vol_wrapper_set = TRUE; /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, - name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ @@ -260,9 +259,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, - NULL, dcpl_id, dapl_id, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ @@ -330,8 +327,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) vol_wrapper_set = TRUE; /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, - dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Register an atom for the dataset */ @@ -411,8 +407,7 @@ H5Dget_space(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataspace */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") done: @@ -443,8 +438,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Get dataspace status */ - if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE_STATUS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0) + if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") done: @@ -485,8 +479,7 @@ H5Dget_type(hid_t dset_id) vol_wrapper_set = TRUE; /* get the datatype */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_TYPE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: @@ -528,8 +521,7 @@ H5Dget_create_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset creation property list */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_DCPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") done: @@ -584,8 +576,7 @@ H5Dget_access_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset access property list */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_DAPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") done: @@ -622,8 +613,7 @@ H5Dget_storage_size(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") /* Get the storage size */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_STORAGE_SIZE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") done: @@ -656,8 +646,7 @@ H5Dget_offset(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") /* Get the offset */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_OFFSET, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") done: @@ -870,8 +859,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, vlen_bufsize.mspace_id = H5I_INVALID_HID; /* Get a copy of the dataset's dataspace */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") /* Create a scalar for the memory dataspace */ @@ -952,8 +940,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set the extent */ - if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_SET_EXTENT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0) + if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") done: @@ -991,8 +978,7 @@ H5Dflush(hid_t dset_id) * XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t * callback needs it and that's in the public API. */ - if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_FLUSH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) + if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") done: @@ -1033,8 +1019,7 @@ H5Drefresh(hid_t dset_id) vol_wrapper_set = TRUE; /* Refresh the dataset object */ - if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_REFRESH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) + if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") done: @@ -1081,8 +1066,7 @@ H5Dformat_convert(hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the dataset */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0) + if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") done: @@ -1118,8 +1102,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") /* Get the chunk indexing type */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) + if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") done: @@ -1160,8 +1143,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") /* Get the dataset creation property list */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) + if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") done: diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index d7b3342..426e33c 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -161,8 +161,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, - H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ @@ -221,8 +220,7 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, - H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Get an atom for the dataset */ @@ -275,8 +273,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* Get the dataspace pointer for the dataset */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0) + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace") if(H5I_INVALID_HID == sid) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset") @@ -306,8 +303,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Increase size */ - if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_SET_EXTENT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0) + if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset") done: -- cgit v0.12 From ad923518098f7c4db9c51085002b9c7dd0a9adc3 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 28 Oct 2018 02:03:08 -0500 Subject: Clean up va_list properly on error. --- src/H5VLcallback.c | 166 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 136 insertions(+), 30 deletions(-) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 9845960..7771b07 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -918,6 +918,7 @@ H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -928,11 +929,15 @@ H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_get() */ @@ -991,6 +996,7 @@ H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t * H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1001,11 +1007,15 @@ H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t * /* Call the corresponding VOL callback */ va_start(arguments, req); - if((cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + arg_started = TRUE; + if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_specific() */ @@ -1043,7 +1053,7 @@ H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr specific' method") /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") done: @@ -1065,6 +1075,7 @@ herr_t H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1075,11 +1086,15 @@ H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->attr_cls.optional)(obj, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_optional() */ @@ -1403,8 +1418,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, + void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1474,6 +1490,7 @@ H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_typ hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1484,11 +1501,15 @@ H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_typ /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_get() */ @@ -1547,6 +1568,7 @@ H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_ hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1557,11 +1579,15 @@ H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_ /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_specific() */ @@ -1621,6 +1647,7 @@ H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1631,11 +1658,15 @@ H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_optional() */ @@ -1906,6 +1937,7 @@ H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1916,11 +1948,15 @@ H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->file_cls.get)(file, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_get() */ @@ -1979,6 +2015,7 @@ H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t spe hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2007,9 +2044,9 @@ H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t spe /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") - va_end(arguments); } /* end if */ else { /* Check if the corresponding VOL callback exists */ @@ -2018,12 +2055,16 @@ H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t spe /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") - va_end(arguments); } /* end else */ done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_specific() */ @@ -2107,6 +2148,7 @@ H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2117,11 +2159,15 @@ H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->file_cls.optional)(file, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_optional() */ @@ -2381,6 +2427,7 @@ H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2391,11 +2438,15 @@ H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_get() */ @@ -2454,6 +2505,7 @@ H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t sp hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2464,11 +2516,15 @@ H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t sp /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_specific() */ @@ -2528,6 +2584,7 @@ H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2538,11 +2595,15 @@ H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_optional() */ @@ -2873,6 +2934,7 @@ H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2883,11 +2945,15 @@ H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_get() */ @@ -2947,6 +3013,7 @@ H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t * H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2957,11 +3024,15 @@ H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t * /* Call the corresponding VOL callback */ va_start(arguments, req); - if((cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + arg_started = TRUE; + if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_specific() */ @@ -2998,7 +3069,7 @@ H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link specific' method") /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") done: @@ -3021,6 +3092,7 @@ H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3031,11 +3103,15 @@ H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_optional() */ @@ -3238,6 +3314,7 @@ H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3248,11 +3325,15 @@ H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_get() */ @@ -3312,6 +3393,7 @@ H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3322,11 +3404,15 @@ H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t /* Call the corresponding VOL callback */ va_start(arguments, req); - if((cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + arg_started = TRUE; + if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_specific() */ @@ -3363,7 +3449,7 @@ H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object specific' method") /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments) < 0) + if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback") done: @@ -3386,6 +3472,7 @@ H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3396,11 +3483,15 @@ H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_optional() */ @@ -3594,6 +3685,7 @@ H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_ty hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3604,11 +3696,15 @@ H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_ty /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_get() */ @@ -3667,6 +3763,7 @@ H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specifi hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3677,11 +3774,15 @@ H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specifi /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_specific() */ @@ -3741,6 +3842,7 @@ H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3751,11 +3853,15 @@ H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Call the corresponding VOL callback */ va_start(arguments, req); + arg_started = TRUE; if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") - va_end(arguments); done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_optional() */ -- cgit v0.12 From 8fd2e1d36e4f9df5d202499204a88cbbdd44461b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 28 Oct 2018 20:51:16 -0500 Subject: Convert attribute VOL callbacks to a standard form that sets up the wrapper object info in a single place. --- src/H5A.c | 80 +++-------- src/H5Adeprec.c | 19 ++- src/H5Aint.c | 2 +- src/H5VLcallback.c | 410 +++++++++++++++++++++++++++++++++++++++++++---------- src/H5VLprivate.h | 14 +- 5 files changed, 373 insertions(+), 152 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 7a6bd4c..711897c 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -296,8 +296,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, attr_name, - acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -307,7 +306,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -402,8 +401,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, attr_name, - acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -413,7 +411,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close (attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -471,8 +469,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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 */ @@ -482,7 +479,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -554,8 +551,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute") /* Register the attribute and get an ID for it */ @@ -565,7 +561,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close (attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -646,8 +642,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -657,7 +652,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -702,8 +697,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Write the attribute data */ - if((ret_value = H5VL_attr_write(vol_obj->data, vol_obj->plugin->cls, - dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_write(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: @@ -745,8 +739,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") /* Read the attribute data */ - if((ret_value = H5VL_attr_read(vol_obj->data, vol_obj->plugin->cls, - dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_read(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: @@ -1247,10 +1240,9 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Rename the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_RENAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name)) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -1308,10 +1300,9 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Rename the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_RENAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name)) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -1365,7 +1356,6 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1386,20 +1376,11 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) + if((ret_value = H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* H5Aiterate2() */ @@ -1454,7 +1435,6 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1484,20 +1464,11 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) + if((ret_value = H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed"); done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* H5Aiterate_by_name() */ @@ -1547,8 +1518,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name)) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1606,8 +1576,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name)) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1677,8 +1646,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute through the VOL */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL)) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1756,8 +1724,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) loc_params.obj_type = H5I_get_type(obj_id); /* Check if the attribute exists */ - if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_EXISTS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -1811,8 +1778,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Check existence of attribute */ - if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_EXISTS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index b7e9ec4..894bbc1 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -156,8 +156,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, - acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, loc_params, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -167,7 +166,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -218,22 +217,21 @@ 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_vol_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 */ - if (NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -291,8 +289,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -302,7 +299,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) diff --git a/src/H5Aint.c b/src/H5Aint.c index 44b11a4..97da9a4 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1163,7 +1163,7 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj) HDassert(attr_vol_obj); /* Close the attribute */ - if((ret_value = H5VL_attr_close(attr_vol_obj->data, attr_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute") /* Free the VOL object */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 7771b07..9610f6a 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -56,6 +56,23 @@ /********************/ /* Local Prototypes */ /********************/ +static void *H5VL__attr_create(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t acpl_id, hid_t aapl_id, + hid_t dxpl_id, void **req); +static void *H5VL__attr_open(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, + void **req); +static herr_tH5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, + void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL___attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, + const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_specific(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); /*********************/ @@ -642,7 +659,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_attr_create + * Function: H5VL__attr_create * * Purpose: Creates an attribute through the VOL * @@ -651,23 +668,60 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +static void * +H5VL__attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC - /* check if the corresponding VOL create callback exists */ + /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.create) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'attr create' method") - /* Call the corresponding VOL create callback */ + /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_create + * + * Purpose: Creates an attribute through the VOL + * + * Return: Success: Pointer to the new attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_create() */ @@ -683,8 +737,8 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ void *ret_value = NULL; /* Return value */ @@ -700,7 +754,7 @@ H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute") done: @@ -709,7 +763,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_attr_open + * Function: H5VL__attr_open * * Purpose: Opens an attribute through the VOL * @@ -718,23 +772,60 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, +static void * +H5VL__attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.open) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'attr open' method") /* Call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->attr_cls.open) (obj, loc_params, name, aapl_id, dxpl_id, req))) + if(NULL == (ret_value = (cls->attr_cls.open)(obj, loc_params, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_open + * + * Purpose: Opens an attribute through the VOL + * + * Return: Success: Pointer to the attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_open() */ @@ -750,8 +841,8 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t aapl_id, hid_t dxpl_id, void **req) +H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, + const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ void *ret_value = NULL; /* Return value */ @@ -767,7 +858,7 @@ H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const ch HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open attribute") done: @@ -776,7 +867,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_attr_read + * Function: H5VL__attr_read * * Purpose: Reads data from attr through the VOL * @@ -785,22 +876,60 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, +static herr_t +H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.read) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr read' method") /* Call the corresponding VOL callback */ - if((cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req) < 0) + if((cls->attr_cls.read)(obj, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_read + * + * Purpose: Reads data from attr through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_read(vol_obj->data, vol_obj->plugin->cls, mem_type_id, buf, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_read() */ @@ -816,7 +945,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_read(void *attr, hid_t plugin_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) +H5VLattr_read(void *obj, hid_t plugin_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ @@ -824,14 +953,14 @@ H5VLattr_read(void *attr, hid_t plugin_id, hid_t mem_type_id, void *buf, hid_t d FUNC_ENTER_API_NOINIT /* Check args and get class pointer */ - if(NULL == attr) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_attr_read(attr, cls, mem_type_id, buf, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") + if(H5VL__attr_read(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -839,7 +968,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_attr_write + * Function: H5VL__attr_write * * Purpose: Writes data to attr through the VOL * @@ -848,23 +977,60 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, +static herr_t +H5VL___attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.write) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr write' method") /* Call the corresponding VOL callback */ - if((cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req) < 0) + if((cls->attr_cls.write)(obj, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_write + * + * Purpose: Writes data to attr through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_write(vol_obj->data, vol_obj->plugin->cls, mem_type_id, buf, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_write() */ @@ -880,7 +1046,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_write(void *attr, hid_t plugin_id, hid_t mem_type_id, const void *buf, +H5VLattr_write(void *obj, hid_t plugin_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ @@ -889,13 +1055,13 @@ H5VLattr_write(void *attr, hid_t plugin_id, hid_t mem_type_id, const void *buf, FUNC_ENTER_API_NOINIT /* Check args and get class pointer */ - if(NULL == attr) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_attr_write(attr, cls, mem_type_id, buf, dxpl_id, req) < 0) + if(H5VL__attr_write(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute") done: @@ -982,9 +1148,41 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__attr_specific + * + * Purpose: Specific operation on attributes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_attr_specific * - * Purpose: specific operation on attributes through the VOL + * Purpose: Specific operation on attributes through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -992,23 +1190,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL_attr_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr specific' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") done: @@ -1016,6 +1216,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_specific() */ @@ -1047,13 +1251,8 @@ H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Bypass the H5VLint layer */ - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr specific' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__attr_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") done: @@ -1062,9 +1261,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_attr_optional + * Function: H5VL__attr_optional * - * Purpose: optional operation specific to plugins. + * Purpose: Optional operation specific to plugins. * * Return: Success: Non-negative * Failure: Negative @@ -1072,22 +1271,56 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr optional' method") /* Call the corresponding VOL callback */ + if((cls->attr_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_optional + * + * Purpose: Optional operation specific to plugins. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_optional(const H5VL_object_t *vol_obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->attr_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if(H5VL__attr_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") done: @@ -1095,6 +1328,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_optional() */ @@ -1124,12 +1361,8 @@ H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr optional' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->attr_cls.optional)(obj, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_optional(obj, cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") done: @@ -1138,7 +1371,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_attr_close + * Function: H5VL__attr_close * * Purpose: Closes an attribute through the VOL * @@ -1147,24 +1380,49 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +static herr_t +H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - /* Sanity check */ - HDassert(attr); - HDassert(cls); - - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr close' method") /* Call the corresponding VOL callback */ - if((cls->attr_cls.close)(attr, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "close failed") + if((cls->attr_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_close + * + * Purpose: Closes an attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1182,7 +1440,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLattr_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1191,13 +1449,13 @@ H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req) H5TRACE4("e", "*xii**x", attr, plugin_id, dxpl_id, req); /* Check args and get class pointer */ - if(NULL == attr) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_attr_close(attr, cls, dxpl_id, req) < 0) + if(H5VL__attr_close(obj, cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute") done: diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index fd44c3b..b2ca1ba 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -103,14 +103,14 @@ H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5V *****************************/ /* 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); -H5_DLL void *H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_attr_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Dataset functions */ H5_DLL void *H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -- cgit v0.12 From ca5ff0c0c2ad95916ed41640419d4c24e78cc83d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 29 Oct 2018 13:15:56 -0500 Subject: Convert dataset callbacks to standard form, for wrapping object IDs, etc. Also, fix a few attribute issues that I missed. --- src/H5A.c | 37 +--- src/H5D.c | 81 ++------ src/H5Ddeprec.c | 12 +- src/H5Dint.c | 7 +- src/H5Dio.c | 12 +- src/H5VLcallback.c | 578 ++++++++++++++++++++++++++++++++++++++++++----------- src/H5VLprivate.h | 18 +- 7 files changed, 513 insertions(+), 232 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 711897c..13ce41b 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -777,8 +777,7 @@ H5Aget_space(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the dataspace */ - if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_SPACE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute") done: @@ -806,7 +805,6 @@ hid_t H5Aget_type(hid_t attr_id) { H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -816,20 +814,11 @@ H5Aget_type(hid_t attr_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Get the datatype */ - if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* H5Aget_type() */ @@ -869,8 +858,7 @@ H5Aget_create_plist(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the acpl */ - if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_ACPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute") done: @@ -920,9 +908,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) loc_params.obj_type = H5I_get_type(attr_id); /* Get the attribute name */ - if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_NAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - loc_params, buf_size, buf, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, buf_size, buf, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") done: @@ -987,8 +973,7 @@ H5Aget_name_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 name */ - if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_NAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name") done: @@ -1027,8 +1012,7 @@ H5Aget_storage_size(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") /* Get the storage size */ - if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_STORAGE_SIZE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl") done: @@ -1067,8 +1051,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) loc_params.obj_type = H5I_get_type(attr_id); /* Get the attribute information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1124,8 +1107,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1188,8 +1170,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: diff --git a/src/H5D.c b/src/H5D.c index 04809cc..5be4c83 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -107,7 +107,6 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist = NULL; /* Property list pointer */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -158,13 +157,8 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, loc_params, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ @@ -172,12 +166,8 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -259,7 +249,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, loc_params, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ @@ -269,7 +259,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close (dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -297,7 +287,6 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) void *dset = NULL; /* dset token from VOL plugin */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -321,13 +310,8 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_open(vol_obj, loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Register an atom for the dataset */ @@ -335,13 +319,10 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") + FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -407,7 +388,7 @@ H5Dget_space(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataspace */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") done: @@ -438,7 +419,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Get dataspace status */ - if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0) + if((ret_value = H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") done: @@ -463,7 +444,6 @@ hid_t H5Dget_type(hid_t dset_id) { H5VL_object_t *vol_obj; /* Dataset structure */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -473,20 +453,11 @@ H5Dget_type(hid_t dset_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* get the datatype */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Dget_type() */ @@ -521,7 +492,7 @@ H5Dget_create_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset creation property list */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") done: @@ -576,7 +547,7 @@ H5Dget_access_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset access property list */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") done: @@ -613,7 +584,7 @@ H5Dget_storage_size(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") /* Get the storage size */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") done: @@ -646,7 +617,7 @@ H5Dget_offset(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") /* Get the offset */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") done: @@ -859,7 +830,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, vlen_bufsize.mspace_id = H5I_INVALID_HID; /* Get a copy of the dataset's dataspace */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") /* Create a scalar for the memory dataspace */ @@ -940,7 +911,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set the extent */ - if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0) + if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") done: @@ -978,7 +949,7 @@ H5Dflush(hid_t dset_id) * XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t * callback needs it and that's in the public API. */ - if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) + if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") done: @@ -999,7 +970,6 @@ herr_t H5Drefresh(hid_t dset_id) { H5VL_object_t *vol_obj; /* Dataset for this operation */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1013,20 +983,11 @@ H5Drefresh(hid_t dset_id) if(H5CX_set_loc(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Refresh the dataset object */ - if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) + if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Drefresh() */ @@ -1066,7 +1027,7 @@ H5Dformat_convert(hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the dataset */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0) + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") done: @@ -1102,7 +1063,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") /* Get the chunk indexing type */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") done: @@ -1143,7 +1104,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") /* Get the dataset creation property list */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") done: diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 426e33c..87b3d8d 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -161,7 +161,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, loc_params, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ @@ -170,7 +170,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, done: if (H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -220,7 +220,7 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_open(vol_obj, loc_params, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Get an atom for the dataset */ @@ -229,7 +229,7 @@ H5Dopen1(hid_t loc_id, const char *name) done: if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -273,7 +273,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* Get the dataspace pointer for the dataset */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace") if(H5I_INVALID_HID == sid) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset") @@ -303,7 +303,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Increase size */ - if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0) + if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset") done: diff --git a/src/H5Dint.c b/src/H5Dint.c index 44a9d88..67889e6 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -300,7 +300,7 @@ H5D__close_cb(H5VL_object_t *dset_vol_obj) HDassert(dset_vol_obj); /* Close the dataset */ - if(H5VL_dataset_close(dset_vol_obj->data, dset_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_close(dset_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset"); done: @@ -2459,10 +2459,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ - if(H5VL_dataset_read(vol_obj->data, vol_obj->plugin->cls, - type_id, vlen_bufsize->mspace_id, - vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, - vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: diff --git a/src/H5Dio.c b/src/H5Dio.c index b30e0c9..ed43f8f 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -191,8 +191,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Read the data */ - if ((ret_value = H5VL_dataset_read(vol_obj->data, vol_obj->plugin->cls, mem_type_id, mem_space_id, - file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) + if ((ret_value = H5VL_dataset_read(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") done: @@ -243,8 +242,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil H5CX_set_dxpl(dxpl_id); /* Read the raw chunk */ - if (H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, - H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) + if (H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") done: @@ -315,8 +313,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Write the data */ - if ((ret_value = H5VL_dataset_write(vol_obj->data, vol_obj->plugin->cls, mem_type_id, mem_space_id, - file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) + if ((ret_value = H5VL_dataset_write(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") done: @@ -373,8 +370,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of H5CX_set_dxpl(dxpl_id); /* Write chunk */ - if (H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, - H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) + if (H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 9610f6a..a543379 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -62,10 +62,12 @@ static void *H5VL__attr_create(void *obj, H5VL_loc_params_t loc_params, static void *H5VL__attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); -static herr_tH5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, +static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL___attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, +static herr_t H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); @@ -73,6 +75,26 @@ static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl void **req, va_list arguments); static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static void *H5VL__dataset_create(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, + hid_t dxpl_id, void **req); +static void *H5VL__dataset_open(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, + hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, + void *buf, void **req); +static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls, + hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, + const void *buf, void **req); +static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, + H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); /*********************/ @@ -814,7 +836,7 @@ H5VL_attr_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, /* Set wrapper info in API context */ if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ @@ -824,7 +846,7 @@ H5VL_attr_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, done: /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_open() */ @@ -978,7 +1000,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL___attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, +H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1070,6 +1092,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__attr_get + * + * Purpose: Get specific information about the attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr get' method") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_attr_get * * Purpose: Get specific information about the attribute through the VOL @@ -1080,30 +1133,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, +H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr get' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + if(H5VL__attr_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") done: /* End access to the va_list, if we started it */ if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_get() */ @@ -1134,12 +1193,8 @@ H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr get' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information") done: @@ -1270,7 +1325,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments) { @@ -1302,8 +1357,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_optional(const H5VL_object_t *vol_obj, const H5VL_class_t *cls, - hid_t dxpl_id, void **req, ...) +H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ @@ -1446,7 +1500,7 @@ H5VLattr_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", attr, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) @@ -1464,7 +1518,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_dataset_create + * Function: H5VL__dataset_create * * Purpose: Creates a dataset through the VOL * @@ -1473,13 +1527,13 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +static void * +H5VL__dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.create) @@ -1491,6 +1545,43 @@ H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_create + * + * Purpose: Creates a dataset through the VOL + * + * Return: Success: Pointer to new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_create() */ @@ -1505,8 +1596,8 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ void *ret_value = NULL; /* Return value */ @@ -1522,7 +1613,7 @@ H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, con HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset") done: @@ -1531,7 +1622,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_dataset_open + * Function: H5VL__dataset_open * * Purpose: Opens a dataset through the VOL * @@ -1540,13 +1631,13 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, +static void * +H5VL__dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.open) @@ -1558,6 +1649,43 @@ H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *c done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_open + * + * Purpose: Opens a dataset through the VOL + * + * Return: Success: Pointer to dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_open() */ @@ -1572,8 +1700,8 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, - hid_t dapl_id, hid_t dxpl_id, void **req) +H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, + const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ void *ret_value = NULL; /* Return value */ @@ -1589,7 +1717,7 @@ H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open dataset") done: @@ -1598,7 +1726,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_dataset_read + * Function: H5VL__dataset_read * * Purpose: Reads data from dataset through the VOL * @@ -1607,24 +1735,62 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, +static herr_t +H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.read) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset read' method") /* Call the corresponding VOL callback */ - if((cls->dataset_cls.read)(dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "read failed") + if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_read + * + * Purpose: Reads data from dataset through the VOL +* + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, + void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_read(vol_obj->data, vol_obj->plugin->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_read() */ @@ -1640,24 +1806,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_read(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, +H5VLdataset_read(void *obj, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, + H5TRACE8("e", "*xiiiii*x**x", obj, plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); /* Check args and get class pointer */ - if(NULL == dset) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_dataset_read(dset, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + if(H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") done: @@ -1666,7 +1832,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_dataset_write + * Function: H5VL__dataset_write * * Purpose: Writes data from dataset through the VOL * @@ -1675,24 +1841,62 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, +static herr_t +H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.write) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset write' method") /* Call the corresponding VOL callback */ - if((cls->dataset_cls.write)(dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_write + * + * Purpose: Writes data from dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, + void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_write(vol_obj->data, vol_obj->plugin->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_write() */ @@ -1708,24 +1912,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_write(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, +H5VLdataset_write(void *obj, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, + H5TRACE8("e", "*xiiiii*x**x", obj, plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); /* Check args and get class pointer */ - if(NULL == dset) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_dataset_write(dset, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + if(H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") done: @@ -1734,6 +1938,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__dataset_get + * + * Purpose: Get specific information about the dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset get' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_dataset_get * * Purpose: Get specific information about the dataset through the VOL @@ -1744,30 +1979,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, +H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset get' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + if(H5VL__dataset_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") done: /* End access to the va_list, if we started it */ if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_get() */ @@ -1783,27 +2024,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_get(void *dset, hid_t plugin_id, H5VL_dataset_get_t get_type, +H5VLdataset_get(void *obj, hid_t plugin_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVci**xx", dset, plugin_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVci**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ - if(NULL == dset) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset get' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback") done: @@ -1812,9 +2049,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__dataset_specific + * + * Purpose: Specific operation on datasets through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset specific' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_dataset_specific * - * Purpose: specific operation on datasets through the VOL + * Purpose: Specific operation on datasets through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -1822,30 +2090,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, +H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset specific' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") + if(H5VL__dataset_specific(vol_obj->data, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") done: /* End access to the va_list, if we started it */ if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_specific() */ @@ -1877,13 +2151,9 @@ H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specifi if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset specific' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1891,9 +2161,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__dataset_optional + * + * Purpose: Optional operation specific to plugins. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset optional' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_dataset_optional * - * Purpose: optional operation specific to plugins. + * Purpose: Optional operation specific to plugins. * * Return: Success: Non-negative * Failure: Negative @@ -1901,30 +2202,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, +H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset optional' method") - /* Call the corresponding VOL callback */ + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 1) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") + if(H5VL__dataset_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: /* End access to the va_list, if we started it */ if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_optional() */ @@ -1955,13 +2263,9 @@ H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset optional' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1969,7 +2273,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_dataset_close + * Function: H5VL__dataset_close * * Purpose: Closes a dataset through the VOL * @@ -1978,26 +2282,68 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +static herr_t +H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Sanity check */ - HDassert(dset); + HDassert(obj); HDassert(cls); /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dset close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset close' method") /* Call the corresponding VOL callback */ - if((cls->dataset_cls.close)(dset, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "close failed") + if((cls->dataset_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_close + * + * Purpose: Closes a dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + HDassert(vol_obj->data); + HDassert(vol_obj->plugin); + HDassert(vol_obj->plugin->cls); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_close() */ @@ -2013,22 +2359,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_close(void *dset, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLdataset_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", dset, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); /* Check args and get class pointer */ - if(NULL == dset) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_dataset_close(dset, cls, dxpl_id, req) < 0) + if(H5VL__dataset_close(obj, cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset") done: diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index b2ca1ba..51d99b4 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -107,20 +107,20 @@ H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t lo H5_DLL void *H5VL_attr_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Dataset functions */ -H5_DLL void *H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); -H5_DLL herr_t H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -H5_DLL herr_t H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void * H5VL_dataset_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* File functions */ H5_DLL void *H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); -- cgit v0.12 From b24259ed8cdb273273f82c2b3f3a2dcac60b32ba Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Mon, 29 Oct 2018 14:24:08 -0500 Subject: Add files and changes to cross compile with CrayLinuxEnvironment and run ctest tests with a batch job on knl compute nodes. --- bin/batch/knl_H5detect.sl.in.cmake | 20 ++++++++++++++++++++ bin/batch/knl_ctestSP.sl | 28 ++++++++++++++++++++++++++++ config/toolchain/crayle.cmake | 20 ++++++++++++++++++++ src/CMakeLists.txt | 6 +++--- 4 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 bin/batch/knl_H5detect.sl.in.cmake create mode 100644 bin/batch/knl_ctestSP.sl create mode 100644 config/toolchain/crayle.cmake diff --git a/bin/batch/knl_H5detect.sl.in.cmake b/bin/batch/knl_H5detect.sl.in.cmake new file mode 100644 index 0000000..39a3ef3 --- /dev/null +++ b/bin/batch/knl_H5detect.sl.in.cmake @@ -0,0 +1,20 @@ +#!/bin/bash + +#SBATCH -p knl -C quad +#SBATCH --nodes=1 +#SBATCH -t 00:10:00 +#SBATCH --mail-type=BEGIN,END,FAIL +#SBATCH --mail-user=@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=knl_h5detect + + +# Inputs: Build directory, output file name, executable file name (username/email if available). +PROGNAME=H5detect +OUTPUT=H5Tinit.c + +CMD="@HDF5_BINARY_DIR@/bin/${PROGNAME} @HDF5_GENERATED_SOURCE_DIR@/${OUTPUT}" +echo "Run $CMD" +srun -n 1 $CMD +echo "Done running $CMD" + diff --git a/bin/batch/knl_ctestSP.sl b/bin/batch/knl_ctestSP.sl new file mode 100644 index 0000000..56da347 --- /dev/null +++ b/bin/batch/knl_ctestSP.sl @@ -0,0 +1,28 @@ +#!/bin/bash + +#SBATCH -p knl -C quad,flat +#SBATCH --nodes=1 +#SBATCH -t 01:00:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + +module load cmake +module load craype-hugepages4M + +cd build +CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" + +echo "Run $CMD. Test output will be in build/ctestS.out" +$CMD >& ctestS.out +echo "Done running $CMD" + + +#run parallel tests except t_cache_image test +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" + +echo "Run $CMD. Test output will be in build/ctestP.out" +$CMD >& ctestP.out +echo "Done running $CMD" + diff --git a/config/toolchain/crayle.cmake b/config/toolchain/crayle.cmake new file mode 100644 index 0000000..a83147b --- /dev/null +++ b/config/toolchain/crayle.cmake @@ -0,0 +1,20 @@ +# Uncomment the following to use cross-compiling +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_COMPILER_VENDOR "CrayLinuxEnvironment") + +set(CMAKE_C_COMPILER cc) +set(CMAKE_Fortran_COMPILER ftn) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") + +# option to use pre-generated H5Tinit.c file +set(HDF5_USE_PREGEN OFF) +# directory where H5Tinit.c file will be found +#set(HDF5_USE_PREGEN_DIR "/lscratch1/lknox/HDF5_1_10_4/CMake-hdf5-1.10.4") + +# option to generate H5Tinit.c by running H5detect on knl compute node during build +set(HDF5_BATCH_H5DETECT ON) +set(HDF5_BATCH_CMD "sbatch") +set(HDF5_BATCH_H5DETECT_SCRIPT "knl_H5detect.sl") +set(MPIEXEC_EXECUTABLE "srun") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 311f8b4..a1bab5c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -943,13 +943,13 @@ 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 + ${HDF5_SOURCE_DIR}/bin/batch/${HDF5_BATCH_H5DETECT_SCRIPT}.in.cmake + ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY ) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c COMMAND ${HDF5_BATCH_CMD} - ARGS ${HDF5_BATCH_H5DETECT_SCRIPT} + ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) -- cgit v0.12 From c9273522e9a7e946802d8545b2532f9129b459a9 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 29 Oct 2018 12:59:25 -0700 Subject: Updated RELEASE.txt to reflect HDFFV-10609 work (H5Xpkg.h files being incorrectly installed). --- release_docs/RELEASE.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 5b56252..73bb149 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -118,6 +118,7 @@ New Features as public and installed them. They are private and will no longer be installed. + HDF5 library private package files (H5Xpkg.h) H5Edefin.h H5Einit.h H5Eterm.h @@ -130,7 +131,7 @@ New Features h5tools_utils.h h5trav.h - (DER - 2018/10/26, HDFFV-10614) + (DER - 2018/10/26, HDFFV-10614, 10609) - Autotools installs now install H5FDwindows.h -- cgit v0.12 From ae0f4a23c074c46db245430e59ac0eb19859e538 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 29 Oct 2018 15:52:32 -0500 Subject: Fix typo in whitespace area --- config/cmake/ConversionTests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index 321d879..c2748b2 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -9,7 +9,7 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -+ + #if defined(__has_attribute) #if __has_attribute(no_sanitize) #define HDF_NO_UBSAN __attribute__((no_sanitize("undefined"))) -- cgit v0.12 From f031cc7b7a11c783e16cd928f534ca0197e61522 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Mon, 29 Oct 2018 16:17:10 -0500 Subject: Add script to run tests with sbatch when not cross compiling. Add new files to MANIFEST. --- MANIFEST | 4 ++++ bin/batch/sbatch_ctestSP.sl | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 bin/batch/sbatch_ctestSP.sl diff --git a/MANIFEST b/MANIFEST index 5733a23..716972d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -92,6 +92,9 @@ ./bin/timekeeper _DO_NOT_DISTRIBUTE_ ./bin/trace ./bin/yodconfigure +./bin/batch/knl_ctestSP.sl +./bin/batch/knl_H5detect.sl.in.cmake +./bin/batch/sbatch_ctestSP.sl ./bin/pkgscrpts/h5rmflags _DO_NOT_DISTRIBUTE_ ./bin/pkgscrpts/makeHDF5BinaryTarfiles.pl _DO_NOT_DISTRIBUTE_ ./bin/pkgscrpts/makeInternalREADME.pl _DO_NOT_DISTRIBUTE_ @@ -3156,6 +3159,7 @@ ./java/lib/ext/slf4j-simple-1.7.25.jar # CMake-specific Files +./config/toolchain/crayle.cmake ./config/toolchain/GCC.cmake ./config/toolchain/intel.cmake diff --git a/bin/batch/sbatch_ctestSP.sl b/bin/batch/sbatch_ctestSP.sl new file mode 100644 index 0000000..56da347 --- /dev/null +++ b/bin/batch/sbatch_ctestSP.sl @@ -0,0 +1,28 @@ +#!/bin/bash + +#SBATCH -p knl -C quad,flat +#SBATCH --nodes=1 +#SBATCH -t 01:00:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + +module load cmake +module load craype-hugepages4M + +cd build +CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" + +echo "Run $CMD. Test output will be in build/ctestS.out" +$CMD >& ctestS.out +echo "Done running $CMD" + + +#run parallel tests except t_cache_image test +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" + +echo "Run $CMD. Test output will be in build/ctestP.out" +$CMD >& ctestP.out +echo "Done running $CMD" + -- cgit v0.12 From aaaf1acc08846684af8750db68cdf6d02bbc540f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 29 Oct 2018 16:52:00 -0500 Subject: Add ref counter to VOL object wrapping in API contexts, so that re-entrant / recursive routines work correctly. Another minor cleanup in the attribute code. --- src/H5Aint.c | 2 +- src/H5VLint.c | 75 +++++++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 54 insertions(+), 23 deletions(-) diff --git a/src/H5Aint.c b/src/H5Aint.c index 97da9a4..8d90cf9 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2628,7 +2628,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5 H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - hid_t obj_loc_id = (-1); /* ID for object located */ + hid_t obj_loc_id = H5I_INVALID_HID; /* ID for object located */ H5A_attr_iter_op_t attr_op; /* Attribute operator */ void *temp_obj = NULL; H5I_type_t obj_type; diff --git a/src/H5VLint.c b/src/H5VLint.c index b00355d..e6e0dbe 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -50,6 +50,7 @@ /* Object wrapping context info */ typedef struct H5VL_wrap_ctx_t { + unsigned rc; /* Ref. count for the # of times the context was set / reset */ const H5VL_t *plugin; /* VOL plugin for "outermost" class to start wrap */ void *obj_wrap_ctx; /* "wrap context" for outermost plugin */ } H5VL_wrap_ctx_t; @@ -857,23 +858,34 @@ H5VL_set_vol_wrapper(void *obj, const H5VL_t *plugin) HDassert(obj); HDassert(plugin); - /* Check if the plugin can create a wrap context */ - if(plugin->cls->get_wrap_ctx) { - /* Sanity check */ - HDassert(plugin->cls->free_wrap_ctx); + /* Retrieve the VOL object wrap context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") - /* Get the wrap context from the plugin */ - if((plugin->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL plugin's object wrap context") - } /* end if */ + /* Check for existing wrapping context */ + if(NULL == vol_wrap_ctx) { + /* Check if the plugin can create a wrap context */ + if(plugin->cls->get_wrap_ctx) { + /* Sanity check */ + HDassert(plugin->cls->free_wrap_ctx); - /* Allocate VOL object wrapper context */ - if(NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context") + /* Get the wrap context from the plugin */ + if((plugin->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL plugin's object wrap context") + } /* end if */ + + /* Allocate VOL object wrapper context */ + if(NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context") - /* Set up VOL object wrapper context */ - vol_wrap_ctx->plugin = plugin; - vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx; + /* Set up VOL object wrapper context */ + vol_wrap_ctx->rc = 1;; + vol_wrap_ctx->plugin = plugin; + vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx; + } /* end if */ + else + /* Incremeent ref count on existing wrapper context */ + vol_wrap_ctx->rc++; /* Save the wrapper context */ if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0) @@ -909,15 +921,34 @@ H5VL_reset_vol_wrapper(void) if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") - /* If there is a VOL plugin object wrapping context, release it */ - if(vol_wrap_ctx->obj_wrap_ctx) { - /* Release the VOL plugin's object wrapping context */ - if((*vol_wrap_ctx->plugin->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release plugin's object wrapping context") - } /* end if */ + /* Check for VOL object wrap context */ + if(NULL == vol_wrap_ctx) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?") + + /* Decrement ref count on wrapping context */ + vol_wrap_ctx->rc--; + + /* Release context if the ref count drops to zero */ + if(0 == vol_wrap_ctx->rc) { + /* If there is a VOL plugin object wrapping context, release it */ + if(vol_wrap_ctx->obj_wrap_ctx) { + /* Release the VOL plugin's object wrapping context */ + if((*vol_wrap_ctx->plugin->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release plugin's object wrapping context") + } /* end if */ - /* Release object wrapping context */ - H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); + /* Release object wrapping context */ + H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); + + /* Reset the wrapper context */ + if(H5CX_set_vol_wrap_ctx(NULL) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") + } /* end if */ + else { + /* Save the updated wrapper context */ + if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12 From 8c37f531a9fd1f0f9e4a432e53ee40a0249e906e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 29 Oct 2018 17:24:33 -0500 Subject: Switch to using VOL callbacks, instead of direct calls to internal routines. --- src/H5Fdeprec.c | 62 ++++++++++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 6fee596..36eae40 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -96,7 +96,8 @@ herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) { - H5F_t *f; /* Top file in mount hierarchy */ + H5VL_object_t *vol_obj = NULL; + H5I_type_t type; H5F_info2_t finfo2; /* Current file info struct */ herr_t ret_value = SUCCEED; /* Return value */ @@ -107,27 +108,17 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) if(!finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - /* For file IDs, get the file object directly - * - * (This prevents the H5G_loc() call from returning the file pointer for - * the top file in a mount hierarchy) - */ - if(H5I_get_type(obj_id) == H5I_FILE ) { - if(NULL == (f = (H5F_t *)H5VL_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - } - else { - H5G_loc_t loc; /* Object location */ - - /* Get symbol table entry */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") - f = loc.oloc->file; - } - HDassert(f->shared); - - /* Get the current file info */ - if(H5F__get_info(f, &finfo2) < 0) + /* Check the type */ + type = H5I_get_type(obj_id); + if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Get the file object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Get the file information */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, &finfo2) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") /* Copy the compatible fields into the older struct */ @@ -165,12 +156,11 @@ H5Fis_hdf5(const char *name) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified") - /* call the private is_HDF5 function */ - if((ret_value = H5F__is_hdf5(name, H5P_FILE_ACCESS_DEFAULT)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable open file") + /* Check if file is accessible */ + if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5") done: - FUNC_LEAVE_API(ret_value) } /* end H5Fis_hdf5() */ @@ -209,16 +199,13 @@ done: * *------------------------------------------------------------------------- */ -/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional'. - */ herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format) { H5VL_object_t *vol_obj; /* File as VOL object */ - H5F_t *f; /* File */ - H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */ - H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */ + H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ib", file_id, latest_format); @@ -226,11 +213,14 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) /* Check args */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") - f = (H5F_t *)(vol_obj->data); + + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(file_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* 'low' and 'high' are both initialized to LATEST. * If latest format is not expected, set 'low' to EARLIEST - */ + */ if(!latest_format) low = H5F_LIBVER_EARLIEST; @@ -238,6 +228,10 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) if(H5F__set_libver_bounds(f, low, high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + /* Set the library's version bounds */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") + done: FUNC_LEAVE_API(ret_value) } /* end H5Fset_latest_format() */ -- cgit v0.12 From 4c6d8d376caca61267a708e82933b9c3d60d6c15 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 29 Oct 2018 17:26:33 -0500 Subject: Remove erroneous call. --- src/H5Fdeprec.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 36eae40..da47e45 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -224,10 +224,6 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) if(!latest_format) low = H5F_LIBVER_EARLIEST; - /* Call private set_libver_bounds function to set the bounds */ - if(H5F__set_libver_bounds(f, low, high) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") - /* Set the library's version bounds */ if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") -- cgit v0.12 From 12e929e1eccfe249b9a75a67c3f15cc4d1d534bc Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 29 Oct 2018 16:06:22 -0700 Subject: Fixed VOL example to use a platform-independent format specifier for size_t. --- examples/h5_vol_external_log_native.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index d6e44db..d3a5dbd 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 %zd\n", n, len); + printf ("Visiting GROUP VOL name = %s %lu\n", n, (unsigned long)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 %zd\n", name, len); + printf ("FILE VOL name = %s %lu\n", name, (unsigned long)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 %zd\n", name, len); + printf ("GROUP VOL name = %s %lu\n", name, (unsigned long)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 %zd\n", name, len); + printf ("DT COMMIT name = %s %lu\n", name, (unsigned long)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 %zd\n", name, len); + printf ("DT OPEN name = %s %lu\n", name, (unsigned long)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 %zd\n", name, len); + printf ("DT OOPEN name = %s %lu\n", name, (unsigned long)len); len = H5Fget_name(file_id, name, 50); - printf("name = %zd %s\n", len, name); + printf("name = %lu %s\n", (unsigned long)len, name); data = malloc (sizeof(int)*nelem); for(i=0;i Date: Tue, 30 Oct 2018 09:53:20 -0700 Subject: Updated MANIFEST file. --- MANIFEST | 1 - 1 file changed, 1 deletion(-) diff --git a/MANIFEST b/MANIFEST index 5733a23..dd379de 100644 --- a/MANIFEST +++ b/MANIFEST @@ -650,7 +650,6 @@ ./src/H5FSmodule.h ./src/H5FSpkg.h ./src/H5FSprivate.h -./src/H5FSpublic.h ./src/H5FSsection.c ./src/H5FSstat.c ./src/H5FStest.c -- cgit v0.12 From 7a5e632c0dd6735269728328aa63a040e0d72e6e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 30 Oct 2018 10:32:17 -0700 Subject: Cleaned up VOL example. --- examples/h5_vol_external_log_native.c | 145 +++++++++++++++------------------- 1 file changed, 62 insertions(+), 83 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index d3a5dbd..26bae30 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -52,63 +52,63 @@ static const H5VL_class_t H5VL_log_g = { NULL, NULL, { /* attribute_cls */ - NULL, //H5VL_log_attr_create, /* create */ - NULL, //H5VL_log_attr_open, /* open */ - NULL, //H5VL_log_attr_read, /* read */ - NULL, //H5VL_log_attr_write, /* write */ - NULL, //H5VL_log_attr_get, /* get */ - NULL, //H5VL_log_attr_specific, /* specific */ - NULL, //H5VL_log_attr_optional, /* optional */ - NULL //H5VL_log_attr_close /* close */ + NULL, /* H5VL_log_attr_create, */ /* create */ + NULL, /* H5VL_log_attr_open, */ /* open */ + NULL, /* H5VL_log_attr_read, */ /* read */ + NULL, /* H5VL_log_attr_write, */ /* write */ + NULL, /* H5VL_log_attr_get, */ /* get */ + NULL, /* H5VL_log_attr_specific, */ /* specific */ + NULL, /* H5VL_log_attr_optional, */ /* optional */ + NULL /* H5VL_log_attr_close */ /* close */ }, { /* dataset_cls */ H5VL_log_dataset_create, /* create */ H5VL_log_dataset_open, /* open */ H5VL_log_dataset_read, /* read */ H5VL_log_dataset_write, /* write */ - NULL, //H5VL_log_dataset_get, /* get */ - NULL, //H5VL_log_dataset_specific, /* specific */ - NULL, //H5VL_log_dataset_optional, /* optional */ + NULL, /* H5VL_log_dataset_get, */ /* get */ + NULL, /* H5VL_log_dataset_specific, */ /* specific */ + NULL, /* H5VL_log_dataset_optional, */ /* optional */ H5VL_log_dataset_close /* close */ }, { /* datatype_cls */ H5VL_log_datatype_commit, /* commit */ H5VL_log_datatype_open, /* open */ H5VL_log_datatype_get, /* get_size */ - NULL, //H5VL_log_datatype_specific, /* specific */ - NULL, //H5VL_log_datatype_optional, /* optional */ + NULL, /* H5VL_log_datatype_specific, */ /* specific */ + NULL, /* H5VL_log_datatype_optional, */ /* optional */ H5VL_log_datatype_close /* close */ }, { /* file_cls */ - H5VL_log_file_create, /* create */ - H5VL_log_file_open, /* open */ - H5VL_log_file_get, /* get */ - NULL, //H5VL_log_file_specific, /* specific */ - NULL, //H5VL_log_file_optional, /* optional */ - H5VL_log_file_close /* close */ + H5VL_log_file_create, /* create */ + H5VL_log_file_open, /* open */ + H5VL_log_file_get, /* get */ + NULL, /* H5VL_log_file_specific, */ /* specific */ + NULL, /* H5VL_log_file_optional, */ /* optional */ + H5VL_log_file_close /* close */ }, { /* group_cls */ - H5VL_log_group_create, /* create */ - NULL, //H5VL_log_group_open, /* open */ - NULL, //H5VL_log_group_get, /* get */ - NULL, //H5VL_log_group_specific, /* specific */ - NULL, //H5VL_log_group_optional, /* optional */ - H5VL_log_group_close /* close */ + H5VL_log_group_create, /* create */ + NULL, /* H5VL_log_group_open, */ /* open */ + NULL, /* H5VL_log_group_get, */ /* get */ + NULL, /* H5VL_log_group_specific, */ /* specific */ + NULL, /* H5VL_log_group_optional, */ /* optional */ + H5VL_log_group_close /* close */ }, { /* link_cls */ - NULL, //H5VL_log_link_create, /* create */ - NULL, //H5VL_log_link_copy, /* copy */ - NULL, //H5VL_log_link_move, /* move */ - NULL, //H5VL_log_link_get, /* get */ - NULL, //H5VL_log_link_specific, /* specific */ - NULL, //H5VL_log_link_optional, /* optional */ + NULL, /* H5VL_log_link_create, */ /* create */ + NULL, /* H5VL_log_link_copy, */ /* copy */ + NULL, /* H5VL_log_link_move, */ /* move */ + NULL, /* H5VL_log_link_get, */ /* get */ + NULL, /* H5VL_log_link_specific, */ /* specific */ + NULL, /* H5VL_log_link_optional, */ /* optional */ }, { /* object_cls */ - H5VL_log_object_open, /* open */ - NULL, //H5VL_log_object_copy, /* copy */ - NULL, //H5VL_log_object_get, /* get */ - H5VL_log_object_specific, /* specific */ - NULL, //H5VL_log_object_optional, /* optional */ + H5VL_log_object_open, /* open */ + NULL, /* H5VL_log_object_copy, */ /* copy */ + NULL, /* H5VL_log_object_get, */ /* get */ + H5VL_log_object_specific, /* specific */ + NULL, /* H5VL_log_object_optional, */ /* optional */ }, { NULL, @@ -123,8 +123,7 @@ typedef struct H5VL_log_t { } H5VL_log_t; static herr_t -visit_cb(hid_t oid, const char *name, - const H5O_info_t *oinfo, void *udata) +visit_cb(hid_t oid, const char *name, const H5O_info_t *oinfo, void *udata) { ssize_t len; char n[25]; @@ -139,9 +138,11 @@ visit_cb(hid_t oid, const char *name, printf("visiting datatype\n"); return 1; -} /* end h5_verify_cached_stabs_cb() */ +} -int main(int argc, char **argv) { +int +main(int argc, char **argv) +{ const char file_name[]="large_dataset.h5"; const char group_name[]="/Group"; const char dataset_name[]="Data"; @@ -184,33 +185,33 @@ 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 %lu\n", name, (unsigned long)len); + printf("FILE VOL name = %s %lu\n", name, (unsigned long)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 %lu\n", name, (unsigned long)len); + printf("GROUP VOL name = %s %lu\n", name, (unsigned long)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 %lu\n", name, (unsigned long)len); + printf("DT COMMIT name = %s %lu\n", name, (unsigned long)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 %lu\n", name, (unsigned long)len); + printf("DT OPEN name = %s %lu\n", name, (unsigned long)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 %lu\n", name, (unsigned long)len); + printf("DT OPEN name = %s %lu\n", name, (unsigned long)len); len = H5Fget_name(file_id, name, 50); printf("name = %lu %s\n", (unsigned long)len, name); - data = malloc (sizeof(int)*nelem); - for(i=0;i Date: Tue, 30 Oct 2018 14:44:54 -0700 Subject: Removed a couple of extraneous commas from VOL example. --- examples/h5_vol_external_log_native.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index 26bae30..616214d 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -101,14 +101,14 @@ static const H5VL_class_t H5VL_log_g = { NULL, /* H5VL_log_link_move, */ /* move */ NULL, /* H5VL_log_link_get, */ /* get */ NULL, /* H5VL_log_link_specific, */ /* specific */ - NULL, /* H5VL_log_link_optional, */ /* optional */ + NULL /* H5VL_log_link_optional, */ /* optional */ }, { /* object_cls */ H5VL_log_object_open, /* open */ NULL, /* H5VL_log_object_copy, */ /* copy */ NULL, /* H5VL_log_object_get, */ /* get */ H5VL_log_object_specific, /* specific */ - NULL, /* H5VL_log_object_optional, */ /* optional */ + NULL /* H5VL_log_object_optional, */ /* optional */ }, { NULL, -- cgit v0.12 From d1d2cf776d4f7b809e3cc1bda1a001ea147dfa89 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Tue, 30 Oct 2018 16:53:09 -0500 Subject: Fix for HDFFV-10554 use_append_chunks in swmr use case test failure Fix the timing issue of the test by moving the open/close of the test file for the writer to use_append_chunk.c and use_append_mchunks.c. --- test/use.h | 2 +- test/use_append_chunk.c | 67 ++++++++++++++++++++++++++++++++++------------ test/use_append_mchunks.c | 68 +++++++++++++++++++++++++++++++++++------------ test/use_common.c | 32 +++++----------------- 4 files changed, 109 insertions(+), 60 deletions(-) diff --git a/test/use.h b/test/use.h index 0885cc5..54d9b26 100644 --- a/test/use.h +++ b/test/use.h @@ -58,6 +58,6 @@ int setup_parameters(int argc, char * const argv[]); void show_parameters(void); void usage(const char *prog); int create_uc_file(void); -int write_uc_file(hbool_t tosend); +int write_uc_file(hbool_t tosend, hid_t fid); int read_uc_file(hbool_t towait); diff --git a/test/use_append_chunk.c b/test/use_append_chunk.c index 005eb51..7dda732 100644 --- a/test/use_append_chunk.c +++ b/test/use_append_chunk.c @@ -124,6 +124,9 @@ main(int argc, char *argv[]) int ret_value = 0; int child_ret_value; hbool_t send_wait = FALSE; + hid_t fapl = -1; /* File access property list */ + hid_t fid = -1; /* File ID */ + char *name; /* Test file name */ /* initialization */ if (setup_parameters(argc, argv) < 0){ @@ -182,29 +185,59 @@ main(int argc, char *argv[]) /* ============= */ /* this process continues to launch the writer */ printf("%d: continue as the writer process\n", mypid); - if (write_uc_file(send_wait) < 0){ - fprintf(stderr, "write_uc_file encountered error\n"); - Hgoto_error(1); + + name = UC_opts.filename; + + /* Set file access proeprty list */ + if((fapl = h5_fileaccess()) < 0) + Hgoto_error(1); + + if(UC_opts.use_swmr) + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + Hgoto_error(1); + + /* Open the file */ + if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) { + fprintf(stderr, "H5Fopen failed\n"); + Hgoto_error(1); + } + + if(write_uc_file(send_wait, fid) < 0) { + fprintf(stderr, "write_uc_file encountered error\n"); + Hgoto_error(1); } /* ================================================ */ /* If readwrite, collect exit code of child process */ /* ================================================ */ if (UC_opts.launch == UC_READWRITE){ - if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0){ - HDperror("waitpid"); - Hgoto_error(1); - } - if (WIFEXITED(child_status)){ - if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ - printf("%d: child process exited with non-zero code (%d)\n", - mypid, child_ret_value); - Hgoto_error(2); - } - } else { - printf("%d: child process terminated abnormally\n", mypid); - Hgoto_error(2); - } + if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0){ + HDperror("waitpid"); + Hgoto_error(1); + } + + /* Close the file */ + if(H5Fclose(fid) < 0) { + fprintf(stderr, "Failed to close file id\n"); + Hgoto_error(1); + } + + /* Close the property list */ + if(H5Pclose(fapl) < 0) { + fprintf(stderr, "Failed to property list\n"); + Hgoto_error(1); + } + + if (WIFEXITED(child_status)){ + if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ + printf("%d: child process exited with non-zero code (%d)\n", + mypid, child_ret_value); + Hgoto_error(2); + } + } else { + printf("%d: child process terminated abnormally\n", mypid); + Hgoto_error(2); + } } done: diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c index 9ee37cb..2dc7bdb 100644 --- a/test/use_append_mchunks.c +++ b/test/use_append_mchunks.c @@ -117,6 +117,9 @@ main(int argc, char *argv[]) int ret_value = 0; int child_ret_value; hbool_t send_wait = 0; + hid_t fapl = -1; /* File access property list */ + hid_t fid = -1; /* File ID */ + char *name; /* Test file name */ /* initialization */ if (setup_parameters(argc, argv) < 0){ @@ -175,29 +178,60 @@ main(int argc, char *argv[]) /* ============= */ /* this process continues to launch the writer */ printf("%d: continue as the writer process\n", mypid); - if (write_uc_file(send_wait) < 0){ - fprintf(stderr, "write_uc_file encountered error\n"); - Hgoto_error(1); + + name = UC_opts.filename; + + /* Set the file access property list */ + if((fapl = h5_fileaccess()) < 0) + Hgoto_error(1); + + if(UC_opts.use_swmr) + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + Hgoto_error(1); + + /* Open the file */ + if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) { + fprintf(stderr, "H5Fopen failed\n"); + Hgoto_error(1); + } + + if(write_uc_file(send_wait, fid) < 0) { + fprintf(stderr, "write_uc_file encountered error\n"); + Hgoto_error(1); } + /* ================================================ */ /* If readwrite, collect exit code of child process */ /* ================================================ */ if (UC_opts.launch == UC_READWRITE){ - if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0){ - perror("waitpid"); - Hgoto_error(1); - } - if (WIFEXITED(child_status)){ - if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ - printf("%d: child process exited with non-zero code (%d)\n", - mypid, child_ret_value); - Hgoto_error(2); - } - } else { - printf("%d: child process terminated abnormally\n", mypid); - Hgoto_error(2); - } + if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0){ + perror("waitpid"); + Hgoto_error(1); + } + + /* Close the file */ + if(H5Fclose(fid) < 0) { + fprintf(stderr, "Failed to close file id\n"); + Hgoto_error(1); + } + + /* Close the property list */ + if(H5Pclose(fapl) < 0) { + fprintf(stderr, "Failed to property list\n"); + Hgoto_error(1); + } + + if (WIFEXITED(child_status)){ + if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ + printf("%d: child process exited with non-zero code (%d)\n", + mypid, child_ret_value); + Hgoto_error(1); + } + } else { + printf("%d: child process terminated abnormally\n", mypid); + Hgoto_error(2); + } } done: diff --git a/test/use_common.c b/test/use_common.c index 5aa6692..164480f 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -252,13 +252,10 @@ int create_uc_file(void) * * Return: 0 succeed; -1 fail. */ -int write_uc_file(hbool_t tosend) +int write_uc_file(hbool_t tosend, hid_t fid) { - hid_t fid; /* File ID for new HDF5 file */ hid_t dsid; /* dataset ID */ - hid_t fapl; /* File access property list */ hid_t dcpl; /* Dataset creation property list */ - char *name; UC_CTYPE *buffer, *bufptr; /* data buffer */ hsize_t cz=UC_opts.chunksize; /* Chunk size */ hid_t f_sid; /* dataset file space id */ @@ -270,19 +267,6 @@ int write_uc_file(hbool_t tosend) hsize_t start[3] = {0,0,0}, count[3]; /* Hyperslab selection values */ hsize_t i, j, k; - name = UC_opts.filename; - - /* Open the file */ - if((fapl = h5_fileaccess()) < 0) - return -1; - if(UC_opts.use_swmr) - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; - if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0){ - fprintf(stderr, "H5Fopen failed\n"); - return -1; - } - if(tosend) /* Send a message that H5Fopen is complete--releasing the file lock */ h5_send_message(WRITER_MESSAGE, NULL, NULL); @@ -427,14 +411,6 @@ int write_uc_file(hbool_t tosend) fprintf(stderr, "Failed to close file space\n"); return -1; } - if (H5Pclose(fapl) < 0){ - fprintf(stderr, "Failed to property list\n"); - return -1; - } - if (H5Fclose(fid) < 0){ - fprintf(stderr, "Failed to close file id\n"); - return -1; - } return 0; } @@ -645,6 +621,12 @@ int read_uc_file(hbool_t towait) } } + /* Close the file */ + if(H5Fclose(fid) < 0) { + fprintf(stderr, "H5Fclose failed\n"); + return -1; + } + if (nreadererr) return -1; else -- cgit v0.12 From b72e926ed0c981d14d5219b32042c3d0b938d1e1 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Wed, 31 Oct 2018 09:54:08 -0500 Subject: A trivial change to reformat a comment. The purpose is simply to try out Git. --- src/H5Dchunk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 30a9a3b..22dc05a 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2784,8 +2784,8 @@ done: /*------------------------------------------------------------------------- * Function: H5D__chunk_hash_val * - * Purpose: To calculate an index based on the dataset's scaled coordinates and - * sizes of the faster dimensions. + * Purpose: To calculate an index based on the dataset's scaled + * coordinates and sizes of the faster dimensions. * * Return: Hash value index * -- cgit v0.12 From d66d5e01c0605e5dc3b5c975419aaf551a4458b0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 31 Oct 2018 18:18:45 -0500 Subject: Refactor and standarize file object callbacks, including some fixes on the dataset callbacks. --- src/H5Dio.c | 4 +- src/H5F.c | 74 +++++----- src/H5Fdeprec.c | 6 +- src/H5Fint.c | 13 +- src/H5Fmount.c | 26 +--- src/H5VLcallback.c | 393 +++++++++++++++++++++++++++++++++++------------------ src/H5VLprivate.h | 8 +- test/tfile.c | 36 +++-- 8 files changed, 338 insertions(+), 222 deletions(-) diff --git a/src/H5Dio.c b/src/H5Dio.c index ed43f8f..f977b0e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -242,7 +242,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil H5CX_set_dxpl(dxpl_id); /* Read the raw chunk */ - if (H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) + if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") done: @@ -370,7 +370,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of H5CX_set_dxpl(dxpl_id); /* Write chunk */ - if (H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) + if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: diff --git a/src/H5F.c b/src/H5F.c index 75d6c04..ffa2d9a 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -199,7 +199,7 @@ H5F__close_cb(H5VL_object_t *file_vol_obj) HDassert(file_vol_obj); /* Close the file */ - if(H5VL_file_close(file_vol_obj->data, file_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); /* Free the VOL object */ @@ -239,8 +239,7 @@ H5Fget_create_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file creation property list */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_FCPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") done: @@ -280,8 +279,7 @@ H5Fget_access_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_FAPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") done: @@ -350,8 +348,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id") /* Get the count */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_OBJ_COUNT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)") } /* If we passed in the 'special' ID, get the count for everything open in the @@ -462,8 +459,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the IDs */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_OBJ_IDS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") } /* end if */ /* If we passed in the 'special' ID, get the count for everything open in the @@ -536,7 +532,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: @@ -573,7 +569,7 @@ H5Fis_accessible(const char *name, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Check if file is accessible */ - if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) + if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") done: @@ -776,7 +772,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Flush the object */ - if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) + if(H5VL_file_specific(vol_obj, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") done: @@ -851,7 +847,7 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Reopen the file */ - if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) + if(H5VL_file_specific(vol_obj, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL plugin") /* Make sure that worked */ @@ -895,7 +891,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the flags */ - if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) + if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags") } /* end if */ @@ -929,7 +925,7 @@ H5Fget_freespace(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the amount of free space in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") done: @@ -964,7 +960,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the file size */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") done: @@ -1025,7 +1021,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") /* Get the file image */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: @@ -1065,7 +1061,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: @@ -1098,8 +1094,7 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") done: @@ -1135,7 +1130,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the current hit rate */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: @@ -1172,7 +1167,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the size data */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") done: @@ -1210,7 +1205,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") done: @@ -1259,7 +1254,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the filename via the VOL */ - if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name") done: @@ -1304,7 +1299,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") done: @@ -1340,7 +1335,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") done: @@ -1379,7 +1374,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: @@ -1412,7 +1407,7 @@ H5Fclear_elink_file_cache(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Release the EFC */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") done: @@ -1472,7 +1467,7 @@ H5Fstart_swmr_write(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Start SWMR writing */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: @@ -1504,8 +1499,7 @@ H5Fstart_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") done: @@ -1538,7 +1532,7 @@ H5Fstop_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") done: @@ -1572,7 +1566,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") done: @@ -1610,7 +1604,7 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set the library's version bounds */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: @@ -1647,7 +1641,7 @@ H5Fformat_convert(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the format */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") done: @@ -1678,7 +1672,7 @@ H5Freset_page_buffering_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") done: @@ -1713,7 +1707,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2 HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats") /* Get the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") done: @@ -1748,7 +1742,7 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Go get the address and size of the cache image */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") done: @@ -1782,7 +1776,7 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa) /* Only do work if valid pointer to fill in */ if(eoa) { /* Retrieve the EOA for the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_EOA, eoa) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_EOA, eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") } /* end if */ @@ -1813,7 +1807,7 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Increment the file size */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_INCR_FILESIZE, increment) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_INCR_FILESIZE, increment) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size") done: diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index da47e45..dfc1441 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -118,7 +118,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, &finfo2) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, &finfo2) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") /* Copy the compatible fields into the older struct */ @@ -157,7 +157,7 @@ H5Fis_hdf5(const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified") /* Check if file is accessible */ - if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0) + if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5") done: @@ -225,7 +225,7 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) low = H5F_LIBVER_EARLIEST; /* Set the library's version bounds */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: diff --git a/src/H5Fint.c b/src/H5Fint.c index 0e35bea..fe387a5 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3529,14 +3529,8 @@ H5F_get_file_id(hid_t obj_id, H5I_type_t type) if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Get the file through the VOL */ - if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_FILE, type, &file) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE, type, &file) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file") if(NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file through the VOL") @@ -3547,6 +3541,11 @@ H5F_get_file_id(hid_t obj_id, H5I_type_t type) /* If the ID does not exist, register it with the VOL plugin */ if(H5I_INVALID_HID == ret_value) { + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + { void *vol_wrap_ctx = NULL; /* Object wrapping context */ diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 0e3c06d..4a67cc2 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -443,7 +443,6 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) H5VL_object_t *child_vol_obj = NULL; /* Child object */ H5I_type_t loc_type; /* ID type of location */ H5I_type_t child_type; /* ID type of child */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -482,21 +481,11 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) if(loc_vol_obj->plugin->cls->value != child_vol_obj->plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL plugin") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(loc_vol_obj->data, loc_vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Perform the mount operation */ - if(H5VL_file_specific(loc_vol_obj->data, loc_vol_obj->plugin->cls, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) + if(H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Fmount() */ @@ -522,7 +511,6 @@ H5Funmount(hid_t loc_id, const char *name) { H5VL_object_t *vol_obj = NULL; /* Parent object */ H5I_type_t loc_type; /* ID type of location */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -545,21 +533,11 @@ H5Funmount(hid_t loc_id, const char *name) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Perform the unmount operation */ - if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_UNMOUNT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0) + if(H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Funmount() */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index a543379..6d28f83 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -95,6 +95,14 @@ static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); /*********************/ @@ -1195,7 +1203,7 @@ H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id /* Call the corresponding internal VOL routine */ if(H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1227,7 +1235,7 @@ H5VL__attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t /* Call the corresponding VOL callback */ if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1264,7 +1272,7 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, va_start(arguments, req); arg_started = TRUE; if((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") done: /* End access to the va_list, if we started it */ @@ -1308,7 +1316,7 @@ H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, /* Call the corresponding internal VOL routine */ if((ret_value = H5VL__attr_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1339,7 +1347,7 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Call the corresponding VOL callback */ if((cls->attr_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1375,7 +1383,7 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) va_start(arguments, req); arg_started = TRUE; if(H5VL__attr_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: /* End access to the va_list, if we started it */ @@ -1417,7 +1425,7 @@ H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list /* Call the corresponding internal VOL routine */ if(H5VL__attr_optional(obj, cls, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2041,7 +2049,7 @@ H5VLdataset_get(void *obj, hid_t plugin_id, H5VL_dataset_get_t get_type, /* Call the corresponding internal VOL routine */ if(H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2214,7 +2222,7 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, /* Call the corresponding VOL callback */ /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 1) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2387,6 +2395,9 @@ done: * * Purpose: Creates a file through the VOL * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * * Return: Success: Pointer to new file * Failure: NULL * @@ -2459,6 +2470,9 @@ done: * * Purpose: Opens a file through the VOL. * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * * Return: Success: Pointer to file. * Failure: NULL * @@ -2527,6 +2541,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__file_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file get' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_file_get * * Purpose: Get specific information about the file through the VOL @@ -2537,30 +2582,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, +H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file get' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->file_cls.get)(file, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + if(H5VL__file_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") done: /* End access to the va_list, if we started it */ if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_get() */ @@ -2576,28 +2627,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, +H5VLfile_get(void *obj, hid_t plugin_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVgi**xx", file, plugin_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVgi**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ - if(NULL == file) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file get' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->file_cls.get)(file, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute file get callback") + /* Call the corresponding internal VOL routine */ + if(H5VL__file_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2605,9 +2652,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__file_specific + * + * Purpose: Perform File specific operations through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file specific' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_file_specific * - * Purpose: perform File specific operations through the VOL + * Purpose: Perform File specific operations through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -2615,28 +2693,34 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, +H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) { + const H5VL_class_t *cls; /* VOL plugin's class struct */ va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Start access to the varargs, so they are available in all situations below */ + va_start(arguments, req); + arg_started = TRUE; + /* Special treatment of file access check */ if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { H5P_genplist_t *plist; /* Property list pointer */ H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ va_list tmp_args; /* argument list passed from the API call */ - hid_t fapl_id; + hid_t fapl_id; /* File access property list for accessing the file */ - /* Get the file access property list */ - va_start(tmp_args, req); + /* Get the file access property list to access the file */ + va_copy(tmp_args, arguments); fapl_id = va_arg(tmp_args, hid_t); va_end(tmp_args); - /* Get the VOL info from the fapl */ + /* Get the VOL info from the FAPL */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) @@ -2645,30 +2729,34 @@ H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t spe /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Call the corresponding VOL callback */ - va_start(arguments, req); - arg_started = TRUE; - if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") } /* end if */ + /* Set wrapper info in API context, for all other operations */ else { - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file specific' method") - - /* Call the corresponding VOL callback */ - va_start(arguments, req); - arg_started = TRUE; - if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + /* Sanity check */ + HDassert(vol_obj); + + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Set the VOL plugin class pointer */ + cls = vol_obj->plugin->cls; } /* end else */ + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + done: /* End access to the va_list, if we started it */ if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_specific() */ @@ -2678,69 +2766,72 @@ done: * * Purpose: Performs a plugin-specific operation on a file * + * Note: The 'obj' parameter is allowed to be NULL + * * Return: Success: Non-negative * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VLfile_specific(void *file, hid_t plugin_id, H5VL_file_specific_t specific_type, +H5VLfile_specific(void *obj, hid_t plugin_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVhi**xx", file, plugin_id, specific_type, dxpl_id, req, + H5TRACE6("e", "*xiVhi**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); - /* Special treatment of file access check */ - if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ - hid_t fapl_id; + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - fapl_id = va_arg(arguments, hid_t); + /* Call the corresponding internal VOL routine */ + if(H5VL__file_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback") - /* Get the VOL info from the fapl */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_specific() */ - /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + +/*------------------------------------------------------------------------- + * Function: H5VL__file_optional + * + * Purpose: Perform a plugin specific operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") - } /* end if */ - else { - /* Check args and get class pointer */ - if(NULL == file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file specific' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file specific callback") - } /* end else */ + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file optional' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLfile_specific() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_optional() */ /*------------------------------------------------------------------------- * Function: H5VL_file_optional * - * Purpose: perform a plugin specific operation + * Purpose: Perform a plugin specific operation * * Return: Success: Non-negative * Failure: Negative @@ -2748,23 +2839,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, ...) +H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file optional' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->file_cls.optional)(file, dxpl_id, req, arguments) < 0) + if(H5VL__file_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: @@ -2772,6 +2864,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_optional() */ @@ -2787,28 +2883,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *file, hid_t plugin_id, hid_t dxpl_id, void **req, +H5VLfile_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", file, plugin_id, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); /* Check args and get class pointer */ - if(NULL == file) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file optional' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->file_cls.optional)(file, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback") + /* Call the corresponding internal VOL routine */ + if(H5VL__file_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2816,7 +2908,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_file_close + * Function: H5VL__file_close * * Purpose: Closes a file through the VOL * @@ -2825,14 +2917,15 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +static herr_t +H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC - HDassert(file); + /* Sanity check */ + HDassert(obj); HDassert(cls); /* Check if the corresponding VOL callback exists */ @@ -2840,11 +2933,47 @@ H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file close' method") /* Call the corresponding VOL callback */ - if((cls->file_cls.close)(file, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed") + if((cls->file_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_close + * + * Purpose: Closes a file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_close() */ @@ -2859,22 +2988,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLfile_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", file, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); /* Check args and get class pointer */ - if(NULL == file) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_file_close(file, cls, dxpl_id, req) < 0) + if(H5VL__file_close(obj, cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") done: @@ -3087,7 +3216,7 @@ H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute group get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3122,7 +3251,7 @@ H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t sp va_start(arguments, req); arg_started = TRUE; if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: /* End access to the va_list, if we started it */ @@ -3166,7 +3295,7 @@ H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_ty /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3201,7 +3330,7 @@ H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, va_start(arguments, req); arg_started = TRUE; if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: /* End access to the va_list, if we started it */ @@ -3243,7 +3372,7 @@ H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_lis /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3595,7 +3724,7 @@ H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute link get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3630,7 +3759,7 @@ H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t * va_start(arguments, req); arg_started = TRUE; if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") done: /* End access to the va_list, if we started it */ @@ -3674,7 +3803,7 @@ H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, /* Bypass the H5VLint layer, calling the VOL callback directly */ if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3709,7 +3838,7 @@ H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, va_start(arguments, req); arg_started = TRUE; if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: /* End access to the va_list, if we started it */ @@ -3751,7 +3880,7 @@ H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3975,7 +4104,7 @@ H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_ob /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute object get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4054,7 +4183,7 @@ H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, /* Bypass the H5VLint layer, calling the VOL callback directly */ if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4089,7 +4218,7 @@ H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, va_start(arguments, req); arg_started = TRUE; if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: /* End access to the va_list, if we started it */ @@ -4131,7 +4260,7 @@ H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_li /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4345,7 +4474,7 @@ H5VLdatatype_get(void *obj, hid_t plugin_id, H5VL_datatype_get_t get_type, /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute datatype get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4380,7 +4509,7 @@ H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specifi va_start(arguments, req); arg_started = TRUE; if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: /* End access to the va_list, if we started it */ @@ -4424,7 +4553,7 @@ H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t speci /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4459,7 +4588,7 @@ H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, va_start(arguments, req); arg_started = TRUE; if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: /* End access to the va_list, if we started it */ @@ -4502,7 +4631,7 @@ H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, /* Bypass the H5VLint layer, calling the VOL callback directly */ if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: FUNC_LEAVE_API_NOINIT(ret_value) diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 51d99b4..1e91523 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -125,10 +125,10 @@ H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, vo /* File functions */ H5_DLL void *H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Group functions */ H5_DLL void *H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); diff --git a/test/tfile.c b/test/tfile.c index f7ac243..e342da0 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1600,6 +1600,7 @@ test_file_is_accessible(void) { hid_t fid; /* File opened with read-write permission */ hid_t fcpl_id; /* File creation property list */ + hid_t fapl = -1; /* File access property list */ int fd; /* POSIX file descriptor */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ @@ -1610,8 +1611,12 @@ test_file_is_accessible(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Detection of HDF5 Files\n")); + /* Get FAPL */ + fapl = h5_fileaccess(); + CHECK(fapl, FAIL, "H5Pcreate"); + /* Create a file */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Close file */ @@ -1619,7 +1624,7 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, H5P_DEFAULT); + status = H5Fis_accessible(FILE1, fapl); VERIFY(status, TRUE, "H5Fis_accessible"); @@ -1631,7 +1636,7 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Pset_userblock"); /* Create file with non-default user block */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Release file-creation property list */ @@ -1643,7 +1648,7 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, H5P_DEFAULT); + status = H5Fis_accessible(FILE1, fapl); VERIFY(status, TRUE, "H5Fis_accessible"); @@ -1664,9 +1669,13 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "HDclose"); /* Verify that the file is not an HDF5 file */ - status = H5Fis_accessible(FILE1, H5P_DEFAULT); + status = H5Fis_accessible(FILE1, fapl); VERIFY(status, FALSE, "H5Fis_accessible"); + /* Close property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end test_file_is_accessible() */ @@ -1683,6 +1692,7 @@ test_file_ishdf5(void) { hid_t file; /* File opened with read-write permission */ hid_t fcpl; /* File creation property list */ + hid_t fapl = -1; /* File access property list */ int fd; /* File Descriptor */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ @@ -1693,8 +1703,12 @@ test_file_ishdf5(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Detection of HDF5 Files (using deprecated H5Fis_hdf5() call)\n")); + /* Get FAPL */ + fapl = h5_fileaccess(); + CHECK(fapl, FAIL, "H5Pcreate"); + /* Create a file */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Close file */ @@ -1714,7 +1728,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Pset_userblock"); /* Create file with non-default user block */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Release file-creation property list */ @@ -1750,6 +1764,10 @@ test_file_ishdf5(void) status = H5Fis_hdf5(FILE1); VERIFY(status, FALSE, "H5Fis_hdf5"); + /* Close property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end test_file_ishdf5() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -2240,10 +2258,8 @@ test_file_double_file_dataset_open(hbool_t new_format) MESSAGE(5, ("Testing double file and dataset open/close\n")); /* Setting up test file */ - - fapl = H5Pcreate(H5P_FILE_ACCESS); + fapl = h5_fileaccess(); CHECK(fapl, FAIL, "H5Pcreate"); - if(new_format) { ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); -- cgit v0.12 From ef7c458d73977b23dceabd24b98029dd9f616816 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 31 Oct 2018 18:41:19 -0500 Subject: Update for change in error stack when opening a dataset. --- test/ttsafe_error.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index ddee1af..56d87ee 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -76,26 +76,29 @@ tts_error(void) expected_g[1].maj_num = H5E_VOL; expected_g[1].min_num = H5E_CANTCREATE; - expected_g[2].maj_num = H5E_DATASET; - expected_g[2].min_num = H5E_CANTINIT; + expected_g[2].maj_num = H5E_VOL; + expected_g[2].min_num = H5E_CANTCREATE; expected_g[3].maj_num = H5E_DATASET; expected_g[3].min_num = H5E_CANTINIT; - expected_g[4].maj_num = H5E_LINK; + expected_g[4].maj_num = H5E_DATASET; expected_g[4].min_num = H5E_CANTINIT; expected_g[5].maj_num = H5E_LINK; - expected_g[5].min_num = H5E_CANTINSERT; + expected_g[5].min_num = H5E_CANTINIT; - expected_g[6].maj_num = H5E_SYM; - expected_g[6].min_num = H5E_NOTFOUND; + expected_g[6].maj_num = H5E_LINK; + expected_g[6].min_num = H5E_CANTINSERT; expected_g[7].maj_num = H5E_SYM; - expected_g[7].min_num = H5E_CALLBACK; + expected_g[7].min_num = H5E_NOTFOUND; - expected_g[8].maj_num = H5E_LINK; - expected_g[8].min_num = H5E_EXISTS; + expected_g[8].maj_num = H5E_SYM; + expected_g[8].min_num = H5E_CALLBACK; + + expected_g[9].maj_num = H5E_LINK; + expected_g[9].min_num = H5E_EXISTS; /* set up mutex for global count of errors */ H5TS_mutex_init(&error_mutex_g); -- cgit v0.12 From a39486a341dd6cb1859ecd489e0d23e9fd1aa069 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 31 Oct 2018 19:17:37 -0500 Subject: Refactor and standardize group VOL callbacks. --- src/H5G.c | 59 +++------ src/H5Gdeprec.c | 10 +- src/H5VLcallback.c | 341 ++++++++++++++++++++++++++++++++++++++++++++--------- src/H5VLprivate.h | 12 +- 4 files changed, 307 insertions(+), 115 deletions(-) diff --git a/src/H5G.c b/src/H5G.c index 3845c7e..ca89993 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -278,7 +278,7 @@ H5G__close_cb(H5VL_object_t *grp_vol_obj) HDassert(grp_vol_obj); /* Close the group */ - if(H5VL_group_close(grp_vol_obj->data, grp_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_group_close(grp_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") /* Free the VOL object */ @@ -321,7 +321,6 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -365,14 +364,8 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, - gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ @@ -380,12 +373,8 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -455,8 +444,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, - gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ @@ -466,7 +454,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -492,10 +480,9 @@ hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { void *grp = NULL; /* Group opened */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, gapl_id); @@ -518,13 +505,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - - if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_open(vol_obj, loc_params, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Register an ID for the group */ @@ -532,12 +513,8 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -571,8 +548,7 @@ H5Gget_create_plist(hid_t group_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID") /* Get the group creation property list for the group */ - if(H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_GCPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_GCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") done: @@ -614,8 +590,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info) /* Retrieve the group's information */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = id_type; - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if((ret_value = H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -667,8 +642,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if((ret_value = H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -728,8 +702,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if((ret_value = H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -800,8 +773,7 @@ H5Gflush(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Flush group's metadata to file */ - if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_FLUSH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) + if(H5VL_group_specific(vol_obj, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") done: @@ -845,8 +817,7 @@ H5Grefresh(hid_t group_id) vol_wrapper_set = TRUE; /* Refresh group's metadata */ - if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_REFRESH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) + if(H5VL_group_specific(vol_obj, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index d207bc1..df5a1d8 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -235,8 +235,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, tmp_gcpl, - H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ @@ -249,7 +248,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -297,8 +296,7 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the group */ - if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_open(vol_obj, loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Get an atom for the group */ @@ -307,7 +305,7 @@ H5Gopen1(hid_t loc_id, const char *name) done: if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 6d28f83..24d9c5c 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -103,6 +103,20 @@ static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl void **req, va_list arguments); static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static void *H5VL__group_create(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, + hid_t dxpl_id, void **req); +static void *H5VL__group_open(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req); /*********************/ @@ -3012,7 +3026,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_group_create + * Function: H5VL__group_create * * Purpose: Creates a group through the VOL * @@ -3021,13 +3035,13 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +static void * +H5VL__group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.create) @@ -3039,6 +3053,43 @@ H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *c done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_create + * + * Purpose: Creates a group through the VOL + * + * Return: Success: Pointer to new group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_create() */ @@ -3070,7 +3121,7 @@ H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group") done: @@ -3079,7 +3130,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_group_open + * Function: H5VL__group_open * * Purpose: Opens a group through the VOL * @@ -3088,13 +3139,13 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +static void * +H5VL__group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.open) @@ -3106,6 +3157,43 @@ H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_open + * + * Purpose: Opens a group through the VOL + * + * Return: Success: Pointer to group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_open() */ @@ -3137,7 +3225,7 @@ H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const c HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") done: @@ -3146,6 +3234,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__group_get + * + * Purpose: Get specific information about the group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group get' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_group_get * * Purpose: Get specific information about the group through the VOL @@ -3156,23 +3275,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, +H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group get' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__group_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") done: @@ -3180,6 +3301,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_get() */ @@ -3210,12 +3335,8 @@ H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group get' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__group_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") done: @@ -3224,6 +3345,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__group_specific + * + * Purpose: Specific operation on groups through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group specific' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_group_specific * * Purpose: Specific operation on groups through the VOL @@ -3234,23 +3386,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, +H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group specific' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + if(H5VL__group_specific(vol_obj->data, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: @@ -3258,6 +3412,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_specific() */ @@ -3289,12 +3447,8 @@ H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_ty if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group specific' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__group_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: @@ -3303,6 +3457,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__group_optional + * + * Purpose: Optional operation specific to plugins. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group optional' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_group_optional * * Purpose: Optional operation specific to plugins. @@ -3313,23 +3498,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, ...) +H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group optional' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if(H5VL__group_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3337,6 +3523,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_optional() */ @@ -3352,7 +3542,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, + va_list arguments) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3366,12 +3557,8 @@ H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_lis if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group optional' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__group_optional(obj, cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3380,7 +3567,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_group_close + * Function: H5VL__group_close * * Purpose: Closes a group through the VOL * @@ -3389,27 +3576,63 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +static herr_t +H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ /* Sanity check */ - HDassert(grp); + HDassert(obj); HDassert(cls); - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group close' method") /* Call the corresponding VOL callback */ - if((cls->group_cls.close)(grp, dxpl_id, req) < 0) + if((cls->group_cls.close)(obj, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_close + * + * Purpose: Closes a group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__group_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_close() */ @@ -3424,22 +3647,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLgroup_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", grp, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); /* Check args and get class pointer */ - if(NULL == grp) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_group_close(grp, cls, dxpl_id, req) < 0) + if(H5VL__group_close(obj, cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group") done: diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 1e91523..fab4bbf 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -131,12 +131,12 @@ H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, vo H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Group functions */ -H5_DLL void *H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void * H5VL_group_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Link functions */ H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -- cgit v0.12 From a5cc4e272b73384600b2b20429d4189e820a0451 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 1 Nov 2018 11:22:54 -0500 Subject: Refactor and standardize the link VOL callbacks. Also fix error stack for testing. --- src/H5Gdeprec.c | 45 +++--- src/H5L.c | 128 ++++------------ src/H5Lexternal.c | 3 +- src/H5O.c | 9 +- src/H5VLcallback.c | 365 +++++++++++++++++++++++++++++++++++++------- src/H5VLprivate.h | 12 +- test/testfiles/error_test_1 | 17 ++- 7 files changed, 382 insertions(+), 197 deletions(-) diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index df5a1d8..769ec42 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -349,6 +349,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ loc_params1.type = H5VL_OBJECT_BY_NAME; loc_params1.obj_type = H5I_get_type(cur_loc_id); @@ -369,11 +370,14 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params") + /* Construct a temporary VOL object */ + tmp_vol_obj.data = NULL; + tmp_vol_obj.plugin = vol_obj->plugin; + /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->plugin->cls, - lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end if */ else if(type == H5L_TYPE_SOFT) { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; @@ -392,10 +396,9 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls, - lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end else-if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type") @@ -467,10 +470,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->plugin->cls, - lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end if */ else if(type == H5L_TYPE_SOFT) { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; @@ -494,10 +496,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls, - lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end else-if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type") @@ -542,8 +543,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->plugin->cls, - H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_move(vol_obj, loc_params1, NULL, loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: @@ -580,27 +580,24 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params1.loc_data.loc_by_name.name = src_name; loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; loc_params1.obj_type = H5I_get_type(src_loc_id); + /* Set location parameter for destination object */ loc_params2.type = H5VL_OBJECT_BY_NAME; loc_params2.loc_data.loc_by_name.name = dst_name; loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; loc_params2.obj_type = H5I_get_type(dst_loc_id); - if(H5L_SAME_LOC != src_loc_id) { + if(H5L_SAME_LOC != src_loc_id) /* get the location object */ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != dst_loc_id) { + if(H5L_SAME_LOC != dst_loc_id) /* get the location object */ if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } /* Move the link */ - if((ret_value = H5VL_link_move(vol_obj1->data, loc_params1, vol_obj2->data, loc_params2, - vol_obj1->plugin->cls, H5P_DEFAULT, H5P_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_move(vol_obj1, loc_params1, vol_obj2, loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -643,8 +640,7 @@ H5Gunlink(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: @@ -688,8 +684,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size)) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value") done: diff --git a/src/H5L.c b/src/H5L.c index 37561d3..d3d8707 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -279,7 +279,6 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5VL_loc_params_t loc_params1; H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ H5VL_loc_params_t loc_params2; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -331,28 +330,11 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if (vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") - /* Set wrapper info in API context */ - { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ - - vol_obj = (vol_obj1 ? vol_obj1 : vol_obj2); - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - } - /* Move the link */ - if (H5VL_link_move((vol_obj1 ? vol_obj1->data : NULL), loc_params1, - (vol_obj2 ? vol_obj2->data : NULL), loc_params2, - (vol_obj1 ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_move(vol_obj1, loc_params1, vol_obj2, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Lmove() */ @@ -379,7 +361,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5VL_loc_params_t loc_params1; H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ H5VL_loc_params_t loc_params2; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -405,7 +387,6 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; - /* Set location paramter for source object */ loc_params1.type = H5VL_OBJECT_BY_NAME; loc_params1.loc_data.loc_by_name.name = src_name; @@ -432,28 +413,15 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") - /* Set wrapper info in API context */ - { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ - - vol_obj = (vol_obj1 ? vol_obj1 : vol_obj2); - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - } + /* Construct a temporary source VOL object */ + tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL); + tmp_vol_obj.plugin = (vol_obj1 ? vol_obj1->plugin : vol_obj2->plugin); /* Copy the link */ - if(H5VL_link_copy((vol_obj1 ? vol_obj1->data : NULL), loc_params1, - (vol_obj2 ? vol_obj2->data : NULL), loc_params2, - (vol_obj1 ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_copy(&tmp_vol_obj, loc_params1, vol_obj2, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Lcopy() */ @@ -483,7 +451,6 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist = NULL; /* Property list pointer */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -529,21 +496,11 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Create the link */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls, - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_soft() */ @@ -568,8 +525,9 @@ herr_t H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj1 = NULL; /* object token of cur_loc_id */ - H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */ + H5VL_object_t *vol_obj1 = NULL; /* Object token of cur_loc_id */ + H5VL_object_t *vol_obj2 = NULL; /* Object token of new_loc_id */ + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; H5P_genplist_t *plist; /* Property list pointer */ @@ -636,10 +594,12 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target name") + /* Construct a temporary VOL object */ + tmp_vol_obj.data = (vol_obj2 ? (vol_obj2->data) : NULL); + tmp_vol_obj.plugin = (vol_obj1 != NULL ? vol_obj1->plugin : vol_obj2->plugin); + /* Create the link */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, (vol_obj2 ? (vol_obj2->data) : NULL), loc_params2, - (vol_obj1 != NULL ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link") done: @@ -675,11 +635,10 @@ herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - H5P_genplist_t *plist; /* Property list pointer */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata, @@ -720,21 +679,11 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Create external link */ - if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->plugin->cls, - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_ud() */ @@ -791,8 +740,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) vol_wrapper_set = TRUE; /* Unlink */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -859,8 +807,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -922,8 +869,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, vol_wrapper_set = TRUE; /* Get the link value */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: @@ -991,8 +937,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value") done: @@ -1049,8 +994,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) vol_wrapper_set = TRUE; /* Check for the existence of the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_EXISTS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1111,8 +1055,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, vol_wrapper_set = TRUE; /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1182,8 +1125,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, vol_wrapper_set = TRUE; /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1383,8 +1325,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_NAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name") done: @@ -1448,9 +1389,7 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, vol_wrapper_set = TRUE; /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - FALSE, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1530,8 +1469,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, vol_wrapper_set = TRUE; /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1609,9 +1547,7 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, vol_wrapper_set = TRUE; /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - TRUE, idx_type, order, NULL, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1696,9 +1632,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, vol_wrapper_set = TRUE; /* Visit the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - TRUE, idx_type, order, NULL, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index ff045c8..1c69c53 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -422,8 +422,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") /* Create an external link */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->plugin->cls, - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link") done: diff --git a/src/H5O.c b/src/H5O.c index 64c9e00..567fce4 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -322,6 +322,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, { H5VL_object_t *vol_obj1 = NULL; /* object token of obj_id */ H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */ + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; H5P_genplist_t *plist; /* Property list pointer */ @@ -383,10 +384,12 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") + /* Construct a temporary VOL object */ + tmp_vol_obj.data = vol_obj2->data; + tmp_vol_obj.plugin = (vol_obj1 != NULL ? vol_obj1->plugin : vol_obj2->plugin); + /* Create a link to the object */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, - (vol_obj1 != NULL ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") done: diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 24d9c5c..ff0e0fd 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -117,6 +117,23 @@ static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxp void **req, va_list arguments); static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, + H5VL_loc_params_t loc_params, const H5VL_class_t *cls, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__link_copy(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__link_move(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__link_get(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__link_specific(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); /*********************/ @@ -3671,22 +3688,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_link_create + * Function: H5VL__link_create * - * Purpose: Creates a hard link through the VOL + * Purpose: Creates a link through the VOL + * + * Note: The 'obj' parameter is allowed to be NULL * * Return: Success: Non-negative * Failure: Negative * *------------------------------------------------------------------------- */ -herr_t -H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, +static herr_t +H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->link_cls.create) @@ -3698,13 +3717,67 @@ H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_create + * + * Purpose: Creates a link through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, + H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, + void **req) +{ + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Special case for hard links */ + if(H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) { + H5P_genplist_t *plist; /* Property list pointer */ + + /* Get the VOL data pointer from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") + if(H5P_peek(plist, H5VL_PROP_LINK_TARGET, &tmp_vol_obj.data) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL plugin info") + } /* end if */ + else + /* Use the VOL object passed in */ + tmp_vol_obj.data = vol_obj->data; + tmp_vol_obj.plugin = vol_obj->plugin; + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(tmp_vol_obj.data, tmp_vol_obj.plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_create() */ /*------------------------------------------------------------------------- * Function: H5VLlink_create * - * Purpose: Creates a hard link + * Purpose: Creates a link * * Note: The 'obj' parameter is allowed to be NULL * @@ -3729,7 +3802,7 @@ H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if(H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") done: @@ -3738,7 +3811,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_link_copy + * Function: H5VL__link_copy * * Purpose: Copys a link from src to dst. * @@ -3747,14 +3820,14 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, +static herr_t +H5VL__link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->link_cls.copy) @@ -3766,6 +3839,46 @@ H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_copy + * + * Purpose: Copys a link from src to dst. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_copy(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, + const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + const H5VL_object_t *vol_obj; /* VOL object for object with data */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj); + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_copy((src_vol_obj->data ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->plugin->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_copy() */ @@ -3798,7 +3911,7 @@ H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if(H5VL__link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") done: @@ -3807,7 +3920,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_link_move + * Function: H5VL__link_move * * Purpose: Moves a link from src to dst. * @@ -3816,14 +3929,14 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, +static herr_t +H5VL__link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->link_cls.move) @@ -3835,6 +3948,46 @@ H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_move + * + * Purpose: Moves a link from src to dst. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_move(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, + const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + const H5VL_object_t *vol_obj; /* VOL object for object with data */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + vol_obj = (src_vol_obj ? src_vol_obj : dst_vol_obj); + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_move((src_vol_obj ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->plugin->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_move() */ @@ -3867,7 +4020,7 @@ H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if(H5VL__link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object") done: @@ -3876,6 +4029,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__link_get + * + * Purpose: Get specific information about the link through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link get' method") + + /* Call the corresponding VOL callback */ + if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_link_get * * Purpose: Get specific information about the link through the VOL @@ -3886,23 +4070,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, - hid_t dxpl_id, void **req, ...) +H5VL_link_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link get' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") done: @@ -3910,6 +4096,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_get() */ @@ -3941,12 +4131,8 @@ H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link get' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__link_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback") done: @@ -3955,9 +4141,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__link_specific + * + * Purpose: Specific operation on links through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_link_specific * - * Purpose: specific operation on links through the VOL + * Purpose: Specific operation on links through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -3965,23 +4182,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link specific' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") done: @@ -3989,6 +4208,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_specific() */ @@ -4020,12 +4243,8 @@ H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link specific' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__link_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") done: @@ -4034,9 +4253,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__link_optional + * + * Purpose: Optional operation specific to plugins. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link optional' method") + + /* Call the corresponding VOL callback */ + if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_link_optional * - * Purpose: optional operation specific to plugins. + * Purpose: Optional operation specific to plugins. * * Return: Success: Non-negative * Failure: Negative @@ -4044,23 +4294,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, ...) +H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link optional' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if(H5VL__link_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: @@ -4068,6 +4319,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_optional() */ @@ -4097,12 +4352,8 @@ H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link optional' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__link_optional(obj, cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index fab4bbf..546c3ca 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -139,12 +139,12 @@ H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, v H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Link functions */ -H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); /* Object functions */ H5_DLL void *H5VL_object_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req); diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index 7838c9c..f0e4a62 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -41,25 +41,28 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dread(): can't read data major: Dataset minor: Read failed - #001: (file name) line (number) in H5VL_dataset_read(): read failed + #001: (file name) line (number) in H5VL_dataset_read(): dataset read failed major: Virtual Object Layer minor: Read failed - #002: (file name) line (number) in H5VL__native_dataset_read(): can't read data + #002: (file name) line (number) in H5VL__dataset_read(): dataset read failed + major: Virtual Object Layer + minor: Read failed + #003: (file name) line (number) in H5VL__native_dataset_read(): can't read data major: Dataset minor: Read failed - #003: (file name) line (number) in H5D__read(): can't read data + #004: (file name) line (number) in H5D__read(): can't read data major: Dataset minor: Read failed - #004: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk + #005: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk major: Low-level I/O minor: Read failed - #005: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed + #006: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed major: Dataset minor: Filter operation failed - #006: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered + #007: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered major: Data filters minor: Read failed - #007: (file name) line (number) in H5PL_load(): filter plugins disabled + #008: (file name) line (number) in H5PL_load(): filter plugins disabled major: Plugin for dynamically loaded library minor: Unable to load metadata into cache -- cgit v0.12 From 4f62c084f1b0502bc984edd8ce380bea22518bd3 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 1 Nov 2018 12:03:34 -0500 Subject: Fixed fprintf to HDfprintf in the following routines: 1) read_uc_file() in use_common.c 2) main() of use_append_chunk.c and use_append_mchunks.c --- test/use_append_chunk.c | 60 ++++++++++++------------- test/use_append_mchunks.c | 54 +++++++++++----------- test/use_common.c | 112 +++++++++++++++++++++++----------------------- 3 files changed, 113 insertions(+), 113 deletions(-) diff --git a/test/use_append_chunk.c b/test/use_append_chunk.c index 7dda732..fb906b6 100644 --- a/test/use_append_chunk.c +++ b/test/use_append_chunk.c @@ -130,7 +130,7 @@ main(int argc, char *argv[]) /* initialization */ if (setup_parameters(argc, argv) < 0){ - Hgoto_error(1); + Hgoto_error(1); } /* Determine the need to send/wait message file*/ @@ -148,20 +148,20 @@ main(int argc, char *argv[]) /* Create file */ /* ============*/ if (UC_opts.launch != UC_READER){ - printf("Creating skeleton data file for test...\n"); - if (create_uc_file() < 0){ - fprintf(stderr, "***encounter error\n"); - Hgoto_error(1); - }else - printf("File created.\n"); + HDprintf("Creating skeleton data file for test...\n"); + if (create_uc_file() < 0){ + HDfprintf(stderr, "***encounter error\n"); + Hgoto_error(1); + }else + HDprintf("File created.\n"); } if (UC_opts.launch==UC_READWRITE){ - /* fork process */ - if((childpid = HDfork()) < 0) { - HDperror("fork"); - Hgoto_error(1); - }; + /* fork process */ + if((childpid = HDfork()) < 0) { + HDperror("fork"); + Hgoto_error(1); + }; }; mypid = HDgetpid(); @@ -169,22 +169,22 @@ main(int argc, char *argv[]) /* launch reader */ /* ============= */ if (UC_opts.launch != UC_WRITER){ - /* child process launch the reader */ - if(0 == childpid) { - printf("%d: launch reader process\n", mypid); - if (read_uc_file(send_wait) < 0){ - fprintf(stderr, "read_uc_file encountered error\n"); - exit(1); - } - exit(0); - } + /* child process launch the reader */ + if(0 == childpid) { + HDprintf("%d: launch reader process\n", mypid); + if (read_uc_file(send_wait) < 0){ + HDfprintf(stderr, "read_uc_file encountered error\n"); + exit(1); + } + exit(0); + } } /* ============= */ /* launch writer */ /* ============= */ /* this process continues to launch the writer */ - printf("%d: continue as the writer process\n", mypid); + HDprintf("%d: continue as the writer process\n", mypid); name = UC_opts.filename; @@ -198,12 +198,12 @@ main(int argc, char *argv[]) /* Open the file */ if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) { - fprintf(stderr, "H5Fopen failed\n"); + HDfprintf(stderr, "H5Fopen failed\n"); Hgoto_error(1); } if(write_uc_file(send_wait, fid) < 0) { - fprintf(stderr, "write_uc_file encountered error\n"); + HDfprintf(stderr, "write_uc_file encountered error\n"); Hgoto_error(1); } @@ -218,24 +218,24 @@ main(int argc, char *argv[]) /* Close the file */ if(H5Fclose(fid) < 0) { - fprintf(stderr, "Failed to close file id\n"); + HDfprintf(stderr, "Failed to close file id\n"); Hgoto_error(1); } /* Close the property list */ if(H5Pclose(fapl) < 0) { - fprintf(stderr, "Failed to property list\n"); + HDfprintf(stderr, "Failed to close the property list\n"); Hgoto_error(1); } if (WIFEXITED(child_status)){ if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ - printf("%d: child process exited with non-zero code (%d)\n", + HDprintf("%d: child process exited with non-zero code (%d)\n", mypid, child_ret_value); Hgoto_error(2); } } else { - printf("%d: child process terminated abnormally\n", mypid); + HDprintf("%d: child process terminated abnormally\n", mypid); Hgoto_error(2); } } @@ -243,9 +243,9 @@ main(int argc, char *argv[]) done: /* Print result and exit */ if (ret_value != 0){ - printf("Error(s) encountered\n"); + HDprintf("Error(s) encountered\n"); }else{ - printf("All passed\n"); + HDprintf("All passed\n"); } return(ret_value); diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c index 2dc7bdb..da7e2b3 100644 --- a/test/use_append_mchunks.c +++ b/test/use_append_mchunks.c @@ -123,7 +123,7 @@ main(int argc, char *argv[]) /* initialization */ if (setup_parameters(argc, argv) < 0){ - Hgoto_error(1); + Hgoto_error(1); } /* Determine the need to send/wait message file*/ @@ -141,20 +141,20 @@ main(int argc, char *argv[]) /* Create file */ /* ============*/ if (UC_opts.launch != UC_READER){ - printf("Creating skeleton data file for test...\n"); + HDprintf("Creating skeleton data file for test...\n"); if (create_uc_file() < 0){ - fprintf(stderr, "***encounter error\n"); + HDfprintf(stderr, "***encounter error\n"); Hgoto_error(1); }else - printf("File created.\n"); + HDprintf("File created.\n"); } if (UC_opts.launch==UC_READWRITE){ - /* fork process */ - if((childpid = fork()) < 0) { - perror("fork"); - Hgoto_error(1); - }; + /* fork process */ + if((childpid = fork()) < 0) { + perror("fork"); + Hgoto_error(1); + }; }; mypid = getpid(); @@ -162,22 +162,22 @@ main(int argc, char *argv[]) /* launch reader */ /* ============= */ if (UC_opts.launch != UC_WRITER){ - /* child process launch the reader */ - if(0 == childpid) { - printf("%d: launch reader process\n", mypid); - if (read_uc_file(send_wait) < 0){ - fprintf(stderr, "read_uc_file encountered error\n"); - exit(1); - } - exit(0); - } + /* child process launch the reader */ + if(0 == childpid) { + HDprintf("%d: launch reader process\n", mypid); + if (read_uc_file(send_wait) < 0){ + HDfprintf(stderr, "read_uc_file encountered error\n"); + exit(1); + } + exit(0); + } } /* ============= */ /* launch writer */ /* ============= */ /* this process continues to launch the writer */ - printf("%d: continue as the writer process\n", mypid); + HDprintf("%d: continue as the writer process\n", mypid); name = UC_opts.filename; @@ -191,12 +191,12 @@ main(int argc, char *argv[]) /* Open the file */ if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) { - fprintf(stderr, "H5Fopen failed\n"); + HDfprintf(stderr, "H5Fopen failed\n"); Hgoto_error(1); } if(write_uc_file(send_wait, fid) < 0) { - fprintf(stderr, "write_uc_file encountered error\n"); + HDfprintf(stderr, "write_uc_file encountered error\n"); Hgoto_error(1); } @@ -212,24 +212,24 @@ main(int argc, char *argv[]) /* Close the file */ if(H5Fclose(fid) < 0) { - fprintf(stderr, "Failed to close file id\n"); + HDfprintf(stderr, "Failed to close file id\n"); Hgoto_error(1); } /* Close the property list */ if(H5Pclose(fapl) < 0) { - fprintf(stderr, "Failed to property list\n"); + HDfprintf(stderr, "Failed to close the property list\n"); Hgoto_error(1); } if (WIFEXITED(child_status)){ if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ - printf("%d: child process exited with non-zero code (%d)\n", + HDprintf("%d: child process exited with non-zero code (%d)\n", mypid, child_ret_value); Hgoto_error(1); } } else { - printf("%d: child process terminated abnormally\n", mypid); + HDprintf("%d: child process terminated abnormally\n", mypid); Hgoto_error(2); } } @@ -237,9 +237,9 @@ main(int argc, char *argv[]) done: /* Print result and exit */ if (ret_value != 0){ - printf("Error(s) encountered\n"); + HDprintf("Error(s) encountered\n"); }else{ - printf("All passed\n"); + HDprintf("All passed\n"); } return(ret_value); diff --git a/test/use_common.c b/test/use_common.c index 164480f..3ecb2e1 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -447,7 +447,7 @@ int read_uc_file(hbool_t towait) /* Before reading, wait for the message that H5Fopen is complete--file lock is released */ if(towait && h5_wait_message(WRITER_MESSAGE) < 0) { - fprintf(stderr, "Cannot find writer message file...failed\n"); + HDfprintf(stderr, "Cannot find writer message file...failed\n"); return -1; } @@ -457,19 +457,19 @@ int read_uc_file(hbool_t towait) if((fapl = h5_fileaccess()) < 0) return -1; if((fid = H5Fopen(name, H5F_ACC_RDONLY | (UC_opts.use_swmr ? H5F_ACC_SWMR_READ : 0), fapl)) < 0){ - fprintf(stderr, "H5Fopen failed\n"); + HDfprintf(stderr, "H5Fopen failed\n"); return -1; } if (H5Pclose(fapl) < 0){ - fprintf(stderr, "Failed to property list\n"); + HDfprintf(stderr, "Failed to property list\n"); return -1; } /* Open the dataset of the program name */ if((dsid = H5Dopen2(fid, progname_g, H5P_DEFAULT)) < 0){ - fprintf(stderr, "H5Dopen2 failed\n"); - return -1; + HDfprintf(stderr, "H5Dopen2 failed\n"); + return -1; } /* allocate space for data buffer 1 X dims[1] X dims[2] of UC_CTYPE */ @@ -477,8 +477,8 @@ int read_uc_file(hbool_t towait) memdims[1] = UC_opts.dims[1]; memdims[2] = UC_opts.dims[2]; if ((buffer=(UC_CTYPE*)HDmalloc((size_t)memdims[1]*(size_t)memdims[2]*sizeof(UC_CTYPE)))==NULL) { - fprintf(stderr, "malloc: failed\n"); - return -1; + HDfprintf(stderr, "malloc: failed\n"); + return -1; }; /* @@ -488,31 +488,31 @@ int read_uc_file(hbool_t towait) f_sid = H5Dget_space(dsid); /* Get filespace handle first. */ rank = H5Sget_simple_extent_ndims(f_sid); if (rank != UC_RANK){ - fprintf(stderr, "rank(%d) of dataset does not match\n", rank); - return -1; + HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank); + return -1; } if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0){ - fprintf(stderr, "H5Sget_simple_extent_dims got error\n"); - return -1; + HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + return -1; } - printf("dataset rank %d, dimensions %llu x %llu x %llu\n", - rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]), - (unsigned long long)(dims[2])); + HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", + rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]), + (unsigned long long)(dims[2])); /* verify that file space dims are as expected and are consistent with memory space dims */ if (dims[1] != memdims[1] || dims[2] != memdims[2]){ - fprintf(stderr, "dataset dimension is not as expected. Got dims=(%llu,%llu,%llu)\n", - (unsigned long long)dims[0], (unsigned long long)dims[1], + HDfprintf(stderr, "dataset dimension is not as expected. Got dims=(%llu,%llu,%llu)\n", + (unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]); - fprintf(stderr, "But memdims=(%llu,%llu,%llu)\n", - (unsigned long long)memdims[0], (unsigned long long)memdims[1], + HDfprintf(stderr, "But memdims=(%llu,%llu,%llu)\n", + (unsigned long long)memdims[0], (unsigned long long)memdims[1], (unsigned long long)memdims[2]); - return -1; + return -1; } /* setup mem-space for buffer */ if ((m_sid=H5Screate_simple(rank, memdims, NULL))<0){ - fprintf(stderr, "H5Screate_simple for memory failed\n"); - return -1; + HDfprintf(stderr, "H5Screate_simple for memory failed\n"); + return -1; }; /* Read 1 plane at a time whenever the dataset grows larger @@ -526,22 +526,22 @@ int read_uc_file(hbool_t towait) /* print progress message according to if new planes are availalbe */ if (nplane_old < dims[0]) { if (nonewplane){ - /* end the previous message */ - printf("\n"); - nonewplane=0; + /* end the previous message */ + HDprintf("\n"); + nonewplane=0; } - printf("reading planes %llu to %llu\n", (unsigned long long)nplane_old, + HDprintf("reading planes %llu to %llu\n", (unsigned long long)nplane_old, (unsigned long long)dims[0]); }else{ if (nonewplane){ - printf("."); + HDprintf("."); if (nonewplane>=30){ - fprintf(stderr, "waited too long for new plane, quit.\n"); + HDfprintf(stderr, "waited too long for new plane, quit.\n"); return -1; } }else{ - /* print mesg only the first time; dots still no new plane */ - printf("no new planes to read "); + /* print mesg only the first time; dots still no new plane */ + HDprintf("no new planes to read "); } nonewplane++; /* pause for a second */ @@ -551,41 +551,41 @@ int read_uc_file(hbool_t towait) /* read planes between last old nplanes and current extent */ /* Get the dataset's dataspace */ if((f_sid = H5Dget_space(dsid)) < 0){ - fprintf(stderr, "H5Dget_space failed\n"); - return -1; + HDfprintf(stderr, "H5Dget_space failed\n"); + return -1; } start[0]=nplane; /* Choose the next plane to read */ if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0){ - fprintf(stderr, "H5Sselect_hyperslab failed\n"); - return -1; + HDfprintf(stderr, "H5Sselect_hyperslab failed\n"); + return -1; } /* Read the plane from the dataset */ if(H5Dread(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0){ - fprintf(stderr, "H5Dread failed\n"); - return -1; + HDfprintf(stderr, "H5Dread failed\n"); + return -1; } /* compare read data with expected data value which is nplane */ bufptr = buffer; nerrs=0; for (j=0; j Date: Thu, 1 Nov 2018 14:54:44 -0500 Subject: Refactor and standardize object VOL callbacks. --- src/H5Adeprec.c | 3 +- src/H5O.c | 159 +++------------------------ src/H5Ocopy.c | 4 +- src/H5Odeprec.c | 27 +---- src/H5Oflush.c | 16 +-- src/H5R.c | 38 +------ src/H5Rdeprec.c | 6 +- src/H5VLcallback.c | 311 ++++++++++++++++++++++++++++++++++++++++++----------- src/H5VLprivate.h | 10 +- src/H5VLpublic.h | 6 +- 10 files changed, 289 insertions(+), 291 deletions(-) diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 894bbc1..ae25cb9 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -343,8 +343,7 @@ H5Aget_num_attrs(hid_t loc_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the number of attributes for the object */ - if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object") H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t); diff --git a/src/H5O.c b/src/H5O.c index 567fce4..7e8484b 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -104,7 +104,6 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) @@ -130,14 +129,8 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Get an atom for the object */ @@ -145,10 +138,6 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Oopen() */ @@ -214,8 +203,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &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(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) @@ -282,8 +270,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &opened_type, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Register the dataset ID */ @@ -439,8 +426,7 @@ H5Oincr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_CHANGE_REF_COUNT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0) + if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -490,8 +476,7 @@ H5Odecr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_CHANGE_REF_COUNT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0) + if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -517,7 +502,6 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -543,21 +527,11 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Check if the object exists */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_EXISTS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Oexists_by_name() */ @@ -581,7 +555,6 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -601,21 +574,11 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Oget_info2() */ @@ -640,7 +603,6 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -670,21 +632,11 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_name2() */ @@ -711,7 +663,6 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -746,21 +697,11 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_idx2() */ @@ -787,7 +728,6 @@ H5Oset_comment(hid_t obj_id, const char *comment) { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -805,21 +745,11 @@ H5Oset_comment(hid_t obj_id, const char *comment) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Oset_comment() */ @@ -847,7 +777,6 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -871,21 +800,11 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Oset_comment_by_name() */ @@ -911,35 +830,24 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); /* Get the object */ - if (NULL == (vol_obj = H5VL_vol_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 */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Retrieve the object's comment */ - if (H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Oget_comment() */ @@ -966,7 +874,6 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) @@ -990,21 +897,11 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Retrieve the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Oget_comment_by_name() */ @@ -1050,7 +947,6 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1074,22 +970,11 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, - H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, op, op_data, fields)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Ovisit2() */ @@ -1135,7 +1020,6 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1170,22 +1054,11 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, - H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, op, op_data, fields)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Ovisit_by_name2() */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index d6c1406..ae883fb 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -253,9 +253,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, vol_wrapper_set = TRUE; /* Copy the object */ - if((ret_value = H5VL_object_copy(vol_obj1->data, loc_params1, vol_obj1->plugin->cls, src_name, - vol_obj2->data, loc_params2, vol_obj2->plugin->cls, dst_name, - ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_object_copy(vol_obj1, loc_params1, src_name, vol_obj2, loc_params2, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 24fdb00..dca1835 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -109,8 +109,7 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -161,8 +160,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -223,8 +221,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -270,7 +267,6 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -292,22 +288,11 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, - H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Ovisit1() */ @@ -383,9 +368,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, - H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 887cc4c..d8d0430 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -92,8 +92,7 @@ H5Oflush(hid_t obj_id) loc_params.obj_type = H5I_get_type(obj_id); /* Flush the object */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, - H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id)) < 0) + if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") done: @@ -239,7 +238,6 @@ H5Orefresh(hid_t oid) { H5VL_object_t *vol_obj = NULL; /* Object token */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -257,21 +255,11 @@ H5Orefresh(hid_t oid) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(oid); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Refresh the object */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, - H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid)) < 0) + if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Orefresh() */ diff --git a/src/H5R.c b/src/H5R.c index 112bd4c..b806777 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -93,7 +93,6 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -127,22 +126,11 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Create reference */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_CREATE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - ref, name, ref_type, space_id)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, ref_type, space_id)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Rcreate() */ @@ -210,8 +198,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &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(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) @@ -270,8 +257,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Get the dataspace with the correct region selected */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_REGION, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) + if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") done: @@ -328,9 +314,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the object type */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, - H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, obj_type, ref_type, ref) < 0) + if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") done: @@ -377,7 +361,6 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) @@ -397,22 +380,11 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Get name */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_NAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - &ret_value, name, size, ref_type, _ref) < 0) + if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Rget_name() */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index a3e94ea..9cbaf1f 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -126,8 +126,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier") /* Get the object information */ - if (H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_TYPE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0) + if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ @@ -183,8 +182,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if (NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &opened_type, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") /* Get an atom for the object */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index ff0e0fd..a820536 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -134,6 +134,20 @@ static herr_t H5VL__link_specific(void *obj, H5VL_loc_params_t loc_params, void **req, va_list arguments); static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments); +static void *H5VL__object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, + H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL__object_copy(void *src_obj, H5VL_loc_params_t src_loc_params, + const char *src_name, void *dst_obj, H5VL_loc_params_t dst_loc_params, + const char *dst_name, const H5VL_class_t *cls, hid_t ocpypl_id, + hid_t lcpl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__object_get(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, H5VL_object_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__object_specific(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); /*********************/ @@ -4362,7 +4376,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_object_open + * Function: H5VL__object_open * * Purpose: Opens a object through the VOL * @@ -4371,13 +4385,13 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, +static void * +H5VL__object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->object_cls.open) @@ -4389,6 +4403,43 @@ H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_open + * + * Purpose: Opens a object through the VOL + * + * Return: Success: Pointer to the object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t params, + H5I_type_t *opened_type, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__object_open(vol_obj->data, params, vol_obj->plugin->cls, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_open() */ @@ -4419,7 +4470,7 @@ H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t plugin_id, H5I_type_t HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_object_open(obj, params, cls, opened_type, dxpl_id, req))) + if(NULL == (ret_value = H5VL__object_open(obj, params, cls, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open object") done: @@ -4428,6 +4479,39 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__object_copy + * + * Purpose: Copies an object to another destination through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_copy(void *src_obj, H5VL_loc_params_t src_loc_params, const char *src_name, + void *dst_obj, H5VL_loc_params_t dst_loc_params, const char *dst_name, + const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, + void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object copy' method") + + /* Call the corresponding VOL callback */ + if((cls->object_cls.copy)(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_copy() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_object_copy * * Purpose: Copies an object to another destination through the VOL @@ -4438,28 +4522,34 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, - const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, - const H5VL_class_t *cls2, const char *dst_name, hid_t ocpypl_id, - hid_t lcpl_id, hid_t dxpl_id, void **req) +H5VL_object_copy(const H5VL_object_t *src_obj, H5VL_loc_params_t src_loc_params, + const char *src_name, const H5VL_object_t *dst_obj, H5VL_loc_params_t dst_loc_params, + const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, + void **req) { + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Make sure that the VOL plugins are the same */ - if(cls1->value != cls2->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + if(src_obj->plugin->cls->value != dst_obj->plugin->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "objects are accessed through different VOL plugins and can't be copied") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls1->object_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object copy' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(src_obj->data, src_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ - if((cls1->object_cls.copy)(src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__object_copy(src_obj->data, src_loc_params, src_name, dst_obj->data, dst_loc_params, dst_name, src_obj->plugin->cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_copy() */ @@ -4475,30 +4565,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t plugin_id1, - const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, - hid_t plugin_id2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, +H5VLobject_copy(void *src_obj, H5VL_loc_params_t src_loc_params, + const char *src_name, void *dst_obj, H5VL_loc_params_t dst_loc_params, + const char *dst_name, hid_t plugin_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls1; /* VOL plugin's class struct */ - H5VL_class_t *cls2; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, plugin_id1, - src_name, dst_obj, loc_params2, plugin_id2, dst_name, ocpypl_id, - lcpl_id, dxpl_id, req); /* Check args and get class pointers */ if(NULL == src_obj || NULL == dst_obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_object_copy(src_obj, loc_params1, cls1, src_name, dst_obj, loc_params2, cls2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + if(H5VL__object_copy(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") done: @@ -4507,6 +4591,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__object_get + * + * Purpose: Get specific information about the object through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object get' method") + + /* Call the corresponding VOL callback */ + if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_object_get * * Purpose: Get specific information about the object through the VOL @@ -4517,23 +4632,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL_object_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object get' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") done: @@ -4541,6 +4658,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_get() */ @@ -4572,12 +4693,8 @@ H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_ob if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object get' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__object_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback") done: @@ -4586,9 +4703,41 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__object_specific + * + * Purpose: Specific operation on objects through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_object_specific * - * Purpose: specific operation on objects through the VOL + * Purpose: Specific operation on objects through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -4596,23 +4745,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL_object_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object specific' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") done: @@ -4620,6 +4771,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_specific() */ @@ -4665,9 +4820,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__object_optional + * + * Purpose: Optional operation specific to plugins. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object optional' method") + + /* Call the corresponding VOL callback */ + if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_object_optional * - * Purpose: optional operation specific to plugins. + * Purpose: Optional operation specific to plugins. * * Return: Success: Non-negative * Failure: Negative @@ -4675,23 +4861,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, ...) +H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object optional' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if(H5VL__object_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: @@ -4699,6 +4886,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_optional() */ @@ -4728,12 +4919,8 @@ H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_li if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object optional' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__object_optional(obj, cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 546c3ca..7b2e590 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -147,11 +147,11 @@ H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); /* Object functions */ -H5_DLL void *H5VL_object_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); +H5_DLL void * H5VL_object_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, H5VL_loc_params_t src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, H5VL_loc_params_t dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); /* Datatype functions */ H5_DLL void *H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 3cf3c79..5d19985 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -490,9 +490,9 @@ H5_DLL herr_t H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void /* Public wrappers for object callbacks */ H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t plugin_id1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, + hid_t plugin_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); -- cgit v0.12 From 51076d40617aa6f0236809c2c919cc6921b3bbc1 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 1 Nov 2018 15:00:40 -0500 Subject: Fixed exit() to HDexit() in use_append_chunk.c and use_append_mchunks.c --- test/use_append_chunk.c | 4 ++-- test/use_append_mchunks.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/use_append_chunk.c b/test/use_append_chunk.c index fb906b6..4e8c672 100644 --- a/test/use_append_chunk.c +++ b/test/use_append_chunk.c @@ -174,9 +174,9 @@ main(int argc, char *argv[]) HDprintf("%d: launch reader process\n", mypid); if (read_uc_file(send_wait) < 0){ HDfprintf(stderr, "read_uc_file encountered error\n"); - exit(1); + HDexit(1); } - exit(0); + HDexit(0); } } diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c index da7e2b3..0414628 100644 --- a/test/use_append_mchunks.c +++ b/test/use_append_mchunks.c @@ -167,9 +167,9 @@ main(int argc, char *argv[]) HDprintf("%d: launch reader process\n", mypid); if (read_uc_file(send_wait) < 0){ HDfprintf(stderr, "read_uc_file encountered error\n"); - exit(1); + HDexit(1); } - exit(0); + HDexit(0); } } -- cgit v0.12 From 4806d29d9f2274e102c76b8672c47cc211dbf3d6 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 1 Nov 2018 17:02:27 -0500 Subject: Refactor and standardize named datatype VOL callbacks. --- src/H5T.c | 97 ++++++++------- src/H5Tcommit.c | 65 ++-------- src/H5Tdeprec.c | 11 +- src/H5VLcallback.c | 344 ++++++++++++++++++++++++++++++++++++++++++++--------- src/H5VLprivate.h | 18 +-- 5 files changed, 359 insertions(+), 176 deletions(-) diff --git a/src/H5T.c b/src/H5T.c index 08f689c..a6c3847 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1612,20 +1612,19 @@ H5T__close_cb(H5T_t *dt) * close it through the VOL plugin. */ if(NULL != dt->vol_obj) { - /* Close the plugin-managed datatype data */ - if(H5VL_datatype_close(dt->vol_obj->data, dt->vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + if(H5VL_datatype_close(dt->vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") /* Free the VOL object */ if(H5VL_free_object(dt->vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object"); + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") dt->vol_obj = NULL; - } + } /* end if */ /* Close the datatype */ if(H5T_close(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1745,7 +1744,7 @@ H5Tcopy(hid_t type_id) /* Copy datatype */ if(NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy") /* Atomize result */ if((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) @@ -2264,30 +2263,30 @@ done: * the return value is an integer type. * * Return: Success: Data type for base data type. - * * Failure: NULL * * Programmer: Raymond Lu - * October 9, 2002 + * October 9, 2002 + * *------------------------------------------------------------------------- */ H5T_t * H5T_get_super(const H5T_t *dt) { - H5T_t *ret_value=NULL; + H5T_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) HDassert(dt); - if (!dt->shared->parent) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type"); - if (NULL==(ret_value=H5T_copy(dt->shared->parent, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type"); + if(!dt->shared->parent) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type") + if(NULL == (ret_value = H5T_copy(dt->shared->parent, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type") done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_get_super() */ /*------------------------------------------------------------------------- @@ -3108,7 +3107,7 @@ H5T__create(H5T_class_t type, size_t size) /* Copy the default string datatype */ if(NULL == (dt = H5T_copy(origin_dt, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy") /* Modify the datatype */ if(H5T__set_size(dt, size) < 0) @@ -3230,9 +3229,9 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Allocate space */ if(NULL == (new_dt = H5FL_MALLOC(H5T_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") if(NULL == (new_dt->shared = H5FL_MALLOC(H5T_shared_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy shared information (entry information is copied last) */ *(new_dt->shared) = *(old_dt->shared); @@ -3273,7 +3272,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Open named datatype again */ if(H5O_open(&old_dt->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type") /* Insert opened named datatype into opened object list for the file */ if(H5FO_insert(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr, new_dt->shared, FALSE)<0) @@ -3337,7 +3336,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) new_dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_malloc(new_dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t)); if (NULL == new_dt->shared->u.compnd.memb) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb, new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t)); @@ -3355,7 +3354,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Range check against compound member's offset */ if ((accum_change < 0) && ((ssize_t) new_dt->shared->u.compnd.memb[i].offset < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype") /* Apply the accumulated size change to the offset of the field */ new_dt->shared->u.compnd.memb[i].offset += (size_t) accum_change; @@ -3370,7 +3369,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* check if we couldn't find a match */ if(old_match < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted") } /* end if */ else old_match = (int) i; @@ -3386,7 +3385,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Range check against datatype size */ if ((accum_change < 0) && ((ssize_t) new_dt->shared->size < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype") /* Apply the accumulated size change to the size of the compound struct */ new_dt->shared->size += (size_t) accum_change; @@ -3404,7 +3403,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) new_dt->shared->u.enumer.value = (uint8_t *)H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size); if(NULL == new_dt->shared->u.enumer.value) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value, new_dt->shared->u.enumer.nmembs * new_dt->shared->size); for(i = 0; i < new_dt->shared->u.enumer.nmembs; i++) { @@ -3418,7 +3417,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) if(method == H5T_COPY_TRANSIENT || method == H5T_COPY_REOPEN) { /* H5T_copy converts any type into a memory type */ if(H5T_set_loc(new_dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") } /* end if */ break; @@ -3694,7 +3693,7 @@ H5T_close_real(H5T_t *dt) /* Clean up resources, depending on shared state */ if(dt->shared->state != H5T_STATE_OPEN) { if(H5T__free(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype") dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); } /* end if */ @@ -3788,7 +3787,7 @@ H5T_close(H5T_t *dt) /* Clean up resources */ if(H5T_close_real(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3837,7 +3836,7 @@ H5T__set_size(H5T_t *dt, size_t size) if(dt->shared->parent) { if(H5T__set_size(dt->shared->parent, size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type") /* Adjust size of datatype appropriately */ if(dt->shared->type==H5T_ARRAY) @@ -3879,7 +3878,7 @@ H5T__set_size(H5T_t *dt, size_t size) size_t max_size; if((num_membs = H5T_get_nmembers(dt)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members") if(num_membs) { for(i = 0; i < (unsigned)num_membs; i++) { @@ -3893,7 +3892,7 @@ H5T__set_size(H5T_t *dt, size_t size) max_size = H5T__get_member_size(dt, max_index); if(size < (max_offset + max_size)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member "); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member ") } /* end if */ /* Compound must not have been packed previously */ @@ -3913,7 +3912,7 @@ H5T__set_size(H5T_t *dt, size_t size) /* Get a copy of unsigned char type as the base/parent type */ if(NULL == (base = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype") dt->shared->parent=H5T_copy(base,H5T_COPY_ALL); /* change this datatype into a VL string */ @@ -3939,7 +3938,7 @@ H5T__set_size(H5T_t *dt, size_t size) /* Set up VL information */ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") } /* end if */ else { prec = 8 * size; @@ -3955,7 +3954,7 @@ H5T__set_size(H5T_t *dt, size_t size) if(dt->shared->u.atomic.u.f.sign >= prec+offset || dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset || dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first") } break; @@ -4095,7 +4094,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) /* Build an index for each type so the names are sorted */ if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))) || NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.compnd.nmembs * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed") for(u = 0; u < dt1->shared->u.compnd.nmembs; u++) idx1[u] = idx2[u] = u; if(dt1->shared->u.enumer.nmembs > 1) { @@ -4181,7 +4180,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) /* Build an index for each type so the names are sorted */ if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))) || NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.enumer.nmembs * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed") for(u=0; ushared->u.enumer.nmembs; u++) idx1[u] = u; if(dt1->shared->u.enumer.nmembs > 1) { @@ -5190,21 +5189,21 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path") /* If the datatype is committed through the VOL, close it */ - if (NULL != dt->vol_obj) { + if(NULL != dt->vol_obj) { H5VL_object_t *vol_obj = dt->vol_obj; /* Close the datatype through the VOL*/ - if ((ret_value = H5VL_datatype_close(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + if(H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") /* Free the datatype and set the VOL object pointer to NULL */ - if (H5VL_free_object(vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object"); + if(H5VL_free_object(vol_obj) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") dt->vol_obj = NULL; - } + } /* end if */ dt->shared->state = H5T_STATE_TRANSIENT; - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -5349,7 +5348,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Mark the VL, compound or array type */ if((changed=H5T_set_loc(dt->shared->parent,f,loc))<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed>0) ret_value=changed; @@ -5373,7 +5372,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Range check against compound member's offset */ if ((accum_change < 0) && ((ssize_t) dt->shared->u.compnd.memb[i].offset < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype") /* Apply the accumulated size change to the offset of the field */ dt->shared->u.compnd.memb[i].offset += (size_t) accum_change; @@ -5389,7 +5388,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Mark the VL, compound, enum or array type */ if((changed = H5T_set_loc(memb_type,f,loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed > 0) ret_value = changed; @@ -5398,7 +5397,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Fail if the old_size is zero */ if (0 == old_size) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero") /* Adjust the size of the member */ dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].size*memb_type->shared->size)/old_size; @@ -5411,7 +5410,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Range check against datatype size */ if ((accum_change < 0) && ((ssize_t) dt->shared->size < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype") /* Apply the accumulated size change to the datatype */ dt->shared->size += (size_t) accum_change; @@ -5423,14 +5422,14 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */ if(dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type)) { if((changed = H5T_set_loc(dt->shared->parent,f,loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed > 0) ret_value = changed; } /* end if */ /* Mark this VL sequence */ if((changed = H5T__vlen_set_loc(dt, f, loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed > 0) ret_value = changed; break; diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 3eb9cd7..0e609ff 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -108,7 +108,6 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -150,15 +149,8 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Commit the type */ - if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, - name, type_id, lcpl_id, tcpl_id, tapl_id, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (data = H5VL_datatype_commit(vol_obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Set up VOL object */ @@ -172,10 +164,6 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, dt->vol_obj = new_obj; done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Tcommit2() */ @@ -315,9 +303,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Commit the datatype */ - if(NULL == (dt = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, - NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dt = H5VL_datatype_commit(vol_obj, loc_params, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Setup VOL object */ @@ -581,7 +567,6 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) void *dt = NULL; /* datatype token created by VOL plugin */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -605,14 +590,8 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Open the datatype */ - if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dt = H5VL_datatype_open(vol_obj, loc_params, name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ @@ -620,13 +599,9 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - /* Cleanup on error */ if(H5I_INVALID_HID == ret_value) - if(dt && H5VL_datatype_close(dt, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") FUNC_LEAVE_API(ret_value) @@ -678,16 +653,15 @@ H5Tget_create_plist(hid_t dtype_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list") if((ret_value = H5P_copy_plist(tcpl_plist, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") - } + } /* end if */ /* If the datatype is committed, retrieve further information */ else { H5VL_object_t *vol_obj = type->vol_obj; /* Get the property list through the VOL */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATATYPE_GET_TCPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_TCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") - } + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -727,8 +701,7 @@ H5Tflush(hid_t type_id) /* Flush metadata for named datatype */ if(dt->vol_obj) - if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->plugin->cls, H5VL_DATATYPE_FLUSH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) + if(H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") done: @@ -752,7 +725,6 @@ herr_t H5Trefresh(hid_t type_id) { H5T_t *dt; /* Datatype for this operation */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -769,22 +741,11 @@ H5Trefresh(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Refresh the datatype's metadata */ - if(dt->vol_obj) { - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(dt->vol_obj->data, dt->vol_obj->plugin) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - - if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->plugin->cls, H5VL_DATATYPE_REFRESH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) + if(dt->vol_obj) + if(H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") - } /* end if */ done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* H5Trefresh */ @@ -1137,8 +1098,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI(NULL) /* get required buf size for encoding the datatype */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATATYPE_GET_BINARY, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0) + if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size") /* allocate buffer to store binary description of the datatype */ @@ -1146,8 +1106,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") /* get binary description of the datatype */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATATYPE_GET_BINARY, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0) + if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype") if(NULL == (dt = H5T_decode((size_t)nalloc, (const unsigned char *)buf))) diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 4cedbd3..69a52e1 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -137,10 +137,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Commit the datatype */ - if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, - name, type_id, H5P_LINK_CREATE_DEFAULT, - H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (data = H5VL_datatype_commit(vol_obj, loc_params, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Set up VOL object */ @@ -197,9 +194,7 @@ H5Topen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the datatype */ - if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->plugin->cls, - name, H5P_DATATYPE_ACCESS_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dt = H5VL_datatype_open(vol_obj, loc_params, name, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ @@ -209,7 +204,7 @@ H5Topen1(hid_t loc_id, const char *name) done: /* Cleanup on error */ if(H5I_INVALID_HID == ret_value) - if(dt && H5VL_datatype_close(dt, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype") FUNC_LEAVE_API(ret_value) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index a820536..a6286c6 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -148,6 +148,21 @@ static herr_t H5VL__object_specific(void *obj, H5VL_loc_params_t loc_params, void **req, va_list arguments); static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments); +static void * H5VL__datatype_commit(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, + hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL__datatype_open(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, + H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, + H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments); +static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); /*********************/ @@ -4929,7 +4944,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_datatype_commit + * Function: H5VL__datatype_commit * * Purpose: Commits a datatype to the file through the VOL * @@ -4938,14 +4953,14 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +static void * +H5VL__datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.commit) @@ -4957,6 +4972,44 @@ H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: Pointer to the new datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_commit(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, + hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_commit() */ @@ -4989,7 +5042,7 @@ H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype") done: @@ -4998,7 +5051,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_datatype_open + * Function: H5VL__datatype_open * * Purpose: Opens a named datatype through the VOL * @@ -5007,24 +5060,61 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +static void * +H5VL__datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.open) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback") /* Call the corresponding VOL callback */ - if(NULL == (ret_value = (cls->datatype_cls.open) (obj, loc_params, name, tapl_id, dxpl_id, req))) + if(NULL == (ret_value = (cls->datatype_cls.open)(obj, loc_params, name, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_open + * + * Purpose: Opens a named datatype through the VOL + * + * Return: Success: Pointer to the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__datatype_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_open() */ @@ -5056,7 +5146,7 @@ H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype") done: @@ -5065,6 +5155,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__datatype_get + * + * Purpose: Get specific information about the datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype get' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_datatype_get * * Purpose: Get specific information about the datatype through the VOL @@ -5075,30 +5196,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, +H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype get' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + if(H5VL__datatype_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") done: /* End access to the va_list, if we started it */ if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_get() */ @@ -5133,8 +5260,8 @@ H5VLdatatype_get(void *obj, hid_t plugin_id, H5VL_datatype_get_t get_type, if(NULL == cls->datatype_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype get' method") - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") done: @@ -5143,9 +5270,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__datatype_specific + * + * Purpose: Specific operation on datatypes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype specific' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_datatype_specific * - * Purpose: specific operation on datatypes through the VOL + * Purpose: Specific operation on datatypes through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -5153,23 +5311,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, +H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype specific' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + if(H5VL__datatype_specific(vol_obj->data, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: @@ -5177,6 +5337,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_specific() */ @@ -5208,12 +5372,8 @@ H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t speci if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype specific' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: @@ -5222,9 +5382,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__datatype_optional + * + * Purpose: Optional operation specific to plugins. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype optional' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_datatype_optional * - * Purpose: optional operation specific to plugins. + * Purpose: Optional operation specific to plugins. * * Return: Success: Non-negative * Failure: Negative @@ -5232,23 +5423,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, +H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype optional' method") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ + /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if(H5VL__datatype_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: @@ -5256,6 +5449,10 @@ done: if(arg_started) va_end(arguments); + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_optional() */ @@ -5286,12 +5483,8 @@ H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype optional' method") - - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_optional(obj, cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: @@ -5300,7 +5493,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_datatype_close + * Function: H5VL__datatype_close * * Purpose: Closes a datatype through the VOL * @@ -5309,23 +5502,60 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +static herr_t +H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype close' method") /* Call the corresponding VOL callback */ - if((cls->datatype_cls.close)(dt, dxpl_id, req) < 0) + if((cls->datatype_cls.close)(obj, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_close + * + * Purpose: Closes a datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_close() */ @@ -5340,22 +5570,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLdatatype_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", dt, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); /* Check args and get class pointer */ - if(NULL == dt) + if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_datatype_close(dt, cls, dxpl_id, req) < 0) + if(H5VL__datatype_close(obj, cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") done: diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 7b2e590..a168b57 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -114,7 +114,7 @@ H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void /* Dataset functions */ H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL void * H5VL_dataset_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_dataset_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); @@ -132,7 +132,7 @@ H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void /* Group functions */ H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL void * H5VL_group_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_group_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); @@ -147,19 +147,19 @@ H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); /* Object functions */ -H5_DLL void * H5VL_object_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_object_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, H5VL_loc_params_t src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, H5VL_loc_params_t dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_object_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); /* Datatype functions */ -H5_DLL void *H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_datatype_get(void *dt, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_datatype_commit(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_datatype_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Asynchronous functions */ H5_DLL herr_t H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status); -- cgit v0.12 From 6fa26d7e4939ac1b61b74bed7bca70055715be24 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Fri, 2 Nov 2018 14:53:35 -0500 Subject: HDFFV-10601 Issues with chunk cache hash value calcuation: 1. H5D__chunk_hash_val: When the number of chunks in the fastest changing dimension is larger than the number of slots in the hash table, H5D__chunk_hash_val abandons the normal hash value calculation algorithm and simply uses the scaled dimension. This will cause chunks a selection that cuts across chunks in dimensions other than the fastest changing to all have the same hash value, and they will therefore always evict each other from the cache, having an obvious major performance impact. Eliminated the check for the number of slots in this function and always use the full algorithm. 2. H5D__chunk_init: When the scaled dimensions (number of chunks in each dimension) are calculated in H5D__chunk_init, a simple divide ("/") operator is used with the dataset size in elements and the chunk size in elements. While this is fine when the dataset size is an exact multiple of the chunk size, in other cases, since "/" rounds down, it results in a scaled dimension one less than it should (it ignores the partial edge chunk). This has trickle down effects on hash value calculation that can cause excess hash value collisions and therefore performance issues. Changed the calculation to (((dataset_size - 1) / chunk_size) + 1). Tested the build with Autotool and CMake. --- src/H5Dchunk.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 22dc05a..7eeb866 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -949,7 +949,12 @@ H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) /* Initial scaled dimension sizes */ if(dset->shared->layout.u.chunk.dim[u] == 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) - rdcc->scaled_dims[u] = dset->shared->curr_dims[u] / dset->shared->layout.u.chunk.dim[u]; + + /* Make a special case when the dimension is 0 because (0 - 1) is a big number for unsigned integer */ + if(dset->shared->curr_dims[u] == 0) + rdcc->scaled_dims[u] = 0; + else + rdcc->scaled_dims[u] = ((dset->shared->curr_dims[u] - 1) / dset->shared->layout.u.chunk.dim[u]) + 1; if( !(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])) ) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") @@ -2799,6 +2804,7 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) hsize_t val; /* Intermediate value */ unsigned ndims = shared->ndims; /* Rank of dataset */ unsigned ret = 0; /* Value to return */ + unsigned u; /* Local index variable */ FUNC_ENTER_STATIC_NOERR @@ -2809,17 +2815,11 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) /* If the fastest changing dimension doesn't have enough entropy, use * other dimensions too */ - if(ndims > 1 && shared->cache.chunk.scaled_dims[ndims - 1] <= shared->cache.chunk.nslots) { - unsigned u; /* Local index variable */ - - val = scaled[0]; - for(u = 1; u < ndims; u++) { - val <<= shared->cache.chunk.scaled_encode_bits[u]; - val ^= scaled[u]; - } /* end for */ - } /* end if */ - else - val = scaled[ndims - 1]; + val = scaled[0]; + for(u = 1; u < ndims; u++) { + val <<= shared->cache.chunk.scaled_encode_bits[u]; + val ^= scaled[u]; + } /* end for */ /* Modulo value against the number of array slots */ ret = (unsigned)(val % shared->cache.chunk.nslots); -- cgit v0.12 From df7cf2a9d3409ce6dfbd28d80af35fa2512320ae Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 4 Nov 2018 00:05:08 -0500 Subject: Refactor, standardize, and revise the async request callbacks. --- examples/h5_vol_external_log_native.c | 10 +- src/H5ESpublic.h | 2 +- src/H5VLcallback.c | 441 ++++++++++++++++++++++++++++++---- src/H5VLnative.c | 8 +- src/H5VLprivate.h | 8 +- src/H5VLpublic.h | 41 ++-- src/H5trace.c | 4 +- 7 files changed, 441 insertions(+), 73 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index 9c761a5..d84aa9e 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -116,10 +116,12 @@ static const H5VL_class_t H5VL_log_g = { H5VL_log_object_specific, /* specific */ NULL, //H5VL_log_object_optional, /* optional */ }, - { - NULL, - NULL, - NULL + { /* request_cls */ + NULL, /* wait */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ }, NULL }; diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h index cb8eebf..2df1a6e 100644 --- a/src/H5ESpublic.h +++ b/src/H5ESpublic.h @@ -29,7 +29,7 @@ typedef enum H5ES_status_t { H5ES_STATUS_IN_PROGRESS, /* Operation has not yet completed */ H5ES_STATUS_SUCCEED, /* Operation has completed, successfully */ H5ES_STATUS_FAIL, /* Operation has completed, but failed */ - H5ES_STATUS_CANCEL /* Operation has not completed and has been cancelled */ + H5ES_STATUS_CANCELLED /* Operation has not completed and was cancelled */ } H5ES_status_t; diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index a6286c6..76143d6 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -163,6 +163,14 @@ static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__request_wait(void *req, const H5VL_class_t *cls, + uint64_t timeout, H5ES_status_t *status); +static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls); +static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls, + H5VL_request_specific_t specific_type, va_list arguments); +static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls, + va_list arguments); +static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls); /*********************/ @@ -5594,9 +5602,45 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_request_cancel + * Function: H5VL__request_wait * - * Purpose: Cancels an asynchronous request through the VOL + * Purpose: Waits on an asychronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout, + H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.wait) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async wait' method") + + /* Call the corresponding VOL callback */ + if((cls->request_cls.wait)(req, timeout, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_wait + * + * Purpose: Waits on an asychronous request through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -5604,27 +5648,136 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, + H5ES_status_t *status) { + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity checks */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_wait(vol_obj->data, vol_obj->plugin->cls, timeout, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_wait + * + * Purpose: Waits on a request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_wait(void *req, hid_t plugin_id, uint64_t timeout, H5ES_status_t *status) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_wait(req, cls, timeout, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_cancel + * + * Purpose: Cancels an asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_cancel(void *req, const H5VL_class_t *cls) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(req); HDassert(cls); - HDassert(status); /* Check if the corresponding VOL callback exists */ - if(NULL == cls->async_cls.cancel) + if(NULL == cls->request_cls.cancel) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async cancel' method") /* Call the corresponding VOL callback */ - if((cls->async_cls.cancel)(req, status) < 0) + if((cls->request_cls.cancel)(req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_cancel + * + * Purpose: Cancels an asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_cancel(const H5VL_object_t *vol_obj) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_cancel(vol_obj->data, vol_obj->plugin->cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_cancel() */ @@ -5639,20 +5792,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status) +H5VLrequest_cancel(void *req, hid_t plugin_id) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "**xi*Es", req, plugin_id, status); + H5TRACE2("e", "*xi", req, plugin_id); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_request_cancel(req, cls, status) < 0) + if(H5VL__request_cancel(req, cls) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") done: @@ -5661,44 +5814,44 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_request_test + * Function: H5VL__request_specific * - * Purpose: Tests an asynchronous request through the VOL + * Purpose: Specific operation on asynchronous request through the VOL * * Return: Success: Non-negative * Failure: Negative * *------------------------------------------------------------------------- */ -herr_t -H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +static herr_t +H5VL__request_specific(void *req, const H5VL_class_t *cls, + H5VL_request_specific_t specific_type, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC - /* Sanity checks */ + /* Sanity check */ HDassert(req); HDassert(cls); - HDassert(status); /* Check if the corresponding VOL callback exists */ - if(NULL == cls->async_cls.test) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async test' method") + if(NULL == cls->request_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async specific' method") /* Call the corresponding VOL callback */ - if((cls->async_cls.test)(req, status) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "request test failed") + if((ret_value = (cls->request_cls.specific)(req, specific_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_test() */ +} /* end H5VL__request_specific() */ /*------------------------------------------------------------------------- - * Function: H5VLrequest_test + * Function: H5VL_request_specific * - * Purpose: Tests a request + * Purpose: Specific operation on asynchronous request through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -5706,31 +5859,113 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status) +H5VL_request_specific(const H5VL_object_t *vol_obj, + H5VL_request_specific_t specific_type, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, specific_type); + arg_started = TRUE; + if((ret_value = H5VL__request_specific(vol_obj->data, vol_obj->plugin->cls, specific_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_specific + * + * Purpose: Performs a plugin-specific operation on an asynchronous request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_specific(void *req, hid_t plugin_id, H5VL_request_specific_t specific_type, + va_list arguments) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "**xi*Es", req, plugin_id, status); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_request_test(req, cls, status) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to test request") + if((ret_value = H5VL__request_specific(req, cls, specific_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") done: FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLrequest_test() */ +} /* end H5VLrequest_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_request_wait + * Function: H5VL__request_optional * - * Purpose: Waits on an asychronous request through the VOL + * Purpose: Optional operation specific to plugins. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async optional' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->request_cls.optional)(req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_optional + * + * Purpose: Optional operation specific to plugins. * * Return: Success: Non-negative * Failure: Negative @@ -5738,34 +5973,150 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +H5VL_request_optional(const H5VL_object_t *vol_obj, ...) { + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Sanity checks */ + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, vol_obj); + arg_started = TRUE; + if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->plugin->cls, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_optional + * + * Purpose: Performs an optional plugin-specific operation on an asynchronous request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_optional(void *req, hid_t plugin_id, va_list arguments) +{ + H5VL_class_t *cls; /* VOL plugin's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__request_optional(req, cls, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_free + * + * Purpose: Frees an asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_free(void *req, const H5VL_class_t *cls) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ HDassert(req); HDassert(cls); - HDassert(status); /* Check if the corresponding VOL callback exists */ - if(NULL == cls->async_cls.wait) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async wait' method") + if(NULL == cls->request_cls.free) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async free' method") /* Call the corresponding VOL callback */ - if((cls->async_cls.wait)(req, status) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + if((cls->request_cls.free)(req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_wait() */ +} /* end H5VL__request_free() */ /*------------------------------------------------------------------------- - * Function: H5VLrequest_wait + * Function: H5VL_request_free * - * Purpose: Waits on a request + * Purpose: Frees an asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_free(const H5VL_object_t *vol_obj) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding VOL callback */ + if(H5VL__request_free(vol_obj->data, vol_obj->plugin->cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_free + * + * Purpose: Frees a request * * Return: Success: Non-negative * Failure: Negative @@ -5773,23 +6124,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status) +H5VLrequest_free(void *req, hid_t plugin_id) { H5VL_class_t *cls; /* VOL plugin's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "**xi*Es", req, plugin_id, status); + H5TRACE2("e", "*xi", req, plugin_id); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Call the corresponding internal VOL routine */ - if(H5VL_request_wait(req, cls, status) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") + if(H5VL__request_free(req, cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request") done: FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLrequest_wait() */ +} /* end H5VLrequest_free() */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index c6954bc..9137e4d 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -192,10 +192,12 @@ static H5VL_class_t H5VL_native_cls_g = { H5VL__native_object_specific, /* specific */ H5VL__native_object_optional /* optional */ }, - { /* async_cls */ + { /* request_cls */ + NULL, /* wait */ NULL, /* cancel */ - NULL, /* test */ - NULL /* wait */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ }, NULL /* optional */ }; diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index a168b57..ee6b7d4 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -162,9 +162,11 @@ H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Asynchronous functions */ -H5_DLL herr_t H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status); -H5_DLL herr_t H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status); -H5_DLL herr_t H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status); +H5_DLL herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5ES_status_t *status); +H5_DLL herr_t H5VL_request_cancel(const H5VL_object_t *vol_obj); +H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...); +H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, ...); +H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj); #endif /* _H5VLprivate_H */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 5d19985..1b8a4a7 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -169,14 +169,21 @@ typedef enum H5VL_object_get_t { /* types for object SPECIFIC callback */ typedef enum H5VL_object_specific_t { - H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */ - H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */ - H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */ - H5VL_REF_CREATE, /* H5Rcreate */ - H5VL_OBJECT_FLUSH, - H5VL_OBJECT_REFRESH + H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */ + H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */ + H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */ + H5VL_REF_CREATE, /* H5Rcreate */ + H5VL_OBJECT_FLUSH, /* H5{D|G|O|T}flush */ + H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */ } H5VL_object_specific_t; +/* types for async request SPECIFIC callback */ +typedef enum H5VL_request_specific_t { + H5VL_REQUEST_WAITANY, /* Wait until any request completes */ + H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */ + H5VL_REQUEST_WAITALL /* Wait until all requests complete */ +} H5VL_request_specific_t; + /* types for different ways that objects are located in an HDF5 container */ typedef enum H5VL_loc_type_t { H5VL_OBJECT_BY_SELF, @@ -329,11 +336,13 @@ typedef struct H5VL_object_class_t { } H5VL_object_class_t; /* Async operation routines */ -typedef struct H5VL_async_class_t { - herr_t (*cancel)(void **, H5ES_status_t *); - herr_t (*test) (void **, H5ES_status_t *); - herr_t (*wait) (void **, H5ES_status_t *); -} H5VL_async_class_t; +typedef struct H5VL_request_class_t { + herr_t (*wait)(void *req, uint64_t timeout, H5ES_status_t *status); + herr_t (*cancel)(void *req); + herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments); + herr_t (*optional)(void *req, va_list arguments); + herr_t (*free)(void *req); +} H5VL_request_class_t; /* enum value to identify the class of a VOL plugin (mostly for comparison purposes) */ @@ -389,7 +398,7 @@ typedef struct H5VL_class_t { H5VL_object_class_t object_cls; /* object class callbacks */ /* Services */ - H5VL_async_class_t async_cls; /* asynchronous class callbacks */ + H5VL_request_class_t request_cls; /* asynchronous request class callbacks */ /* Catch-all */ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ @@ -506,9 +515,11 @@ H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, v H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req); /* Public wrappers for asynchronous request callbacks */ -H5_DLL herr_t H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_wait(void *req, hid_t plugin_id, uint64_t timeout, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t plugin_id); +H5_DLL herr_t H5VLrequest_specific(void *req, hid_t plugin_id, H5VL_request_specific_t specific_type, va_list arguments); +H5_DLL herr_t H5VLrequest_optional(void *req, hid_t plugin_id, va_list arguments); +H5_DLL herr_t H5VLrequest_free(void *req, hid_t plugin_id); #ifdef __cplusplus } diff --git a/src/H5trace.c b/src/H5trace.c index a63bdfa..797130e 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -834,8 +834,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5ES_STATUS_FAIL: HDfprintf(out, "H5ES_STATUS_FAIL"); break; - case H5ES_STATUS_CANCEL: - HDfprintf(out, "H5ES_STATUS_CANCEL"); + case H5ES_STATUS_CANCELLED: + HDfprintf(out, "H5ES_STATUS_CANCELLED"); break; default: -- cgit v0.12 From 1daa7b830ac9ce6028c21f22fddaa67bd4dc8d96 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 4 Nov 2018 01:27:23 -0500 Subject: Switch driver | plugin => connector. --- examples/h5_vol_external_log_native.c | 68 +- src/H5A.c | 16 +- src/H5Adeprec.c | 12 +- src/H5D.c | 10 +- src/H5Ddeprec.c | 10 +- src/H5F.c | 30 +- src/H5Fint.c | 22 +- src/H5Fmount.c | 6 +- src/H5Fprivate.h | 2 +- src/H5G.c | 8 +- src/H5Gdeprec.c | 10 +- src/H5I.c | 12 +- src/H5L.c | 42 +- src/H5Lexternal.c | 2 +- src/H5O.c | 14 +- src/H5Ocopy.c | 2 +- src/H5Oflush.c | 24 +- src/H5Pfapl.c | 238 +++---- src/H5R.c | 2 +- src/H5Rdeprec.c | 12 +- src/H5T.c | 6 +- src/H5Tcommit.c | 24 +- src/H5Tdeprec.c | 12 +- src/H5VL.c | 188 +++--- src/H5VLcallback.c | 1150 ++++++++++++++++----------------- src/H5VLint.c | 176 ++--- src/H5VLnative.c | 36 +- src/H5VLnative.h | 4 +- src/H5VLnative_private.h | 6 +- src/H5VLprivate.h | 50 +- src/H5VLpublic.h | 174 ++--- test/tmisc.c | 22 +- test/vol.c | 72 ++- 33 files changed, 1232 insertions(+), 1230 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index a6ed2b5..0d48b73 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -40,12 +40,12 @@ static herr_t H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req); static void *H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); static herr_t H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -hid_t native_plugin_id = -1; +hid_t native_connector_id = -1; static const H5VL_class_t H5VL_log_g = { 0, /* VOL class struct version */ - LOG, /* ID of plugin */ - "log", /* Name of plugin */ + LOG, /* ID of connector */ + "log", /* Name of connector */ 0, /* capability flags */ H5VL_log_init, /* initialize */ H5VL_log_term, /* terminate */ @@ -137,7 +137,7 @@ visit_cb(hid_t oid, const char *name, const H5O_info_t *oinfo, void *udata) char n[25]; if(H5Iget_type(oid) == H5I_GROUP) { - len = H5VLget_plugin_name(oid, n, 50); + len = H5VLget_connector_name(oid, n, 50); printf("Visiting GROUP VOL name = %s %zd\n", n, len); } if(H5Iget_type(oid) == H5I_DATASET) @@ -175,42 +175,42 @@ main(int argc, char **argv) under_fapl = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_native(under_fapl); - assert(H5VLis_plugin_registered("native") == 1); + assert(H5VLis_connector_registered("native") == 1); - vol_id = H5VLregister_plugin(&H5VL_log_g, H5P_DEFAULT); + vol_id = H5VLregister_connector(&H5VL_log_g, H5P_DEFAULT); assert(vol_id > 0); - assert(H5VLis_plugin_registered("log") == 1); + assert(H5VLis_connector_registered("log") == 1); - vol_id2 = H5VLget_plugin_id("log"); + vol_id2 = H5VLget_connector_id("log"); H5VLclose(vol_id2); - native_plugin_id = H5VLget_plugin_id("native"); - assert(native_plugin_id > 0); + native_connector_id = H5VLget_connector_id("native"); + assert(native_connector_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_plugin_name(file_id, name, 25); + len = H5VLget_connector_name(file_id, name, 25); printf("FILE VOL name = %s %zd\n", name, len); group_id = H5Gcreate2(file_id, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - len = H5VLget_plugin_name(group_id, name, 50); + len = H5VLget_connector_name(group_id, name, 50); 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_plugin_name(int_id, name, 50); + len = H5VLget_connector_name(int_id, name, 50); printf("DT COMMIT name = %s %zd\n", name, len); H5Tclose(int_id); int_id = H5Topen2(file_id, "int", H5P_DEFAULT); - len = H5VLget_plugin_name(int_id, name, 50); + len = H5VLget_connector_name(int_id, name, 50); printf("DT OPEN name = %s %zd\n", name, len); H5Tclose(int_id); int_id = H5Oopen(file_id,"int",H5P_DEFAULT); - len = H5VLget_plugin_name(int_id, name, 50); + len = H5VLget_connector_name(int_id, name, 50); printf("DT OOPEN name = %s %zd\n", name, len); len = H5Fget_name(file_id, name, 50); @@ -228,7 +228,7 @@ main(int argc, char **argv) datasetId = H5Dcreate2(file_id,fullpath,H5T_NATIVE_INT,dataspaceId,H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); H5Sclose(dataspaceId); - len = H5VLget_plugin_name(datasetId, name, 50); + len = H5VLget_connector_name(datasetId, name, 50); printf("DSET name = %s %zd\n", name, len); H5Dwrite(datasetId, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); @@ -244,9 +244,9 @@ main(int argc, char **argv) H5Pclose(acc_tpl); H5Pclose(under_fapl); - H5VLclose(native_plugin_id); - H5VLunregister_plugin(vol_id); - assert(H5VLis_plugin_registered("log") == 0); + H5VLclose(native_connector_id); + H5VLunregister_connector(vol_id); + assert(H5VLis_connector_registered("log") == 0); return EXIT_SUCCESS; } @@ -300,7 +300,7 @@ H5VL_log_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **re { H5VL_log_t *f = (H5VL_log_t *)file; - H5VLfile_get(f->under_object, native_plugin_id, get_type, dxpl_id, req, arguments); + H5VLfile_get(f->under_object, native_connector_id, get_type, dxpl_id, req, arguments); printf("------- LOG H5Fget %d\n", get_type); return 1; @@ -311,7 +311,7 @@ H5VL_log_file_close(void *file, hid_t dxpl_id, void **req) { H5VL_log_t *f = (H5VL_log_t *)file; - H5VLfile_close(f->under_object, native_plugin_id, dxpl_id, req); + H5VLfile_close(f->under_object, native_connector_id, dxpl_id, req); free(f); printf("------- LOG H5Fclose\n"); @@ -327,7 +327,7 @@ H5VL_log_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, group = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - group->under_object = H5VLgroup_create(o->under_object, loc_params, native_plugin_id, name, gcpl_id, gapl_id, dxpl_id, req); + group->under_object = H5VLgroup_create(o->under_object, loc_params, native_connector_id, name, gcpl_id, gapl_id, dxpl_id, req); printf("------- LOG H5Gcreate\n"); return (void *)group; @@ -338,7 +338,7 @@ H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req) { H5VL_log_t *g = (H5VL_log_t *)grp; - H5VLgroup_close(g->under_object, native_plugin_id, dxpl_id, req); + H5VLgroup_close(g->under_object, native_connector_id, dxpl_id, req); free(g); printf("------- LOG H5Gclose\n"); @@ -354,7 +354,7 @@ H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *na dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dt->under_object = H5VLdatatype_commit(o->under_object, loc_params, native_plugin_id, name, + dt->under_object = H5VLdatatype_commit(o->under_object, loc_params, native_connector_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); printf("------- LOG H5Tcommit\n"); @@ -369,7 +369,7 @@ H5VL_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dt->under_object = H5VLdatatype_open(o->under_object, loc_params, native_plugin_id, name, tapl_id, dxpl_id, req); + dt->under_object = H5VLdatatype_open(o->under_object, loc_params, native_connector_id, name, tapl_id, dxpl_id, req); printf("------- LOG H5Topen\n"); return (void *)dt; @@ -381,7 +381,7 @@ H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, voi H5VL_log_t *o = (H5VL_log_t *)dt; herr_t ret_value; - ret_value = H5VLdatatype_get(o->under_object, native_plugin_id, get_type, dxpl_id, req, arguments); + ret_value = H5VLdatatype_get(o->under_object, native_connector_id, get_type, dxpl_id, req, arguments); printf("------- LOG datatype get\n"); return ret_value; @@ -394,7 +394,7 @@ H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req) assert(type->under_object); - H5VLdatatype_close(type->under_object, native_plugin_id, dxpl_id, req); + H5VLdatatype_close(type->under_object, native_connector_id, dxpl_id, req); free(type); printf("------- LOG H5Tclose\n"); @@ -409,7 +409,7 @@ H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened new_obj = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - new_obj->under_object = H5VLobject_open(o->under_object, loc_params, native_plugin_id, opened_type, dxpl_id, req); + new_obj->under_object = H5VLobject_open(o->under_object, loc_params, native_connector_id, opened_type, dxpl_id, req); printf("------- LOG H5Oopen\n"); return (void *)new_obj; @@ -421,7 +421,7 @@ H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_sp { H5VL_log_t *o = (H5VL_log_t *)obj; - H5VLobject_specific(o->under_object, loc_params, native_plugin_id, specific_type, dxpl_id, req, arguments); + H5VLobject_specific(o->under_object, loc_params, native_connector_id, specific_type, dxpl_id, req, arguments); printf("------- LOG Object specific\n"); return 1; @@ -435,7 +435,7 @@ H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *nam dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dset->under_object = H5VLdataset_create(o->under_object, loc_params, native_plugin_id, name, dcpl_id, dapl_id, dxpl_id, req); + dset->under_object = H5VLdataset_create(o->under_object, loc_params, native_connector_id, name, dcpl_id, dapl_id, dxpl_id, req); printf("------- LOG H5Dcreate\n"); return (void *)dset; @@ -449,7 +449,7 @@ H5VL_log_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dset->under_object = H5VLdataset_open(o->under_object, loc_params, native_plugin_id, name, dapl_id, dxpl_id, req); + dset->under_object = H5VLdataset_open(o->under_object, loc_params, native_connector_id, name, dapl_id, dxpl_id, req); printf("------- LOG H5Dopen\n"); return (void *)dset; @@ -461,7 +461,7 @@ H5VL_log_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, { H5VL_log_t *d = (H5VL_log_t *)dset; - H5VLdataset_read(d->under_object, native_plugin_id, mem_type_id, mem_space_id, file_space_id, + H5VLdataset_read(d->under_object, native_connector_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); printf("------- LOG H5Dread\n"); @@ -474,7 +474,7 @@ H5VL_log_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, { H5VL_log_t *d = (H5VL_log_t *)dset; - H5VLdataset_write(d->under_object, native_plugin_id, mem_type_id, mem_space_id, file_space_id, + H5VLdataset_write(d->under_object, native_connector_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); printf("------- LOG H5Dwrite\n"); @@ -486,7 +486,7 @@ H5VL_log_dataset_close(void *dset, hid_t dxpl_id, void **req) { H5VL_log_t *d = (H5VL_log_t *)dset; - H5VLdataset_close(d->under_object, native_plugin_id, dxpl_id, req); + H5VLdataset_close(d->under_object, native_connector_id, dxpl_id, req); free(d); printf("------- LOG H5Dclose\n"); diff --git a/src/H5A.c b/src/H5A.c index 13ce41b..bfbb6e4 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -300,7 +300,7 @@ H5Acreate2(hid_t loc_id, const char *attr_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(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -348,7 +348,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id) { - void *attr = NULL; /* attr token from VOL plugin */ + void *attr = NULL; /* attr token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5P_genplist_t *plist; /* Property list pointer */ H5VL_loc_params_t loc_params; @@ -405,7 +405,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(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -440,7 +440,7 @@ done: hid_t H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { - void *attr = NULL; /* attr token from VOL plugin */ + void *attr = NULL; /* attr token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -473,7 +473,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(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -511,7 +511,7 @@ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id) { - void *attr = NULL; /* attr token from VOL plugin */ + void *attr = NULL; /* attr token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -555,7 +555,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(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -646,7 +646,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(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index ae25cb9..bf97a25 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -114,7 +114,7 @@ hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id) { - void *attr = NULL; /* attr token from VOL plugin */ + void *attr = NULL; /* attr token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ @@ -160,7 +160,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(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: @@ -198,7 +198,7 @@ done: hid_t H5Aopen_name(hid_t loc_id, const char *name) { - void *attr = NULL; /* attr token from VOL plugin */ + void *attr = NULL; /* attr token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -225,7 +225,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(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: @@ -263,7 +263,7 @@ done: hid_t H5Aopen_idx(hid_t loc_id, unsigned idx) { - void *attr = NULL; /* attr token from VOL plugin */ + void *attr = NULL; /* attr token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -293,7 +293,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(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: diff --git a/src/H5D.c b/src/H5D.c index 5be4c83..67c2876 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -162,7 +162,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(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: @@ -210,7 +210,7 @@ hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id) { - void *dset = NULL; /* dset token from VOL plugin */ + void *dset = NULL; /* dset token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ @@ -253,7 +253,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(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: @@ -284,7 +284,7 @@ done: hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { - void *dset = NULL; /* dset token from VOL plugin */ + void *dset = NULL; /* dset token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -315,7 +315,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(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 87b3d8d..d778e83 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -40,7 +40,7 @@ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ -#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -113,7 +113,7 @@ hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) { - void *dset = NULL; /* dset token from VOL plugin */ + void *dset = NULL; /* dset token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ @@ -165,7 +165,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(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: @@ -197,7 +197,7 @@ done: hid_t H5Dopen1(hid_t loc_id, const char *name) { - void *dset = NULL; /* dset token from VOL plugin */ + void *dset = NULL; /* dset token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -224,7 +224,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(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: diff --git a/src/H5F.c b/src/H5F.c index ffa2d9a..b7fc126 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -609,7 +609,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) H5P_genplist_t *plist; /* Property list pointer */ H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -643,10 +643,10 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL plugin info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL plugin ID") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID") /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for @@ -661,7 +661,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ - if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, plugin_prop.plugin_id, TRUE)) < 0) + if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -693,7 +693,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { void *new_file = NULL; /* file struct for new file */ H5P_genplist_t *plist; /* Property list pointer */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ H5VL_class_t *cls = NULL; /* VOL class structure for callback info */ hid_t ret_value; /* return value */ @@ -722,17 +722,17 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) /* Get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL plugin info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL plugin ID") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL connector ID") /* Open the file through the VOL layer */ if(NULL == (new_file = H5VL_file_open(cls, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") /* Get an ID for the file */ - if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, plugin_prop.plugin_id, TRUE)) < 0) + if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -836,7 +836,7 @@ hid_t H5Freopen(hid_t file_id) { H5VL_object_t *vol_obj = NULL; - void *file; /* File token from VOL plugin */ + void *file; /* File token from VOL connector */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -848,14 +848,14 @@ H5Freopen(hid_t file_id) /* Reopen the file */ if(H5VL_file_specific(vol_obj, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL plugin") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL connector") /* Make sure that worked */ if(NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") /* Get an atom for the file */ - if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: diff --git a/src/H5Fint.c b/src/H5Fint.c index fe387a5..6e8f073 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -37,8 +37,8 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL plugins */ -#include "H5VLnative_private.h" /* Native VOL plugin */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ @@ -2175,7 +2175,7 @@ H5F_get_id(H5F_t *file) HDassert(file); if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) { - /* resurrect the ID - Register an ID with the native driver */ + /* resurrect the ID - Register an ID with the native connector */ { void *vol_wrap_ctx = NULL; /* Object wrapping context */ @@ -3243,7 +3243,7 @@ H5F__start_swmr_write(H5F_t *f) H5G_name_t *obj_paths = NULL; /* Group hierarchy path */ size_t u; /* Local index variable */ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ - H5VL_t *vol_plugin = NULL; /* VOL plugin for the file */ + H5VL_t *vol_connector = NULL; /* VOL connector for the file */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3308,7 +3308,7 @@ H5F__start_swmr_write(H5F_t *f) if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") - /* Save the VOL plugin and the object wrapping context for the refresh step */ + /* Save the VOL connector and the object wrapping context for the refresh step */ if(grp_dset_count > 0) { H5VL_object_t *vol_obj; @@ -3317,12 +3317,12 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; - /* Get the (top) plugin for the ID */ - vol_plugin = vol_obj->plugin; + /* Get the (top) connector for the ID */ + vol_connector = vol_obj->connector; } /* end if */ /* Gather information about opened objects (groups, datasets) in the file */ @@ -3388,7 +3388,7 @@ H5F__start_swmr_write(H5F_t *f) /* Refresh (reopen) the objects (groups & datasets) in the file */ for(u = 0; u < grp_dset_count; u++) - if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_plugin, TRUE) < 0) + if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_connector, TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") /* Unlock the file */ @@ -3539,10 +3539,10 @@ H5F_get_file_id(hid_t obj_id, H5I_type_t type) if(H5I_find_id(file, H5I_FILE, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") - /* If the ID does not exist, register it with the VOL plugin */ + /* If the ID does not exist, register it with the VOL connector */ if(H5I_INVALID_HID == ret_value) { /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 4a67cc2..d7f8915 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -477,9 +477,9 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) if(NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object") - /* Check if both objects are associated with the same VOL plugin */ - if(loc_vol_obj->plugin->cls->value != child_vol_obj->plugin->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL plugin") + /* Check if both objects are associated with the same VOL connector */ + if(loc_vol_obj->connector->cls->value != child_vol_obj->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL connector") /* Perform the mount operation */ if(H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index b611f44..00aefa0 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -479,7 +479,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */ #define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */ #define H5F_ACS_FILE_DRV_NAME "vfd_info" /* File driver ID & info */ -#define H5F_ACS_VOL_DRV_NAME "vol_driver_info" /* VOL driver ID & info */ +#define H5F_ACS_VOL_CONN_NAME "vol_connector_info" /* VOL connector ID & info */ #define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ #define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */ diff --git a/src/H5G.c b/src/H5G.c index ca89993..4625765 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -369,7 +369,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(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: @@ -448,7 +448,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(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: @@ -509,7 +509,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(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: @@ -812,7 +812,7 @@ H5Grefresh(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 769ec42..8aae2a1 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -43,7 +43,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5Pprivate.h" /* Property lists */ -#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -239,7 +239,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(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: @@ -300,7 +300,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(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: @@ -372,7 +372,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Construct a temporary VOL object */ tmp_vol_obj.data = NULL; - tmp_vol_obj.plugin = vol_obj->plugin; + tmp_vol_obj.connector = vol_obj->connector; /* Create the link through the VOL */ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) @@ -850,7 +850,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't set VOL wrapper info") vol_wrapper_set = TRUE; diff --git a/src/H5I.c b/src/H5I.c index f8bb8c4..8a4b220 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2146,7 +2146,7 @@ done: * * Failure: -1 * - * NOTE: Not safe for arbitrary VOL plugins as it relies on + * NOTE: Not safe for arbitrary VOL connectors as it relies on * private H5G calls. * * Comments: Public function @@ -2181,7 +2181,7 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2260,7 +2260,7 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) HDassert(item); HDassert(udata); - /* Get a pointer to the VOL plugin's data */ + /* Get a pointer to the VOL connector's data */ obj_ptr = H5I__unwrap(item->obj_ptr, type); /* Check for a match */ @@ -2337,7 +2337,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ H5G_name_t *path = NULL; /* Path to file object */ - const void *obj_ptr = NULL; /* Pointer to VOL plugin object */ + const void *obj_ptr = NULL; /* Pointer to VOL connector object */ FUNC_ENTER_STATIC_NOERR @@ -2352,7 +2352,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->plugin->cls->value) + if(H5_VOL_NATIVE == vol_obj->connector->cls->value) path = H5G_nameof((const H5G_t *)obj_ptr); break; } @@ -2362,7 +2362,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->plugin->cls->value) + if(H5_VOL_NATIVE == vol_obj->connector->cls->value) path = H5D_nameof((const H5D_t *)obj_ptr); break; } diff --git a/src/H5L.c b/src/H5L.c index d3d8707..830caae 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_private.h" /* Native VOL driver */ +#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ @@ -325,10 +325,10 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Make sure that the VOL plugins are the same */ + /* Make sure that the VOL connectors are the same */ if (vol_obj1 && vol_obj2) - if (vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") /* Move the link */ if(H5VL_link_move(vol_obj1, loc_params1, vol_obj2, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) @@ -408,14 +408,14 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Make sure that the VOL plugins are the same */ + /* Make sure that the VOL connectors are the same */ if(vol_obj1 && vol_obj2) - if(vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + if(vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") /* Construct a temporary source VOL object */ tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL); - tmp_vol_obj.plugin = (vol_obj1 ? vol_obj1->plugin : vol_obj2->plugin); + tmp_vol_obj.connector = (vol_obj1 ? vol_obj1->connector : vol_obj2->connector); /* Copy the link */ if(H5VL_link_copy(&tmp_vol_obj, loc_params1, vol_obj2, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) @@ -579,10 +579,10 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(NULL == (vol_obj2 = (H5VL_object_t *)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 */ + /* Make sure that the VOL connectors are the same */ if(vol_obj1 && vol_obj2) - if(vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + if(vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") /* Get the link creation plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -596,7 +596,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, /* Construct a temporary VOL object */ tmp_vol_obj.data = (vol_obj2 ? (vol_obj2->data) : NULL); - tmp_vol_obj.plugin = (vol_obj1 != NULL ? vol_obj1->plugin : vol_obj2->plugin); + tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector); /* Create the link */ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) @@ -735,7 +735,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -864,7 +864,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -989,7 +989,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1050,7 +1050,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1120,7 +1120,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1384,7 +1384,7 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.obj_type = H5I_get_type(group_id); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1464,7 +1464,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1542,7 +1542,7 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1627,7 +1627,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 1c69c53..3cacdf5 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_private.h" /* Native VOL driver */ +#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ diff --git a/src/H5O.c b/src/H5O.c index 7e8484b..5c3a0a6 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -134,7 +134,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(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: @@ -206,7 +206,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &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(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: @@ -274,7 +274,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(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: @@ -356,10 +356,10 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_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 */ + /* Make sure that the VOL connectors are the same */ if(vol_obj1 && vol_obj2) - if (vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -373,7 +373,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, /* Construct a temporary VOL object */ tmp_vol_obj.data = vol_obj2->data; - tmp_vol_obj.plugin = (vol_obj1 != NULL ? vol_obj1->plugin : vol_obj2->plugin); + tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector); /* Create a link to the object */ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index ae883fb..cc1680d 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -248,7 +248,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.obj_type = H5I_get_type(dst_loc_id); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj1->data, vol_obj1->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj1->data, vol_obj1->connector) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") vol_wrapper_set = TRUE; diff --git a/src/H5Oflush.c b/src/H5Oflush.c index d8d0430..4b429f8 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -299,7 +299,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) H5O_loc_t obj_oloc; H5G_name_t obj_path; H5O_shared_t cached_H5O_shared; - H5VL_t *plugin = NULL; + H5VL_t *connector = NULL; /* Create empty object location */ obj_loc.oloc = &obj_oloc; @@ -317,29 +317,29 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) if(H5T_save_refresh_state(oid, &cached_H5O_shared) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state") - /* Get the VOL object from the ID and cache a pointer to the plugin. + /* Get the VOL object from the ID and cache a pointer to the connector. * The vol_obj will disappear when the underlying object is closed, so * we can't use that directly. */ if(NULL == (vol_obj = H5VL_vol_object(oid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - plugin = vol_obj->plugin; + connector = vol_obj->connector; - /* Bump the number of references on the VOL plugin. - * If you don't do this, VDS refreshes can accidentally close the plugin. + /* Bump the number of references on the VOL connector. + * If you don't do this, VDS refreshes can accidentally close the connector. */ - plugin->nrefs++; + connector->nrefs++; /* Close object & evict its metadata */ if((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Re-open the object, re-fetching its metadata */ - if((H5O_refresh_metadata_reopen(oid, &obj_loc, plugin, FALSE)) < 0) + if((H5O_refresh_metadata_reopen(oid, &obj_loc, connector, FALSE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") - /* Restore the number of references on the VOL plugin */ - plugin->nrefs--; + /* Restore the number of references on the VOL connector */ + connector->nrefs--; /* Restore important datatype state */ if(H5I_get_type(oid) == H5I_DATATYPE) @@ -442,7 +442,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_plugin, hbool_t start_swmr) +H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector, hbool_t start_swmr) { void *object = NULL; /* Object for this operation */ H5I_type_t type; /* Type of object for the ID */ @@ -452,7 +452,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_plugin, h /* Sanity check */ HDassert(obj_loc); - HDassert(vol_plugin); + HDassert(vol_connector); /* Get object's type */ type = H5I_get_type(oid); @@ -499,7 +499,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_plugin, h } /* end switch */ /* Re-register ID for the object */ - if((H5VL_register_using_existing_id(type, object, vol_plugin, TRUE, oid)) < 0) + if((H5VL_register_using_existing_id(type, object, vol_connector, TRUE, oid)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh") done: diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index c6387a3..820c291 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -39,7 +39,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory Management */ #include "H5Ppkg.h" /* Property lists */ -#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Includes needed to set as default file driver */ #include "H5FDsec2.h" /* POSIX unbuffered I/O */ @@ -48,8 +48,8 @@ #include "H5FDwindows.h" /* Win32 I/O */ #endif -/* Includes needed to set the default VOL plugin */ -#include "H5VLnative_private.h" /* Native VOL plugin */ +/* Includes needed to set the default VOL connector */ +#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ @@ -262,16 +262,16 @@ #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF 0 #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC H5P__encode_unsigned #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC H5P__decode_unsigned -/* Definition for file VOL plugin properties (ID, etc.) */ -#define H5F_ACS_VOL_SIZE sizeof(H5VL_plugin_prop_t) -#define H5F_ACS_VOL_DEF {H5_DEFAULT_VOL, NULL} -#define H5F_ACS_VOL_CRT H5P__facc_vol_create -#define H5F_ACS_VOL_SET H5P__facc_vol_set -#define H5F_ACS_VOL_GET H5P__facc_vol_get -#define H5F_ACS_VOL_DEL H5P__facc_vol_del -#define H5F_ACS_VOL_COPY H5P__facc_vol_copy -#define H5F_ACS_VOL_CMP H5P__facc_vol_cmp -#define H5F_ACS_VOL_CLOSE H5P__facc_vol_close +/* Definition for file VOL connector properties (ID, etc.) */ +#define H5F_ACS_VOL_CONN_SIZE sizeof(H5VL_connector_prop_t) +#define H5F_ACS_VOL_CONN_DEF {H5_DEFAULT_VOL, NULL} +#define H5F_ACS_VOL_CONN_CRT H5P__facc_vol_create +#define H5F_ACS_VOL_CONN_SET H5P__facc_vol_set +#define H5F_ACS_VOL_CONN_GET H5P__facc_vol_get +#define H5F_ACS_VOL_CONN_DEL H5P__facc_vol_del +#define H5F_ACS_VOL_CONN_COPY H5P__facc_vol_copy +#define H5F_ACS_VOL_CONN_CMP H5P__facc_vol_cmp +#define H5F_ACS_VOL_CONN_CLOSE H5P__facc_vol_close /******************/ @@ -334,7 +334,7 @@ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_c static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); -/* VOL plugin callbacks */ +/* VOL connector callbacks */ static herr_t H5P__facc_vol_create(const char *name, size_t size, void *value); static herr_t H5P__facc_vol_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__facc_vol_get(hid_t prop_id, const char *name, size_t size, void *value); @@ -437,7 +437,7 @@ static herr_t H5P__facc_reg_prop(H5P_genclass_t *pclass) { const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */ - const H5VL_plugin_prop_t def_vol_prop = H5F_ACS_VOL_DEF; /* Default VOL plugin ID & info (initialized from a variable) */ + const H5VL_connector_prop_t def_vol_prop = H5F_ACS_VOL_CONN_DEF; /* Default VOL connector ID & info (initialized from a variable) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -668,11 +668,11 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the file VOL plugin ID & info */ + /* Register the file VOL connector ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P__register_real(pclass, H5F_ACS_VOL_DRV_NAME, H5F_ACS_VOL_SIZE, &def_vol_prop, - H5F_ACS_VOL_CRT, H5F_ACS_VOL_SET, H5F_ACS_VOL_GET, NULL, NULL, - H5F_ACS_VOL_DEL, H5F_ACS_VOL_COPY, H5F_ACS_VOL_CMP, H5F_ACS_VOL_CLOSE) < 0) + if(H5P__register_real(pclass, H5F_ACS_VOL_CONN_NAME, H5F_ACS_VOL_CONN_SIZE, &def_vol_prop, + H5F_ACS_VOL_CONN_CRT, H5F_ACS_VOL_CONN_SET, H5F_ACS_VOL_CONN_GET, NULL, NULL, + H5F_ACS_VOL_CONN_DEL, H5F_ACS_VOL_CONN_COPY, H5F_ACS_VOL_CONN_CMP, H5F_ACS_VOL_CONN_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -4974,7 +4974,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P_set_vol * - * Purpose: Set the VOL plugin for a file access property list + * Purpose: Set the VOL connector for a file access property list * (PLIST_ID). The VOL properties will * be copied into the property list and the reference count on * the VOL will be incremented. @@ -4991,18 +4991,18 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) FUNC_ENTER_NOAPI(FAIL) if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5VL_plugin_prop_t vol_prop; /* Property for VOL ID & info */ + H5VL_connector_prop_t vol_prop; /* Property for VOL ID & info */ - /* Prepare the VOL plugin property */ - vol_prop.plugin_id = vol_id; - vol_prop.plugin_info = vol_info; + /* Prepare the VOL connector property */ + vol_prop.connector_id = vol_id; + vol_prop.connector_info = vol_info; - /* Set the plugin ID & info property */ - if(H5P_set(plist, H5F_ACS_VOL_DRV_NAME, &vol_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL plugin ID & info") + /* Set the connector ID & info property */ + if(H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info") } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); @@ -5015,7 +5015,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_vol * - * Purpose: Set the file VOL plugin (VOL_ID) for a file access + * Purpose: Set the file VOL connector (VOL_ID) for a file access * property list (PLIST_ID) * * Return: Success: Non-negative @@ -5050,7 +5050,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Pget_vol_id * - * Purpose: Returns the ID of the current VOL plugin. + * Purpose: Returns the ID of the current VOL connector. * This ID should be closed with H5VLclose(). * * Return: Success: Non-negative @@ -5073,18 +5073,18 @@ H5Pget_vol_id(hid_t plist_id, hid_t *vol_id) /* Get the current VOL ID */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - /* Get the plugin property */ - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") + /* Get the connector property */ + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info") /* Increment the VOL ID's ref count */ - if(H5I_inc_ref(plugin_prop.plugin_id, TRUE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin ID") + if(H5I_inc_ref(connector_prop.connector_id, TRUE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") - /* Set the plugin ID to return */ - *vol_id = plugin_prop.plugin_id; + /* Set the connector ID to return */ + *vol_id = connector_prop.connector_id; } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") @@ -5097,8 +5097,8 @@ done: /*------------------------------------------------------------------------- * Function: H5Pget_vol_info * - * Purpose: Returns a copy of the VOL info for a plugin. - * This information should be freed with H5VLfree_plugin_info. + * Purpose: Returns a copy of the VOL info for a connector. + * This information should be freed with H5VLfree_connector_info. * * Return: Success: Non-negative * Failure: Negative @@ -5120,28 +5120,28 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info) /* Get the current VOL info */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - void *new_plugin_info = NULL; /* Copy of plugin info */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + void *new_connector_info = NULL; /* Copy of connector info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - /* Get the plugin property */ - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") + /* Get the connector property */ + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info") - /* Copy plugin info, if it exists */ - if(plugin_prop.plugin_info) { - H5VL_class_t *plugin; /* Pointer to plugin */ + /* Copy connector info, if it exists */ + if(connector_prop.connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ - /* Retrieve the plugin for the ID */ - if(NULL == (plugin = (H5VL_class_t *)H5I_object(plugin_prop.plugin_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop.connector_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Allocate and copy plugin info */ - if(H5VL_copy_plugin_info(plugin, &new_plugin_info, plugin_prop.plugin_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "plugin info copy failed") + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop.connector_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") } /* end if */ - /* Set the plugin info */ - *vol_info = new_plugin_info; + /* Set the connector info */ + *vol_info = new_connector_info; } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") @@ -5154,7 +5154,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__vol_copy * - * Purpose: Copy VOL plugin ID & info. + * Purpose: Copy VOL connector ID & info. * * Note: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine @@ -5173,29 +5173,29 @@ H5P__vol_copy(void *value) FUNC_ENTER_STATIC if(value) { - H5VL_plugin_prop_t *plugin_prop = (H5VL_plugin_prop_t *)value; /* Driver ID & info struct */ + H5VL_connector_prop_t *connector_prop = (H5VL_connector_prop_t *)value; /* connector ID & info struct */ - /* Copy the plugin ID & info, if there is one */ - if(plugin_prop->plugin_id > 0) { - /* Increment the reference count on plugin ID and copy plugin info */ - if(H5I_inc_ref(plugin_prop->plugin_id, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin ID") + /* Copy the connector ID & info, if there is one */ + if(connector_prop->connector_id > 0) { + /* Increment the reference count on connector ID and copy connector info */ + if(H5I_inc_ref(connector_prop->connector_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") - /* Copy plugin info, if it exists */ - if(plugin_prop->plugin_info) { - H5VL_class_t *plugin; /* Pointer to plugin */ - void *new_plugin_info = NULL; /* Copy of plugin info */ + /* Copy connector info, if it exists */ + if(connector_prop->connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ + void *new_connector_info = NULL; /* Copy of connector info */ - /* Retrieve the plugin for the ID */ - if(NULL == (plugin = (H5VL_class_t *)H5I_object(plugin_prop->plugin_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Allocate and copy plugin info */ - if(H5VL_copy_plugin_info(plugin, &new_plugin_info, plugin_prop->plugin_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "plugin info copy failed") + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") - /* Set the plugin info to the copy */ - plugin_prop->plugin_info = new_plugin_info; + /* Set the connector info to the copy */ + connector_prop->connector_info = new_connector_info; } /* end if */ } /* end if */ } /* end if */ @@ -5208,7 +5208,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__vol_free * - * Purpose: Free VOL plugin ID & info. + * Purpose: Free VOL connector ID & info. * * Return: Success: Non-negative * Failure: Negative @@ -5223,25 +5223,25 @@ H5P__vol_free(void *value) FUNC_ENTER_STATIC if(value) { - H5VL_plugin_prop_t *info = (H5VL_plugin_prop_t *)value; /* Driver ID & info struct */ + H5VL_connector_prop_t *info = (H5VL_connector_prop_t *)value; /* connector ID & info struct */ - /* Free the plugin info (if it exists) and decrement the ID */ - if(info->plugin_id > 0) { - if(info->plugin_info) { - H5VL_class_t *plugin; /* Pointer to plugin */ + /* Free the connector info (if it exists) and decrement the ID */ + if(info->connector_id > 0) { + if(info->connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ - /* Retrieve the plugin for the ID */ - if(NULL == (plugin = (H5VL_class_t *)H5I_object(info->plugin_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(info->connector_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Free the plugin info */ - if(H5VL_free_plugin_info(plugin, (void *)info->plugin_info) < 0) /* Casting away const OK - QAK */ - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin info object") + /* Free the connector info */ + if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") } /* end if */ - /* Decrement reference count for plugin ID */ - if(H5I_dec_ref(info->plugin_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for plugin ID") + /* Decrement reference count for connector ID */ + if(H5I_dec_ref(info->connector_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID") } /* end if */ } /* end if */ @@ -5253,7 +5253,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_create * - * Purpose: Create callback for the VOL plugin ID & info property. + connectorose: Create callback for the VOL connector ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5267,9 +5267,9 @@ H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size FUNC_ENTER_STATIC - /* Make copy of the VOL plugin */ + /* Make copy of the VOL connector */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5279,7 +5279,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_set * - * Purpose: Copies a VOL plugin property when it's set for a property list + * Purpose: Copies a VOL connector property when it's set for a property list * * Return: Success: Non-negative * Failure: Negative @@ -5297,9 +5297,9 @@ H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, /* Sanity check */ HDassert(value); - /* Make copy of VOL plugin ID & info */ + /* Make copy of VOL connector ID & info */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5309,7 +5309,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_get * - * Purpose: Copies a VOL plugin property when it's retrieved from a property list + * Purpose: Copies a VOL connector property when it's retrieved from a property list * * Return: Success: Non-negative * Failure: Negative @@ -5327,9 +5327,9 @@ H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, /* Sanity check */ HDassert(value); - /* Make copy of VOL plugin */ + /* Make copy of VOL connector */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5339,7 +5339,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_del * - * Purpose: Frees memory used to store the VOL plugin ID & info property + * Purpose: Frees memory used to store the VOL connector ID & info property * * Return: Success: Non-negative * Failure: Negative @@ -5353,9 +5353,9 @@ H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, FUNC_ENTER_STATIC - /* Free the VOL plugin ID & info */ + /* Free the VOL connector ID & info */ if(H5P__vol_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL plugin") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5365,7 +5365,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_copy * - * Purpose: Copy callback for the VOL plugin ID & info property. + * Purpose: Copy callback for the VOL connector ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5379,9 +5379,9 @@ H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC - /* Make copy of VOL plugin */ + /* Make copy of VOL connector */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5391,7 +5391,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_cmp * - * Purpose: Callback routine which is called whenever the VOL plugin + * Purpose: Callback routine which is called whenever the VOL connector * ID & info property in the file access property list * is compared. * @@ -5404,9 +5404,9 @@ done: static int H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED size) { - const H5VL_plugin_prop_t *info1 = (const H5VL_plugin_prop_t *)_info1; /* Create local aliases for values */ - const H5VL_plugin_prop_t *info2 = (const H5VL_plugin_prop_t *)_info2; - H5VL_class_t *cls1, *cls2; /* Driver class for each property */ + const H5VL_connector_prop_t *info1 = (const H5VL_connector_prop_t *)_info1; /* Create local aliases for values */ + const H5VL_connector_prop_t *info2 = (const H5VL_connector_prop_t *)_info2; + H5VL_class_t *cls1, *cls2; /* connector class for each property */ int cmp_value; /* Value from comparison */ int ret_value = 0; /* Return value */ @@ -5415,18 +5415,18 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED /* Sanity check */ HDassert(info1); HDassert(info2); - HDassert(size == sizeof(H5VL_plugin_prop_t)); + HDassert(size == sizeof(H5VL_connector_prop_t)); - /* Compare plugins */ - if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->plugin_id))) + /* Compare connectors */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->connector_id))) HGOTO_DONE(-1) - if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->plugin_id))) + if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->connector_id))) HGOTO_DONE(1) - if(0 != (cmp_value = H5VL_cmp_plugin_cls(cls1, cls2))) + if(0 != (cmp_value = H5VL_cmp_connector_cls(cls1, cls2))) HGOTO_DONE(cmp_value); /* At this point, we should be able to assume that we are dealing with - * the same plugin class struct (or a copies of the same class struct) + * the same connector class struct (or a copies of the same class struct) */ @@ -5434,7 +5434,7 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED * info objects */ HDassert(cls1->info_cmp == cls2->info_cmp); - if(0 != (cmp_value = H5VL_cmp_plugin_info(cls1, info1->plugin_info, info2->plugin_info))) + if(0 != (cmp_value = H5VL_cmp_connector_info(cls1, info1->connector_info, info2->connector_info))) HGOTO_DONE(cmp_value); done: @@ -5445,7 +5445,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_close * - * Purpose: Close callback for the VOL plugin ID & info property. + * Purpose: Close callback for the VOL connector ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5459,9 +5459,9 @@ H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC - /* Free the VOL plugin */ + /* Free the VOL connector */ if(H5P__vol_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL plugin") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5R.c b/src/H5R.c index b806777..fa25375 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -201,7 +201,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &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(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 9cbaf1f..ba71a4b 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -37,13 +37,13 @@ #include "H5Ppublic.h" /* Property lists */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ -#include "H5Oprivate.h" /* Object headers */ +#include "H5Oprivate.h" /* Object headers */ #include "H5Rpkg.h" /* References */ @@ -186,7 +186,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(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: diff --git a/src/H5T.c b/src/H5T.c index a6c3847..cd54183 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1609,10 +1609,10 @@ H5T__close_cb(H5T_t *dt) HDassert(dt->shared); /* If this datatype is VOL-managed (i.e.: has a VOL object), - * close it through the VOL plugin. + * close it through the VOL connector. */ if(NULL != dt->vol_obj) { - /* Close the plugin-managed datatype data */ + /* Close the connector-managed datatype data */ if(H5VL_datatype_close(dt->vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") @@ -3671,7 +3671,7 @@ done: * Purpose: Frees a datatype and all associated memory. * * Note: Does _not_ deal with open named datatypes, etc. so this - * should never see a type managed by a VOL plugin. + * should never see a type managed by a VOL connector. * * Return: Non-negative on success/Negative on failure * diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 0e609ff..b02f8ce 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -156,11 +156,11 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* Set up VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->plugin = vol_obj->plugin; - new_obj->plugin->nrefs ++; + new_obj->connector = vol_obj->connector; + new_obj->connector->nrefs ++; new_obj->data = data; - /* Set the committed type object to the VOL plugin pointer in the H5T_t struct */ + /* Set the committed type object to the VOL connector pointer in the H5T_t struct */ dt->vol_obj = new_obj; done: @@ -267,7 +267,7 @@ done: herr_t H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { - void *dt = NULL; /* datatype object created by VOL plugin */ + void *dt = NULL; /* datatype object created by VOL connector */ H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */ H5T_t *type = NULL; /* Datatype created */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ @@ -309,11 +309,11 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) /* Setup VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->plugin = vol_obj->plugin; - new_obj->plugin->nrefs ++; + new_obj->connector = vol_obj->connector; + new_obj->connector->nrefs ++; new_obj->data = dt; - /* Set the committed type object to the VOL plugin pointer in the H5T_t struct */ + /* Set the committed type object to the VOL connector pointer in the H5T_t struct */ type->vol_obj = new_obj; done: @@ -564,7 +564,7 @@ done: hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) { - void *dt = NULL; /* datatype token created by VOL plugin */ + void *dt = NULL; /* datatype token created by VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -595,7 +595,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(H5I_DATATYPE, dt, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: @@ -1080,7 +1080,7 @@ H5T_update_shared(H5T_t *dt) /*------------------------------------------------------------------------- * Function: H5T_construct_datatype * - * Purpose: Create a Library datatype with a plugin specific datatype object + * Purpose: Create a Library datatype with a connector specific datatype object * * Return: Success: A type structure * Failure: NULL @@ -1092,7 +1092,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) { ssize_t nalloc; void *buf = NULL; - H5T_t *dt = NULL; /* datatype token from VOL plugin */ + H5T_t *dt = NULL; /* datatype token from VOL connector */ H5T_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) @@ -1151,7 +1151,7 @@ H5T_get_named_type(const H5T_t *dt) /*------------------------------------------------------------------------- * Function: H5T_get_actual_type * - * Purpose: Returns underlying native datatype created by native plugin + * Purpose: Returns underlying native datatype created by native connector * if datatype is committed, otherwise return the datatype * object associate with the ID. * diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 69a52e1..3385794 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -43,7 +43,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Ppublic.h" /* Property Lists */ #include "H5Tpkg.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -143,11 +143,11 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) /* Set up VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->plugin = vol_obj->plugin; - new_obj->plugin->nrefs ++; + new_obj->connector = vol_obj->connector; + new_obj->connector->nrefs ++; new_obj->data = data; - /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */ + /* Set the committed type object to the VOL connectorg pointer in the H5T_t struct */ dt->vol_obj = new_obj; done: @@ -174,7 +174,7 @@ done: hid_t H5Topen1(hid_t loc_id, const char *name) { - void *dt = NULL; /* Datatype token created by VOL plugin */ + void *dt = NULL; /* Datatype token created by VOL connector */ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -198,7 +198,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(H5I_DATATYPE, dt, vol_obj->plugin, TRUE)) < 0) + if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: diff --git a/src/H5VL.c b/src/H5VL.c index 225e983..0a835a2 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -45,21 +45,21 @@ /* Local Typedefs */ /******************/ -/* Information needed for iterating over the registered VOL plugin hid_t IDs. - * The name of the new VOL plugin that is being registered is stored in the +/* Information needed for iterating over the registered VOL connector hid_t IDs. + * The name of the new VOL connector that is being registered is stored in the * name field and the found_id field is initialized to H5I_INVALID_HID (-1). - * If we find a VOL plugin with the same name, we set the found_id field to + * If we find a VOL connector with the same name, we set the found_id field to * the existing ID for return to the function. */ typedef struct { - const char *name; /* The name of the VOL plugin to check */ + const char *name; /* The name of the VOL connector to check */ hid_t found_id; /* The library ID if we found a match */ -} H5VL_get_plugin_ud_t; +} H5VL_get_connector_ud_t; /********************/ /* Local Prototypes */ /********************/ -static int H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data); +static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data); /*********************/ /* Package Variables */ @@ -75,7 +75,7 @@ static int H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data); /*------------------------------------------------------------------------- - * Function: H5VL__get_plugin_cb + * Function: H5VL__get_connector_cb * * Purpose: Callback routine to search through registered VOLs * @@ -87,9 +87,9 @@ static int H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data); *------------------------------------------------------------------------- */ static int -H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) +H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data) { - H5VL_get_plugin_ud_t *op_data = (H5VL_get_plugin_ud_t *)_op_data; /* User data for callback */ + H5VL_get_connector_ud_t *op_data = (H5VL_get_connector_ud_t *)_op_data; /* User data for callback */ H5VL_class_t *cls = (H5VL_class_t *)obj; int ret_value = H5_ITER_CONT; /* Callback return value */ @@ -101,17 +101,17 @@ H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__get_plugin_cb() */ +} /* end H5VL__get_connector_cb() */ /*------------------------------------------------------------------------- - * Function: H5VLregister_plugin + * Function: H5VLregister_connector * - * Purpose: Registers a new VOL plugin as a member of the virtual object + * Purpose: Registers a new VOL connector as a member of the virtual object * layer class. * - * Return: Success: A VOL plugin ID which is good until the - * library is closed or the plugin is + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is * unregistered. * * Failure: H5I_INVALID_HID @@ -119,9 +119,9 @@ H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) *------------------------------------------------------------------------- */ hid_t -H5VLregister_plugin(const H5VL_class_t *cls, hid_t vipl_id) +H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id) { - H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) @@ -129,48 +129,48 @@ H5VLregister_plugin(const H5VL_class_t *cls, hid_t vipl_id) /* Check arguments */ if (!cls) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL plugin class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL connector class pointer cannot be NULL") if (!cls->name) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin class name cannot be the NULL pointer") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the NULL pointer") if (0 == HDstrlen(cls->name)) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin class name cannot be the empty string") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the empty string") if (cls->info_copy && !cls->info_free) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin must provide free callback for VOL info objects when a copy callback is provided") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for VOL info objects when a copy callback is provided") if (cls->get_wrap_ctx && !cls->free_wrap_ctx) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin must provide free callback for object wrapping contexts when a get callback is provided") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided") op_data.found_id = H5I_INVALID_HID; op_data.name = cls->name; - /* check if plugin is already registered */ - if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) + /* check if connector is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs") - /* Increment the ref count on the existing VOL plugin ID, if it's already registered */ + /* Increment the ref count on the existing VOL connector ID, if it's already registered */ if(op_data.found_id != H5I_INVALID_HID) { if (H5I_inc_ref(op_data.found_id, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") ret_value = op_data.found_id; } /* end if */ else { /* Create a new class ID */ - if ((ret_value = H5VL_register_plugin(cls, TRUE, vipl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin") + if ((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") } /* end else */ done: FUNC_LEAVE_API(ret_value) -} /* end H5VLregister_plugin() */ +} /* end H5VLregister_connector() */ /*------------------------------------------------------------------------- - * Function: H5VLregister_plugin_by_name + * Function: H5VLregister_connector_by_name * - * Purpose: Registers a new VOL plugin as a member of the virtual object + * Purpose: Registers a new VOL connector as a member of the virtual object * layer class. * - * Return: Success: A VOL plugin ID which is good until the - * library is closed or the plugin is + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is * unregistered. * * Failure: H5I_INVALID_HID @@ -178,9 +178,9 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLregister_plugin_by_name(const char *name, hid_t vipl_id) +H5VLregister_connector_by_name(const char *name, hid_t vipl_id) { - H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) @@ -188,44 +188,44 @@ H5VLregister_plugin_by_name(const char *name, hid_t vipl_id) /* Check arguments */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL plugin name is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL connector name is disallowed") if (0 == HDstrlen(name)) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL plugin name is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed") op_data.found_id = H5I_INVALID_HID; op_data.name = name; - /* Check if plugin is already registered */ - if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) + /* Check if connector is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") - /* If plugin alread registered, increment ref count on ID and return ID */ + /* If connector alread registered, increment ref count on ID and return ID */ if (op_data.found_id != H5I_INVALID_HID) { if (H5I_inc_ref(op_data.found_id, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") ret_value = op_data.found_id; } /* end if */ else { H5PL_key_t key; const H5VL_class_t *cls; - /* Try loading the plugin */ + /* Try loading the connector */ key.name = name; if (NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, key))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL plugin") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector") - /* Register the plugin we loaded */ - if ((ret_value = H5VL_register_plugin(cls, TRUE, vipl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin ID") + /* Register the connector we loaded */ + if ((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") } /* end else */ done: FUNC_LEAVE_API(ret_value) -} /* end H5VLregister_plugin_by_name() */ +} /* end H5VLregister_connector_by_name() */ /*------------------------------------------------------------------------- - * Function: H5VLis_plugin_registered + * Function: H5VLis_connector_registered * * Purpose: Tests whether a VOL class has been registered or not * @@ -238,9 +238,9 @@ done: *------------------------------------------------------------------------- */ htri_t -H5VLis_plugin_registered(const char *name) +H5VLis_connector_registered(const char *name) { - H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_API(FAIL) @@ -250,7 +250,7 @@ H5VLis_plugin_registered(const char *name) op_data.name = name; /* Check arguments */ - if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids") if (op_data.found_id != H5I_INVALID_HID) @@ -258,13 +258,13 @@ H5VLis_plugin_registered(const char *name) done: FUNC_LEAVE_API(ret_value) -} /* end H5VLis_plugin_registered() */ +} /* end H5VLis_connector_registered() */ /*------------------------------------------------------------------------- - * Function: H5VLget_plugin_id + * Function: H5VLget_connector_id * - * Purpose: Retrieves the ID for a registered VOL plugin. + * Purpose: Retrieves the ID for a registered VOL connector. * * Return: Positive if the VOL class has been registered * Negative on error (if the class is not a valid class or not registered) @@ -272,9 +272,9 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLget_plugin_id(const char *name) +H5VLget_connector_id(const char *name) { - H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -284,55 +284,55 @@ H5VLget_plugin_id(const char *name) op_data.name = name; /* Check arguments */ - if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL plugin IDs") + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connector IDs") if (op_data.found_id != H5I_INVALID_HID) { if (H5I_inc_ref(op_data.found_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") ret_value = op_data.found_id; } /* end if */ done: FUNC_LEAVE_API(ret_value) -} /* end H5VLget_plugin_id() */ +} /* end H5VLget_connector_id() */ /*------------------------------------------------------------------------- - * Function: H5VLget_plugin_name + * Function: H5VLget_connector_name * - * Purpose: Returns the plugin name for the VOL associated with the + * Purpose: Returns the connector name for the VOL associated with the * object or file ID * - * Return: Success: The length of the plugin name + * Return: Success: The length of the connector name * * Failure: Negative * *------------------------------------------------------------------------- */ ssize_t -H5VLget_plugin_name(hid_t obj_id, char *name/*out*/, size_t size) +H5VLget_connector_name(hid_t obj_id, char *name/*out*/, size_t size) { ssize_t ret_value = -1; FUNC_ENTER_API(FAIL) H5TRACE3("Zs", "ixz", obj_id, name, size); - if ((ret_value = H5VL_get_plugin_name(obj_id, name, size)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get plugin name") + if ((ret_value = H5VL_get_connector_name(obj_id, name, size)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get connector name") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLget_plugin_name() */ +} /* end H5VLget_connector_name() */ /*------------------------------------------------------------------------- * Function: H5VLclose * - * Purpose: Closes a VOL plugin ID. This in no way affects + * Purpose: Closes a VOL connector ID. This in no way affects * file access property lists which have been defined to use - * this VOL plugin or files which are already opened under with - * this plugin. + * this VOL connector or files which are already opened under with + * this connector. * * Return: Success: Non-negative * Failure: Negative @@ -349,11 +349,11 @@ H5VLclose(hid_t vol_id) /* Check args */ if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector") - /* Decrement the ref count on the ID, possibly releasing the VOL plugin */ + /* Decrement the ref count on the ID, possibly releasing the VOL connector */ if(H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL plugin ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL connector ID") done: FUNC_LEAVE_API(ret_value) @@ -361,12 +361,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLunregister_plugin + * Function: H5VLunregister_connector * - * Purpose: Removes a VOL plugin ID from the library. This in no way affects + * Purpose: Removes a VOL connector ID from the library. This in no way affects * file access property lists which have been defined to use - * this VOL plugin or files which are already opened under with - * this plugin. + * this VOL connector or files which are already opened under with + * this connector. * * Return: Success: Non-negative * @@ -375,7 +375,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLunregister_plugin(hid_t vol_id) +H5VLunregister_connector(hid_t vol_id) { herr_t ret_value = SUCCEED; /* Return value */ @@ -384,25 +384,25 @@ H5VLunregister_plugin(hid_t vol_id) /* Check arguments */ if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector") /* The H5VL_class_t struct will be freed by this function */ if (H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL plugin") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLunregister_plugin() */ +} /* end H5VLunregister_connector() */ /*--------------------------------------------------------------------------- - * Function: H5VLcmp_plugin_cls + * Function: H5VLcmp_connector_cls * - * Purpose: Compares two plugin classes + * Purpose: Compares two connector classes * * Return: Success: Non-negative, with *cmp set to positive if - * plugin_id1 is greater than plugin_id2, negative if plugin_id2 - * is greater than plugin_id1 and zero if plugin_id1 and plugin_id2 + * connector_id1 is greater than connector_id2, negative if connector_id2 + * is greater than connector_id1 and zero if connector_id1 and connector_id2 * are equal. * * Failure: Negative @@ -410,24 +410,24 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5VLcmp_plugin_cls(int *cmp, hid_t plugin_id1, hid_t plugin_id2) +H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2) { - H5VL_class_t *cls1, *cls2; /* Plugins for IDs */ + H5VL_class_t *cls1, *cls2; /* connectors for IDs */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*Isii", cmp, plugin_id1, plugin_id2); + H5TRACE3("e", "*Isii", cmp, connector_id1, connector_id2); /* Check args and get class pointers */ - if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(connector_id1, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(connector_id2, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Compare the two VOL plugin classes */ - *cmp = H5VL_cmp_plugin_cls(cls1, cls2); + /* Compare the two VOL connector classes */ + *cmp = H5VL_cmp_connector_cls(cls1, cls2); done: FUNC_LEAVE_API(ret_value) -} /* H5VLcmp_plugin_cls() */ +} /* H5VLcmp_connector_cls() */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 76143d6..25c5e7b 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -192,7 +192,7 @@ static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls); /*------------------------------------------------------------------------- * Function: H5VLinitialize * - * Purpose: Calls the plugin-specific callback to initialize the plugin. + * Purpose: Calls the connector-specific callback to initialize the connector. * * Return: Success: Non-negative * Failure: Negative @@ -200,21 +200,21 @@ static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls); *------------------------------------------------------------------------- */ herr_t -H5VLinitialize(hid_t plugin_id, hid_t vipl_id) +H5VLinitialize(hid_t connector_id, hid_t vipl_id) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE2("e", "ii", plugin_id, vipl_id); + H5TRACE2("e", "ii", connector_id, vipl_id); /* Check args */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Invoke class' callback, if there is one */ if(cls->initialize && cls->initialize(vipl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not initialize") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not initialize") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -224,7 +224,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLterminate * - * Purpose: Calls the plugin-specific callback to terminate the plugin. + * Purpose: Calls the connector-specific callback to terminate the connector. * * Return: Success: Non-negative * Failure: Negative @@ -232,21 +232,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLterminate(hid_t plugin_id) +H5VLterminate(hid_t connector_id) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE1("e", "i", plugin_id); + H5TRACE1("e", "i", connector_id); /* Check args */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Invoke class' callback, if there is one */ if(cls->terminate && cls->terminate() < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not terminate cleanly") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -256,7 +256,7 @@ done: /*--------------------------------------------------------------------------- * Function: H5VLget_cap_flags * - * Purpose: Retrieves the capability flag for a plugin + * Purpose: Retrieves the capability flag for a connector * * Return: Success: Non-negative * Failure: Negative @@ -264,17 +264,17 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5VLget_cap_flags(hid_t plugin_id, unsigned *cap_flags) +H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE2("e", "i*Iu", plugin_id, cap_flags); + H5TRACE2("e", "i*Iu", connector_id, cap_flags); /* Check args */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Retrieve capability flags */ if(cap_flags) @@ -286,9 +286,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_copy_plugin_info + * Function: H5VL_copy_connector_info * - * Purpose: Copy the VOL info for a plugin + * Purpose: Copy the VOL info for a connector * * Return: Success: Non-negative * Failure: Negative @@ -296,45 +296,45 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_copy_plugin_info(const H5VL_class_t *plugin, void **dst_info, +H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, const void *src_info) { - void *new_plugin_info = NULL; /* Copy of plugin info */ + void *new_connector_info = NULL; /* Copy of connector info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(plugin); + HDassert(connector); /* Check for actual source info */ if(src_info) { - /* Allow the plugin to copy or do it ourselves */ - if(plugin->info_copy) { - if(NULL == (new_plugin_info = (plugin->info_copy)(src_info))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "plugin info copy callback failed") + /* Allow the connector to copy or do it ourselves */ + if(connector->info_copy) { + if(NULL == (new_connector_info = (connector->info_copy)(src_info))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "connector info copy callback failed") } /* end if */ - else if(plugin->info_size > 0) { - if(NULL == (new_plugin_info = H5MM_malloc(plugin->info_size))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "plugin info allocation failed") - HDmemcpy(new_plugin_info, src_info, plugin->info_size); + else if(connector->info_size > 0) { + if(NULL == (new_connector_info = H5MM_malloc(connector->info_size))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed") + HDmemcpy(new_connector_info, src_info, connector->info_size); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy plugin info") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info") } /* end if */ - /* Set the plugin info for the copy */ - *dst_info = new_plugin_info; + /* Set the connector info for the copy */ + *dst_info = new_connector_info; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_copy_plugin_info() */ +} /* end H5VL_copy_connector_info() */ /*--------------------------------------------------------------------------- - * Function: H5VLcopy_plugin_info + * Function: H5VLcopy_connector_info * - * Purpose: Copies a VOL plugin's info object + * Purpose: Copies a VOL connector's info object * * Return: Success: Non-negative * Failure: Negative @@ -342,31 +342,31 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5VLcopy_plugin_info(hid_t plugin_id, void **dst_vol_info, void *src_vol_info) +H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "i**x*x", plugin_id, dst_vol_info, src_vol_info); + H5TRACE3("e", "i**x*x", connector_id, dst_vol_info, src_vol_info); /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Copy the VOL plugin's info object */ - if(H5VL_copy_plugin_info(cls, dst_vol_info, src_vol_info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL plugin info object") + /* Copy the VOL connector's info object */ + if(H5VL_copy_connector_info(cls, dst_vol_info, src_vol_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL connector info object") done: FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLcopy_plugin_info() */ +} /* H5VLcopy_connector_info() */ /*------------------------------------------------------------------------- - * Function: H5VL_cmp_plugin_info + * Function: H5VL_cmp_connector_info * - * Purpose: Compare VOL info for a plugin + * Purpose: Compare VOL info for a connector * * Return: Positive if VALUE1 is greater than VALUE2, negative if * VALUE2 is greater than VALUE1 and zero if VALUE1 and @@ -375,7 +375,7 @@ done: *------------------------------------------------------------------------- */ int -H5VL_cmp_plugin_info(const H5VL_class_t *plugin, const void *info1, +H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *info1, const void *info2) { int cmp_value; /* Value from comparison */ @@ -384,14 +384,14 @@ H5VL_cmp_plugin_info(const H5VL_class_t *plugin, const void *info1, FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(plugin); + HDassert(connector); /* Use the class's info comparison routine to compare the info objects, * if there is a a callback, otherwise just compare the info objects as * memory buffers */ - if(plugin->info_cmp) { - if(0 != (cmp_value = (plugin->info_cmp)(info1, info2))) + if(connector->info_cmp) { + if(0 != (cmp_value = (connector->info_cmp)(info1, info2))) HGOTO_DONE(cmp_value); } /* end if */ else { @@ -400,23 +400,23 @@ H5VL_cmp_plugin_info(const H5VL_class_t *plugin, const void *info1, if(info1 != NULL && info2 == NULL) HGOTO_DONE(1); if(info1) { - HDassert(plugin->info_size > 0); - if(0 != (cmp_value = HDmemcmp(info1, info2, plugin->info_size))) + HDassert(connector->info_size > 0); + if(0 != (cmp_value = HDmemcmp(info1, info2, connector->info_size))) HGOTO_DONE(cmp_value); } /* end if */ } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_cmp_plugin_info() */ +} /* end H5VL_cmp_connector_info() */ /*--------------------------------------------------------------------------- - * Function: H5VLcmp_plugin_info + * Function: H5VLcmp_connector_info * - * Purpose: Compares two plugin info objects + * Purpose: Compares two connector info objects * - * Note: Both info objects must be from the same VOL plugin class + * Note: Both info objects must be from the same VOL connector class * * Return: Success: Non-negative, with *cmp set to positive if * info1 is greater than info2, negative if info2 @@ -427,31 +427,31 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, const void *info2) +H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, const void *info2) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*Isi*x*x", cmp, plugin_id, info1, info2); + H5TRACE4("e", "*Isi*x*x", cmp, connector_id, info1, info2); /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Compare the two VOL plugin info objects */ + /* Compare the two VOL connector info objects */ if(cmp) - *cmp = H5VL_cmp_plugin_info(cls, info1, info2); + *cmp = H5VL_cmp_connector_info(cls, info1, info2); done: FUNC_LEAVE_API(ret_value) -} /* H5VLcmp_plugin_info() */ +} /* H5VLcmp_connector_info() */ /*------------------------------------------------------------------------- - * Function: H5VL_free_plugin_info + * Function: H5VL_free_connector_info * - * Purpose: Free VOL info for a plugin + * Purpose: Free VOL info for a connector * * Return: Success: Non-negative * Failure: Negative @@ -459,21 +459,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_free_plugin_info(const H5VL_class_t *plugin, void *info) +H5VL_free_connector_info(const H5VL_class_t *connector, void *info) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(plugin); + HDassert(connector); /* Only free info object, if it's non-NULL */ if(info) { - /* Allow the plugin to free info or do it ourselves */ - if(plugin->info_free) { - if((plugin->info_free)(info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "plugin info free request failed") + /* Allow the connector to free info or do it ourselves */ + if(connector->info_free) { + if((connector->info_free)(info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed") } /* end if */ else H5MM_xfree(info); @@ -481,13 +481,13 @@ H5VL_free_plugin_info(const H5VL_class_t *plugin, void *info) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_free_plugin_info() */ +} /* end H5VL_free_connector_info() */ /*--------------------------------------------------------------------------- - * Function: H5VLfree_plugin_info + * Function: H5VLfree_connector_info * - * Purpose: Free VOL plugin info object + * Purpose: Free VOL connector info object * * Return: Success: Non-negative * Failure: Negative @@ -495,25 +495,25 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5VLfree_plugin_info(hid_t plugin_id, void *info) +H5VLfree_connector_info(hid_t connector_id, void *info) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE2("e", "i*x", plugin_id, info); + H5TRACE2("e", "i*x", connector_id, info); /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Free the VOL plugin info object */ - if(H5VL_free_plugin_info(cls, info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin info object") + /* Free the VOL connector info object */ + if(H5VL_free_connector_info(cls, info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") done: FUNC_LEAVE_API_NOINIT(ret_value) -} /* H5VLfree_plugin_info() */ +} /* H5VLfree_connector_info() */ /*--------------------------------------------------------------------------- @@ -527,21 +527,21 @@ done: *--------------------------------------------------------------------------- */ void * -H5VLget_object(void *obj, hid_t plugin_id) +H5VLget_object(void *obj, hid_t connector_id) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE2("*x", "*xi", obj, plugin_id); + H5TRACE2("*x", "*xi", obj, connector_id); /* Check args */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Check for 'get_object' callback in plugin */ + /* Check for 'get_object' callback in connector */ if(cls->get_object) ret_value = (cls->get_object)(obj); else @@ -555,7 +555,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_get_wrap_ctx * - * Purpose: Retrieve the VOL object wrapping context for a plugin + * Purpose: Retrieve the VOL object wrapping context for a connector * * Return: Success: Non-negative * Failure: Negative @@ -563,25 +563,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_get_wrap_ctx(const H5VL_class_t *plugin, void *obj, void **wrap_ctx) +H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(plugin); + HDassert(connector); HDassert(obj); HDassert(wrap_ctx); - /* Allow the plugin to copy or do it ourselves */ - if(plugin->get_wrap_ctx) { + /* Allow the connector to copy or do it ourselves */ + if(connector->get_wrap_ctx) { /* Sanity check */ - HDassert(plugin->free_wrap_ctx); + HDassert(connector->free_wrap_ctx); - /* Invoke plugin's callback */ - if((plugin->get_wrap_ctx)(obj, wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "plugin wrap context callback failed") + /* Invoke connector's callback */ + if((connector->get_wrap_ctx)(obj, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector wrap context callback failed") } /* end if */ else *wrap_ctx = NULL; @@ -594,7 +594,7 @@ done: /*--------------------------------------------------------------------------- * Function: H5VLget_wrap_ctx * - * Purpose: Get a VOL plugin's object wrapping context + * Purpose: Get a VOL connector's object wrapping context * * Return: Success: Non-negative * Failure: Negative @@ -602,21 +602,21 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5VLget_wrap_ctx(void *obj, hid_t plugin_id, void **wrap_ctx) +H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "*xi**x", obj, plugin_id, wrap_ctx); + H5TRACE3("e", "*xi**x", obj, connector_id, wrap_ctx); /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Get the VOL plugin's object wrapper */ + /* Get the VOL connector's object wrapper */ if(H5VL_get_wrap_ctx(cls, obj, wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL plugin object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL connector object wrap context") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -626,7 +626,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_free_wrap_ctx * - * Purpose: Free object wrapping context for a plugin + * Purpose: Free object wrapping context for a connector * * Return: Success: Non-negative * Failure: Negative @@ -634,31 +634,31 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_free_wrap_ctx(const H5VL_class_t *plugin, void *wrap_ctx) +H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(plugin); + HDassert(connector); /* Only free wrap context, if it's non-NULL */ if(wrap_ctx) { - /* Free the plugin's object wrapping context */ - if((plugin->free_wrap_ctx)(wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "plugin wrap context free request failed") + /* Free the connector's object wrapping context */ + if((connector->free_wrap_ctx)(wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_free_plugin_info() */ +} /* end H5VL_free_connector_info() */ /*--------------------------------------------------------------------------- * Function: H5VLfree_wrap_ctx * - * Purpose: Release a VOL plugin's object wrapping context + * Purpose: Release a VOL connector's object wrapping context * * Return: Success: Non-negative * Failure: Negative @@ -666,21 +666,21 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5VLfree_wrap_ctx(void *wrap_ctx, hid_t plugin_id) +H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE2("e", "*xi", wrap_ctx, plugin_id); + H5TRACE2("e", "*xi", wrap_ctx, connector_id); /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Release the VOL plugin's object wrapper */ + /* Release the VOL connector's object wrapper */ if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context") done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -690,7 +690,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_wrap_object * - * Purpose: Wrap an object with plugin + * Purpose: Wrap an object with connector * * Return: Success: Non-negative * Failure: Negative @@ -698,20 +698,20 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_wrap_object(const H5VL_class_t *plugin, void *wrap_ctx, void *obj) +H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj) { void *ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Sanity checks */ - HDassert(plugin); + HDassert(connector); HDassert(obj); /* Only wrap object if there's a wrap context */ if(wrap_ctx) { - /* Ask the plugin to wrap the object */ - if(NULL == (ret_value = (plugin->wrap_object)(obj, wrap_ctx))) + /* Ask the connector to wrap the object */ + if(NULL == (ret_value = (connector->wrap_object)(obj, wrap_ctx))) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") } /* end if */ else @@ -725,7 +725,7 @@ done: /*--------------------------------------------------------------------------- * Function: H5VLwrap_object * - * Purpose: Asks a plugin to wrap an underlying object. + * Purpose: Asks a connector to wrap an underlying object. * * Return: Success: Non-NULL * Failure: NULL @@ -733,19 +733,19 @@ done: *--------------------------------------------------------------------------- */ void * -H5VLwrap_object(void *obj, hid_t plugin_id, void *wrap_ctx) +H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("*x", "*xi*x", obj, plugin_id, wrap_ctx); + H5TRACE3("*x", "*xi*x", obj, connector_id, wrap_ctx); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Wrap the object */ if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj))) @@ -776,7 +776,7 @@ H5VL__attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *c /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'attr create' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr create' method") /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) @@ -807,12 +807,12 @@ H5VL_attr_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, acpl_id, aapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") done: @@ -835,21 +835,21 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, +H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, acpl_id, + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, connector_id, name, acpl_id, aapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req))) @@ -880,7 +880,7 @@ H5VL__attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'attr open' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr open' method") /* Call the corresponding VOL open callback */ if(NULL == (ret_value = (cls->attr_cls.open)(obj, loc_params, name, aapl_id, dxpl_id, req))) @@ -911,12 +911,12 @@ H5VL_attr_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, aapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__attr_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") done: @@ -939,21 +939,21 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, +H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, aapl_id, + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, aapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req))) @@ -984,7 +984,7 @@ H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr read' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr read' method") /* Call the corresponding VOL callback */ if((cls->attr_cls.read)(obj, mem_type_id, buf, dxpl_id, req) < 0) @@ -1015,12 +1015,12 @@ H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__attr_read(vol_obj->data, vol_obj->plugin->cls, mem_type_id, buf, dxpl_id, req) < 0) + if(H5VL__attr_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed") done: @@ -1043,9 +1043,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_read(void *obj, hid_t plugin_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) +H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT @@ -1053,8 +1053,8 @@ H5VLattr_read(void *obj, hid_t plugin_id, hid_t mem_type_id, void *buf, hid_t dx /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__attr_read(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) @@ -1085,7 +1085,7 @@ H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const vo /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr write' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr write' method") /* Call the corresponding VOL callback */ if((cls->attr_cls.write)(obj, mem_type_id, buf, dxpl_id, req) < 0) @@ -1116,12 +1116,12 @@ H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__attr_write(vol_obj->data, vol_obj->plugin->cls, mem_type_id, buf, dxpl_id, req) < 0) + if(H5VL__attr_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") done: @@ -1144,10 +1144,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_write(void *obj, hid_t plugin_id, hid_t mem_type_id, const void *buf, +H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT @@ -1155,8 +1155,8 @@ H5VLattr_write(void *obj, hid_t plugin_id, hid_t mem_type_id, const void *buf, /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__attr_write(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) @@ -1187,7 +1187,7 @@ H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr get' method") /* Call the corresponding VOL callback */ if((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) @@ -1220,14 +1220,14 @@ H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__attr_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") done: @@ -1254,20 +1254,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id, +H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVai**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVai**xx", obj, connector_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) @@ -1299,7 +1299,7 @@ H5VL__attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr specific' method") /* Call the corresponding VOL callback */ if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) @@ -1332,14 +1332,14 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") done: @@ -1358,7 +1358,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLattr_specific * - * Purpose: Performs a plugin-specific operation on an attribute + * Purpose: Performs a connector-specific operation on an attribute * * Return: Success: Non-negative * Failure: Negative @@ -1366,21 +1366,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, +H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, plugin_id, specific_type, + H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if((ret_value = H5VL__attr_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) @@ -1394,7 +1394,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__attr_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -1411,7 +1411,7 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr optional' method") /* Call the corresponding VOL callback */ if((cls->attr_cls.optional)(obj, dxpl_id, req, arguments) < 0) @@ -1425,7 +1425,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_attr_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -1443,14 +1443,14 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__attr_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) + if(H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: @@ -1469,7 +1469,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLattr_optional * - * Purpose: Performs an optional plugin-specific operation on an attribute + * Purpose: Performs an optional connector-specific operation on an attribute * * Return: Success: Non-negative * Failure: Negative @@ -1477,19 +1477,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__attr_optional(obj, cls, dxpl_id, req, arguments) < 0) @@ -1519,7 +1519,7 @@ H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) /* Check if the corresponding VOL callback exists */ if(NULL == cls->attr_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr close' method") /* Call the corresponding VOL callback */ if((cls->attr_cls.close)(obj, dxpl_id, req) < 0) @@ -1551,7 +1551,7 @@ H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) HDassert(vol_obj); /* Call the corresponding internal VOL routine */ - if(H5VL__attr_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + if(H5VL__attr_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed") done: @@ -1570,19 +1570,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__attr_close(obj, cls, dxpl_id, req) < 0) @@ -1613,7 +1613,7 @@ H5VL__dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'dataset create' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset create' method") /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) @@ -1644,12 +1644,12 @@ H5VL_dataset_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, dapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "create failed") done: @@ -1672,21 +1672,21 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, +H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, dcpl_id, + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, connector_id, name, dcpl_id, dapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req))) @@ -1717,7 +1717,7 @@ H5VL__dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t * /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'dataset open' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset open' method") /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->dataset_cls.open)(obj, loc_params, name, dapl_id, dxpl_id, req))) @@ -1748,12 +1748,12 @@ H5VL_dataset_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__dataset_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") done: @@ -1776,21 +1776,21 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, +H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, dapl_id, + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, dapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) @@ -1822,7 +1822,7 @@ H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset read' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset read' method") /* Call the corresponding VOL callback */ if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) @@ -1854,12 +1854,12 @@ H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__dataset_read(vol_obj->data, vol_obj->plugin->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + if(H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed") done: @@ -1882,21 +1882,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_read(void *obj, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, +H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "*xiiiii*x**x", obj, plugin_id, mem_type_id, mem_space_id, + H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) @@ -1928,7 +1928,7 @@ H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset write' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset write' method") /* Call the corresponding VOL callback */ if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) @@ -1960,12 +1960,12 @@ H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__dataset_write(vol_obj->data, vol_obj->plugin->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + if(H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed") done: @@ -1988,21 +1988,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_write(void *obj, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, +H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "*xiiiii*x**x", obj, plugin_id, mem_type_id, mem_space_id, + H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) @@ -2033,7 +2033,7 @@ H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_typ /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset get' method") /* Call the corresponding VOL callback */ if((cls->dataset_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) @@ -2066,14 +2066,14 @@ H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__dataset_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") done: @@ -2100,20 +2100,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_get(void *obj, hid_t plugin_id, H5VL_dataset_get_t get_type, +H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVci**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVci**xx", obj, connector_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) @@ -2144,7 +2144,7 @@ H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset specific' method") /* Call the corresponding VOL callback */ if((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) @@ -2177,14 +2177,14 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t spec FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__dataset_specific(vol_obj->data, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments) < 0) + if(H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") done: @@ -2203,7 +2203,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLdataset_specific * - * Purpose: Performs a plugin-specific operation on a dataset + * Purpose: Performs a connector-specific operation on a dataset * * Return: Success: Non-negative * Failure: Negative @@ -2211,21 +2211,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specific_type, +H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVdi**xx", obj, plugin_id, specific_type, dxpl_id, req, + H5TRACE6("e", "*xiVdi**xx", obj, connector_id, specific_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__dataset_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) @@ -2239,7 +2239,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__dataset_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -2256,7 +2256,7 @@ H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset optional' method") /* Call the corresponding VOL callback */ if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0) @@ -2270,7 +2270,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_dataset_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -2290,14 +2290,14 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, /* Call the corresponding VOL callback */ /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__dataset_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) + if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: @@ -2316,7 +2316,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLdataset_optional * - * Purpose: Performs an optional plugin-specific operation on a dataset + * Purpose: Performs an optional connector-specific operation on a dataset * * Return: Success: Non-negative * Failure: Negative @@ -2324,20 +2324,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, +H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__dataset_optional(obj, cls, dxpl_id, req, arguments) < 0) @@ -2371,7 +2371,7 @@ H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **re /* Check if the corresponding VOL callback exists */ if(NULL == cls->dataset_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset close' method") /* Call the corresponding VOL callback */ if((cls->dataset_cls.close)(obj, dxpl_id, req) < 0) @@ -2403,16 +2403,16 @@ H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) /* Sanity check */ HDassert(vol_obj); HDassert(vol_obj->data); - HDassert(vol_obj->plugin); - HDassert(vol_obj->plugin->cls); + HDassert(vol_obj->connector); + HDassert(vol_obj->connector->cls); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__dataset_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + if(H5VL__dataset_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed") done: @@ -2435,19 +2435,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__dataset_close(obj, cls, dxpl_id, req) < 0) @@ -2481,7 +2481,7 @@ H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_ /* Check if the corresponding VOL callback exists */ if(NULL == cls->file_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'file create' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file create' method") /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) @@ -2507,8 +2507,8 @@ H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) { H5P_genplist_t *plist; /* Property list pointer */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT @@ -2517,12 +2517,12 @@ H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, /* Get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL plugin info") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) @@ -2556,7 +2556,7 @@ H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t /* Check if the corresponding VOL callback exists */ if(NULL == cls->file_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'file open' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file open' method") /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) @@ -2582,8 +2582,8 @@ H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) { H5P_genplist_t *plist; /* Property list pointer */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT @@ -2592,12 +2592,12 @@ H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, /* Get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL plugin info") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req))) @@ -2628,7 +2628,7 @@ H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, /* Check if the corresponding VOL callback exists */ if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file get' method") /* Call the corresponding VOL callback */ if((cls->file_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) @@ -2661,14 +2661,14 @@ H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__file_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__file_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") done: @@ -2695,20 +2695,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_get(void *obj, hid_t plugin_id, H5VL_file_get_t get_type, +H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVgi**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVgi**xx", obj, connector_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__file_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) @@ -2739,7 +2739,7 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t spe /* Check if the corresponding VOL callback exists */ if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method") /* Call the corresponding VOL callback */ if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) @@ -2764,7 +2764,7 @@ herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) { - const H5VL_class_t *cls; /* VOL plugin's class struct */ + const H5VL_class_t *cls; /* VOL connector's class struct */ va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -2779,7 +2779,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t /* Special treatment of file access check */ if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { H5P_genplist_t *plist; /* Property list pointer */ - H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ va_list tmp_args; /* argument list passed from the API call */ hid_t fapl_id; /* File access property list for accessing the file */ @@ -2791,24 +2791,24 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t /* Get the VOL info from the FAPL */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL plugin info") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info") /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") } /* end if */ /* Set wrapper info in API context, for all other operations */ else { /* Sanity check */ HDassert(vol_obj); - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; - /* Set the VOL plugin class pointer */ - cls = vol_obj->plugin->cls; + /* Set the VOL connector class pointer */ + cls = vol_obj->connector->cls; } /* end else */ @@ -2832,7 +2832,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLfile_specific * - * Purpose: Performs a plugin-specific operation on a file + * Purpose: Performs a connector-specific operation on a file * * Note: The 'obj' parameter is allowed to be NULL * @@ -2842,19 +2842,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_specific(void *obj, hid_t plugin_id, H5VL_file_specific_t specific_type, +H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVhi**xx", obj, plugin_id, specific_type, dxpl_id, req, + H5TRACE6("e", "*xiVhi**xx", obj, connector_id, specific_type, dxpl_id, req, arguments); /* Check args and get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__file_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) @@ -2868,7 +2868,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__file_optional * - * Purpose: Perform a plugin specific operation + * Purpose: Perform a connector specific operation * * Return: Success: Non-negative * Failure: Negative @@ -2885,7 +2885,7 @@ H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Check if the corresponding VOL callback exists */ if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file optional' method") /* Call the corresponding VOL callback */ if((cls->file_cls.optional)(obj, dxpl_id, req, arguments) < 0) @@ -2899,7 +2899,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_file_optional * - * Purpose: Perform a plugin specific operation + * Purpose: Perform a connector specific operation * * Return: Success: Non-negative * Failure: Negative @@ -2917,14 +2917,14 @@ H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__file_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) + if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: @@ -2943,7 +2943,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLfile_optional * - * Purpose: Performs an optional plugin-specific operation on a file + * Purpose: Performs an optional connector-specific operation on a file * * Return: Success: Non-negative * Failure: Negative @@ -2951,20 +2951,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, +H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__file_optional(obj, cls, dxpl_id, req, arguments) < 0) @@ -2998,7 +2998,7 @@ H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) /* Check if the corresponding VOL callback exists */ if(NULL == cls->file_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file close' method") /* Call the corresponding VOL callback */ if((cls->file_cls.close)(obj, dxpl_id, req) < 0) @@ -3028,12 +3028,12 @@ H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__file_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + if(H5VL__file_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") done: @@ -3056,19 +3056,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__file_close(obj, cls, dxpl_id, req) < 0) @@ -3099,7 +3099,7 @@ H5VL__group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t * /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'group create' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group create' method") /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) @@ -3130,12 +3130,12 @@ H5VL_group_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, gcpl_id, gapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") done: @@ -3158,21 +3158,21 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, +H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, gcpl_id, + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, connector_id, name, gcpl_id, gapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req))) @@ -3203,7 +3203,7 @@ H5VL__group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cl /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'group open' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group open' method") /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->group_cls.open)(obj, loc_params, name, gapl_id, dxpl_id, req))) @@ -3234,12 +3234,12 @@ H5VL_group_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, gapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__group_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed") done: @@ -3262,21 +3262,21 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, +H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, gapl_id, + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, gapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) @@ -3307,7 +3307,7 @@ H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group get' method") /* Call the corresponding VOL callback */ if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) @@ -3340,14 +3340,14 @@ H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__group_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__group_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") done: @@ -3374,20 +3374,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, +H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVii**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVii**xx", obj, connector_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__group_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) @@ -3418,7 +3418,7 @@ H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t s /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group specific' method") /* Call the corresponding VOL callback */ if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) @@ -3451,14 +3451,14 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__group_specific(vol_obj->data, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments) < 0) + if(H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: @@ -3477,7 +3477,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLgroup_specific * - * Purpose: Performs a plugin-specific operation on a group + * Purpose: Performs a connector-specific operation on a group * * Return: Success: Non-negative * Failure: Negative @@ -3485,21 +3485,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_type, +H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVji**xx", obj, plugin_id, specific_type, dxpl_id, req, + H5TRACE6("e", "*xiVji**xx", obj, connector_id, specific_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__group_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) @@ -3513,7 +3513,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__group_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -3530,7 +3530,7 @@ H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method") /* Call the corresponding VOL callback */ if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) @@ -3544,7 +3544,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_group_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -3562,14 +3562,14 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ... FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__group_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) + if(H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3588,7 +3588,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLgroup_optional * - * Purpose: Performs an optional plugin-specific operation on a group + * Purpose: Performs an optional connector-specific operation on a group * * Return: Success: Non-negative * Failure: Negative @@ -3596,20 +3596,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, +H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__group_optional(obj, cls, dxpl_id, req, arguments) < 0) @@ -3643,7 +3643,7 @@ H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) /* Check if the corresponding VOL callback exists */ if(NULL == cls->group_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group close' method") /* Call the corresponding VOL callback */ if((cls->group_cls.close)(obj, dxpl_id, req) < 0) @@ -3673,12 +3673,12 @@ H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__group_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + if(H5VL__group_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") done: @@ -3701,19 +3701,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__group_close(obj, cls, dxpl_id, req) < 0) @@ -3746,7 +3746,7 @@ H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_param /* Check if the corresponding VOL callback exists */ if(NULL == cls->link_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link create' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method") /* Call the corresponding VOL callback */ if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0) @@ -3786,20 +3786,20 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") if(H5P_peek(plist, H5VL_PROP_LINK_TARGET, &tmp_vol_obj.data) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL plugin info") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info") } /* end if */ else /* Use the VOL object passed in */ tmp_vol_obj.data = vol_obj->data; - tmp_vol_obj.plugin = vol_obj->plugin; + tmp_vol_obj.connector = vol_obj->connector; /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(tmp_vol_obj.data, tmp_vol_obj.plugin) < 0) + if(H5VL_set_vol_wrapper(tmp_vol_obj.data, tmp_vol_obj.connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") done: @@ -3825,18 +3825,18 @@ done: */ herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) + hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, plugin_id, lcpl_id, + H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req); /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) @@ -3868,7 +3868,7 @@ H5VL__link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, /* Check if the corresponding VOL callback exists */ if(NULL == cls->link_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link copy' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link copy' method") /* Call the corresponding VOL callback */ if((cls->link_cls.copy)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0) @@ -3902,12 +3902,12 @@ H5VL_link_copy(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, /* Set wrapper info in API context */ vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj); - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__link_copy((src_vol_obj->data ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->plugin->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if(H5VL__link_copy((src_vol_obj->data ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") done: @@ -3933,19 +3933,19 @@ done: */ herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, + H5VL_loc_params_t loc_params2, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, - plugin_id, lcpl_id, lapl_id, dxpl_id, req); + connector_id, lcpl_id, lapl_id, dxpl_id, req); /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) @@ -3977,7 +3977,7 @@ H5VL__link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, /* Check if the corresponding VOL callback exists */ if(NULL == cls->link_cls.move) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link move' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link move' method") /* Call the corresponding VOL callback */ if((cls->link_cls.move)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0) @@ -4011,12 +4011,12 @@ H5VL_link_move(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, /* Set wrapper info in API context */ vol_obj = (src_vol_obj ? src_vol_obj : dst_vol_obj); - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__link_move((src_vol_obj ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->plugin->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if(H5VL__link_move((src_vol_obj ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") done: @@ -4042,19 +4042,19 @@ done: */ herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, + H5VL_loc_params_t loc_params2, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, - plugin_id, lcpl_id, lapl_id, dxpl_id, req); + connector_id, lcpl_id, lapl_id, dxpl_id, req); /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) @@ -4085,7 +4085,7 @@ H5VL__link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, /* Check if the corresponding VOL callback exists */ if(NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link get' method") /* Call the corresponding VOL callback */ if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) @@ -4118,14 +4118,14 @@ H5VL_link_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") done: @@ -4152,21 +4152,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_get_t get_type, +H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVli**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, + H5TRACE7("e", "*xxiVli**xx", obj, loc_params, connector_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__link_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0) @@ -4197,7 +4197,7 @@ H5VL__link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t /* Check if the corresponding VOL callback exists */ if(NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link specific' method") /* Call the corresponding VOL callback */ if((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) @@ -4230,14 +4230,14 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") done: @@ -4256,7 +4256,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLlink_specific * - * Purpose: Performs a plugin-specific operation on a link + * Purpose: Performs a connector-specific operation on a link * * Return: Success: Non-negative * Failure: Negative @@ -4264,21 +4264,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, +H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, plugin_id, specific_type, + H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if((ret_value = H5VL__link_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) @@ -4292,7 +4292,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__link_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -4309,7 +4309,7 @@ H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Check if the corresponding VOL callback exists */ if(NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link optional' method") /* Call the corresponding VOL callback */ if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) @@ -4323,7 +4323,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_link_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -4341,14 +4341,14 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__link_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) + if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: @@ -4367,7 +4367,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLlink_optional * - * Purpose: Performs an optional plugin-specific operation on a link + * Purpose: Performs an optional connector-specific operation on a link * * Return: Success: Non-negative * Failure: Negative @@ -4375,19 +4375,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__link_optional(obj, cls, dxpl_id, req, arguments) < 0) @@ -4418,7 +4418,7 @@ H5VL__object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, /* Check if the corresponding VOL callback exists */ if(NULL == cls->object_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'object open' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'object open' method") /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->object_cls.open)(obj, params, opened_type, dxpl_id, req))) @@ -4449,12 +4449,12 @@ H5VL_object_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t params, FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__object_open(vol_obj->data, params, vol_obj->plugin->cls, opened_type, dxpl_id, req))) + if(NULL == (ret_value = H5VL__object_open(vol_obj->data, params, vol_obj->connector->cls, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") done: @@ -4477,20 +4477,20 @@ done: *------------------------------------------------------------------------- */ void * -H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t plugin_id, H5I_type_t *opened_type, +H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("*x", "*xxi*Iti**x", obj, params, plugin_id, opened_type, dxpl_id, req); + H5TRACE6("*x", "*xxi*Iti**x", obj, params, connector_id, opened_type, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__object_open(obj, params, cls, opened_type, dxpl_id, req))) @@ -4523,7 +4523,7 @@ H5VL__object_copy(void *src_obj, H5VL_loc_params_t src_loc_params, const char *s /* Check if the corresponding VOL callback exists */ if(NULL == cls->object_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object copy' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object copy' method") /* Call the corresponding VOL callback */ if((cls->object_cls.copy)(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0) @@ -4555,17 +4555,17 @@ H5VL_object_copy(const H5VL_object_t *src_obj, H5VL_loc_params_t src_loc_params, FUNC_ENTER_NOAPI(FAIL) - /* Make sure that the VOL plugins are the same */ - if(src_obj->plugin->cls->value != dst_obj->plugin->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "objects are accessed through different VOL plugins and can't be copied") + /* Make sure that the VOL connectors are the same */ + if(src_obj->connector->cls->value != dst_obj->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "objects are accessed through different VOL connectors and can't be copied") /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(src_obj->data, src_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(src_obj->data, src_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__object_copy(src_obj->data, src_loc_params, src_name, dst_obj->data, dst_loc_params, dst_name, src_obj->plugin->cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + if(H5VL__object_copy(src_obj->data, src_loc_params, src_name, dst_obj->data, dst_loc_params, dst_name, src_obj->connector->cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed") done: @@ -4590,10 +4590,10 @@ done: herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t src_loc_params, const char *src_name, void *dst_obj, H5VL_loc_params_t dst_loc_params, - const char *dst_name, hid_t plugin_id, hid_t ocpypl_id, hid_t lcpl_id, + const char *dst_name, hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT @@ -4601,8 +4601,8 @@ H5VLobject_copy(void *src_obj, H5VL_loc_params_t src_loc_params, /* Check args and get class pointers */ if(NULL == src_obj || NULL == dst_obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__object_copy(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) @@ -4633,7 +4633,7 @@ H5VL__object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cl /* Check if the corresponding VOL callback exists */ if(NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object get' method") /* Call the corresponding VOL callback */ if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) @@ -4666,14 +4666,14 @@ H5VL_object_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") done: @@ -4700,21 +4700,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, +H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVni**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, + H5TRACE7("e", "*xxiVni**xx", obj, loc_params, connector_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__object_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0) @@ -4746,7 +4746,7 @@ H5VL__object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_ /* Check if the corresponding VOL callback exists */ if(NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object specific' method") /* Call the corresponding VOL callback */ if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) @@ -4779,14 +4779,14 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") done: @@ -4805,7 +4805,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLobject_specific * - * Purpose: Performs a plugin-specific operation on an object + * Purpose: Performs a connector-specific operation on an object * * Return: Success: Non-negative * Failure: Negative @@ -4813,25 +4813,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, +H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, plugin_id, specific_type, + H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Check if the corresponding VOL callback exists */ if(NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `object specific' method") /* Bypass the H5VLint layer, calling the VOL callback directly */ if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) @@ -4845,7 +4845,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__object_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -4862,7 +4862,7 @@ H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Check if the corresponding VOL callback exists */ if(NULL == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object optional' method") /* Call the corresponding VOL callback */ if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) @@ -4876,7 +4876,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_object_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -4894,14 +4894,14 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, .. FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__object_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) + if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: @@ -4920,7 +4920,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLobject_optional * - * Purpose: Performs an optional plugin-specific operation on an object + * Purpose: Performs an optional connector-specific operation on an object * * Return: Success: Non-negative * Failure: Negative @@ -4928,19 +4928,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__object_optional(obj, cls, dxpl_id, req, arguments) < 0) @@ -4972,7 +4972,7 @@ H5VL__datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_ /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.commit) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'datatype commit' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'datatype commit' method") /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->datatype_cls.commit)(obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) @@ -5004,12 +5004,12 @@ H5VL_datatype_commit(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__datatype_commit(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") done: @@ -5032,22 +5032,22 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, +H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, plugin_id, name, type_id, + H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, connector_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) @@ -5109,12 +5109,12 @@ H5VL_datatype_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL__datatype_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, tapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__datatype_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") done: @@ -5137,21 +5137,21 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, +H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, tapl_id, + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, tapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) @@ -5182,7 +5182,7 @@ H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_t /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method") /* Call the corresponding VOL callback */ if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) @@ -5215,14 +5215,14 @@ H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__datatype_get(vol_obj->data, vol_obj->plugin->cls, get_type, dxpl_id, req, arguments) < 0) + if(H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") done: @@ -5249,24 +5249,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_get(void *obj, hid_t plugin_id, H5VL_datatype_get_t get_type, +H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVei**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVei**xx", obj, connector_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `datatype get' method") /* Call the corresponding internal VOL routine */ if(H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) @@ -5297,7 +5297,7 @@ H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specif /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method") /* Call the corresponding VOL callback */ if((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) @@ -5330,14 +5330,14 @@ H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t sp FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__datatype_specific(vol_obj->data, vol_obj->plugin->cls, specific_type, dxpl_id, req, arguments) < 0) + if(H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: @@ -5356,7 +5356,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLdatatype_specific * - * Purpose: Performs a plugin-specific operation on a datatype + * Purpose: Performs a connector-specific operation on a datatype * * Return: Success: Non-negative * Failure: Negative @@ -5364,21 +5364,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t specific_type, +H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVfi**xx", obj, plugin_id, specific_type, dxpl_id, req, + H5TRACE6("e", "*xiVfi**xx", obj, connector_id, specific_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) @@ -5392,7 +5392,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__datatype_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -5409,7 +5409,7 @@ H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method") /* Call the corresponding VOL callback */ if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) @@ -5423,7 +5423,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_datatype_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -5442,14 +5442,14 @@ H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__datatype_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req, arguments) < 0) + if(H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: @@ -5468,7 +5468,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLdatatype_optional * - * Purpose: Performs an optional plugin-specific operation on a datatype + * Purpose: Performs an optional connector-specific operation on a datatype * * Return: Success: Non-negative * Failure: Negative @@ -5476,20 +5476,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, +H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__datatype_optional(obj, cls, dxpl_id, req, arguments) < 0) @@ -5520,7 +5520,7 @@ H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, /* Check if the corresponding VOL callback exists */ if(NULL == cls->datatype_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype close' method") /* Call the corresponding VOL callback */ if((cls->datatype_cls.close)(obj, dxpl_id, req) < 0) @@ -5550,12 +5550,12 @@ H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__datatype_close(vol_obj->data, vol_obj->plugin->cls, dxpl_id, req) < 0) + if(H5VL__datatype_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") done: @@ -5578,19 +5578,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_close(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req) +H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xii**x", obj, plugin_id, dxpl_id, req); + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__datatype_close(obj, cls, dxpl_id, req) < 0) @@ -5626,7 +5626,7 @@ H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout, /* Check if the corresponding VOL callback exists */ if(NULL == cls->request_cls.wait) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async wait' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async wait' method") /* Call the corresponding VOL callback */ if((cls->request_cls.wait)(req, timeout, status) < 0) @@ -5660,12 +5660,12 @@ H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__request_wait(vol_obj->data, vol_obj->plugin->cls, timeout, status) < 0) + if(H5VL__request_wait(vol_obj->data, vol_obj->connector->cls, timeout, status) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") done: @@ -5688,16 +5688,16 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_wait(void *req, hid_t plugin_id, uint64_t timeout, H5ES_status_t *status) +H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__request_wait(req, cls, timeout, status) < 0) @@ -5731,7 +5731,7 @@ H5VL__request_cancel(void *req, const H5VL_class_t *cls) /* Check if the corresponding VOL callback exists */ if(NULL == cls->request_cls.cancel) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async cancel' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async cancel' method") /* Call the corresponding VOL callback */ if((cls->request_cls.cancel)(req) < 0) @@ -5764,12 +5764,12 @@ H5VL_request_cancel(const H5VL_object_t *vol_obj) HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__request_cancel(vol_obj->data, vol_obj->plugin->cls) < 0) + if(H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") done: @@ -5792,17 +5792,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_cancel(void *req, hid_t plugin_id) +H5VLrequest_cancel(void *req, hid_t connector_id) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE2("e", "*xi", req, plugin_id); + H5TRACE2("e", "*xi", req, connector_id); /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__request_cancel(req, cls) < 0) @@ -5837,7 +5837,7 @@ H5VL__request_specific(void *req, const H5VL_class_t *cls, /* Check if the corresponding VOL callback exists */ if(NULL == cls->request_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async specific' method") /* Call the corresponding VOL callback */ if((ret_value = (cls->request_cls.specific)(req, specific_type, arguments)) < 0) @@ -5873,14 +5873,14 @@ H5VL_request_specific(const H5VL_object_t *vol_obj, HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, specific_type); arg_started = TRUE; - if((ret_value = H5VL__request_specific(vol_obj->data, vol_obj->plugin->cls, specific_type, arguments)) < 0) + if((ret_value = H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, specific_type, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") done: @@ -5899,7 +5899,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLrequest_specific * - * Purpose: Performs a plugin-specific operation on an asynchronous request + * Purpose: Performs a connector-specific operation on an asynchronous request * * Return: Success: Non-negative * Failure: Negative @@ -5907,17 +5907,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_specific(void *req, hid_t plugin_id, H5VL_request_specific_t specific_type, +H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if((ret_value = H5VL__request_specific(req, cls, specific_type, arguments)) < 0) @@ -5931,7 +5931,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__request_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -5951,7 +5951,7 @@ H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments) /* Check if the corresponding VOL callback exists */ if(NULL == cls->request_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async optional' method") /* Call the corresponding VOL callback */ if((ret_value = (cls->request_cls.optional)(req, arguments)) < 0) @@ -5965,7 +5965,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_request_optional * - * Purpose: Optional operation specific to plugins. + * Purpose: Optional operation specific to connectors. * * Return: Success: Non-negative * Failure: Negative @@ -5986,14 +5986,14 @@ H5VL_request_optional(const H5VL_object_t *vol_obj, ...) HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ va_start(arguments, vol_obj); arg_started = TRUE; - if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->plugin->cls, arguments)) < 0) + if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") done: @@ -6012,7 +6012,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VLrequest_optional * - * Purpose: Performs an optional plugin-specific operation on an asynchronous request + * Purpose: Performs an optional connector-specific operation on an asynchronous request * * Return: Success: Non-negative * Failure: Negative @@ -6020,16 +6020,16 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_optional(void *req, hid_t plugin_id, va_list arguments) +H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if((ret_value = H5VL__request_optional(req, cls, arguments)) < 0) @@ -6063,7 +6063,7 @@ H5VL__request_free(void *req, const H5VL_class_t *cls) /* Check if the corresponding VOL callback exists */ if(NULL == cls->request_cls.free) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async free' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async free' method") /* Call the corresponding VOL callback */ if((cls->request_cls.free)(req) < 0) @@ -6096,12 +6096,12 @@ H5VL_request_free(const H5VL_object_t *vol_obj) HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding VOL callback */ - if(H5VL__request_free(vol_obj->data, vol_obj->plugin->cls) < 0) + if(H5VL__request_free(vol_obj->data, vol_obj->connector->cls) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed") done: @@ -6124,17 +6124,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_free(void *req, hid_t plugin_id) +H5VLrequest_free(void *req, hid_t connector_id) { - H5VL_class_t *cls; /* VOL plugin's class struct */ + H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE2("e", "*xi", req, plugin_id); + H5TRACE2("e", "*xi", req, connector_id); /* Get class pointer */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ if(H5VL__request_free(req, cls) < 0) diff --git a/src/H5VLint.c b/src/H5VLint.c index e6e0dbe..4590885 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -51,8 +51,8 @@ /* Object wrapping context info */ typedef struct H5VL_wrap_ctx_t { unsigned rc; /* Ref. count for the # of times the context was set / reset */ - const H5VL_t *plugin; /* VOL plugin for "outermost" class to start wrap */ - void *obj_wrap_ctx; /* "wrap context" for outermost plugin */ + const H5VL_t *connector; /* VOL connector for "outermost" class to start wrap */ + void *obj_wrap_ctx; /* "wrap context" for outermost connector */ } H5VL_wrap_ctx_t; @@ -67,7 +67,7 @@ typedef struct H5VL_wrap_ctx_t { static herr_t H5VL__free_cls(H5VL_class_t *cls); static void *H5VL__wrap_obj(void *obj); static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object, - H5VL_t *vol_plugin, hbool_t wrap_obj); + H5VL_t *vol_connector, hbool_t wrap_obj); static void *H5VL__object(hid_t id, H5I_type_t obj_type); @@ -185,7 +185,7 @@ H5VL_term_package(void) n++; } /* end if */ else { - /* Destroy the VOL plugin ID group */ + /* Destroy the VOL connector ID group */ n += (H5I_dec_type_ref(H5I_VOL) > 0); /* Mark interface as closed */ @@ -220,9 +220,9 @@ H5VL__free_cls(H5VL_class_t *cls) /* Sanity check */ HDassert(cls); - /* Shut down the VOL plugin */ + /* Shut down the VOL connector */ if(cls->terminate && cls->terminate() < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not terminate cleanly") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") /* Release the class */ H5MM_xfree(cls->name); @@ -236,8 +236,8 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__wrap_obj * - * Purpose: Wraps a library object with possible VOL plugin wrappers, to - * match the VOL plugin stack for the file. + * Purpose: Wraps a library object with possible VOL connector wrappers, to + * match the VOL connector stack for the file. * * Return: Success: Wrapped object pointer * Failure: NULL @@ -265,7 +265,7 @@ H5VL__wrap_obj(void *obj) /* If there is a VOL object wrapping context, wrap the object */ if(vol_wrap_ctx) { /* Wrap object, using the VOL callback */ - if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->plugin->cls, vol_wrap_ctx->obj_wrap_ctx, obj))) + if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj))) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") } /* end if */ else @@ -290,7 +290,7 @@ done: *------------------------------------------------------------------------- */ static H5VL_object_t * -H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t wrap_obj) +H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t wrap_obj) { H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */ H5VL_object_t *ret_value = NULL; /* Return value */ @@ -299,7 +299,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t wra /* Check arguments */ HDassert(object); - HDassert(vol_plugin); + HDassert(vol_connector); /* Make sure type number is valid */ if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP) @@ -308,7 +308,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t wra /* Create the new VOL object */ if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object") - new_vol_obj->plugin = vol_plugin; + new_vol_obj->connector = vol_connector; if(wrap_obj) { if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object") @@ -316,8 +316,8 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t wra else new_vol_obj->data = object; - /* Bump the reference count on the VOL plugin */ - vol_plugin->nrefs++; + /* Bump the reference count on the VOL connector */ + vol_connector->nrefs++; /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */ if(H5I_DATATYPE == type) { @@ -345,7 +345,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref) +H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref) { H5VL_object_t *vol_obj = NULL; /* VOL object wrapper for library object */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -354,11 +354,11 @@ H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref /* Check arguments */ HDassert(object); - HDassert(vol_plugin); + HDassert(vol_connector); /* Set up VOL object for the passed-in data */ /* (Does not wrap object, since it's from a VOL callback) */ - if(NULL == (vol_obj = H5VL__new_vol_obj(type, object, vol_plugin, FALSE))) + if(NULL == (vol_obj = H5VL__new_vol_obj(type, object, vol_connector, FALSE))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") /* Register VOL object as _object_ type, for future object API calls */ @@ -389,7 +389,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref, hid_t existing_id) +H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id) { H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */ herr_t ret_value = SUCCEED; /* Return value */ @@ -398,11 +398,11 @@ H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_plugi /* Check arguments */ HDassert(object); - HDassert(vol_plugin); + HDassert(vol_connector); /* Set up VOL object for the passed-in data */ /* (Wraps object, since it's a library object) */ - if(NULL == (new_vol_obj = H5VL__new_vol_obj(type, object, vol_plugin, TRUE))) + if(NULL == (new_vol_obj = H5VL__new_vol_obj(type, object, vol_connector, TRUE))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") /* Call the underlying H5I function to complete the registration */ @@ -418,8 +418,8 @@ done: * 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 plugin's ID to - * get the plugin information instead of it being passed in. + * or opened through the VOL. Uses the VOL connector's ID to + * get the connector information instead of it being passed in. * * Return: Success: A valid HDF5 ID * Failure: H5I_INVALID_HID @@ -427,28 +427,28 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t plugin_id, hbool_t app_ref) +H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref) { H5VL_class_t *cls = NULL; - H5VL_t *plugin = NULL; /* VOL plugin struct */ + H5VL_t *connector = NULL; /* VOL connector struct */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI(FAIL) - /* Get the VOL class object from the plugin's ID */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL plugin ID") + /* Get the VOL class object from the connector's ID */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID") /* Setup VOL info struct */ - if (NULL == (plugin = H5FL_CALLOC(H5VL_t))) + if (NULL == (connector = H5FL_CALLOC(H5VL_t))) HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate VOL info struct") - plugin->cls = cls; - plugin->id = plugin_id; - if (H5I_inc_ref(plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") + connector->cls = cls; + connector->id = connector_id; + if (H5I_inc_ref(connector->id, FALSE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") /* Get an ID for the VOL object */ - if ((ret_value = H5VL_register(type, obj, plugin, app_ref)) < 0) + if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: @@ -460,7 +460,7 @@ done: * Function: H5VL_free_object * * Purpose: Wrapper to unregister an object ID with a VOL aux struct - * and decrement ref count on VOL plugin ID + * and decrement ref count on VOL connector ID * * Return: SUCCEED/FAIL * @@ -476,12 +476,12 @@ H5VL_free_object(H5VL_object_t *vol_obj) /* Check arguments */ HDassert(vol_obj); - vol_obj->plugin->nrefs --; + vol_obj->connector->nrefs --; - if(0 == vol_obj->plugin->nrefs) { - if(H5I_dec_ref(vol_obj->plugin->id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") - vol_obj->plugin = H5FL_FREE(H5VL_t, vol_obj->plugin); + if(0 == vol_obj->connector->nrefs) { + if(H5I_dec_ref(vol_obj->connector->id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector") + vol_obj->connector = H5FL_FREE(H5VL_t, vol_obj->connector); } /* end if */ vol_obj = H5FL_FREE(H5VL_object_t, vol_obj); @@ -492,20 +492,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_register_plugin + * Function: H5VL_register_connector * - * Purpose: Registers a new VOL plugin as a member of the virtual object + * Purpose: Registers a new VOL connector as a member of the virtual object * layer class. * - * Return: Success: A VOL plugin ID which is good until the - * library is closed or the plugin is unregistered. + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is unregistered. * * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VL_register_plugin(const void *_cls, hbool_t app_ref, hid_t vipl_id) +H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id) { const H5VL_class_t *cls = (const H5VL_class_t *)_cls; H5VL_class_t *saved = NULL; @@ -518,18 +518,18 @@ H5VL_register_plugin(const void *_cls, hbool_t app_ref, hid_t vipl_id) /* Copy the class structure so the caller can reuse or free it */ if (NULL == (saved = H5FL_CALLOC(H5VL_class_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL plugin class struct") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector class struct") HDmemcpy(saved, cls, sizeof(H5VL_class_t)); if(NULL == (saved->name = H5MM_strdup(cls->name))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL plugin name") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector name") - /* Initialize the VOL plugin */ + /* Initialize the VOL connector */ if(cls->initialize && cls->initialize(vipl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL plugin") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL connector") /* Create the new class ID */ if ((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") done: if (ret_value < 0) @@ -537,21 +537,21 @@ done: H5FL_FREE(H5VL_class_t, saved); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_register_plugin() */ +} /* end H5VL_register_connector() */ /*------------------------------------------------------------------------- - * Function: H5VL_get_plugin_name + * Function: H5VL_get_connector_name * - * Purpose: Private version of H5VLget_plugin_name + * Purpose: Private version of H5VLget_connector_name * - * Return: Success: The length of the plugin name + * Return: Success: The length of the connector name * Failure: Negative * *------------------------------------------------------------------------- */ ssize_t -H5VL_get_plugin_name(hid_t id, char *name /*out*/, size_t size) +H5VL_get_connector_name(hid_t id, char *name /*out*/, size_t size) { H5VL_object_t *vol_obj; const H5VL_class_t *cls; @@ -564,7 +564,7 @@ H5VL_get_plugin_name(hid_t id, char *name /*out*/, size_t size) if (NULL == (vol_obj = H5VL_vol_object(id))) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid VOL identifier") - cls = vol_obj->plugin->cls; + cls = vol_obj->connector->cls; len = HDstrlen(cls->name); if(name) { @@ -578,7 +578,7 @@ H5VL_get_plugin_name(hid_t id, char *name /*out*/, size_t size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_get_plugin_name() */ +} /* end H5VL_get_connector_name() */ /*------------------------------------------------------------------------- @@ -629,7 +629,7 @@ done: * Function: H5VL_object_data * * Purpose: Correctly retrieve the 'data' field for a VOL object (H5VL_object), - * even for nested / stacked VOL plugins. + * even for nested / stacked VOL connectors. * * Return: Success: object pointer * Failure: NULL @@ -643,9 +643,9 @@ H5VL_object_data(const H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Check for 'get_object' callback in plugin */ - if(vol_obj->plugin->cls->get_object) - ret_value = (vol_obj->plugin->cls->get_object)(vol_obj->data); + /* Check for 'get_object' callback in connector */ + if(vol_obj->connector->cls->get_object) + ret_value = (vol_obj->connector->cls->get_object)(vol_obj->data); else ret_value = vol_obj->data; @@ -780,9 +780,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_cmp_plugin_cls + * Function: H5VL_cmp_connector_cls * - * Purpose: Compare VOL class for a plugin + * Purpose: Compare VOL class for a connector * * Return: Positive if VALUE1 is greater than VALUE2, negative if * VALUE2 is greater than VALUE1 and zero if VALUE1 and @@ -791,7 +791,7 @@ done: *------------------------------------------------------------------------- */ int -H5VL_cmp_plugin_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls2) +H5VL_cmp_connector_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls2) { int cmp_value; /* Value from comparison */ int ret_value = 0; /* Return value */ @@ -802,14 +802,14 @@ H5VL_cmp_plugin_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls2) HDassert(cls1); HDassert(cls1); - /* Compare plugin "values" */ + /* Compare connector "values" */ if(cls1->value < cls2->value) HGOTO_DONE(-1) if(cls1->value > cls2->value) HGOTO_DONE(1) HDassert(cls1->value == cls2->value); - /* Compare plugin names */ + /* Compare connector names */ if(cls1->name == NULL && cls2->name != NULL) HGOTO_DONE(-1); if(cls1->name != NULL && cls2->name == NULL) @@ -817,14 +817,14 @@ H5VL_cmp_plugin_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls2) if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) HGOTO_DONE(cmp_value); - /* Compare plugin VOL API versions */ + /* Compare connector VOL API versions */ if(cls1->version < cls2->version) HGOTO_DONE(-1) if(cls1->version > cls2->version) HGOTO_DONE(1) HDassert(cls1->version == cls2->version); - /* Compare plugin info */ + /* Compare connector info */ if(cls1->info_size < cls2->info_size) HGOTO_DONE(-1) if(cls1->info_size > cls2->info_size) @@ -833,30 +833,30 @@ H5VL_cmp_plugin_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_cmp_plugin_cls() */ +} /* end H5VL_cmp_connector_cls() */ /*------------------------------------------------------------------------- * Function: H5VL_set_vol_wrapper * - * Purpose: Set up object wrapping context for current VOL plugin + * Purpose: Set up object wrapping context for current VOL connector * * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ herr_t -H5VL_set_vol_wrapper(void *obj, const H5VL_t *plugin) +H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector) { H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ - void *obj_wrap_ctx = NULL; /* VOL plugin's wrapping context */ + void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ HDassert(obj); - HDassert(plugin); + HDassert(connector); /* Retrieve the VOL object wrap context */ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) @@ -864,14 +864,14 @@ H5VL_set_vol_wrapper(void *obj, const H5VL_t *plugin) /* Check for existing wrapping context */ if(NULL == vol_wrap_ctx) { - /* Check if the plugin can create a wrap context */ - if(plugin->cls->get_wrap_ctx) { + /* Check if the connector can create a wrap context */ + if(connector->cls->get_wrap_ctx) { /* Sanity check */ - HDassert(plugin->cls->free_wrap_ctx); + HDassert(connector->cls->free_wrap_ctx); - /* Get the wrap context from the plugin */ - if((plugin->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL plugin's object wrap context") + /* Get the wrap context from the connector */ + if((connector->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context") } /* end if */ /* Allocate VOL object wrapper context */ @@ -880,7 +880,7 @@ H5VL_set_vol_wrapper(void *obj, const H5VL_t *plugin) /* Set up VOL object wrapper context */ vol_wrap_ctx->rc = 1;; - vol_wrap_ctx->plugin = plugin; + vol_wrap_ctx->connector = connector; vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx; } /* end if */ else @@ -903,7 +903,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_reset_vol_wrapper * - * Purpose: Reset object wrapping context for current VOL plugin + * Purpose: Reset object wrapping context for current VOL connector * * Return: SUCCEED / FAIL * @@ -930,11 +930,11 @@ H5VL_reset_vol_wrapper(void) /* Release context if the ref count drops to zero */ if(0 == vol_wrap_ctx->rc) { - /* If there is a VOL plugin object wrapping context, release it */ + /* If there is a VOL connector object wrapping context, release it */ if(vol_wrap_ctx->obj_wrap_ctx) { - /* Release the VOL plugin's object wrapping context */ - if((*vol_wrap_ctx->plugin->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release plugin's object wrapping context") + /* Release the VOL connector's object wrapping context */ + if((*vol_wrap_ctx->connector->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context") } /* end if */ /* Release object wrapping context */ @@ -983,18 +983,18 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) if(TRUE == H5T_already_vol_managed((const H5T_t *)obj)) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") - /* Wrap the object with VOL plugin info */ + /* Wrap the object with VOL connector info */ if(NULL == (new_obj = H5VL__wrap_obj(obj))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object") /* Retrieve the VOL object wrapping context */ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") - if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->plugin) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its plugin is NULL???") + if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its connector is NULL???") /* Get an ID for the object */ - if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->plugin->id, app_ref)) < 0) + if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->connector->id, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") done: diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 9137e4d..12dbcdb 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: The native VOL plugin where access is to a single HDF5 file + * Purpose: The native VOL connector where access is to a single HDF5 file * using HDF5 VFDs. */ @@ -40,11 +40,11 @@ #include "H5Rpkg.h" /* References */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tpkg.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL drivers */ -#include "H5VLnative_private.h" /* Native VOL plugin */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative_private.h" /* Native VOL connector */ /* - * The VOL plugin identification number. + * The VOL connector identification number. */ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; @@ -117,7 +117,7 @@ static herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, static herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); -/* Native VOL plugin class struct */ +/* Native VOL connector class struct */ static H5VL_class_t H5VL_native_cls_g = { H5VL_NATIVE_VERSION, /* version */ H5VL_NATIVE_VALUE, /* value */ @@ -206,10 +206,10 @@ static H5VL_class_t H5VL_native_cls_g = { /*------------------------------------------------------------------------- * Function: H5VL_native_init * - * Purpose: Initialize this VOL plugin by registering it with the + * Purpose: Initialize this VOL connector by registering it with the * library. * - * Return: Success: The ID for the native plugin + * Return: Success: The ID for the native connector * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- @@ -221,10 +221,10 @@ H5VL_native_init(hid_t vipl_id) FUNC_ENTER_NOAPI(H5I_INVALID_HID) - /* Register the native VOL plugin, if it isn't already */ + /* Register the native VOL connector, if it isn't already */ if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) - if((H5VL_NATIVE_ID_g = H5VL_register_plugin((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, vipl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL plugin") + if((H5VL_NATIVE_ID_g = H5VL_register_connector((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector") /* Set return value */ ret_value = H5VL_NATIVE_ID_g; @@ -259,7 +259,7 @@ H5VL__native_term(void) * Function: H5Pset_fapl_native * * Purpose: Modify the file access property list to use the H5VL_NATIVE - * plugin defined in this source file. + * connector defined in this source file. * * Return: SUCCEED/FAIL * @@ -288,7 +288,7 @@ done: * Function: H5VL__native_get_file * * Purpose: Utility routine to get file struct for an object via the - * native VOL plugin. + * native VOL connector. * * Returns: SUCCESS: A pointer to the H5F_t struct for the file * associated with the object. @@ -414,7 +414,7 @@ H5VL__native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *at if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") - /* If this is a named datatype, get the plugin's pointer to the datatype */ + /* If this is a named datatype, get the connector's pointer to the datatype */ type = H5T_get_actual_type(dt); if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) @@ -1275,7 +1275,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_dataset_optional * - * Purpose: Perform a plugin-specific operation on a native dataset + * Purpose: Perform a connector-specific operation on a native dataset * * Return: SUCCEED/FAIL * @@ -1741,7 +1741,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, void **ret = va_arg(arguments, void **); H5F_t *new_file = NULL; - /* Reopen the file through the VOL plugin */ + /* Reopen the file through the VOL connector */ if(NULL == (new_file = H5F__reopen((H5F_t *)obj))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") new_file->id_exists = TRUE; @@ -1810,7 +1810,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_file_optional * - * Purpose: Perform a plugin-specific operation on a native file + * Purpose: Perform a connector-specific operation on a native file * * Return: SUCCEED/FAIL * @@ -3116,7 +3116,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_object_specific * - * Purpose: Perform a plugin-specific operation for an objectibute + * Purpose: Perform a connector-specific operation for an objectibute * * Return: SUCCEED/FAIL * @@ -3239,7 +3239,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_object_optional * - * Purpose: Perform a plugin-specific operation for an objectibute + * Purpose: Perform a connector-specific operation for an objectibute * * Return: Success: 0 * Failure: -1 diff --git a/src/H5VLnative.h b/src/H5VLnative.h index d26c2d1..af4ea59 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -11,13 +11,13 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: The public header file for the native VOL driver. + * Purpose: The public header file for the native VOL connector. */ #ifndef _H5VLnative_H #define _H5VLnative_H -/* Characteristics of the native VOL driver */ +/* Characteristics of the native VOL connector */ #define H5VL_NATIVE_NAME "native" #define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */ #define H5VL_NATIVE_VERSION 0 diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 397d496..559c8aa 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -11,16 +11,16 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: The private header file for the native VOL driver. + * Purpose: The private header file for the native VOL connector. */ #ifndef _H5VLnative_private_H #define _H5VLnative_private_H -/* Include driver's public header */ +/* Include connector's public header */ #include "H5VLnative.h" -/* Initializer function for native VOL driver */ +/* Initializer function for native VOL connector */ #define H5VL_NATIVE (H5VL_native_init(H5P_DEFAULT)) diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index ee6b7d4..83e9600 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -26,24 +26,24 @@ /* Library Private Typedefs */ /****************************/ -/* Internal struct to track VOL plugin information for objects */ +/* Internal struct to track VOL connector information for objects */ typedef struct H5VL_t { - const H5VL_class_t *cls; /* Pointer to plugin class struct */ + const H5VL_class_t *cls; /* Pointer to connector class struct */ int64_t nrefs; /* Number of references by objects using this struct */ - hid_t id; /* Identifier for the VOL plugin */ + hid_t id; /* Identifier for the VOL connector */ } H5VL_t; /* Internal vol object structure returned to the API */ typedef struct H5VL_object_t { - void *data; /* Pointer to plugin-managed data for this object */ - H5VL_t *plugin; /* Pointer to VOL plugin struct */ + void *data; /* Pointer to connector-managed data for this object */ + H5VL_t *connector; /* Pointer to VOL connector struct */ } H5VL_object_t; -/* Internal structure to hold the plugin ID & info for FAPLs */ -typedef struct H5VL_plugin_prop_t { - hid_t plugin_id; /* VOL plugin's ID */ - const void *plugin_info; /* VOL plugin info, for open callbacks */ -} H5VL_plugin_prop_t; +/* Internal structure to hold the connector ID & info for FAPLs */ +typedef struct H5VL_connector_prop_t { + hid_t connector_id; /* VOL connector's ID */ + const void *connector_info; /* VOL connector info, for open callbacks */ +} H5VL_connector_prop_t; /*****************************/ /* Library Private Variables */ @@ -55,16 +55,16 @@ typedef struct H5VL_plugin_prop_t { /* Utility functions */ H5_DLL herr_t H5VL_init(void); -H5_DLL int H5VL_cmp_plugin_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls); -H5_DLL int H5VL_copy_plugin_info(const H5VL_class_t *plugin, void **dst_info, +H5_DLL int H5VL_cmp_connector_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls); +H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, const void *src_info); -H5_DLL int H5VL_cmp_plugin_info(const H5VL_class_t *plugin, const void *info1, +H5_DLL int H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *info1, const void *info2); -H5_DLL herr_t H5VL_free_plugin_info(const H5VL_class_t *plugin, void *info); +H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info); -/* Functions that deal with VOL plugins */ -H5_DLL hid_t H5VL_register_plugin(const void *cls, hbool_t app_ref, hid_t vipl_id); -H5_DLL ssize_t H5VL_get_plugin_name(hid_t id, char *name/*out*/, size_t size); +/* Functions that deal with VOL connectors */ +H5_DLL hid_t H5VL_register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id); +H5_DLL ssize_t H5VL_get_connector_name(hid_t id, char *name/*out*/, size_t size); /* 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 @@ -84,22 +84,22 @@ H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id); H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); /* Functions that wrap / unwrap VOL objects */ -H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *plugin, void *obj, +H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx); -H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *plugin, void *wrap_ctx); -H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_plugin); +H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx); +H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_connector); H5_DLL herr_t H5VL_reset_vol_wrapper(void); -H5_DLL void * H5VL_wrap_object(const H5VL_class_t *plugin, void *wrap_ctx, +H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj); /* ID registration functions */ -H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref); +H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref); H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref); -H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, 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); +H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref); +H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id); /****************************** - * VOL plugin callback wrappers + * VOL connector callback wrappers *****************************/ /* Attribute functions */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 1b8a4a7..95c3d11 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -52,7 +52,7 @@ /* Group creation property names */ #define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id" -/* Default VOL plugin value */ +/* Default VOL connector value */ #define H5VL_VOL_DEFAULT 0 @@ -345,47 +345,47 @@ typedef struct H5VL_request_class_t { } H5VL_request_class_t; -/* enum value to identify the class of a VOL plugin (mostly for comparison purposes) */ +/* enum value to identify the class of a VOL connector (mostly for comparison purposes) */ typedef enum H5VL_class_value_t { H5_VOL_NATIVE = 0, /* This should be first */ H5_VOL_MAX_LIB_VALUE = 128 /* This should be last */ } H5VL_class_value_t; -/* Capability flags for plugins */ -#define H5VL_CAP_FLAG_NONE 0 /* No special plugin capabilities */ -#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Plugin is threadsafe */ +/* Capability flags for connector */ +#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */ +#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */ -/* Class information for each VOL plugin */ +/* Class information for each VOL connector */ /* XXX: We should consider adding a UUID/GUID field to this struct * as well as a H5VLregister_by_uuid() API call for people who - * really care about getting a particular VOL plugin. + * really care about getting a particular VOL connector. * XXX: We should also consider adding enough information so that - * files can be opened without specifying the VOL plugin. + * files can be opened without specifying the VOL connector. * e.g.: If we stored a UUID and version, we could search for - * a matching VOL plugin so a user did not have to make any + * a matching VOL connector so a user did not have to make any * H5VL calls. */ typedef struct H5VL_class_t { - /* XXX: How do we identify unique VOL plugin? + /* XXX: How do we identify unique VOL connector? * This is unclear, but for now we'll keep * all the ID fields from the original VOL * branch. */ - unsigned int version; /* VOL plugin API version # */ - H5VL_class_value_t value; /* value to identify plugin */ - const char *name; /* Plugin name (MUST be unique!) */ - unsigned cap_flags; /* capability flags for plugin */ - herr_t (*initialize)(hid_t vipl_id); /* Plugin initialization callback */ - herr_t (*terminate)(void); /* Plugin termination callback */ + unsigned int version; /* VOL connector API version # */ + H5VL_class_value_t value; /* value to identify connector */ + const char *name; /* connector name (MUST be unique!) */ + unsigned cap_flags; /* capability flags for connector */ + herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */ + herr_t (*terminate)(void); /* Connector termination callback */ size_t info_size; /* size of the vol info */ void * (*info_copy)(const void *info); /* callback to create a copy of the vol info */ int (*info_cmp)(const void *info1, const void *info2); /* callback to compare vol info */ herr_t (*info_free)(void *info); /* callback to release the vol info copy */ void * (*get_object)(const void *obj); /* callback to retrieve underlying object */ - herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* callback to retrieve the object wrapping context for the plugin */ - herr_t (*free_wrap_ctx)(void *wrap_ctx); /* callback to release the object wrapping context for the plugin */ + herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* callback to retrieve the object wrapping context for the connector */ + herr_t (*free_wrap_ctx)(void *wrap_ctx); /* callback to release the object wrapping context for the connector */ void* (*wrap_object)(void *obj, void *wrap_ctx); /* callback to wrap an object */ /* Data Model */ @@ -417,109 +417,109 @@ typedef struct H5VL_class_t { extern "C" { #endif -/* VOL Plugin Functionality */ -H5_DLL hid_t H5VLregister_plugin(const H5VL_class_t *cls, hid_t vipl_id); -H5_DLL hid_t H5VLregister_plugin_by_name(const char *plugin_name, hid_t vipl_id); -H5_DLL htri_t H5VLis_plugin_registered(const char *name); -H5_DLL hid_t H5VLget_plugin_id(const char *name); -H5_DLL ssize_t H5VLget_plugin_name(hid_t id, char *name/*out*/, size_t size); -H5_DLL herr_t H5VLclose(hid_t plugin_id); -H5_DLL herr_t H5VLunregister_plugin(hid_t plugin_id); +/* VOL Connector Functionality */ +H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); +H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id); +H5_DLL htri_t H5VLis_connector_registered(const char *name); +H5_DLL hid_t H5VLget_connector_id(const char *name); +H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name/*out*/, size_t size); +H5_DLL herr_t H5VLclose(hid_t connector_id); +H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); /***************************************************************************** - * VOL callback wrappers and helper routines, for _VOL_plugin_ authors only! * + * VOL callback wrappers and helper routines, for _VOL_connector_ authors only! * * (Not part of the public API for _application_ developers) * *****************************************************************************/ -/* Helper routines for VOL plugin authors */ -H5_DLL herr_t H5VLcmp_plugin_cls(int *cmp, hid_t plugin_id1, hid_t plugin_id2); +/* Helper routines for VOL connector authors */ +H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2); /* Public wrappers for generic callbacks */ -H5_DLL herr_t H5VLinitialize(hid_t plugin_id, hid_t vipl_id); -H5_DLL herr_t H5VLterminate(hid_t plugin_id); -H5_DLL herr_t H5VLget_cap_flags(hid_t plugin_id, unsigned *cap_flags); -H5_DLL herr_t H5VLcopy_plugin_info(hid_t plugin_id, void **dst_vol_info, void *src_vol_info); -H5_DLL herr_t H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, +H5_DLL herr_t H5VLinitialize(hid_t connector_id, hid_t vipl_id); +H5_DLL herr_t H5VLterminate(hid_t connector_id); +H5_DLL herr_t H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags); +H5_DLL herr_t H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info); +H5_DLL herr_t H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, const void *info2); -H5_DLL herr_t H5VLfree_plugin_info(hid_t plugin_id, void *vol_info); -H5_DLL void *H5VLget_object(void *obj, hid_t plugin_id); -H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t plugin_id, void **wrap_ctx); -H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t plugin_id); -H5_DLL void *H5VLwrap_object(void *obj, hid_t plugin_id, void *wrap_ctx); +H5_DLL herr_t H5VLfree_connector_info(hid_t connector_id, void *vol_info); +H5_DLL void *H5VLget_object(void *obj, hid_t connector_id); +H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx); +H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id); +H5_DLL void *H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx); /* Public wrappers for attribute callbacks */ -H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_read(void *attr, hid_t plugin_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_write(void *attr, hid_t plugin_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for dataset callbacks */ -H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdataset_read(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); -H5_DLL herr_t H5VLdataset_write(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -H5_DLL herr_t H5VLdataset_get(void *dset, hid_t plugin_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_close(void *dset, hid_t plugin_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VLdataset_write(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for file callbacks */ H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_specific(void *obj, hid_t plugin_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for group callbacks */ -H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for link callbacks */ -H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); /* Public wrappers for object callbacks */ -H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, - hid_t plugin_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); + hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); /* Public wrappers for named datatype callbacks */ -H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t plugin_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for asynchronous request callbacks */ -H5_DLL herr_t H5VLrequest_wait(void *req, hid_t plugin_id, uint64_t timeout, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t plugin_id); -H5_DLL herr_t H5VLrequest_specific(void *req, hid_t plugin_id, H5VL_request_specific_t specific_type, va_list arguments); -H5_DLL herr_t H5VLrequest_optional(void *req, hid_t plugin_id, va_list arguments); -H5_DLL herr_t H5VLrequest_free(void *req, hid_t plugin_id); +H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t connector_id); +H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments); +H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments); +H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id); #ifdef __cplusplus } diff --git a/test/tmisc.c b/test/tmisc.c index 02521e4..fef94dd 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -3481,15 +3481,15 @@ test_misc19(void) HDfree(vfd_cls); -/* Check H5I operations on virtual object plugins */ +/* Check H5I operations on virtual object connectors */ /* Get a VOL class to register */ vol_cls = h5_get_dummy_vol_class(); CHECK(vol_cls, NULL, "h5_get_dummy_vol_class"); - /* Register a VOL plugin */ - volid = H5VLregister_plugin(vol_cls, H5P_DEFAULT); - CHECK(volid, FAIL, "H5VLregister_plugin"); + /* Register a VOL connector */ + volid = H5VLregister_connector(vol_cls, H5P_DEFAULT); + CHECK(volid, FAIL, "H5VLregister_connector"); /* Check the reference count */ rc = H5Iget_ref(volid); @@ -3499,23 +3499,23 @@ test_misc19(void) rc = H5Iinc_ref(volid); VERIFY(rc, 2, "H5Iinc_ref"); - /* Unregister the VOL plugin normally */ - ret = H5VLunregister_plugin(volid); - CHECK(ret, FAIL, "H5VLunregister_plugin"); + /* Unregister the VOL connector normally */ + ret = H5VLunregister_connector(volid); + CHECK(ret, FAIL, "H5VLunregister_connector"); /* Check the reference count */ rc = H5Iget_ref(volid); VERIFY(rc, 1, "H5Iget_ref"); - /* Unregister the VOL plugin by decrementing the reference count */ + /* Unregister the VOL connector by decrementing the reference count */ rc = H5Idec_ref(volid); VERIFY(rc, 0, "H5Idec_ref"); - /* Try unregistering the VOL plugin again (should fail) */ + /* Try unregistering the VOL connector again (should fail) */ H5E_BEGIN_TRY { - ret = H5VLunregister_plugin(volid); + ret = H5VLunregister_connector(volid); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5VLunregister_plugin"); + VERIFY(ret, FAIL, "H5VLunregister_connector"); HDfree(vol_cls); diff --git a/test/vol.c b/test/vol.c index fc47087..d9157cf 100644 --- a/test/vol.c +++ b/test/vol.c @@ -113,10 +113,12 @@ static const H5VL_class_t fake_vol_g = { NULL, /* specific */ NULL /* optional */ }, - { /* async_cls */ + { /* request_cls */ + NULL, /* wait */ NULL, /* cancel */ - NULL, /* test */ - NULL /* wait */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ }, NULL /* optional */ }; @@ -126,7 +128,7 @@ static const H5VL_class_t fake_vol_g = { * Function: test_vol_registration() * * Purpose: Tests if we can load, register, and close a simple - * VOL plugin. + * VOL connector. * * Return: SUCCEED/FAIL * @@ -140,44 +142,44 @@ test_vol_registration(void) TESTING("VOL registration"); - /* The test/fake VOL plugin should not be registered at the start of the test */ - if ((is_registered = H5VLis_plugin_registered(FAKE_VOL_NAME)) < 0) + /* The test/fake VOL connector should not be registered at the start of the test */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (is_registered > 0) - FAIL_PUTS_ERROR("native VOL plugin is inappropriately registered"); + FAIL_PUTS_ERROR("native VOL connector is inappropriately registered"); /* Load a VOL interface */ - if ((vol_id = H5VLregister_plugin(&fake_vol_g, H5P_DEFAULT)) < 0) + if ((vol_id = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; - /* The test/fake VOL plugin should be registered now */ - if ((is_registered = H5VLis_plugin_registered(FAKE_VOL_NAME)) < 0) + /* The test/fake VOL connector should be registered now */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) - FAIL_PUTS_ERROR("native VOL plugin is un-registered"); + FAIL_PUTS_ERROR("native VOL connector is un-registered"); - /* Re-register a VOL plugin */ - if ((vol_id2 = H5VLregister_plugin(&fake_vol_g, H5P_DEFAULT)) < 0) + /* Re-register a VOL connector */ + if ((vol_id2 = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; - /* The test/fake VOL plugin should still be registered now */ - if ((is_registered = H5VLis_plugin_registered(FAKE_VOL_NAME)) < 0) + /* The test/fake VOL connector should still be registered now */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) - FAIL_PUTS_ERROR("native VOL plugin is un-registered"); + FAIL_PUTS_ERROR("native VOL connector is un-registered"); /* Unregister the second test/fake VOL ID */ - if (H5VLunregister_plugin(vol_id2) < 0) + if (H5VLunregister_connector(vol_id2) < 0) FAIL_STACK_ERROR; - /* The test/fake VOL plugin should still be registered now */ - if ((is_registered = H5VLis_plugin_registered(FAKE_VOL_NAME)) < 0) + /* The test/fake VOL connector should still be registered now */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) - FAIL_PUTS_ERROR("native VOL plugin is un-registered"); + FAIL_PUTS_ERROR("native VOL connector is un-registered"); /* Unregister the original test/fake VOL ID */ - if (H5VLunregister_plugin(vol_id) < 0) + if (H5VLunregister_connector(vol_id) < 0) FAIL_STACK_ERROR; PASSED(); @@ -185,7 +187,7 @@ test_vol_registration(void) error: H5E_BEGIN_TRY { - H5VLunregister_plugin(vol_id); + H5VLunregister_connector(vol_id); } H5E_END_TRY; return FAIL; @@ -195,7 +197,7 @@ error: /*------------------------------------------------------------------------- * Function: test_native_vol_init() * - * Purpose: Tests if the native VOL plugin gets initialized. + * Purpose: Tests if the native VOL connector gets initialized. * * Return: SUCCEED/FAIL * @@ -206,13 +208,13 @@ test_native_vol_init(void) { htri_t is_registered; - TESTING("Native VOL plugin initialization"); + TESTING("Native VOL connector initialization"); - /* The native VOL plugin should always be registered */ - if ((is_registered = H5VLis_plugin_registered(H5VL_NATIVE_NAME)) < 0) + /* The native VOL connector should always be registered */ + if ((is_registered = H5VLis_connector_registered(H5VL_NATIVE_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) - FAIL_PUTS_ERROR("native VOL plugin is un-registered"); + FAIL_PUTS_ERROR("native VOL connector is un-registered"); PASSED(); return SUCCEED; @@ -226,7 +228,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_file_operation() * - * Purpose: Uses the native VOL plugin to test basic VOL file operations + * Purpose: Uses the native VOL connector to test basic VOL file operations * * Return: SUCCEED/FAIL * @@ -347,7 +349,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_group_operation() * - * Purpose: Uses the native VOL plugin to test basic VOL group operations + * Purpose: Uses the native VOL connector to test basic VOL group operations * * Return: SUCCEED/FAIL * @@ -438,7 +440,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_dataset_operation() * - * Purpose: Uses the native VOL plugin to test basic VOL dataset operations + * Purpose: Uses the native VOL connector to test basic VOL dataset operations * * Return: SUCCEED/FAIL * @@ -607,7 +609,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_attribute_operation() * - * Purpose: Uses the native VOL plugin to test basic VOL attribute operations + * Purpose: Uses the native VOL connector to test basic VOL attribute operations * * Return: SUCCEED/FAIL * @@ -705,7 +707,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_object_operation() * - * Purpose: Uses the native VOL plugin to test basic VOL object operations + * Purpose: Uses the native VOL connector to test basic VOL object operations * * Return: SUCCEED/FAIL * @@ -769,7 +771,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_link_operation() * - * Purpose: Uses the native VOL plugin to test basic VOL link operations + * Purpose: Uses the native VOL connector to test basic VOL link operations * * Return: SUCCEED/FAIL * @@ -834,7 +836,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_datatype_operation() * - * Purpose: Uses the native VOL plugin to test basic VOL datatype operations + * Purpose: Uses the native VOL connector to test basic VOL datatype operations * * Return: SUCCEED/FAIL * @@ -916,7 +918,7 @@ error: /*------------------------------------------------------------------------- * Function: test_echo_vol_operation() * - * Purpose: Uses the echo VOL plugin to test basic VOL operations + * Purpose: Uses the echo VOL connector to test basic VOL operations * via the H5VL public API. * * Return: SUCCEED/FAIL -- cgit v0.12 From afd54bbe5ce6568e0e010bbce145dfe9a60de2bf Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 4 Nov 2018 02:09:27 -0600 Subject: Remove most debugging shims & scaffolding. --- src/H5Aint.c | 16 ----- src/H5Dint.c | 8 --- src/H5Dvirtual.c | 8 --- src/H5Fint.c | 176 +++++++++++++++++++++++++++++++++++++----------------- src/H5Fpkg.h | 16 ++--- src/H5G.c | 10 ---- src/H5Gint.c | 16 ----- src/H5Gtraverse.c | 8 --- src/H5L.c | 106 -------------------------------- src/H5Lexternal.c | 8 --- src/H5Ocopy.c | 10 ---- src/H5Oint.c | 8 --- src/H5VLnative.c | 110 ++++------------------------------ 13 files changed, 141 insertions(+), 359 deletions(-) diff --git a/src/H5Aint.c b/src/H5Aint.c index 8d90cf9..f8efd26 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -923,14 +923,6 @@ H5A__get_type(H5A_t *attr) * two level IDs, where the VOL object is a copy of the * returned datatype */ -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") } @@ -2655,14 +2647,6 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5 HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object"); /* Get an ID for the object */ -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} if((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype"); diff --git a/src/H5Dint.c b/src/H5Dint.c index 67889e6..d5ac251 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -3398,14 +3398,6 @@ H5D__get_type(const H5D_t *dset) * two-level IDs, where the VOL object is a copy of the * returned datatype. */ -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} if((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") } /* end if */ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 3dc44c5..feb836d 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2972,14 +2972,6 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) HDassert(dset && *dset); /* Get a temporary identifier for this source dataset */ -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} if((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID") diff --git a/src/H5Fint.c b/src/H5Fint.c index 6e8f073..c085e83 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2176,14 +2176,6 @@ H5F_get_id(H5F_t *file) if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) { /* resurrect the ID - Register an ID with the native connector */ -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} if((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") file->id_exists = TRUE; @@ -3244,7 +3236,6 @@ H5F__start_swmr_write(H5F_t *f) size_t u; /* Local index variable */ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ H5VL_t *vol_connector = NULL; /* VOL connector for the file */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -3316,11 +3307,6 @@ H5F__start_swmr_write(H5F_t *f) if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0]))) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Get the (top) connector for the ID */ vol_connector = vol_obj->connector; } /* end if */ @@ -3396,10 +3382,6 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to unlock the file") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") - if(ret_value < 0 && setup) { /* Re-enable accumulator */ @@ -3504,10 +3486,79 @@ done: } /* H5F__format_convert() */ +/*--------------------------------------------------------------------------- + * Function: H5F__get_file + * + * Purpose: Utility routine to get file struct for an object + * + * Returns: SUCCESS: A pointer to the H5F_t struct for the file + * associated with the object. + * FAILURE: NULL + * + *--------------------------------------------------------------------------- + */ +H5F_t * +H5F__get_file(void *obj, H5I_type_t type) +{ + H5F_t *ret_value = NULL; /* File pointer */ + H5O_loc_t *oloc = NULL; /* Object location for ID */ + + FUNC_ENTER_PACKAGE + + switch(type) { + case H5I_FILE: + ret_value = (H5F_t *)obj; + break; + + case H5I_GROUP: + oloc = H5G_oloc((H5G_t *)obj); + break; + + case H5I_DATATYPE: + oloc = H5T_oloc((H5T_t *)obj); + break; + + case H5I_DATASET: + oloc = H5D_oloc((H5D_t *)obj); + break; + + case H5I_ATTR: + oloc = H5A_oloc((H5A_t *)obj); + break; + + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + } /* end switch */ + + /* Set return value for objects (not files) */ + if(oloc) + ret_value = oloc->file; + + /* Couldn't find a file struct */ + if(!ret_value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F__get_file */ + + /*------------------------------------------------------------------------- - * Function: H5F_get_file_id + * Function: H5F__get_file_id * - * Purpose: The private version of H5Iget_file_id(), obtains the file + * Purpose: The package version of H5Iget_file_id(), obtains the file * ID given an object ID. * * Return: Success: The file ID associated with the object @@ -3516,58 +3567,71 @@ done: *------------------------------------------------------------------------- */ hid_t -H5F_get_file_id(hid_t obj_id, H5I_type_t type) +H5F__get_file_id(H5F_t *file) { - H5VL_object_t *vol_obj; - void *file = NULL; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_NOAPI(H5I_INVALID_HID) - - /* Get the object pointer */ - if(NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") + hid_t file_id = H5I_INVALID_HID; /* File ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - /* Get the file through the VOL */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE, type, &file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file") - if(NULL == file) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file through the VOL") + FUNC_ENTER_PACKAGE /* Check if the file's ID already exists */ - if(H5I_find_id(file, H5I_FILE, &ret_value) < 0) + if(H5I_find_id(file, H5I_FILE, &file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") /* If the ID does not exist, register it with the VOL connector */ - if(H5I_INVALID_HID == ret_value) { - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} - if ((ret_value = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0) + if(H5I_INVALID_HID == file_id) { + if((file_id = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + file->id_exists = TRUE; } /* end if */ else { /* Increment ref count on existing ID */ - if(H5I_inc_ref(ret_value, TRUE) < 0) + if(H5I_inc_ref(file_id, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") } /* end else */ + /* Set return value */ + ret_value = file_id; + done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__get_file_id() */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_file_id + * + * Purpose: The private version of H5Iget_file_id(), obtains the file + * ID given an object ID. + * + * Return: Success: The file ID associated with the object + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5F_get_file_id(hid_t obj_id, H5I_type_t type) +{ + H5VL_object_t *vol_obj; /* File info */ + hid_t file_id = H5I_INVALID_HID; /* File ID for object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Get the object pointer */ + 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 */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_ID, type, &file_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID") + if(H5I_INVALID_HID == file_id) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL") + + /* Set return value */ + ret_value = file_id; + +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_file_id() */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index ea5d5e8..990a6b9 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -383,14 +383,14 @@ typedef enum H5VL_file_optional_t { H5VL_FILE_CLEAR_ELINK_CACHE, /* Clear external link cache */ H5VL_FILE_GET_FILE_IMAGE, /* file image */ H5VL_FILE_GET_FREE_SECTIONS, /* file free selections */ - H5VL_FILE_GET_FREE_SPACE, /* file freespace */ - H5VL_FILE_GET_INFO, /* file info */ + H5VL_FILE_GET_FREE_SPACE, /* file freespace */ + H5VL_FILE_GET_INFO, /* file info */ H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */ - H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */ - H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */ - H5VL_FILE_GET_SIZE, /* file size */ - H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */ - H5VL_FILE_GET_FILE, /* retrieve or resurrect file of object */ + H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */ + H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */ + H5VL_FILE_GET_SIZE, /* file size */ + H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */ + H5VL_FILE_GET_FILE_ID, /* retrieve or resurrect file ID of object */ H5VL_FILE_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */ H5VL_FILE_SET_MDC_CONFIG, /* set metadata cache configuration */ H5VL_FILE_GET_METADATA_READ_RETRY_INFO, @@ -448,6 +448,8 @@ H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); +H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type); +H5_DLL hid_t H5F__get_file_id(H5F_t *file); /* File mount related routines */ H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id); diff --git a/src/H5G.c b/src/H5G.c index 4625765..0beee14 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -797,7 +797,6 @@ herr_t H5Grefresh(hid_t group_id) { H5VL_object_t *vol_obj; /* Group for this operation */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -811,20 +810,11 @@ H5Grefresh(hid_t group_id) if(H5CX_set_loc(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Refresh group's metadata */ if(H5VL_group_specific(vol_obj, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* H5Grefresh */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 8f9e908..049c696 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -807,14 +807,6 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, */ if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -1076,14 +1068,6 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} /* Register an ID for the starting group */ if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index eb8c778..2d8de99 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -198,14 +198,6 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, /* Create a group ID to pass to the user-defined callback */ if(NULL == (grp = H5G_open(&grp_loc_copy))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} if((cur_grp = H5VL_wrap_register(H5I_GROUP, grp, FALSE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") diff --git a/src/H5L.c b/src/H5L.c index 830caae..6a86a34 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -710,7 +710,6 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -734,20 +733,11 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Unlink */ if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Ldelete() */ @@ -840,7 +830,6 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -863,20 +852,11 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Get the link value */ if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Lget_val() */ @@ -962,7 +942,6 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -988,20 +967,11 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Check for the existence of the link */ if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Lexists() */ @@ -1026,7 +996,6 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1049,20 +1018,11 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Get the link information */ if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Lget_info() */ @@ -1088,7 +1048,6 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1119,20 +1078,11 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Get the link information */ if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Lget_info_by_idx() */ @@ -1358,7 +1308,6 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1383,20 +1332,11 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(group_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Iterate over the links */ if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Literate() */ @@ -1430,7 +1370,6 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1463,20 +1402,11 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, loc_params.loc_data.loc_by_name.name = group_name; loc_params.loc_data.loc_by_name.lapl_id = lapl_id; - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Iterate over the links */ if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Literate_by_name() */ @@ -1516,7 +1446,6 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1541,20 +1470,11 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Iterate over the links */ if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Lvisit() */ @@ -1593,7 +1513,6 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1626,20 +1545,11 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.name = group_name; loc_params.loc_data.loc_by_name.lapl_id = lapl_id; - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Visit the links */ if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Lvisit_by_name() */ @@ -2014,14 +1924,6 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group") @@ -2807,14 +2709,6 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID") diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 3cacdf5..ad0344e 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -242,14 +242,6 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, if(NULL == (ext_obj = H5O_open_name(&root_loc, obj_name, &opened_type))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} /* Get an ID for the external link's object */ if((ext_obj_id = H5VL_wrap_register(opened_type, ext_obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object") diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index cc1680d..213a697 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -204,7 +204,6 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5VL_loc_params_t loc_params1; H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */ H5VL_loc_params_t loc_params2; - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -247,20 +246,11 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.type = H5VL_OBJECT_BY_SELF; loc_params2.obj_type = H5I_get_type(dst_loc_id); - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj1->data, vol_obj1->connector) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Copy the object */ if(H5VL_object_copy(vol_obj1, loc_params1, src_name, vol_obj2, loc_params2, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Ocopy() */ diff --git a/src/H5Oint.c b/src/H5Oint.c index 2b40d64..3a60d9d 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -2658,14 +2658,6 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Get an ID for the visited object */ -{ -void *vol_wrap_ctx = NULL; /* Object wrapping context */ - -/* Retrieve the VOL object wrap context */ -if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") -HDassert(vol_wrap_ctx); -} if((obj_id = H5VL_wrap_register(opened_type, obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register visited object") diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 12dbcdb..7b15828 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -50,7 +50,6 @@ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; /* Prototypes */ -static H5F_t *H5VL__native_get_file(void *obj, H5I_type_t type); static herr_t H5VL__native_term(void); /* Atrribute callbacks */ @@ -284,92 +283,6 @@ done: } /* end H5Pset_fapl_native() */ -/*--------------------------------------------------------------------------- - * Function: H5VL__native_get_file - * - * Purpose: Utility routine to get file struct for an object via the - * native VOL connector. - * - * Returns: SUCCESS: A pointer to the H5F_t struct for the file - * associated with the object. - * FAILURE: NULL - * - *--------------------------------------------------------------------------- - */ -static H5F_t * -H5VL__native_get_file(void *obj, H5I_type_t type) -{ - H5F_t *ret_value = NULL; /* File pointer */ - H5O_loc_t *oloc = NULL; /* Object location for ID */ - - FUNC_ENTER_STATIC - - switch(type) { - case H5I_FILE: - ret_value = (H5F_t *)obj; - break; - - case H5I_GROUP: - { - H5G_t *grp; - grp = (H5G_t *)obj; - oloc = H5G_oloc(grp); - break; - } - - case H5I_DATATYPE: - { - H5T_t *dt; - dt = (H5T_t *)obj; - oloc = H5T_oloc(dt); - break; - } - - case H5I_DATASET: - { - H5D_t *dset; - dset = (H5D_t *)obj; - oloc = H5D_oloc(dset); - break; - } - - case H5I_ATTR: - { - H5A_t *attr; - attr = (H5A_t *)obj; - oloc = H5A_oloc(attr); - break; - } - - case H5I_UNINIT: - case H5I_BADID: - case H5I_DATASPACE: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_VOL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") - } - - if(!ret_value) { - if (!oloc) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not assocated with a file") - ret_value = oloc->file; - } - if(!ret_value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5VL__native_get_file */ - - /*------------------------------------------------------------------------- * Function: H5VL__native_attr_create * @@ -1484,8 +1397,8 @@ H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t /* Create the file */ if(NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file") - new_file->id_exists = TRUE; + ret_value = (void *)new_file; done: @@ -1520,8 +1433,8 @@ H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, /* Open the file */ if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - new_file->id_exists = TRUE; + ret_value = (void *)new_file; done: @@ -1659,7 +1572,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, ssize_t *ret = va_arg(arguments, ssize_t *); size_t len; - if(NULL == (f = H5VL__native_get_file(obj, type))) + if(NULL == (f = H5F__get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") len = HDstrlen(H5F_OPEN_NAME(f)); @@ -1710,7 +1623,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, H5F_t *f = NULL; /* File to flush */ /* Get the file for the object */ - if(NULL == (f = H5VL__native_get_file(obj, type))) + if(NULL == (f = H5F__get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Nothing to do if the file is read only. This determination is @@ -1745,6 +1658,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, if(NULL == (new_file = H5F__reopen((H5F_t *)obj))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") new_file->id_exists = TRUE; + *ret = (void *)new_file; break; } @@ -1894,7 +1808,7 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR /* Get the file struct. This call is careful to not return the file pointer * for the top file in a mount hierarchy. */ - if(NULL == (f = H5VL__native_get_file(obj, type))) + if(NULL == (f = H5F__get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct") /* Get the file info */ @@ -1958,15 +1872,15 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR } /* H5Iget_file_id */ - case H5VL_FILE_GET_FILE: + case H5VL_FILE_GET_FILE_ID: { H5I_type_t type = va_arg(arguments, H5I_type_t); - void **ret = va_arg(arguments, void **); + hid_t *file_id = va_arg(arguments, hid_t *); - if(NULL == (f = H5VL__native_get_file(obj, type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - f->id_exists = TRUE; - *ret = (void*)f; + if(NULL == (f = H5F__get_file(obj, type))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object") + if((*file_id = H5F__get_file_id(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID") break; } -- cgit v0.12 From db48399bd89488eff2d9c8811339a4cd9c006dfa Mon Sep 17 00:00:00 2001 From: hdftest Date: Mon, 5 Nov 2018 12:21:13 -0600 Subject: Snapshot version 1.11 release 3. --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/cmake/scripts/HDF5config.cmake | 2 +- configure.ac | 2 +- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.txt b/README.txt index 2d03cc7..03e8dd7 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.3 currently under development +HDF5 version 1.11.4 currently under development ------------------------------------------------------------------------------ Please refer to the release_docs/INSTALL file for installation instructions. diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index c771e8b..697fb77 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.11.3" +PROJECT_NUMBER = "1.11.4" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 69760e1..dd3b17c 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -34,7 +34,7 @@ cmake_minimum_required (VERSION 3.10) # CTEST_SOURCE_NAME - source folder ############################################################################## -set (CTEST_SOURCE_VERSION "1.11.3") +set (CTEST_SOURCE_VERSION "1.11.4") set (CTEST_SOURCE_VERSEXT "") ############################################################################## diff --git a/configure.ac b/configure.ac index c06359d..0a1370f 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.11.3], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.11.4], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 73bb149..eed04d2 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.11.3 currently under development +HDF5 version 1.11.4 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index c247e57..353ff16 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -93,10 +93,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 11 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 3 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 4 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.11.3" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.11.4" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) -- cgit v0.12 From be0d6b206aaa04f7d9cb406a71aeeb458ba67975 Mon Sep 17 00:00:00 2001 From: hdftest Date: Mon, 5 Nov 2018 12:40:04 -0600 Subject: Update HDF5-Examples version to be included in CMake-* tar/zip files. --- bin/release | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/release b/bin/release index afdbb51..e43be17 100755 --- a/bin/release +++ b/bin/release @@ -225,7 +225,7 @@ tar2cmakezip() # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmziptmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmziptmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.8-Source.tar.gz $cmziptmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.10-Source.tar.gz $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmziptmpsubdir cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmziptmpsubdir @@ -320,7 +320,7 @@ tar2cmaketgz() # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmgztmpsubdir cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir - cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.8-Source.tar.gz $cmgztmpsubdir + cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.10-Source.tar.gz $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmgztmpsubdir -- cgit v0.12 From a6a46fb27f333530440071b4d2f2edc45f80d90b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 6 Nov 2018 09:32:34 -0600 Subject: Add custom target to force wait on generated file --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a1bab5c..5ba56e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1034,6 +1034,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) +add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${gen_SRCS}) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" @@ -1056,12 +1057,14 @@ target_link_libraries (${HDF5_LIB_TARGET} set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) +add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET}) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) + add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${shared_gen_SRCS}) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" @@ -1086,6 +1089,7 @@ if (BUILD_SHARED_LIBS) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES FOLDER libraries) + add_dependencies (${HDF5_LIBSH_TARGET} gen_${HDF5_LIBSH_TARGET}) set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET}) endif () -- cgit v0.12 From 1bd3a2885865f4745209233ea84045a22e6dce9c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 6 Nov 2018 09:34:50 -0600 Subject: TRILAB-36 add custom target on generated files --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a1bab5c..5ba56e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1034,6 +1034,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) +add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${gen_SRCS}) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" @@ -1056,12 +1057,14 @@ target_link_libraries (${HDF5_LIB_TARGET} set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) +add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET}) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) + add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${shared_gen_SRCS}) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" @@ -1086,6 +1089,7 @@ if (BUILD_SHARED_LIBS) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES FOLDER libraries) + add_dependencies (${HDF5_LIBSH_TARGET} gen_${HDF5_LIBSH_TARGET}) set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET}) endif () -- cgit v0.12 From 81cb24ac1db0f4936b19067cdb7fa4e14e0d00db Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 6 Nov 2018 10:56:36 -0600 Subject: Commit version changes for additional files for 1.11.3 snapshot release. --- java/src/hdf/hdf5lib/H5.java | 4 ++-- java/test/TestH5.java | 4 ++-- .../testfiles/h5repack_layout.h5-plugin_version_test.ddl | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index be7cae4..f9f9b65 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * exception handlers to print out the HDF-5 error stack. *
* - * @version HDF5 1.11.3
+ * @version HDF5 1.11.4
* See also: hdf.hdf5lib.HDFArray
* hdf.hdf5lib.HDF5Constants
* hdf.hdf5lib.HDF5CDataTypes
@@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 11, 3 }; + public final static int LIB_VERSION[] = { 1, 11, 4 }; public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 738c9f1..54603ca 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -162,7 +162,7 @@ public class TestH5 { */ @Test public void testH5get_libversion() { - int libversion[] = { 1, 11, 3 }; + int libversion[] = { 1, 11, 4 }; try { H5.H5get_libversion(libversion); @@ -184,7 +184,7 @@ public class TestH5 { */ @Test public void testH5check_version() { - int majnum = 1, minnum = 11, relnum = 3; + int majnum = 1, minnum = 11, relnum = 4; try { H5.H5check_version(majnum, minnum, relnum); diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index 8f48c37..1d2914b 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 11 3 } + PARAMS { 9 1 11 4 } } } FILLVALUE { -- cgit v0.12 From b9b89705c3c504aa7ababb265f8ec64ed8fd4a35 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 6 Nov 2018 15:10:55 -0600 Subject: Correct extlib depends --- config/cmake_ext_mod/HDFLibMacros.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index 8a37af3..2eda66c 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -75,14 +75,14 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) # Create imported target jpeg-static add_library(jpeg-static STATIC IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (jpeg-static "jpeg" STATIC "") - add_dependencies (JPEG jpeg-static) + add_dependencies (jpeg-static JPEG) set (JPEG_STATIC_LIBRARY "jpeg-static") set (JPEG_LIBRARIES ${JPEG_STATIC_LIBRARY}) if (BUILD_SHARED_LIBS) # Create imported target jpeg-shared add_library(jpeg-shared SHARED IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (jpeg-shared "jpeg" SHARED "") - add_dependencies (JPEG jpeg-shared) + add_dependencies (jpeg-shared JPEG) set (JPEG_SHARED_LIBRARY "jpeg-shared") set (JPEG_LIBRARIES ${JPEG_LIBRARIES} ${JPEG_SHARED_LIBRARY}) endif () @@ -171,14 +171,14 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) # Create imported target szip-static add_library(szip-static STATIC IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (szip-static "szip" STATIC "") - add_dependencies (SZIP szip-static) + add_dependencies (szip-static SZIP) set (SZIP_STATIC_LIBRARY "szip-static") set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY}) if (BUILD_SHARED_LIBS) # Create imported target szip-shared add_library(szip-shared SHARED IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (szip-shared "szip" SHARED "") - add_dependencies (SZIP szip-shared) + add_dependencies (szip-shared SZIP) set (SZIP_SHARED_LIBRARY "szip-shared") set (SZIP_LIBRARIES ${SZIP_LIBRARIES} ${SZIP_SHARED_LIBRARY}) endif () @@ -269,14 +269,14 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) # Create imported target zlib-static add_library(zlib-static STATIC IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (zlib-static ${ZLIB_LIB_NAME} STATIC "") - add_dependencies (ZLIB zlib-static) + add_dependencies (zlib-static ZLIB) set (ZLIB_STATIC_LIBRARY "zlib-static") set (ZLIB_LIBRARIES ${ZLIB_STATIC_LIBRARY}) if (BUILD_SHARED_LIBS) # Create imported target zlib-shared add_library(zlib-shared SHARED IMPORTED) HDF_IMPORT_SET_LIB_OPTIONS (zlib-shared ${ZLIB_LIB_NAME} SHARED "") - add_dependencies (ZLIB zlib-shared) + add_dependencies (zlib-shared ZLIB) set (ZLIB_SHARED_LIBRARY "zlib-shared") set (ZLIB_LIBRARIES ${ZLIB_LIBRARIES} ${ZLIB_SHARED_LIBRARY}) endif () -- cgit v0.12 From c77d044dd0af2dfcbf6369cf6975f36f0a28cd76 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 6 Nov 2018 15:30:15 -0600 Subject: Correct platforms --- release_docs/RELEASE.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index eed04d2..dcc9892 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -639,10 +639,9 @@ Supported Platforms Windows 7 Visual Studio 2015 w/ Intel Fortran 16 (cmake) - Windows 7 x64 Visual Studio 2012 w/ Intel Fortran 15 (cmake) - Visual Studio 2013 w/ Intel Fortran 15 (cmake) + Windows 7 x64 Visual Studio 2013 Visual Studio 2015 w/ Intel Fortran 16 (cmake) - Visual Studio 2015 w/ Intel C, Fortran 2017 (cmake) + Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake) Visual Studio 2015 w/ MSMPI 8 (cmake) Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake) -- cgit v0.12 From 79903575e64e1e8f46ce27e6212d5d5939a8a900 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 6 Nov 2018 15:45:58 -0600 Subject: HDFFV-10605 Only test plugins if SHARED enabled --- test/CMakeLists.txt | 2 + test/CMakeTests.cmake | 36 +++++++++-------- tools/test/h5dump/CMakeLists.txt | 48 ++++++++++++----------- tools/test/h5dump/CMakeTests.cmake | 4 +- tools/test/h5ls/CMakeLists.txt | 44 +++++++++++---------- tools/test/h5ls/CMakeTests.cmake | 4 +- tools/test/h5repack/CMakeLists.txt | 76 ++++++++++++++++++------------------ tools/test/h5repack/CMakeTests.cmake | 2 + 8 files changed, 116 insertions(+), 100 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 959bac8..ed6bacc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -62,6 +62,7 @@ endif () ################################################################################# # If filter plugin tests can be tested ################################################################################# +if (BUILD_SHARED_LIBS) # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir1") file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir2") @@ -159,6 +160,7 @@ endif () "${CMAKE_BINARY_DIR}/vol/$" ) endforeach () +endif () ################################################################################# # Test program sources diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index bc759ce..3ad9de7 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -1030,29 +1030,31 @@ endif () ############################################################################## ### F I L T E R P L U G I N T E S T S ############################################################################## -if (WIN32) - set (CMAKE_SEP "\;") - set (BIN_REL_PATH "../../") -else () - set (CMAKE_SEP ":") - set (BIN_REL_PATH "../") -endif () +if (BUILD_SHARED_LIBS) + if (WIN32) + set (CMAKE_SEP "\;") + set (BIN_REL_PATH "../../") + else () + set (CMAKE_SEP ":") + set (BIN_REL_PATH "../") + endif () -add_test (NAME H5PLUGIN-filter_plugin COMMAND $) -set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES - ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} -) + add_test (NAME H5PLUGIN-filter_plugin COMMAND $) + set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES + ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} + ) ############################################################################## # HDFFV-9655 relative plugin test disabled # -#add_test (NAME H5PLUGIN-pluginRelative COMMAND $) -#set_tests_properties (H5PLUGIN-pluginRelative PROPERTIES -# ENVIRONMENT "HDF5_PLUGIN_PATH=@/${BIN_REL_PATH}testdir1${CMAKE_SEP}@/${BIN_REL_PATH}testdir2;srcdir=${HDF5_TEST_BINARY_DIR}" -# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} -#) +# add_test (NAME H5PLUGIN-pluginRelative COMMAND $) +# set_tests_properties (H5PLUGIN-pluginRelative PROPERTIES +# ENVIRONMENT "HDF5_PLUGIN_PATH=@/${BIN_REL_PATH}testdir1${CMAKE_SEP}@/${BIN_REL_PATH}testdir2;srcdir=${HDF5_TEST_BINARY_DIR}" +# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} +# ) ############################################################################## +endif () if (TEST_SHELL_SCRIPTS) include (ShellTests.cmake) diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 4c409e8..51938ae 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -4,29 +4,31 @@ project (HDF5_TOOLS_TEST_H5DUMP C) #----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- -set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") -set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") -set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) - -add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) -target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") - -# make plugins dir -file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") -#----------------------------------------------------------------------------- -# Copy plugin library to a plugins folder -#----------------------------------------------------------------------------- -add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" -) +if (BUILD_SHARED_LIBS) + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) +endif () # -------------------------------------------------------------------- # Add the h5dump test executable diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index eedb432..b02dc35 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -1549,4 +1549,6 @@ ############################################################################## ### P L U G I N T E S T S ############################################################################## -ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5) +if (BUILD_SHARED_LIBS) + ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5) +endif () diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index 5b8cbe0..dc5804c 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -4,29 +4,31 @@ project (HDF5_TOOLS_TEST_H5LS C) #----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- -set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls") -set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") -set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) +if (BUILD_SHARED_LIBS) + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) -add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) -target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") -# make plugins dir -file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") -#----------------------------------------------------------------------------- -# Copy plugin library to a plugins folder -#----------------------------------------------------------------------------- -add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" -) + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) +endif () include (CMakeTests.cmake) diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index d03a344..488b271 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -470,4 +470,6 @@ ############################################################################## ### P L U G I N T E S T S ############################################################################## -ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -d tudfilter.h5) +if (BUILD_SHARED_LIBS) + ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -d tudfilter.h5) +endif () diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 2a168e9..890d5d2 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -32,45 +32,47 @@ set_target_properties (h5repacktest PROPERTIES FOLDER tools) #----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- -set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") -set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") -set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) -set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") -set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}") -set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) +if (BUILD_SHARED_LIBS) + set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") + set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") + set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}") + set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) -add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) -target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") -add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) -target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED) -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") + add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") -# make plugins dir -file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") -#----------------------------------------------------------------------------- -# Copy plugin library to a plugins folder -#----------------------------------------------------------------------------- -add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" -) -add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" -) + # make plugins dir + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") + #----------------------------------------------------------------------------- + # Copy plugin library to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) + add_custom_command ( + TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$" + "${CMAKE_BINARY_DIR}/plugins/$" + ) +endif () include (CMakeTests.cmake) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index a063e19..3ee5e27 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -1450,11 +1450,13 @@ ADD_H5_VERIFY_INVALIDBOUNDS (latest_latest_invalid bounds_latest_latest.h5 0 1) ############################################################################## ### P L U G I N T E S T S ############################################################################## +if (BUILD_SHARED_LIBS) ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,0,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE}) ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,0,1,9) ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE) # check for no parameters ADD_H5_UD_TEST (plugin_zero 0 h5repack_layout.h5 -v -f UD=250,0,0) +endif () if (HDF5_TEST_VFD) # Run test with different Virtual File Driver -- cgit v0.12 From 3a13bb72e8d33808eb3bfd68c2a6b4ae5153f3a0 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Thu, 8 Nov 2018 15:41:49 -0600 Subject: HDFFV-10601: I changed to a better way to calculate the number of chunks in a dataset. --- src/H5Dchunk.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 7eeb866..cb6b925 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -950,11 +950,9 @@ H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) if(dset->shared->layout.u.chunk.dim[u] == 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) - /* Make a special case when the dimension is 0 because (0 - 1) is a big number for unsigned integer */ - if(dset->shared->curr_dims[u] == 0) - rdcc->scaled_dims[u] = 0; - else - rdcc->scaled_dims[u] = ((dset->shared->curr_dims[u] - 1) / dset->shared->layout.u.chunk.dim[u]) + 1; + /* Round up to the next integer # of chunks, to accommodate partial chunks */ + rdcc->scaled_dims[u] = (dset->shared->curr_dims[u] + dset->shared->layout.u.chunk.dim[u] - 1) / + dset->shared->layout.u.chunk.dim[u]; if( !(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])) ) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") -- cgit v0.12 From 1d2f7ca4901d126d677a32ecb4e2bc60b3b41182 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 9 Nov 2018 11:20:48 -0600 Subject: TRILAB-36 only copy shared generated --- src/CMakeLists.txt | 47 ++++++++++++----------------------------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5ba56e5..376260e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -954,15 +954,6 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) 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 - 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 - ) - 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 @@ -972,30 +963,17 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) 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}$ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared - ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) - endif () - endif () - endif () -else () - if (BUILD_SHARED_LIBS) - add_custom_command ( - 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 - ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) endif () endif () +if (BUILD_SHARED_LIBS) + add_custom_command ( + 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 + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) +endif () add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") @@ -1017,10 +995,9 @@ 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}$ - ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_BINARY_DIR}/H5lib_settings.c" "${HDF5_BINARY_DIR}/shared/H5lib_settings.c" + DEPENDS ${HDF5_BINARY_DIR}/H5lib_settings.c ) set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () -- cgit v0.12 From 4fbd6bb8a5b4f9048574da65c09a110ff8b83f34 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Fri, 9 Nov 2018 11:24:42 -0600 Subject: HDFFV-10511 -- Make fortran specific subroutines names PRIVATE Made non-public APIs private. --- fortran/src/H5Aff.F90 | 3 + fortran/src/H5Dff.F90 | 9 ++ fortran/src/H5Pff.F90 | 8 ++ fortran/src/H5Rff.F90 | 6 ++ fortran/src/H5Tff.F90 | 2 + fortran/src/H5_buildiface.F90 | 194 ++++++++++++++++++++++++++++++++---------- 6 files changed, 178 insertions(+), 44 deletions(-) diff --git a/fortran/src/H5Aff.F90 b/fortran/src/H5Aff.F90 index 827b803..a728f2d 100644 --- a/fortran/src/H5Aff.F90 +++ b/fortran/src/H5Aff.F90 @@ -76,6 +76,9 @@ MODULE H5A USE H5GLOBAL + PRIVATE h5awrite_char_scalar, h5awrite_ptr + PRIVATE h5aread_char_scalar, h5aread_ptr + INTERFACE h5awrite_f MODULE PROCEDURE h5awrite_char_scalar ! This is the preferred way to call h5awrite diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90 index 3915f72..77f0a15 100644 --- a/fortran/src/H5Dff.F90 +++ b/fortran/src/H5Dff.F90 @@ -90,6 +90,15 @@ MODULE H5D USE, INTRINSIC :: ISO_C_BINDING USE H5GLOBAL + PRIVATE h5dread_vl_integer, h5dread_vl_real, h5dread_vl_string + PRIVATE h5dwrite_vl_integer, h5dwrite_vl_real, h5dwrite_vl_string + PRIVATE h5dwrite_reference_obj, h5dwrite_reference_dsetreg, h5dwrite_char_scalar, h5dwrite_ptr + PRIVATE h5dread_reference_obj, h5dread_reference_dsetreg, h5dread_char_scalar, h5dread_ptr + PRIVATE h5dfill_integer, h5dfill_c_float, h5dfill_c_double, h5dfill_char +#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0 + PRIVATE h5dfill_c_long_double +#endif + INTERFACE h5dextend_f MODULE PROCEDURE h5dset_extent_f END INTERFACE diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index afb9136..455c72e 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -42,6 +42,14 @@ MODULE H5P USE H5GLOBAL USE H5fortkit + PRIVATE h5pset_fapl_multi_l, h5pset_fapl_multi_s + PRIVATE h5pset_fill_value_integer, h5pset_fill_value_char, h5pset_fill_value_ptr + PRIVATE h5pget_fill_value_integer, h5pget_fill_value_char, h5pget_fill_value_ptr + PRIVATE h5pset_integer, h5pset_char, h5pset_ptr + PRIVATE h5pget_integer, h5pget_char, h5pget_ptr + PRIVATE h5pregister_integer, h5pregister_ptr + PRIVATE h5pinsert_integer, h5pinsert_char, h5pinsert_ptr + INTERFACE h5pset_fapl_multi_f MODULE PROCEDURE h5pset_fapl_multi_l MODULE PROCEDURE h5pset_fapl_multi_s diff --git a/fortran/src/H5Rff.F90 b/fortran/src/H5Rff.F90 index f5a9c6e..6c2ba28 100644 --- a/fortran/src/H5Rff.F90 +++ b/fortran/src/H5Rff.F90 @@ -56,6 +56,12 @@ MODULE H5R ! END TYPE ! + PRIVATE h5rget_object_type_obj_f + PRIVATE h5rget_region_region_f, h5rget_region_ptr_f + PRIVATE h5rcreate_object_f, h5rcreate_region_f, h5rcreate_ptr_f + PRIVATE h5rdereference_object_f, h5rdereference_region_f, h5rdereference_ptr_f + PRIVATE h5rget_name_object_f, h5rget_name_region_f, h5rget_name_ptr_f + INTERFACE h5rget_object_type_f MODULE PROCEDURE h5rget_object_type_obj_f diff --git a/fortran/src/H5Tff.F90 b/fortran/src/H5Tff.F90 index b63c61d..46c8f39 100644 --- a/fortran/src/H5Tff.F90 +++ b/fortran/src/H5Tff.F90 @@ -41,6 +41,8 @@ MODULE H5T USE H5GLOBAL IMPLICIT NONE + PRIVATE h5tenum_insert_f03, h5tenum_insert_f90 + !****t* H5T/hvl_t ! Fortran2003 Derived Type: TYPE hvl_t diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index d4ebdd3..e5d103d 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -135,162 +135,268 @@ PROGRAM H5_buildiface WRITE(11,'(A)') "MODULE H5_GEN" - WRITE(11,'(A)') ' USE, INTRINSIC :: ISO_C_BINDING' - WRITE(11,'(A)') ' USE H5GLOBAL' + WRITE(11,'(2X,A)') 'USE, INTRINSIC :: ISO_C_BINDING' + WRITE(11,'(2X,A)') 'USE H5GLOBAL' + + WRITE(11,'(2X,A)') 'USE H5A' + WRITE(11,'(2X,A)') 'USE H5D' + WRITE(11,'(2X,A)') 'USE H5P' + WRITE(11,'(2X,A)') 'IMPLICIT NONE' + +!****************************** +! DECLARE PRIVETE INTERFACES +!****************************** + + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5awrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5awrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO k = 2, 8 + WRITE(11,'(2X,A)') "PRIVATE h5awrite_ckind_rank"//chr_rank(k) + ENDDO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5aread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5aread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO k = 2, 8 + WRITE(11,'(2X,A)') "PRIVATE h5aread_ckind_rank"//chr_rank(k) + ENDDO + + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dwrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dwrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO k = 2, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dwrite_ckind_rank"//chr_rank(k) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO i = 1, num_ikinds + j = ikind(i) + WRITE(chr2,'(I2)') j + DO k = 1, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + ENDDO + END DO + DO k = 2, 8 + WRITE(11,'(2X,A)') "PRIVATE h5dread_ckind_rank"//chr_rank(k) + ENDDO + + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pset_fill_value_kind_"//TRIM(ADJUSTL(chr2)) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pget_fill_value_kind_"//TRIM(ADJUSTL(chr2)) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pset_kind_"//TRIM(ADJUSTL(chr2)) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pget_kind_"//TRIM(ADJUSTL(chr2)) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pregister_kind_"//TRIM(ADJUSTL(chr2)) + END DO + DO i = 1, num_rkinds + j = rkind(i) + WRITE(chr2,'(I2)') j + WRITE(11,'(2X,A)') "PRIVATE h5pinsert_kind_"//TRIM(ADJUSTL(chr2)) + END DO - WRITE(11,'(A)') ' USE H5A' - WRITE(11,'(A)') ' USE H5D' - WRITE(11,'(A)') ' USE H5P' - WRITE(11,'(A)') ' IMPLICIT NONE' !*************** ! H5A INTERFACES !*************** ! ! H5Awrite_f ! - WRITE(11,'(A)') " INTERFACE h5awrite_f" + WRITE(11,'(2X,A)') "INTERFACE h5awrite_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5awrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5awrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO i = 1, num_ikinds j = ikind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5awrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5awrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO k = 2, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5awrite_ckind_rank"//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5awrite_ckind_rank"//chr_rank(k) ENDDO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Aread_f - WRITE(11,'(A)') " INTERFACE h5aread_f" + WRITE(11,'(2X,A)') "INTERFACE h5aread_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5aread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5aread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO i = 1, num_ikinds j = ikind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5aread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5aread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO k = 2, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5aread_ckind_rank"//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5aread_ckind_rank"//chr_rank(k) ENDDO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" !*************** ! H5D INTERFACES !*************** ! ! H5Dwrite_f - WRITE(11,'(A)') " INTERFACE h5dwrite_f" + WRITE(11,'(2X,A)') "INTERFACE h5dwrite_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dwrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dwrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO i = 1, num_ikinds j = ikind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dwrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dwrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO k = 2, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dwrite_ckind_rank"//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dwrite_ckind_rank"//chr_rank(k) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Dread_f - WRITE(11,'(A)') " INTERFACE h5dread_f" + WRITE(11,'(2X,A)') "INTERFACE h5dread_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO i = 1, num_ikinds j = ikind(i) WRITE(chr2,'(I2)') j DO k = 1, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k) ENDDO END DO DO k = 2, 8 - WRITE(11,'(A)') " MODULE PROCEDURE h5dread_ckind_rank"//chr_rank(k) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dread_ckind_rank"//chr_rank(k) ENDDO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" !*************** ! H5P INTERFACES !*************** ! ! H5Pset_fill_value_f - WRITE(11,'(A)') " INTERFACE h5pset_fill_value_f" + WRITE(11,'(2X,A)') "INTERFACE h5pset_fill_value_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pset_fill_value_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pset_fill_value_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Pget_fill_value_f - WRITE(11,'(A)') " INTERFACE h5pget_fill_value_f" + WRITE(11,'(2X,A)') "INTERFACE h5pget_fill_value_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pget_fill_value_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pget_fill_value_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Pset_f - WRITE(11,'(A)') " INTERFACE h5pset_f" + WRITE(11,'(2X,A)') "INTERFACE h5pset_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pset_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pset_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Pget_f - WRITE(11,'(A)') " INTERFACE h5pget_f" + WRITE(11,'(2X,A)') "INTERFACE h5pget_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pget_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pget_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Pregister_f - WRITE(11,'(A)') " INTERFACE h5pregister_f" + WRITE(11,'(2X,A)') "INTERFACE h5pregister_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pregister_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pregister_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" ! H5Pinsert_f - WRITE(11,'(A)') " INTERFACE h5pinsert_f" + WRITE(11,'(2X,A)') "INTERFACE h5pinsert_f" DO i = 1, num_rkinds j = rkind(i) WRITE(chr2,'(I2)') j - WRITE(11,'(A)') " MODULE PROCEDURE h5pinsert_kind_"//TRIM(ADJUSTL(chr2)) + WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pinsert_kind_"//TRIM(ADJUSTL(chr2)) END DO - WRITE(11,'(A)') " END INTERFACE" + WRITE(11,'(2X,A)') "END INTERFACE" WRITE(11,'(A)') 'CONTAINS' -- cgit v0.12 From 9bbaca66ca1f987ede2f5c7e9c5938523a47262f Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Fri, 9 Nov 2018 11:29:24 -0600 Subject: fixed sp. --- fortran/src/H5_buildiface.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index e5d103d..f793b7f 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -144,7 +144,7 @@ PROGRAM H5_buildiface WRITE(11,'(2X,A)') 'IMPLICIT NONE' !****************************** -! DECLARE PRIVETE INTERFACES +! DECLARE PRIVATE INTERFACES !****************************** DO i = 1, num_rkinds -- cgit v0.12 From 6b959b1e2118389f56fd5ee960603c2cc19ed65b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 9 Nov 2018 14:38:03 -0600 Subject: Fix target files for commands --- tools/test/h5dump/CMakeTests.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index b02dc35..382e664 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -750,10 +750,10 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DEPENDS "H5DUMP-IMPORT-${resultfile}-clear-objects") - add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND h5import ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) + add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND $ ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-${resultfile}) - add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND h5diff ${testfile} ${resultfile}.h5 /integer /integer) + add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND $ ${testfile} ${resultfile}.h5 /integer /integer) set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-h5import-${resultfile}) endif () -- cgit v0.12 From cd73b837db95493de0641b2c63537b42b8b57a84 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Fri, 9 Nov 2018 16:00:34 -0600 Subject: HDFFV-10537: Remove installation of Fortran test mod files Removed from autools install, cmake does not have this issue. --- hl/fortran/test/Makefile.am | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am index ba672aa..0552aaa 100644 --- a/hl/fortran/test/Makefile.am +++ b/hl/fortran/test/Makefile.am @@ -58,18 +58,6 @@ clean-local: $(RM) *.$(F9XMODEXT); \ fi -install-data-local: - @if test -n "$(F9XMODEXT)" && test "X$(F9XMODEXT)" != "Xo"; then \ - $(CP) $(top_builddir)/$(subdir)/*.$(F9XMODEXT) $(DESTDIR)$(includedir)/. ; \ - fi - -uninstall-local: - @if test -n "$(F9XMODEXT)" -a "X$(F9XMODEXT)" != "Xo"; then \ - if test -f "$(includedir)/hdf5.$(F9XMODEXT)" -o -f "$(DESTDIR)$(includedir)/HDF5.$(F9XMODEXT)"; then \ - set -x; $(RM) $(includedir)/*.$(F9XMODEXT); \ - fi; \ - fi - # Mark this directory as part of the Fortran API (this affects output # from tests in conclude.am) FORTRAN_API=yes -- cgit v0.12 From ca1b9025fe8be1eab6bd76d58ab78bb9450c41f1 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 10 Nov 2018 11:54:20 -0600 Subject: Switch switch remainder of API routines to use VOL callbacks. --- bin/trace | 2 + src/H5Adeprec.c | 25 ++-- src/H5Aint.c | 7 +- src/H5Apkg.h | 7 + src/H5Dint.c | 2 +- src/H5Dpkg.h | 2 +- src/H5G.c | 20 +-- src/H5Gcompact.c | 68 ---------- src/H5Gdense.c | 77 ----------- src/H5Gdeprec.c | 369 ++++++++++++++++++++++++++--------------------------- src/H5Gpkg.h | 23 ++-- src/H5Gstab.c | 115 ----------------- src/H5I.c | 21 +-- src/H5Itest.c | 23 +++- src/H5O.c | 30 ++--- src/H5Oattribute.c | 2 +- src/H5Oint.c | 2 +- src/H5Opkg.h | 7 - src/H5Oprivate.h | 6 + src/H5Plcpl.c | 2 +- src/H5Rint.c | 4 +- src/H5VLcallback.c | 50 +++++--- src/H5VLnative.c | 151 ++++++++++++++++++++-- src/H5VLpublic.h | 5 +- src/H5trace.c | 3 + 25 files changed, 462 insertions(+), 561 deletions(-) diff --git a/bin/trace b/bin/trace index fa7090b..f665d9d 100755 --- a/bin/trace +++ b/bin/trace @@ -68,6 +68,7 @@ $Source = ""; "unsigned" => "Iu", "unsigned int" => "Iu", "uint32_t" => "Iu", + "uint64_t" => "UL", "H5I_type_t" => "It", "H5G_link_t" => "Ll", #Same as H5L_type_t now "H5L_type_t" => "Ll", @@ -111,6 +112,7 @@ $Source = ""; "H5VL_link_specific_t" => "Vm", "H5VL_object_get_t" => "Vn", "H5VL_object_specific_t" => "Vo", + "H5VL_request_specific_t" => "Vr", "void" => "x", "FILE" => "x", "H5A_operator_t" => "x", diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index bf97a25..af3ab4d 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -115,7 +115,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id) { void *attr = NULL; /* attr token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -199,7 +199,7 @@ hid_t H5Aopen_name(hid_t loc_id, const char *name) { void *attr = NULL; /* attr token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -264,7 +264,7 @@ hid_t H5Aopen_idx(hid_t loc_id, unsigned idx) { void *attr = NULL; /* attr token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -327,7 +327,7 @@ done: int H5Aget_num_attrs(hid_t loc_id) { - H5VL_object_t *vol_obj; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5O_info_t oinfo; int ret_value = -1; @@ -338,7 +338,7 @@ H5Aget_num_attrs(hid_t loc_id) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* get the location object */ + /* Get the location object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") @@ -393,18 +393,23 @@ done: herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) { - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + herr_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5_ITER_ERROR) H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data); /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "location is not valid for an attribute") + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") /* Call attribute iteration routine */ - if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); + if((ret_value = H5VL_attr_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_ATTR_ITERATE_OLD, loc_id, attr_num, op, op_data)) < 0) + HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes"); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Aint.c b/src/H5Aint.c index f8efd26..6502fa4 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2659,7 +2659,7 @@ done: if(obj_loc_id != H5I_INVALID_HID) { if(H5I_dec_app_ref(obj_loc_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object"); - } + } /* end if */ else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location"); @@ -2688,7 +2688,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, hsize_t idx; /* Index of attribute to start iterating at */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP; @@ -2699,13 +2699,12 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, /* Call internal attribute iteration routine */ if((ret_value = H5A__iterate_common(loc_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, &idx, &attr_op, op_data)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") + HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Translate hsize_t index value to legacy unsigned index value*/ if(attr_num) *attr_num = (unsigned)idx; -done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_old() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 91061cd..12e0857 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -155,6 +155,13 @@ typedef struct { H5A_t **attrs; /* Pointer to array of attribute pointers */ } H5A_attr_table_t; +/* Types for optional attribute VOL operations */ +typedef enum H5VL_attr_optional_t { +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5VL_ATTR_ITERATE_OLD /* H5Aiterate (deprecated routine) */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ +} H5VL_attr_optional_t; + /*****************************/ /* Package Private Variables */ diff --git a/src/H5Dint.c b/src/H5Dint.c index d5ac251..6bb3343 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1966,7 +1966,7 @@ H5D_nameof(const H5D_t *dataset) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : (H5G_name_t *)NULL) + FUNC_LEAVE_NOAPI(dataset ? (H5G_name_t *)&(dataset->path) : (H5G_name_t *)NULL) } /* end H5D_nameof() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index c84c245..30652a5 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -110,7 +110,7 @@ typedef struct H5D_type_info_t { hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */ } H5D_type_info_t; -/* types for dataset optional VOL operations */ +/* Types for dataset optional VOL operations */ typedef enum H5VL_dataset_optional_t { H5VL_DATASET_FORMAT_CONVERT, /* H5Dformat_convert (internal) */ H5VL_DATASET_GET_CHUNK_INDEX_TYPE, /* H5Dget_chunk_index_type */ diff --git a/src/H5G.c b/src/H5G.c index 0beee14..114f3bf 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -351,13 +351,13 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Get the gcpl structure and set the link properties on it */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") - if (H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) + if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set property value for lcpl id") - /* get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Set the location parameters */ @@ -439,7 +439,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* get the location object */ + /* Get the location object */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") @@ -590,7 +590,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info) /* Retrieve the group's information */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = id_type; - if((ret_value = H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -632,7 +632,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up location parameters */ @@ -642,7 +642,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -688,7 +688,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") - /* get the location object */ + /* Get the location object */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") @@ -702,7 +702,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index b32ce39..7e2b324 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -572,71 +572,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__compact_lookup_by_idx() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5G__compact_get_type_by_idx - * - * Purpose: Returns the type of objects in the group by giving index. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Sep 12, 2005 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo, - hsize_t idx) -{ - H5G_link_table_t ltable = {0, NULL}; /* Link table */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(oloc); - - /* Build table of all link messages */ - if(H5G__compact_build_table(oloc, linfo, H5_INDEX_NAME, H5_ITER_INC, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table") - - /* Check for going out of bounds */ - if(idx >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound") - - /* Determine type of object */ - if(ltable.lnks[idx].type == H5L_TYPE_SOFT) - ret_value = H5G_LINK; - else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN) - ret_value = H5G_UDLINK; - else if(ltable.lnks[idx].type == H5L_TYPE_HARD){ - H5O_loc_t tmp_oloc; /* Temporary object location */ - H5O_type_t obj_type; /* Type of object at location */ - - /* Build temporary object location */ - tmp_oloc.file = oloc->file; - tmp_oloc.addr = ltable.lnks[idx].u.hard.addr; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") - - /* Map to group object type */ - if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") - } else { - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type") - } /* end else */ - -done: - /* Release link table */ - if(ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__compact_get_type_by_idx() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/src/H5Gdense.c b/src/H5Gdense.c index d2bcad1..a2ef55c 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -1777,80 +1777,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_delete() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5G__dense_get_type_by_idx - * - * Purpose: Returns the type of objects in the group by giving index. - * - * Note: This routine assumes a lookup on the link name index in - * increasing order and isn't currently set up to be as - * flexible as other routines in this code module, because - * the H5Gget_objtype_by_idx that it's supporting is - * deprecated. - * - * Return: Success: Non-negative, object type - * Failure: Negative - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 19 2006 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo, hsize_t idx) -{ - H5G_link_table_t ltable = {0, NULL}; /* Table of links */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* - * Check arguments. - */ - HDassert(f); - HDassert(linfo); - - /* Build the table of links for this group */ - if(H5G__dense_build_table(f, linfo, H5_INDEX_NAME, H5_ITER_INC, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "error building table of links") - - /* Check for going out of bounds */ - if(idx >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "index out of bound") - - /* Determine type of object */ - if(ltable.lnks[idx].type == H5L_TYPE_SOFT) - ret_value = H5G_LINK; - else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN) - ret_value = H5G_UDLINK; - else if(ltable.lnks[idx].type == H5L_TYPE_HARD) { - H5O_loc_t tmp_oloc; /* Temporary object location */ - H5O_type_t obj_type; /* Type of object at location */ - - /* Build temporary object location */ - tmp_oloc.file = f; - tmp_oloc.addr = ltable.lnks[idx].u.hard.addr; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") - - /* Map to group object type */ - if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") - } else { - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type") - } /* end else */ - -done: - /* Release link table */ - if(ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__dense_get_type_by_idx() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 8aae2a1..6ed5344 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -72,13 +72,9 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ - static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, - hbool_t follow_link, H5G_stat_t *statbuf/*out*/); -static H5G_obj_t H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -172,7 +168,7 @@ hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) { void *grp = NULL; /* New group created */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */ @@ -227,6 +223,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get property value for lcpl id") + /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); @@ -275,10 +272,10 @@ done: hid_t H5Gopen1(hid_t loc_id, const char *name) { - void *grp = NULL; /* Group opened */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *grp = NULL; /* Group opened */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); @@ -346,7 +343,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Create link */ if(type == H5L_TYPE_HARD) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; H5VL_object_t tmp_vol_obj; /* Temporary object token of */ @@ -379,7 +376,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; loc_params.type = H5VL_OBJECT_BY_NAME; @@ -442,8 +439,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the appropriate kind of link */ if(type == H5L_TYPE_HARD) { - H5VL_object_t *vol_obj1 = NULL; /* object token of loc_id */ - H5VL_object_t *vol_obj2 = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj1; /* Object token of loc_id */ + H5VL_object_t *vol_obj2; /* Object token of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; @@ -474,7 +471,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; /* Soft links only need one location, the new_loc_id, but it's possible that @@ -517,10 +514,10 @@ done: herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name); @@ -562,9 +559,9 @@ herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name) { - H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */ + H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ H5VL_loc_params_t loc_params1; - H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */ + H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -615,7 +612,7 @@ done: herr_t H5Gunlink(hid_t loc_id, const char *name) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -659,7 +656,7 @@ done: herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -712,14 +709,13 @@ done: herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { - H5G_loc_t loc; /* Group's location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", loc_id, name, comment); - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") @@ -727,8 +723,18 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set the comment */ - if(H5G_loc_set_comment(&loc, name, comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: @@ -762,14 +768,13 @@ done: int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf); - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(bufsize > 0 && !buf) @@ -779,8 +784,18 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Get the comment */ - if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, buf, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") done: @@ -816,20 +831,17 @@ herr_t H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { - H5G_loc_t loc; /* Location of object */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; H5G_link_iterate_t lnk_op; /* Link operator */ - H5VL_object_t *vol_obj; hsize_t last_obj; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + hsize_t idx; /* Internal location to hold index */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_p && *idx_p < 0) @@ -845,28 +857,25 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + /* Get the object pointer */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - - /* Call private function */ - if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") + /* Call private iteration function, through VOL callback */ + if((ret_value = H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_ITERATE_OLD, loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) + HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links"); /* Set the index we stopped at */ if(idx_p) *idx_p = (int)last_obj; done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Giterate() */ @@ -890,29 +899,35 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5G_loc_t loc; /* Location of object */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5I_type_t id_type; /* Type of ID */ + H5VL_loc_params_t loc_params; H5G_info_t grp_info; /* Group information */ - H5O_type_t obj_type; /* Type of object at location */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", loc_id, num_objs); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + id_type = H5I_get_type(loc_id); + if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID") if(!num_objs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") - /* Retrieve information about the group */ - if(H5G__obj_info(loc.oloc, &grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = id_type; + + /* Get group location */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve the group's information */ + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, &grp_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") - /* Set the number of objects [sic: links] in the group */ + /* Set the number of objects [i.e. links] in the group */ *num_objs = grp_info.nlinks; done: @@ -939,23 +954,40 @@ done: */ herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, - H5G_stat_t *statbuf/*out*/) + H5G_stat_t *statbuf/*out*/) { - H5G_loc_t loc; /* Group's location */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - /* Get info */ - if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + + /* Retrieve object info, if pointer to struct is given */ + if(statbuf) { + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve the object's information */ + if(H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_GET_OBJINFO, loc_params, (unsigned)follow_link, statbuf) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -980,6 +1012,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */ + H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -988,48 +1021,43 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c if(lnk == NULL && obj_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name) - /* Only modify user's buffer if it's available */ - if(udata->statbuf) { - H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */ - - /* Common code to retrieve the file's fileno */ - if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno") + /* Common code to retrieve the file's fileno */ + if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno") - /* Info for soft and UD links is gotten by H5L_get_info. If we have - * a hard link, follow it and get info on the object - */ - if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { - H5O_info_t oinfo; /* Object information */ + /* Info for soft and UD links is gotten by H5L_get_info. If we have + * a hard link, follow it and get info on the object + */ + if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { + H5O_info_t oinfo; /* Object information */ - /* Go retrieve the object information */ - /* (don't need index & heap info) */ - HDassert(obj_loc); - if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") + /* Go retrieve the object information */ + /* (don't need index & heap info) */ + HDassert(obj_loc); + if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") - /* Get mapped object type */ - statbuf->type = H5G_map_obj_type(oinfo.type); + /* Get mapped object type */ + statbuf->type = H5G_map_obj_type(oinfo.type); - /* Get object number (i.e. address) for object */ - statbuf->objno[0] = (unsigned long)(oinfo.addr); + /* Get object number (i.e. address) for object */ + statbuf->objno[0] = (unsigned long)(oinfo.addr); #if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long)); + statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long)); #else - statbuf->objno[1] = 0; + statbuf->objno[1] = 0; #endif - /* Get # of hard links pointing to object */ - statbuf->nlink = oinfo.rc; + /* Get # of hard links pointing to object */ + statbuf->nlink = oinfo.rc; - /* Get modification time for object */ - statbuf->mtime = oinfo.ctime; + /* Get modification time for object */ + statbuf->mtime = oinfo.ctime; - /* Retrieve the object header information */ - statbuf->ohdr.size = oinfo.hdr.space.total; - statbuf->ohdr.free = oinfo.hdr.space.free; - statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs; - statbuf->ohdr.nchunks = oinfo.hdr.nchunks; - } /* end if */ + /* Retrieve the object header information */ + statbuf->ohdr.size = oinfo.hdr.space.total; + statbuf->ohdr.free = oinfo.hdr.space.free; + statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs; + statbuf->ohdr.nchunks = oinfo.hdr.nchunks; } /* end if */ done: @@ -1057,22 +1085,22 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/) { H5G_trav_goi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(loc); HDassert(name && *name); + HDassert(statbuf); - /* Reset stat buffer, if one was given */ - if(statbuf) - HDmemset(statbuf, 0, sizeof(H5G_stat_t)); + /* Reset stat buffer */ + HDmemset(statbuf, 0, sizeof(H5G_stat_t)); /* Set up user data for retrieving information */ udata.statbuf = statbuf; @@ -1080,12 +1108,11 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, udata.loc_file = loc->oloc->file; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : H5G_TARGET_SLINK|H5G_TARGET_UDLINK), - H5G__get_objinfo_cb, &udata) < 0) + if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") /* If we're pointing at a soft or UD link, get the real link length and type */ - if(statbuf && follow_link == 0) { + if(follow_link == 0) { H5L_info_t linfo; /* Link information buffer */ herr_t ret; @@ -1137,24 +1164,33 @@ done: ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) { - H5G_loc_t loc; /* Object location */ - H5O_type_t obj_type; /* Type of object at location */ - ssize_t ret_value; + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size); - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set collective metadata read info") + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = "."; + loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME; + loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; + loc_params.loc_data.loc_by_idx.n = idx; + loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Call internal function */ - if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name") done: FUNC_LEAVE_API(ret_value) @@ -1179,82 +1215,39 @@ done: H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) { - H5G_loc_t loc; /* Object location */ - H5G_obj_t ret_value; + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + H5O_info_t oinfo; /* Object info (contains object type) */ + unsigned fields; /* Which fields in object info to populate */ + H5G_obj_t ret_value; /* Return value */ FUNC_ENTER_API(H5G_UNKNOWN) H5TRACE2("Go", "ih", loc_id, idx); - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") - - /* Call internal function*/ - if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_objtype_by_idx() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__obj_get_type_by_idx - * - * Purpose: Private function for H5Gget_objtype_by_idx. - * Returns the type of objects in the group by giving index. - * - * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) - * - * Failure: Negative - * - * Programmer: Raymond Lu - * Nov 20, 2002 - * - *------------------------------------------------------------------------- - */ -static H5G_obj_t -H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) -{ - H5O_linfo_t linfo; /* Link info message */ - htri_t linfo_exists; /* Whether the link info message exists */ - H5O_type_t obj_type; /* Type of object at location */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = "."; + loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME; + loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; + loc_params.loc_data.loc_by_idx.n = idx; + loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); - FUNC_ENTER_STATIC_TAG(oloc->addr) + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") - /* Sanity check */ - HDassert(oloc); + /* Retrieve the object's basic information (which includes its type) */ + fields = H5O_INFO_BASIC; + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, fields) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info") - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "not a group") - - /* Attempt to get the link info for this group */ - if((linfo_exists = H5G__obj_get_linfo(oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't check for link info message") - if(linfo_exists) { - if(H5F_addr_defined(linfo.fheap_addr)) { - /* Get the object's name from the dense link storage */ - if((ret_value = H5G__dense_get_type_by_idx(oloc->file, &linfo, idx)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") - } /* end if */ - else { - /* Get the object's type from the link messages */ - if((ret_value = H5G__compact_get_type_by_idx(oloc, &linfo, idx)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") - } /* end else */ - } /* end if */ - else { - /* Get the object's type from the symbol table */ - if((ret_value = H5G__stab_get_type_by_idx(oloc, idx)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") - } /* end else */ + /* Map to group object type */ + if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(oinfo.type))) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") done: - FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5G__obj_get_type_by_idx() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_objtype_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 836213d..ef330c4 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -299,6 +299,14 @@ typedef struct H5G_copy_file_ud_t { H5G_cache_t cache; /* Cached data for symbol table entry */ } H5G_copy_file_ud_t; +/* Types for optional group VOL operations */ +typedef enum H5VL_group_optional_t { +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5VL_GROUP_ITERATE_OLD, /* HG5Giterate (deprecated routine) */ + H5VL_GROUP_GET_OBJINFO /* HG5Gget_objinfo (deprecated routine) */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ +} H5VL_group_optional_t; + /*****************************/ /* Package Private Variables */ @@ -381,9 +389,6 @@ H5_DLL herr_t H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t #ifndef H5_STRICT_FORMAT_CHECKS H5_DLL herr_t H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab); #endif /* H5_STRICT_FORMAT_CHECKS */ -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* @@ -448,10 +453,6 @@ H5_DLL htri_t H5G__compact_lookup(const H5O_loc_t *grp_oloc, const char *name, H5_DLL herr_t H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G__compact_get_type_by_idx(H5O_loc_t *oloc, - const H5O_linfo_t *linfo, hsize_t idx); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Functions that understand "dense" link storage */ H5_DLL herr_t H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, @@ -476,10 +477,6 @@ H5_DLL herr_t H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); H5_DLL herr_t H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo, - hsize_t idx); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Functions that understand group objects */ H5_DLL herr_t H5G__obj_create(H5F_t *f, H5G_obj_create_t *gcrt_info, @@ -494,6 +491,10 @@ H5_DLL herr_t H5G__obj_iterate(const H5O_loc_t *grp_oloc, H5_DLL herr_t H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info); H5_DLL htri_t H5G__obj_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk); +#ifndef H5_NO_DEPRECATED_SYMBOLS +H5_DLL herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, + hbool_t follow_link, H5G_stat_t *statbuf/*out*/); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* * These functions operate on group hierarchy names. diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 9072b97..e8d38b9 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -1103,118 +1103,3 @@ done: } /* end H5G__stab_valid */ #endif /* H5_STRICT_FORMAT_CHECKS */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5G_stab_get_type_by_idx_cb - * - * Purpose: Callback for B-tree iteration 'by index' info query to - * retrieve the type of an object - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Nov 7, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata) -{ - H5G_bt_it_gtbi_t *udata = (H5G_bt_it_gtbi_t *)_udata; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Sanity check */ - HDassert(ent); - HDassert(udata); - - /* Check for a soft link */ - switch(ent->type) { - case H5G_CACHED_SLINK: - udata->type = H5G_LINK; - break; - - case H5G_CACHED_ERROR: - case H5G_NOTHING_CACHED: - case H5G_CACHED_STAB: - case H5G_NCACHED: - default: - { - H5O_loc_t tmp_oloc; /* Temporary object location */ - H5O_type_t obj_type; /* Type of object at location */ - - /* Build temporary object location */ - tmp_oloc.file = udata->f; - HDassert(H5F_addr_defined(ent->header)); - tmp_oloc.addr = ent->header; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - udata->type = H5G_map_obj_type(obj_type); - } - break; - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_get_type_by_idx_cb */ - - -/*------------------------------------------------------------------------- - * Function: H5G__stab_get_type_by_idx - * - * Purpose: Private function for H5Gget_objtype_by_idx. - * Returns the type of objects in the group by giving index. - * - * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) - * - * Failure: UNKNOWN - * - * Programmer: Raymond Lu - * Nov 20, 2002 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) -{ - H5O_stab_t stab; /* Info about local heap & B-tree */ - H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - - FUNC_ENTER_PACKAGE_TAG(oloc->addr) - - /* Sanity check */ - HDassert(oloc); - - /* Get the B-tree & local heap info */ - if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") - - /* Set iteration information */ - udata.common.idx = idx; - udata.common.num_objs = 0; - udata.common.op = H5G_stab_get_type_by_idx_cb; - udata.f = oloc->file; - udata.type = H5G_UNKNOWN; - - /* Iterate over the group members */ - if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed") - - /* If we don't know the type now, we almost certainly went out of bounds */ - if(udata.type == H5G_UNKNOWN) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "index out of bound") - - /* Set the return value */ - ret_value = udata.type; - -done: - FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5G__stab_get_type_by_idx() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/src/H5I.c b/src/H5I.c index 8a4b220..f4a221f 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2164,36 +2164,27 @@ done: ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size) { - H5VL_object_t *vol_obj; + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; H5G_loc_t loc; /* Object location */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", id, name, size); - /* Get object location */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") - /* Get the object pointer */ if(NULL == (vol_obj = H5VL_vol_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") - /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't set VOL wrapper info") - vol_wrapper_set = TRUE; + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); /* Retrieve object's name */ - if((ret_value = H5G_get_name(&loc, name, size, NULL)) < 0) + if(H5VL_object_get(vol_obj, loc_params, H5VL_ID_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't reset VOL wrapper info") - FUNC_LEAVE_API(ret_value) } /* end H5Iget_name() */ diff --git a/src/H5Itest.c b/src/H5Itest.c index 4b54835..79bc482 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -78,26 +78,41 @@ ssize_t H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) { + H5VL_object_t *vol_obj; /* Object token of id */ H5G_loc_t loc; /* Object location */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t vol_wrapper_set = FALSE;/* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE - /* Get object location */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") - /* Set API context */ if(H5CX_push() < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context") api_ctx_pushed = TRUE; + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_vol_object(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Get object location */ + if(H5G_loc(id, &loc) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") + /* Call internal group routine to retrieve object's name */ if((ret_value = H5G_get_name(&loc, name, size, cached)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_ATOM, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context") diff --git a/src/H5O.c b/src/H5O.c index 5c3a0a6..01b16ce 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -100,7 +100,7 @@ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; @@ -169,7 +169,7 @@ hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; @@ -252,7 +252,7 @@ done: hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; @@ -407,7 +407,7 @@ done: herr_t H5Oincr_refcount(hid_t object_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; @@ -457,7 +457,7 @@ done: herr_t H5Odecr_refcount(hid_t object_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -500,7 +500,7 @@ done: htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; htri_t ret_value = FAIL; /* Return value */ @@ -553,7 +553,7 @@ done: herr_t H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -601,7 +601,7 @@ herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -661,7 +661,7 @@ herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -726,7 +726,7 @@ done: herr_t H5Oset_comment(hid_t obj_id, const char *comment) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -775,7 +775,7 @@ herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -828,7 +828,7 @@ done: ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; ssize_t ret_value = -1; /* Return value */ @@ -872,7 +872,7 @@ ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; ssize_t ret_value = -1; /* Return value */ @@ -945,7 +945,7 @@ herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ @@ -1018,7 +1018,7 @@ herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 1d509e5..6e135c5 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -1304,7 +1304,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index_t idx_type, /* Iterate over attributes in table */ if((ret_value = H5A__attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_CANTNEXT, "iteration operator failed"); + HERROR(H5E_ATTR, H5E_BADITER, "iteration operator failed"); } /* end else */ done: diff --git a/src/H5Oint.c b/src/H5Oint.c index 3a60d9d..059a8a8 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -2114,7 +2114,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) /* Set the object's reference count */ oinfo->rc = oh->nlink; - } + } /* end if */ /* Get time information, if requested */ if(fields & H5O_INFO_TIME) { diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 7254edb..dbc8089 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -414,13 +414,6 @@ typedef struct H5O_chk_cache_ud_t { H5O_common_cache_ud_t common; /* Common object header cache callback info */ } H5O_chk_cache_ud_t; -/* types for object optional VOL operations */ -typedef enum H5VL_object_optional_t { - H5VL_OBJECT_GET_COMMENT, /* get object comment */ - H5VL_OBJECT_GET_INFO, /* get object info */ - H5VL_OBJECT_SET_COMMENT /* set object comment */ -} H5VL_object_optional_t; - /* Header message ID to class mapping */ H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES]; diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 048e13e..e8565b9 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -851,6 +851,12 @@ typedef struct { } u; } H5O_mesg_operator_t; +/* Types for object optional VOL operations */ +typedef enum H5VL_object_optional_t { + H5VL_OBJECT_GET_COMMENT, /* get object comment */ + H5VL_OBJECT_GET_INFO, /* get object info */ + H5VL_OBJECT_SET_COMMENT /* set object comment */ +} H5VL_object_optional_t; /* Typedef for abstract object creation */ typedef struct { diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 6568ecd..16be52a 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -55,7 +55,7 @@ /* Definitions for Location params */ #define H5L_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t) -#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {HADDR_UNDEF}} +#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {{HADDR_UNDEF}}} /* Definitions for target object NAME */ #define H5L_CRT_TARGET_NAME_SIZE sizeof(char *) diff --git a/src/H5Rint.c b/src/H5Rint.c index 7142d54..365facd 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -728,7 +728,7 @@ H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, UINT32DECODE(p, hobjid.idx); /* Get the dataset region from the heap (allocate inside routine) */ - if ((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL) + if((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, (-1), "Unable to read dataset region information") /* Get the object oid for the dataset */ @@ -748,7 +748,7 @@ H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, } /* end switch */ /* Get name, length, etc. */ - if ((ret_value = H5G_get_name_by_addr(f, &oloc, name, size)) < 0) + if((ret_value = H5G_get_name_by_addr(f, &oloc, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name") done: diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 25c5e7b..557105a 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -1049,6 +1049,7 @@ H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) @@ -1151,6 +1152,7 @@ H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) @@ -1261,7 +1263,8 @@ H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVai**xx", obj, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVai**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -1414,7 +1417,7 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr optional' method") /* Call the corresponding VOL callback */ - if((cls->attr_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: @@ -1450,7 +1453,7 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + if((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: @@ -1492,7 +1495,7 @@ H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_l HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(H5VL__attr_optional(obj, cls, dxpl_id, req, arguments) < 0) + if((ret_value = H5VL__attr_optional(obj, cls, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: @@ -2107,7 +2110,8 @@ H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVci**xx", obj, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVci**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -2702,7 +2706,8 @@ H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVgi**xx", obj, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVgi**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -3381,7 +3386,8 @@ H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVii**xx", obj, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVii**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -3533,7 +3539,7 @@ H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method") /* Call the corresponding VOL callback */ - if((cls->group_cls.optional)(obj, dxpl_id, req, arguments) < 0) + if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3569,7 +3575,7 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ... /* Call the corresponding internal VOL routine */ va_start(arguments, req); arg_started = TRUE; - if(H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + if((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3612,7 +3618,7 @@ H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(H5VL__group_optional(obj, cls, dxpl_id, req, arguments) < 0) + if((ret_value = H5VL__group_optional(obj, cls, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3831,8 +3837,8 @@ H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, connector_id, lcpl_id, - lapl_id, dxpl_id, req); + H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, connector_id, + lcpl_id, lapl_id, dxpl_id, req); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -4159,8 +4165,8 @@ H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_l herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVli**xx", obj, loc_params, connector_id, get_type, dxpl_id, req, - arguments); + H5TRACE7("e", "*xxiVli**xx", obj, loc_params, connector_id, get_type, dxpl_id, + req, arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -4484,7 +4490,8 @@ H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t connector_id, H5I_typ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("*x", "*xxi*Iti**x", obj, params, connector_id, opened_type, dxpl_id, req); + H5TRACE6("*x", "*xxi*Iti**x", obj, params, connector_id, opened_type, dxpl_id, + req); /* Check args and get class pointer */ if(NULL == obj) @@ -4597,6 +4604,9 @@ H5VLobject_copy(void *src_obj, H5VL_loc_params_t src_loc_params, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT + H5TRACE11("e", "*xx*s*xx*siiii**x", src_obj, src_loc_params, src_name, + dst_obj, dst_loc_params, dst_name, connector_id, ocpypl_id, lcpl_id, + dxpl_id, req); /* Check args and get class pointers */ if(NULL == src_obj || NULL == dst_obj) @@ -4707,8 +4717,8 @@ H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVni**xx", obj, loc_params, connector_id, get_type, dxpl_id, req, - arguments); + H5TRACE7("e", "*xxiVni**xx", obj, loc_params, connector_id, get_type, dxpl_id, + req, arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -5256,7 +5266,8 @@ H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVei**xx", obj, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVei**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -5694,6 +5705,7 @@ H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xiUL*Es", req, connector_id, timeout, status); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -5914,6 +5926,7 @@ H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t spec herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xiVrx", req, connector_id, specific_type, arguments); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -6026,6 +6039,7 @@ H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT + H5TRACE3("e", "*xix", req, connector_id, arguments); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 7b15828..bf847c5 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -59,6 +59,7 @@ static herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_ static herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); static herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req); /* Dataset callbacks */ @@ -85,7 +86,8 @@ static herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req); static void *H5VL__native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); static void *H5VL__native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__native_group_specific(void *dset, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req); /* Link callbacks */ @@ -139,7 +141,7 @@ static H5VL_class_t H5VL_native_cls_g = { H5VL__native_attr_write, /* write */ H5VL__native_attr_get, /* get */ H5VL__native_attr_specific, /* specific */ - NULL, /* optional */ + H5VL__native_attr_optional, /* optional */ H5VL__native_attr_close /* close */ }, { /* dataset_cls */ @@ -173,7 +175,7 @@ static H5VL_class_t H5VL_native_cls_g = { H5VL__native_group_open, /* open */ H5VL__native_group_get, /* get */ H5VL__native_group_specific, /* specific */ - NULL, /* optional */ + H5VL__native_group_optional, /* optional */ H5VL__native_group_close /* close */ }, { /* link_cls */ @@ -796,6 +798,51 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__native_attr_optional + * + * Purpose: Perform a connector-specific operation on a native attribute + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5VL_attr_optional_t optional_type; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + optional_type = va_arg(arguments, H5VL_attr_optional_t); + switch(optional_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + case H5VL_ATTR_ITERATE_OLD: + { + hid_t loc_id = va_arg(arguments, hid_t); + unsigned *attr_num = va_arg(arguments, unsigned *); + H5A_operator1_t op = va_arg(arguments, H5A_operator1_t); + void *op_data = va_arg(arguments, void *); + + /* Call the actual iteration routine */ + if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0) + HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes"); + + break; + } +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_attr_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL__native_attr_close * * Purpose: Closes an attribute. @@ -1551,14 +1598,14 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, /* Check for SWMR write access on the file */ if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) *intent_flags |= H5F_ACC_SWMR_WRITE; - } + } /* end if */ else { *intent_flags = H5F_ACC_RDONLY; /* Check for SWMR read access on the file */ if(H5F_INTENT(f) & H5F_ACC_SWMR_READ) *intent_flags |= H5F_ACC_SWMR_READ; - } + } /* end else */ break; } @@ -1581,7 +1628,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size)); if(len >= size) name[size-1]='\0'; - } + } /* end if */ /* Set the return value for the API call */ *ret = (ssize_t)len; @@ -2370,6 +2417,77 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__native_group_optional + * + * Purpose: Perform a connector-specific operation on a native group + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5VL_group_optional_t optional_type; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + optional_type = va_arg(arguments, H5VL_group_optional_t); + switch(optional_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + /* H5Giterate (deprecated) */ + case H5VL_GROUP_ITERATE_OLD: + { + H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + hsize_t idx = va_arg(arguments, hsize_t); + hsize_t *last_obj = va_arg(arguments, hsize_t *); + const H5G_link_iterate_t *lnk_op = va_arg(arguments, const H5G_link_iterate_t *); + void *op_data = va_arg(arguments, void *); + H5G_loc_t grp_loc; + + /* Get the location struct for the object */ + if(H5G_loc_real(obj, loc_params.obj_type, &grp_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Call the actual iteration routine */ + if((ret_value = H5G_iterate(&grp_loc, loc_params.loc_data.loc_by_name.name, H5_INDEX_NAME, H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0) + HERROR(H5E_VOL, H5E_BADITER, "error iterating over group's links"); + + break; + } + + /* H5Gget_objinfo (deprecated) */ + case H5VL_GROUP_GET_OBJINFO: + { + H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + hbool_t follow_link = va_arg(arguments, unsigned); + H5G_stat_t *statbuf = va_arg(arguments, H5G_stat_t *); + H5G_loc_t grp_loc; + + /* Get the location struct for the object */ + if(H5G_loc_real(obj, loc_params.obj_type, &grp_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Call the actual group objinfo routine */ + if(H5G__get_objinfo(&grp_loc, loc_params.loc_data.loc_by_name.name, follow_link, statbuf) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + + break; + } +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_group_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VL__native_group_close * * Purpose: Closes a group. @@ -2655,13 +2773,12 @@ H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t g if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */ if(H5L_get_info(&loc, loc_params.loc_data.loc_by_name.name, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */ - if(H5L_get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") - } + } /* end else-if */ else HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") break; @@ -3018,6 +3135,20 @@ H5VL__native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get break; } + /* H5Iget_name */ + case H5VL_ID_GET_NAME: + { + ssize_t *ret = va_arg(arguments, ssize_t *); + char *name = va_arg(arguments, char *); + size_t size = va_arg(arguments, size_t); + + /* Retrieve object's name */ + if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") } /* end switch */ @@ -3222,7 +3353,7 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") break; } diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 95c3d11..7049930 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -162,9 +162,10 @@ typedef enum H5VL_link_specific_t { /* types for object GET callback */ typedef enum H5VL_object_get_t { - H5VL_REF_GET_NAME, /* object name */ + H5VL_REF_GET_NAME, /* object name, for reference */ H5VL_REF_GET_REGION, /* dataspace of region */ - H5VL_REF_GET_TYPE /* type of object */ + H5VL_REF_GET_TYPE, /* type of object */ + H5VL_ID_GET_NAME /* object name, for hid_t */ } H5VL_object_get_t; /* types for object SPECIFIC callback */ diff --git a/src/H5trace.c b/src/H5trace.c index 797130e..de63c4c 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2893,6 +2893,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_REF_GET_NAME: HDfprintf(out, "H5VL_REF_GET_NAME"); break; + case H5VL_ID_GET_NAME: + HDfprintf(out, "H5VL_ID_GET_NAME"); + break; default: HDfprintf(out, "%ld", (long)get); break; -- cgit v0.12 From ba609275d8874a8681f8f077cfac33b3b516c41f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 12 Nov 2018 11:52:46 -0600 Subject: Fix target depends --- src/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 376260e..0bf433d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -956,12 +956,19 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) else () add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) + add_custom_target (gen_H5Tinit ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp" "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" + DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp + ) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) endif () endif () -- cgit v0.12 From a442ce607b10304e48edf5ff114cf17e87fd834a Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 12 Nov 2018 12:13:18 -0600 Subject: Fix a few error messages --- src/H5VLcallback.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 557105a..52d1296 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -1620,7 +1620,7 @@ H5VL__dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1653,7 +1653,7 @@ H5VL_dataset_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed") done: /* Reset object wrapping info in API context */ @@ -5092,7 +5092,7 @@ H5VL__datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t /* Call the corresponding VOL callback */ if(NULL == (ret_value = (cls->datatype_cls.open)(obj, loc_params, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5125,7 +5125,7 @@ H5VL_datatype_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, /* Call the corresponding internal VOL routine */ if(NULL == (ret_value = H5VL__datatype_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed") done: /* Reset object wrapping info in API context */ -- cgit v0.12 From 17f9cb41583a1f7195337791852214d02c24a005 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 12 Nov 2018 12:14:25 -0600 Subject: Switch tool error output to match VOL changes within library --- tools/test/h5dump/errfiles/filter_fail.err | 17 ++++---- tools/test/h5dump/errfiles/tall-1.err | 23 ++++++----- tools/test/h5dump/errfiles/tall-2A.err | 23 ++++++----- tools/test/h5dump/errfiles/tall-2A0.err | 23 ++++++----- tools/test/h5dump/errfiles/tall-2B.err | 23 ++++++----- tools/test/h5dump/errfiles/tarray1_big.err | 27 ++++++++----- tools/test/h5dump/errfiles/tattr-3.err | 9 +++-- tools/test/h5dump/errfiles/tattrregR.err | 18 ++++++--- tools/test/h5dump/errfiles/tcomp-3.err | 17 ++++---- tools/test/h5dump/errfiles/tdataregR.err | 18 ++++++--- tools/test/h5dump/errfiles/tdset-2.err | 30 ++++++++------ tools/test/h5dump/errfiles/textlink.err | 46 ++++++++++++---------- tools/test/h5dump/errfiles/textlinkfar.err | 37 +++++++++-------- tools/test/h5dump/errfiles/textlinksrc.err | 37 +++++++++-------- tools/test/h5dump/errfiles/tgroup-2.err | 17 ++++---- tools/test/h5dump/errfiles/torderlinks1.err | 23 ++++++----- tools/test/h5dump/errfiles/torderlinks2.err | 23 ++++++----- tools/test/h5dump/errfiles/tperror.err | 30 ++++++++------ tools/test/h5dump/errfiles/tslink-D.err | 21 +++++----- ...h5repack_layout.h5-dset2_chunk_20x10-errstk.tst | 29 ++++++++------ 20 files changed, 286 insertions(+), 205 deletions(-) diff --git a/tools/test/h5dump/errfiles/filter_fail.err b/tools/test/h5dump/errfiles/filter_fail.err index f6d38b1..07b0aa0 100644 --- a/tools/test/h5dump/errfiles/filter_fail.err +++ b/tools/test/h5dump/errfiles/filter_fail.err @@ -2,25 +2,28 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dread(): can't read data major: Dataset minor: Read failed - #001: (file name) line (number) in H5VL_dataset_read(): read failed + #001: (file name) line (number) in H5VL_dataset_read(): dataset read failed major: Virtual Object Layer minor: Read failed - #002: (file name) line (number) in H5VL__native_dataset_read(): can't read data + #002: (file name) line (number) in H5VL__dataset_read(): dataset read failed + major: Virtual Object Layer + minor: Read failed + #003: (file name) line (number) in H5VL__native_dataset_read(): can't read data major: Dataset minor: Read failed - #003: (file name) line (number) in H5D__read(): can't read data + #004: (file name) line (number) in H5D__read(): can't read data major: Dataset minor: Read failed - #004: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk + #005: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk major: Low-level I/O minor: Read failed - #005: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed + #006: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed major: Dataset minor: Filter operation failed - #006: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered + #007: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered major: Data filters minor: Read failed - #007: (file name) line (number) in H5PL_load(): filter plugins disabled + #008: (file name) line (number) in H5PL_load(): filter plugins disabled major: Plugin for dynamically loaded library minor: Unable to load metadata into cache h5dump error: unable to print data diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index faa0c50..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index faa0c50..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index faa0c50..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index faa0c50..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tarray1_big.err b/tools/test/h5dump/errfiles/tarray1_big.err index c008c06..ff22495 100644 --- a/tools/test/h5dump/errfiles/tarray1_big.err +++ b/tools/test/h5dump/errfiles/tarray1_big.err @@ -2,39 +2,48 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tattr-3.err b/tools/test/h5dump/errfiles/tattr-3.err index 2df0b01..8481acf 100644 --- a/tools/test/h5dump/errfiles/tattr-3.err +++ b/tools/test/h5dump/errfiles/tattr-3.err @@ -5,13 +5,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_attr_open(): attribute open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_attr_open(): unable to open attribute: 'attr' + #002: (file name) line (number) in H5VL__attr_open(): attribute open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_attr_open(): unable to open attribute: 'attr' major: Attribute minor: Can't open object - #003: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' + #004: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' major: Attribute minor: Can't open object - #004: (file name) line (number) in H5O__attr_open_by_name(): can't locate attribute: 'attr' + #005: (file name) line (number) in H5O__attr_open_by_name(): can't locate attribute: 'attr' major: Attribute minor: Object not found h5dump error: unable to open attribute "attr" diff --git a/tools/test/h5dump/errfiles/tattrregR.err b/tools/test/h5dump/errfiles/tattrregR.err index bd57b22..8a1539c 100644 --- a/tools/test/h5dump/errfiles/tattrregR.err +++ b/tools/test/h5dump/errfiles/tattrregR.err @@ -2,26 +2,32 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tcomp-3.err b/tools/test/h5dump/errfiles/tcomp-3.err index 5601cb9..fc59b0b 100644 --- a/tools/test/h5dump/errfiles/tcomp-3.err +++ b/tools/test/h5dump/errfiles/tcomp-3.err @@ -2,24 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Topen2(): unable to open named datatype major: Datatype minor: Can't open object - #001: (file name) line (number) in H5VL_datatype_open(): open failed + #001: (file name) line (number) in H5VL_datatype_open(): datatype open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_datatype_open(): unable to open named datatype + #002: (file name) line (number) in H5VL__datatype_open(): datatype open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_datatype_open(): unable to open named datatype major: Datatype minor: Can't open object - #003: (file name) line (number) in H5T__open_name(): not found + #004: (file name) line (number) in H5T__open_name(): not found major: Datatype minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #007: (file name) line (number) in H5G__loc_find_cb(): object '#6632' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object '#6632' doesn't exist major: Symbol table minor: Object not found diff --git a/tools/test/h5dump/errfiles/tdataregR.err b/tools/test/h5dump/errfiles/tdataregR.err index bd57b22..8a1539c 100644 --- a/tools/test/h5dump/errfiles/tdataregR.err +++ b/tools/test/h5dump/errfiles/tdataregR.err @@ -2,26 +2,32 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to dereference object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err index 1fd7edb..2d70b35 100644 --- a/tools/test/h5dump/errfiles/tdset-2.err +++ b/tools/test/h5dump/errfiles/tdset-2.err @@ -5,44 +5,50 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset + #002: (file name) line (number) in H5VL__dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset major: Dataset minor: Can't open object - #003: (file name) line (number) in H5D__open_name(): not found + #004: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #007: (file name) line (number) in H5G__loc_find_cb(): object 'dset3' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object 'dset3' doesn't exist major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5VL_link_get(): get failed + #001: (file name) line (number) in H5VL_link_get(): link get failed major: Virtual Object Layer minor: Can't get value - #002: (file name) line (number) in H5VL__native_link_get(): unable to get link info + #002: (file name) line (number) in H5VL__link_get(): link get failed + major: Virtual Object Layer + minor: Can't get value + #003: (file name) line (number) in H5VL__native_link_get(): unable to get link info major: Links minor: Object not found - #003: (file name) line (number) in H5L_get_info(): name doesn't exist + #004: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #006: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #007: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "dset3" diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index abeef52..aaf3144 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -2,67 +2,73 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' major: File accessibility minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err index 43ab092..8245291 100644 --- a/tools/test/h5dump/errfiles/textlinkfar.err +++ b/tools/test/h5dump/errfiles/textlinkfar.err @@ -2,55 +2,58 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open object + #010: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #010: (file name) line (number) in H5O_open_name(): object not found + #011: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #011: (file name) line (number) in H5G_loc_find(): can't find object + #012: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G_traverse(): internal path traversal failed + #013: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #013: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #014: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #015: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #015: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #016: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #016: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #017: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #017: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #018: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err index 43ab092..8245291 100644 --- a/tools/test/h5dump/errfiles/textlinksrc.err +++ b/tools/test/h5dump/errfiles/textlinksrc.err @@ -2,55 +2,58 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open object + #010: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #010: (file name) line (number) in H5O_open_name(): object not found + #011: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #011: (file name) line (number) in H5G_loc_find(): can't find object + #012: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G_traverse(): internal path traversal failed + #013: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #013: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #014: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #015: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #015: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #016: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #016: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #017: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #017: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #018: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tgroup-2.err b/tools/test/h5dump/errfiles/tgroup-2.err index 6ffb426..27557f3 100644 --- a/tools/test/h5dump/errfiles/tgroup-2.err +++ b/tools/test/h5dump/errfiles/tgroup-2.err @@ -2,25 +2,28 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Gopen2(): unable to open group major: Symbol table minor: Can't open object - #001: (file name) line (number) in H5VL_group_open(): open failed + #001: (file name) line (number) in H5VL_group_open(): group open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_group_open(): unable to open group + #002: (file name) line (number) in H5VL__group_open(): group open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_group_open(): unable to open group major: Symbol table minor: Can't open object - #003: (file name) line (number) in H5G__open_name(): group not found + #004: (file name) line (number) in H5G__open_name(): group not found major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #007: (file name) line (number) in H5G__loc_find_cb(): object 'y' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object 'y' doesn't exist major: Symbol table minor: Object not found h5dump error: unable to open group "/y" diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index cd47d90..ce31ced 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index cd47d90..ce31ced 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err index cf4127d..b0b908b 100644 --- a/tools/test/h5dump/errfiles/tperror.err +++ b/tools/test/h5dump/errfiles/tperror.err @@ -5,44 +5,50 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset + #002: (file name) line (number) in H5VL__dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset major: Dataset minor: Can't open object - #003: (file name) line (number) in H5D__open_name(): not found + #004: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #007: (file name) line (number) in H5G__loc_find_cb(): object 'bogus' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object 'bogus' doesn't exist major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5VL_link_get(): get failed + #001: (file name) line (number) in H5VL_link_get(): link get failed major: Virtual Object Layer minor: Can't get value - #002: (file name) line (number) in H5VL__native_link_get(): unable to get link info + #002: (file name) line (number) in H5VL__link_get(): link get failed + major: Virtual Object Layer + minor: Can't get value + #003: (file name) line (number) in H5VL__native_link_get(): unable to get link info major: Links minor: Object not found - #003: (file name) line (number) in H5L_get_info(): name doesn't exist + #004: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #006: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #007: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "bogus" diff --git a/tools/test/h5dump/errfiles/tslink-D.err b/tools/test/h5dump/errfiles/tslink-D.err index 6d2be80..e650a33 100644 --- a/tools/test/h5dump/errfiles/tslink-D.err +++ b/tools/test/h5dump/errfiles/tslink-D.err @@ -5,30 +5,33 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset + #002: (file name) line (number) in H5VL__dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset major: Dataset minor: Can't open object - #003: (file name) line (number) in H5D__open_name(): not found + #004: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #009: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #009: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #010: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #010: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #011: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst index 7c01137..4e69148 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst @@ -2,40 +2,43 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): unable to create dataset major: Dataset minor: Unable to initialize object - #001: (file name) line (number) in H5VL_dataset_create(): create failed + #001: (file name) line (number) in H5VL_dataset_create(): dataset create failed major: Virtual Object Layer - minor: Unable to initialize object - #002: (file name) line (number) in H5VL__native_dataset_create(): unable to create dataset + minor: Unable to create file + #002: (file name) line (number) in H5VL__dataset_create(): dataset create failed + major: Virtual Object Layer + minor: Unable to create file + #003: (file name) line (number) in H5VL__native_dataset_create(): unable to create dataset major: Dataset minor: Unable to initialize object - #003: (file name) line (number) in H5D__create_named(): unable to create and link to dataset + #004: (file name) line (number) in H5D__create_named(): unable to create and link to dataset major: Dataset minor: Unable to initialize object - #004: (file name) line (number) in H5L_link_object(): unable to create new link to object + #005: (file name) line (number) in H5L_link_object(): unable to create new link to object major: Links minor: Unable to initialize object - #005: (file name) line (number) in H5L__create_real(): can't insert link + #006: (file name) line (number) in H5L__create_real(): can't insert link major: Links minor: Unable to insert object - #006: (file name) line (number) in H5G_traverse(): internal path traversal failed + #007: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #008: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #008: (file name) line (number) in H5L__link_cb(): unable to create object + #009: (file name) line (number) in H5L__link_cb(): unable to create object major: Links minor: Unable to initialize object - #009: (file name) line (number) in H5O_obj_create(): unable to open object + #010: (file name) line (number) in H5O_obj_create(): unable to open object major: Object header minor: Can't open object - #010: (file name) line (number) in H5O__dset_create(): unable to create dataset + #011: (file name) line (number) in H5O__dset_create(): unable to create dataset major: Dataset minor: Unable to initialize object - #011: (file name) line (number) in H5D__create(): unable to construct layout information + #012: (file name) line (number) in H5D__create(): unable to construct layout information major: Dataset minor: Unable to initialize object - #012: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace + #013: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace major: Dataset minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): -- cgit v0.12 From 7e204759f861f4f482db2032127a4dc406fcd1d6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 12 Nov 2018 12:26:11 -0600 Subject: Fix generate file commands --- src/CMakeLists.txt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0bf433d..31a38be 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -947,13 +947,12 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY ) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp COMMAND ${HDF5_BATCH_CMD} ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) else () add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp @@ -962,15 +961,15 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) - add_custom_target (gen_H5Tinit ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp" "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" - DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp - ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) endif () + add_custom_target (gen_H5Tinit ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp" "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" + DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) endif () if (BUILD_SHARED_LIBS) add_custom_command ( -- cgit v0.12 From ef29549f0d66612fcdeefc763785c6826c67ad8b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 12 Nov 2018 13:31:10 -0800 Subject: Updated the Java tests so that they don't fail when the error stack changes. --- java/test/TestH5E.java | 28 +++++++------ java/test/TestH5Edefault.java | 92 ++++++++++++++++++++++++------------------- java/test/junit.sh.in | 85 +++++++++++++++++++-------------------- 3 files changed, 107 insertions(+), 98 deletions(-) diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 542a092..fd015c0 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -38,9 +38,6 @@ import org.junit.rules.TestName; public class TestH5E { @Rule public TestName testname = new TestName(); - public static final int ERRSTACK_CNT = 6; - public static final int ERRSTACK_MTY_CNT = 0; - long hdf_java_classid = -1; long current_stackid = -1; @@ -130,6 +127,10 @@ public class TestH5E { @Test public void testH5Epop() { + + long num_msg = -1; + long saved_num_msg = -1; + try { H5.H5Eset_current_stack(current_stackid); } @@ -144,7 +145,7 @@ public class TestH5E { catch (Throwable err) { } - // save current stack contents + // Save current stack contents try { current_stackid = H5.H5Eget_current_stack(); } @@ -153,7 +154,6 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - long num_msg = -1; try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -162,7 +162,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Epop #:" + num_msg, num_msg == 0); try { num_msg = H5.H5Eget_num(current_stackid); @@ -172,8 +172,9 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT); + assertTrue("H5.H5Epop #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; try { H5.H5Epop(current_stackid, 1); } @@ -190,7 +191,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop", num_msg == TestH5E.ERRSTACK_CNT - 1); + assertTrue("H5.H5Epop", num_msg == saved_num_msg - 1); } @Test @@ -231,7 +232,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT); + assertTrue("testH5Epush #:" + num_msg, num_msg == 0); } catch (Throwable err) { err.printStackTrace(); @@ -242,7 +243,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT + 1); + assertTrue("testH5Epush #:" + num_msg, num_msg == 1); } catch (Throwable err) { err.printStackTrace(); @@ -302,7 +303,7 @@ public class TestH5E { catch (Throwable err) { } - // save current stack contents + // Save current stack contents try { current_stackid = H5.H5Eget_current_stack(); } @@ -318,7 +319,7 @@ public class TestH5E { err.printStackTrace(); fail("testH5Ewalk:H5Eget_num " + err); } - assertTrue("testH5Ewalk #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT); + assertTrue("testH5Ewalk #:" + num_msg, num_msg > 0); try { H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); @@ -328,7 +329,8 @@ public class TestH5E { fail("testH5Ewalk:H5Ewalk2 " + err); } assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty()); - assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==TestH5E.ERRSTACK_CNT); + assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size() > 0); } } + diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 4676205..591793f 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -30,7 +30,6 @@ public class TestH5Edefault { @Rule public TestName testname = new TestName(); public static final int ERRSTACK_CNT = 6; - public static final int ERRSTACK_MTY_CNT = 0; @Before public void H5Eset_default_stack() { @@ -76,6 +75,7 @@ public class TestH5Edefault { public void testH5Eget_current_stack() { long num_msg = -1; long num_msg_default = -1; + long saved_num_msg = -1; long stack_id = -1; long stack_id_default = HDF5Constants.H5E_DEFAULT; try { @@ -86,7 +86,7 @@ public class TestH5Edefault { stack_id_default = HDF5Constants.H5E_DEFAULT; //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have messages on the error stack try { num_msg_default = H5.H5Eget_num(stack_id_default); } @@ -94,9 +94,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg_default; - //Save a copy of the current stack and clears the current stack + // Save a copy of the current stack and clear the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -107,7 +108,7 @@ public class TestH5Edefault { assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0); assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == stack_id_default); - // Verify we have the correct number of messages + // Verify the default stack is empty try { num_msg_default = H5.H5Eget_num(stack_id_default); } @@ -117,7 +118,7 @@ public class TestH5Edefault { } assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0); - //Verify the copy has the correct number of messages + // Verify the copy has the same number of messages as the original try { num_msg = H5.H5Eget_num(stack_id); } @@ -125,7 +126,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); try { H5.H5Eclose_stack(stack_id); @@ -140,6 +141,7 @@ public class TestH5Edefault { public void testH5Eget_current_stack_pop() { long num_msg = -1; long num_msg_default = -1; + long saved_num_msg = -1; long stack_id = -1; try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); @@ -148,7 +150,7 @@ public class TestH5Edefault { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify there are error messages on the stack and save it try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -156,9 +158,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg_default; - //Save a copy of the current stack and clears the current stack + // Save a copy of the current stack and clear the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -169,7 +172,7 @@ public class TestH5Edefault { assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0); assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); - // Verify we have the correct number of messages + // Verify the stack is empty try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -177,9 +180,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0); - //Verify the copy has the correct number of messages + // Verify the copy has the correct number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -187,9 +190,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Generate errors on default stack + // Generate errors on default stack try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } @@ -197,7 +200,7 @@ public class TestH5Edefault { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have a nonzero number of messages and save it try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -205,9 +208,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg; - //Remove one message from the current stack + // Remove one message from the current stack try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -216,9 +220,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT - 1); + assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == saved_num_msg - 1); - //Verify the copy still has the correct number of messages + // Verify the copy still has the old number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -226,7 +230,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); } @Test(expected = IllegalArgumentException.class) @@ -281,6 +285,9 @@ public class TestH5Edefault { public void testH5Eset_current_stack() { long num_msg = -1; long stack_id = -1; + long saved_num_msg = -1; + + // Generate errors on the default stack try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } @@ -288,7 +295,7 @@ public class TestH5Edefault { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have a nonzero number of messages and save it try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -296,9 +303,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; - //Save a copy of the current stack + // Save a copy of the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -309,7 +317,7 @@ public class TestH5Edefault { assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id < 0); assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); - //Verify the copy has the correct number of messages + // Verify the copy has the same number of messages as the original stack try { num_msg = H5.H5Eget_num(stack_id); } @@ -317,9 +325,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Generate errors on default stack + // Generate errors on default stack (again, in the same way) try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } @@ -327,7 +335,7 @@ public class TestH5Edefault { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have the same number of messages as before try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -335,9 +343,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Remove one message from the current stack + // Remove one message from the current stack try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -346,9 +354,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1); + assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == saved_num_msg - 1); - //Verify the copy still has the correct number of messages + // Verify the copy still has the correct number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -356,8 +364,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); + // Se the current stack to be the default and try that again try { H5.H5Eset_current_stack(stack_id); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -366,7 +375,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == saved_num_msg); } @Test(expected = IllegalArgumentException.class) @@ -377,6 +386,7 @@ public class TestH5Edefault { @Test public void testH5Epop() throws Throwable { long num_msg = -1; + long saved_num_msg = -1; try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } @@ -389,7 +399,8 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Epop before #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -398,7 +409,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1); + assertTrue("H5.H5Epop after #:" + num_msg, num_msg == saved_num_msg - 1); } @Test(expected = IllegalArgumentException.class) @@ -474,7 +485,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eclear2_with_msg: " + err); } - assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg > 0); try { H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -483,7 +494,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eclear2_with_msg: " + err); } - assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0); } @Test(expected = IllegalArgumentException.class) @@ -519,7 +530,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_num: " + err); } - assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == 0); } @Test @@ -537,7 +548,8 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_num_with_msg: " + err); } - assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > TestH5Edefault.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0); } } + diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 02d0147..350fb7b 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -1010,53 +1010,48 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Z.txt JUnit-TestH5Z.out |sed 's/^/ /' fi -if test "X-$BUILD_MODE" = "X-production" ; then - if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" - TESTING JUnit-TestH5E - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) - - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - JUnit-TestH5E.ext > JUnit-TestH5E.out - - if diff JUnit-TestH5E.out JUnit-TestH5E.txt > /dev/null; then - echo " PASSED JUnit-TestH5E" - else - echo "**FAILED** JUnit-TestH5E" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF JUnit-TestH5E.txt JUnit-TestH5E.out |sed 's/^/ /' - fi - fi +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" +TESTING JUnit-TestH5E +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) - if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" - TESTING JUnit-TestH5Edefault - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) - - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out - - if diff JUnit-TestH5Edefault.out JUnit-TestH5Edefault.txt > /dev/null; then - echo " PASSED JUnit-TestH5Edefault" - else - echo "**FAILED** JUnit-TestH5Edefault" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF JUnit-TestH5Edefault.txt JUnit-TestH5Edefault.out |sed 's/^/ /' - fi - fi +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5E.ext > JUnit-TestH5E.out + +if diff JUnit-TestH5E.out JUnit-TestH5E.txt > /dev/null; then + echo " PASSED JUnit-TestH5E" +else + echo "**FAILED** JUnit-TestH5E" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5E.txt JUnit-TestH5E.out |sed 's/^/ /' fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" +TESTING JUnit-TestH5Edefault +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) + +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out + +if diff JUnit-TestH5Edefault.out JUnit-TestH5Edefault.txt > /dev/null; then + echo " PASSED JUnit-TestH5Edefault" +else + echo "**FAILED** JUnit-TestH5Edefault" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5Edefault.txt JUnit-TestH5Edefault.out |sed 's/^/ /' +fi + if test $USE_FILTER_SZIP = "yes"; then echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate" TESTING JUnit-TestH5Giterate -- cgit v0.12 From 110c1b671ea7f2f5e8154d66f6ca6fcfb00b2bb2 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 13 Nov 2018 07:45:56 -0800 Subject: The Java tests will no longer fail when the zlib is not present. --- java/test/TestH5Z.java | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java index 31adf22..f3049ed 100644 --- a/java/test/TestH5Z.java +++ b/java/test/TestH5Z.java @@ -41,8 +41,8 @@ public class TestH5Z { @Test public void testH5Zfilter_avail() { try { - int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); - assertTrue("H5.H5Zfilter_avail_DEFLATE", filter_found > 0); + int filter_found; + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_FLETCHER32); assertTrue("H5.H5Zfilter_avail_FLETCHER32", filter_found > 0); filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_NBIT); @@ -51,8 +51,12 @@ public class TestH5Z { assertTrue("H5.H5Zfilter_avail_SCALEOFFSET", filter_found > 0); filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); assertTrue("H5.H5Zfilter_avail_SHUFFLE", filter_found > 0); -// filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); -// assertTrue("H5.H5Zfilter_avail_SZIP", filter_found > 0); + + // Just make sure H5Zfilter_avail() doesn't fail with szip/zlib + // since there is no way for us to determine if they should be present + // or not. + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); } catch (Throwable err) { err.printStackTrace(); @@ -63,9 +67,8 @@ public class TestH5Z { @Test public void testH5Zget_filter_info() { try { - int filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); - assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); - assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + int filter_flag; + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32); assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); @@ -78,9 +81,19 @@ public class TestH5Z { filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE); assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); -// filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); -// assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); -// assertTrue("H5.H5Zget_filter_info_ENCODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + + if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE)) { + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + } + + if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP)) { + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); + // Decode should always be available, but we have no way of determining + // if encode is so don't assert on that. + assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + } } catch (Throwable err) { err.printStackTrace(); @@ -96,3 +109,4 @@ public class TestH5Z { H5.H5Zunregister(HDF5Constants.H5Z_FILTER_SHUFFLE); } } + -- cgit v0.12 From 2fe10c647c003eaba2f84d52daaae23c3341916a Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Tue, 13 Nov 2018 11:37:29 -0600 Subject: HDFFV10601: Adding performance test to verify the improvement. --- tools/test/perform/CMakeLists.txt | 10 ++ tools/test/perform/Makefile.am | 4 +- tools/test/perform/chunk_cache.c | 361 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 373 insertions(+), 2 deletions(-) create mode 100644 tools/test/perform/chunk_cache.c diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index fa41608..14abdec 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -51,6 +51,16 @@ TARGET_C_PROPERTIES (iopipe STATIC) target_link_libraries (iopipe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (iopipe PROPERTIES FOLDER perform) +#-- Adding test for chunk_cache +set (chunk_cache_SOURCES + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk_cache.c +) +add_executable (chunk_cache ${chunk_cache_SOURCES}) +target_include_directories(chunk_cache PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +TARGET_C_PROPERTIES (chunk_cache STATIC) +target_link_libraries (chunk_cache PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +set_target_properties (chunk_cache PROPERTIES FOLDER perform) + #-- Adding test for overhead set (overhead_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c diff --git a/tools/test/perform/Makefile.am b/tools/test/perform/Makefile.am index 5a89a66..39800d7 100644 --- a/tools/test/perform/Makefile.am +++ b/tools/test/perform/Makefile.am @@ -50,12 +50,12 @@ if BUILD_PARALLEL_CONDITIONAL TEST_PROG_PARA=h5perf perf endif # Serial test programs. -TEST_PROG = iopipe chunk overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS) +TEST_PROG = iopipe chunk chunk_cache overhead zip_perf perf_meta h5perf_serial $(BUILD_ALL_PROGS) # check_PROGRAMS will be built but not installed. Do not any executable # that is in bin_PROGRAMS already. Otherwise, it will be removed twice in # "make clean" and some systems, e.g., AIX, do not like it. -check_PROGRAMS= iopipe chunk overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf +check_PROGRAMS= iopipe chunk chunk_cache overhead zip_perf perf_meta $(BUILD_ALL_PROGS) perf h5perf_SOURCES=pio_perf.c pio_engine.c h5perf_serial_SOURCES=sio_perf.c sio_engine.c diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c new file mode 100644 index 0000000..9a6315a --- /dev/null +++ b/tools/test/perform/chunk_cache.c @@ -0,0 +1,361 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://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: check the performance of chunk cache in these two cases (HDFFV-10601): + * 1. partial chunks exist along any dimension. + * 2. number of slots in chunk cache is smaller than the number of chunks + * in the fastest-growing dimension. + */ +#include +#include "hdf5.h" + +#define FILENAME "chunk_cache_perf.h5" + +#define RANK 2 + +#define DSET1_NAME "partial_chunks" +#define DSET1_DIM1 9 * 1000 +#define DSET1_DIM2 9 +#define CHUNK1_DIM1 2 * 1000 +#define CHUNK1_DIM2 2 + +#define DSET2_NAME "hash_value" +#define DSET2_DIM1 300 +#define DSET2_DIM2 600 +#define CHUNK2_DIM1 100 +#define CHUNK2_DIM2 100 + +#define RDCC_NSLOTS 5 +#define RDCC_NBYTES 1024 * 1024 * 10 +#define RDCC_W0 0.75F + +#define FILTER_COUNTER 306 +static size_t nbytes_global; + +typedef struct test_time_t { + long tv_sec; + long tv_usec; +} test_time_t; + +/* Local function prototypes for the dummy filter */ +static size_t +counter (unsigned flags, size_t cd_nelmts, + const unsigned *cd_values, size_t nbytes, + size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_COUNTER[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + FILTER_COUNTER, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "counter", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + counter, /* The actual filter function */ +}}; + +/*------------------------------------------------------------------------- + * Count number of bytes but don't do anything else. Keep + * track of the data of chunks being read from file into memory. + */ +static size_t +counter (unsigned flags, size_t cd_nelmts, + const unsigned *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + nbytes_global += nbytes; + return nbytes; +} + +/*---------------------------------------------------------------------------*/ +static int +test_time_get_current(test_time_t *tv) +{ + struct timespec tp; + + if (!tv) + return -1; + if (clock_gettime(CLOCK_MONOTONIC, &tp)) + return -1; + + tv->tv_sec = tp.tv_sec; + tv->tv_usec = tp.tv_nsec / 1000; + + return 0; +} + +/*---------------------------------------------------------------------------*/ +static double +test_time_to_double(test_time_t tv) +{ + return (double) tv.tv_sec + (double) (tv.tv_usec) * 0.000001; +} + +/*---------------------------------------------------------------------------*/ +static test_time_t +test_time_add(test_time_t in1, test_time_t in2) +{ + test_time_t out; + + out.tv_sec = in1.tv_sec + in2.tv_sec; + out.tv_usec = in1.tv_usec + in2.tv_usec; + if(out.tv_usec > 1000000) { + out.tv_usec -= 1000000; + out.tv_sec += 1; + } + + return out; +} + +/*---------------------------------------------------------------------------*/ +static test_time_t +test_time_subtract(test_time_t in1, test_time_t in2) +{ + test_time_t out; + + out.tv_sec = in1.tv_sec - in2.tv_sec; + out.tv_usec = in1.tv_usec - in2.tv_usec; + if(out.tv_usec < 0) { + out.tv_usec += 1000000; + out.tv_sec -= 1; + } + + return out; +} + +/*------------------------------------------------------------------------------- + * Create a chunked dataset with partial chunks along either dimensions: + * dataset dimension: 9000 x 9 + * chunk dimension: 2000 x 2 + */ +static void create_dset1(hid_t file) +{ + hid_t dataspace, dataset; + hid_t dcpl; + hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2}; + herr_t status; + hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2}; + int data[DSET1_DIM1][DSET1_DIM2]; /* data for writing */ + int i, j; + + /* Create the data space. */ + dataspace = H5Screate_simple (RANK, dims, NULL); + + /* Modify dataset creation properties, i.e. enable chunking */ + dcpl = H5Pcreate (H5P_DATASET_CREATE); + status = H5Pset_chunk (dcpl, RANK, chunk_dims); + + /* Set the dummy filter simply for counting the number of bytes being read into the memory */ + H5Zregister(H5Z_COUNTER); + H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL); + + /* Create a new dataset within the file using chunk creation properties. */ + dataset = H5Dcreate2 (file, DSET1_NAME, H5T_NATIVE_INT, dataspace, + H5P_DEFAULT, dcpl, H5P_DEFAULT); + + for (i = 0; i < DSET1_DIM1; i++) + for (j = 0; j < DSET1_DIM2; j++) + data[i][j] = i+j; + + /* Write data to dataset */ + status = H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, data); + + /* Close resources */ + status = H5Dclose (dataset); + status = H5Pclose (dcpl); + status = H5Sclose (dataspace); +} + +/*--------------------------------------------------------------------------- + * Create a chunked dataset for testing hash values: + * dataset dimensions: 300 x 600 + * chunk dimensions: 100 x 100 + */ +static void create_dset2(hid_t file) +{ + hid_t dataspace, dataset; + hid_t dcpl; + hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2}; + herr_t status; + hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2}; + int data[DSET2_DIM1][DSET2_DIM2]; /* data for writing */ + int i, j; + + /* Create the data space. */ + dataspace = H5Screate_simple (RANK, dims, NULL); + + /* Modify dataset creation properties, i.e. enable chunking */ + dcpl = H5Pcreate (H5P_DATASET_CREATE); + status = H5Pset_chunk (dcpl, RANK, chunk_dims); + + /* Set the dummy filter simply for counting the number of bytes being read into the memory */ + H5Zregister(H5Z_COUNTER); + H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL); + + /* Create a new dataset within the file using chunk creation properties. */ + dataset = H5Dcreate2 (file, DSET2_NAME, H5T_NATIVE_INT, dataspace, + H5P_DEFAULT, dcpl, H5P_DEFAULT); + + for (i = 0; i < DSET2_DIM1; i++) + for (j = 0; j < DSET2_DIM2; j++) + data[i][j] = i+j; + + /* Write data to dataset */ + status = H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, data); + + /* Close resources */ + status = H5Dclose (dataset); + status = H5Pclose (dcpl); + status = H5Sclose (dataspace); +} +/*--------------------------------------------------------------------------- + * Check the performance of the chunk cache when partial chunks exist + * along the dataset dimensions. + */ +static void check_partial_chunks_perf(hid_t file) +{ + hid_t dataset; + hid_t filespace; + hid_t memspace; + hid_t dapl; + + herr_t status; + int rdata[DSET1_DIM2]; /* data for reading */ + int i; + + hsize_t row_rank = 1; + hsize_t row_dim[1] = {DSET1_DIM2}; + hsize_t start[RANK] = {0, 0}; + hsize_t count[RANK] = {1, DSET1_DIM2}; + test_time_t t = {0, 0}, t1 = {0, 0}, t2 = {0, 0}; + + dapl = H5Pcreate(H5P_DATASET_ACCESS); + status = H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0); + + dataset = H5Dopen2 (file, DSET1_NAME, dapl); + + memspace = H5Screate_simple(row_rank, row_dim, NULL); + filespace = H5Dget_space(dataset); + + nbytes_global = 0; + + test_time_get_current(&t1); + + /* Read the data row by row */ + for(i = 0; i < DSET1_DIM1; i++) { + start[0] = i; + status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, + start, NULL, count, NULL); + + status = H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, rdata); + } + + test_time_get_current(&t2); + t = test_time_add(t, test_time_subtract(t2, t1)); + + printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", test_time_to_double(t), nbytes_global); + + status = H5Dclose (dataset); + status = H5Sclose (filespace); + status = H5Sclose (memspace); + status = H5Pclose (dapl); +} + +/*--------------------------------------------------------------------------- + * Check the performance of chunk cache when the number of cache slots + * is smaller than the number of chunks along the fastest-growing + * dimension of the dataset. + */ +static void check_hash_value_perf(hid_t file) +{ + hid_t dataset; + hid_t filespace; + hid_t memspace; + hid_t dapl; + + herr_t status; + int rdata[DSET2_DIM1]; /* data for reading */ + int i; + + hsize_t column_rank = 1; + hsize_t column_dim[1] = {DSET2_DIM1}; + hsize_t start[RANK] = {0, 0}; + hsize_t count[RANK] = {DSET2_DIM1, 1}; + test_time_t t = {0, 0}, t1 = {0, 0}, t2 = {0, 0}; + + dapl = H5Pcreate(H5P_DATASET_ACCESS); + status = H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0); + + dataset = H5Dopen2 (file, DSET2_NAME, dapl); + + memspace = H5Screate_simple(column_rank, column_dim, NULL); + filespace = H5Dget_space(dataset); + + nbytes_global = 0; + + test_time_get_current(&t1); + + /* Read the data column by column */ + for(i = 0; i < DSET2_DIM2; i++) { + start[1] = i; + status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, + start, NULL, count, NULL); + + status = H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, rdata); + } + + test_time_get_current(&t2); + t = test_time_add(t, test_time_subtract(t2, t1)); + + printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", test_time_to_double(t), nbytes_global); + + status = H5Dclose (dataset); + status = H5Sclose (filespace); + status = H5Sclose (memspace); + status = H5Pclose (dapl); +} + +/*------------------------------------------------------------------------------------- + * Purpose: check the performance of chunk cache in these two cases (HDFFV-10601): + * 1. partial chunks exist along any dimension. + * 2. number of slots in chunk cache is smaller than the number of chunks + * in the fastest-growing dimension. + *-------------------------------------------------------------------------------------*/ +int +main (void) +{ + hid_t file; /* handles */ + + /* Create a new file. If file exists its contents will be overwritten. */ + file = H5Fcreate (FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + create_dset1(file); + create_dset2(file); + + H5Fclose (file); + + /* Re-open the file for testing performance. */ + file = H5Fopen (FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + + check_partial_chunks_perf(file); + check_hash_value_perf(file); + + H5Fclose (file); + + return 0; +} -- cgit v0.12 From 6cbd463d411ebbd621adfb92034c434d41d9a58a Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 14 Nov 2018 11:19:28 -0600 Subject: Add script and changes to wait for H5Tinit.c Add more sample batch scripts, specifically for sbatch, not for knl cross compile. Don't run parallel tests when no parallel test script is configured in HDF5options.cmake. --- MANIFEST | 5 + bin/batch/knl_ctestP.sl | 18 + bin/batch/knl_ctestS.sl | 17 + bin/batch/sbatch_ctestP.sl | 17 + bin/batch/sbatch_ctestS.sl | 16 + bin/batch/sbatch_ctestSP.sl | 3 - config/cmake/scripts/CTestScript.cmake | 609 +++++++++++++++++--------------- config/cmake/scripts/wait_H5Tinit.cmake | 10 + src/CMakeLists.txt | 25 +- 9 files changed, 416 insertions(+), 304 deletions(-) create mode 100644 bin/batch/knl_ctestP.sl create mode 100644 bin/batch/knl_ctestS.sl create mode 100644 bin/batch/sbatch_ctestP.sl create mode 100644 bin/batch/sbatch_ctestS.sl create mode 100755 config/cmake/scripts/wait_H5Tinit.cmake diff --git a/MANIFEST b/MANIFEST index e586b3b..e8ab7fe 100644 --- a/MANIFEST +++ b/MANIFEST @@ -92,8 +92,12 @@ ./bin/timekeeper _DO_NOT_DISTRIBUTE_ ./bin/trace ./bin/yodconfigure +./bin/batch/knl_ctestP.sl +./bin/batch/knl_ctestS.sl ./bin/batch/knl_ctestSP.sl ./bin/batch/knl_H5detect.sl.in.cmake +./bin/batch/sbatch_ctestS.sl +./bin/batch/sbatch_ctestP.sl ./bin/batch/sbatch_ctestSP.sl ./bin/pkgscrpts/h5rmflags _DO_NOT_DISTRIBUTE_ ./bin/pkgscrpts/makeHDF5BinaryTarfiles.pl _DO_NOT_DISTRIBUTE_ @@ -3323,6 +3327,7 @@ ./config/cmake/scripts/CTestScript.cmake ./config/cmake/scripts/HDF5config.cmake ./config/cmake/scripts/HDF5options.cmake +./config/cmake/scripts/wait_H5Tinit.cmake # Files generated by autogen ./aclocal.m4 diff --git a/bin/batch/knl_ctestP.sl b/bin/batch/knl_ctestP.sl new file mode 100644 index 0000000..3a03fe2 --- /dev/null +++ b/bin/batch/knl_ctestP.sl @@ -0,0 +1,18 @@ +#!/bin/bash + +#SBATCH -p knl -C quad,flat +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + +cd build +#run parallel tests except t_cache_image test +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" + +echo "Run $CMD. Test output will be in build/ctestP.out" +$CMD >& ctestP.out +echo "Done running $CMD" + diff --git a/bin/batch/knl_ctestS.sl b/bin/batch/knl_ctestS.sl new file mode 100644 index 0000000..5b77c5b --- /dev/null +++ b/bin/batch/knl_ctestS.sl @@ -0,0 +1,17 @@ +#!/bin/bash + +#SBATCH -p knl -C quad,flat +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + +cd build +CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" + +echo "Run $CMD. Test output will be in build/ctestS.out" +$CMD >& ctestS.out +echo "Done running $CMD" + diff --git a/bin/batch/sbatch_ctestP.sl b/bin/batch/sbatch_ctestP.sl new file mode 100644 index 0000000..e967dce --- /dev/null +++ b/bin/batch/sbatch_ctestP.sl @@ -0,0 +1,17 @@ +#!/bin/bash + +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + + +cd build +CMD="ctest . -R TEST_PAR|PH5DIFF|PERFORM -E t_cache_image -C Release -T test" + +echo "Run $CMD. Test output will be in build/ctestP.out" +$CMD >& ctestP.out +echo "Done running $CMD" + diff --git a/bin/batch/sbatch_ctestS.sl b/bin/batch/sbatch_ctestS.sl new file mode 100644 index 0000000..a103356 --- /dev/null +++ b/bin/batch/sbatch_ctestS.sl @@ -0,0 +1,16 @@ +#!/bin/bash + +#SBATCH --nodes=1 +#SBATCH -t 00:30:00 +#SBATCH --mail-type=BEGIN,END,FAIL +##SBATCH --mail-user=@sandia.gov +#SBATCH --export=ALL +#SBATCH --job-name=h5_ctestS + + +cd build +CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" + +echo "Run $CMD. Test output will be in build/ctestS.out" +$CMD >& ctestS.out +echo "Done running $CMD" diff --git a/bin/batch/sbatch_ctestSP.sl b/bin/batch/sbatch_ctestSP.sl index 56da347..5d79d9b 100644 --- a/bin/batch/sbatch_ctestSP.sl +++ b/bin/batch/sbatch_ctestSP.sl @@ -1,6 +1,5 @@ #!/bin/bash -#SBATCH -p knl -C quad,flat #SBATCH --nodes=1 #SBATCH -t 01:00:00 #SBATCH --mail-type=BEGIN,END,FAIL @@ -8,8 +7,6 @@ #SBATCH --export=ALL #SBATCH --job-name=h5_ctestS -module load cmake -module load craype-hugepages4M cd build CMD="ctest . -E TEST_PAR|H5DIFF|PERFORM -C Release -j 32 -T test" diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 43cd48d..fd56ffa 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -9,298 +9,325 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -cmake_minimum_required (VERSION 3.10) -######################################################## -# This dashboard is maintained by The HDF Group -# For any comments please contact cdashhelp@hdfgroup.org -# -######################################################## -# ----------------------------------------------------------- -# -- Get environment -# ----------------------------------------------------------- -if (NOT SITE_OS_NAME) - ## machine name not provided - attempt to discover with uname - ## -- set hostname - ## -------------------------- - find_program (HOSTNAME_CMD NAMES hostname) - exec_program (${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME) - set (CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}") - find_program (UNAME NAMES uname) - macro (getuname name flag) - exec_program ("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") - endmacro () - - getuname (osname -s) - getuname (osrel -r) - getuname (cpu -m) - message (STATUS "Dashboard script uname output: ${osname}-${osrel}-${cpu}\n") - - set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") - if (SITE_BUILDNAME_SUFFIX) - set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}") - endif () - set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}") -else () - ## machine name provided - ## -------------------------- - if (CMAKE_HOST_UNIX) - set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}") - else () - set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}") - endif () - if (SITE_BUILDNAME_SUFFIX) - set (CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}") - endif () - set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") -endif () - -#----------------------------------------------------------------------------- -# MAC machines need special option -#----------------------------------------------------------------------------- -if (APPLE) - # Compiler choice - execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set (ENV{CC} "${XCODE_CC}") - set (ENV{CXX} "${XCODE_CXX}") - - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif () - -#----------------------------------------------------------------------------- -set (NEED_REPOSITORY_CHECKOUT 0) -set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") -if (CTEST_USE_TAR_SOURCE) - ## Uncompress source if tar file provided - ## -------------------------- - if (WIN32) - message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]") - execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) - else () - message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar]") - execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) - endif () - - if (NOT rv EQUAL 0) - message (STATUS "extracting... [error-(${rv}) clean up]") - file (REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") - message (FATAL_ERROR "error: extract of ${CTEST_USE_TAR_SOURCE} failed") - endif () - - file (RENAME ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE} ${CTEST_SOURCE_DIRECTORY}) - set (LOCAL_SKIP_UPDATE "TRUE") -else () - if (LOCAL_UPDATE) - if (CTEST_USE_GIT_SOURCE) - find_program (CTEST_GIT_COMMAND NAMES git git.cmd) - set (CTEST_GIT_UPDATE_OPTIONS) - - if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") - set (NEED_REPOSITORY_CHECKOUT 1) - endif () - - if (${NEED_REPOSITORY_CHECKOUT}) - if (REPOSITORY_BRANCH) - set (CTEST_GIT_options "clone \"${REPOSITORY_URL}\" --branch \"${REPOSITORY_BRANCH}\" --single-branch \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules") - else () - set (CTEST_GIT_options "clone \"${REPOSITORY_URL}\" \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules") - endif () - set (CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} ${CTEST_GIT_options}") - else () - set (CTEST_GIT_options "pull") - endif () - set (CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}") - else () - ## -------------------------- - ## use subversion to get source - #----------------------------------------------------------------------------- - ## cygwin does not handle the find_package() call - ## -------------------------- - set (CTEST_UPDATE_COMMAND "SVNCommand") - if (NOT SITE_CYGWIN}) - find_package (Subversion) - set (CTEST_SVN_COMMAND "${Subversion_SVN_EXECUTABLE}") - set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}") - else () - set (CTEST_SVN_COMMAND "/usr/bin/svn") - set (CTEST_UPDATE_COMMAND "/usr/bin/svn") - endif () - - if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") - set (NEED_REPOSITORY_CHECKOUT 1) - endif () - - if (NOT CTEST_REPO_VERSION) - set (CTEST_REPO_VERSION "HEAD") - endif () - if (${NEED_REPOSITORY_CHECKOUT}) - set (CTEST_CHECKOUT_COMMAND - "\"${CTEST_SVN_COMMAND}\" co ${REPOSITORY_URL} \"${CTEST_SOURCE_DIRECTORY}\" -r ${CTEST_REPO_VERSION}") - else () - if (CTEST_REPO_VERSION) - set (CTEST_SVN_UPDATE_OPTIONS "-r ${CTEST_REPO_VERSION}") - endif () - endif () - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -## Clear the build directory -## -------------------------- -set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) -if (NOT EXISTS "${CTEST_BINARY_DIRECTORY}") - file (MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") -else () - ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY}) -endif () - -# Use multiple CPU cores to build -include (ProcessorCount) -ProcessorCount (N) -if (NOT N EQUAL 0) - if (NOT WIN32) - set (CTEST_BUILD_FLAGS -j${N}) - endif () - set (ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) -endif () - -#----------------------------------------------------------------------------- -# Send the main script as a note. -list (APPEND CTEST_NOTES_FILES - "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" - "${CMAKE_CURRENT_LIST_FILE}" - "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake" -) - -#----------------------------------------------------------------------------- -# Check for required variables. -# -------------------------- -foreach (req - CTEST_CMAKE_GENERATOR - CTEST_SITE - CTEST_BUILD_NAME - ) - if (NOT DEFINED ${req}) - message (FATAL_ERROR "The containing script must set ${req}") - endif () -endforeach () - -#----------------------------------------------------------------------------- -# Initialize the CTEST commands -#------------------------------ -if(CMAKE_GENERATOR_TOOLSET) - set(CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}") -else () - set(CTEST_CONFIGURE_TOOLSET "") -endif() -if (LOCAL_MEMCHECK_TEST) - find_program (CTEST_MEMORYCHECK_COMMAND NAMES valgrind) - set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\"" - ) -else () - if (LOCAL_COVERAGE_TEST) - find_program (CTEST_COVERAGE_COMMAND NAMES gcov) - endif () - set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\"" - ) -endif () - -#----------------------------------------------------------------------------- -## -- set output to english -set ($ENV{LC_MESSAGES} "en_EN") - -# Print summary information. -foreach (v - CTEST_SITE - CTEST_BUILD_NAME - CTEST_SOURCE_DIRECTORY - CTEST_BINARY_DIRECTORY - CTEST_CMAKE_GENERATOR - CTEST_CONFIGURATION_TYPE - CTEST_GIT_COMMAND - CTEST_CHECKOUT_COMMAND - CTEST_CONFIGURE_COMMAND - CTEST_SCRIPT_DIRECTORY - CTEST_USE_LAUNCHERS - ) - set (vars "${vars} ${v}=[${${v}}]\n") -endforeach () -message (STATUS "Dashboard script configuration:\n${vars}\n") - -#----------------------------------------------------------------------------- -#----------------------------------------------------------------------------- - ## NORMAL process - ## -- LOCAL_UPDATE updates the source folder from svn - ## -- LOCAL_SUBMIT reports to CDash server - ## -- LOCAL_SKIP_TEST skips the test process (only builds) - ## -- LOCAL_MEMCHECK_TEST executes the Valgrind testing - ## -- LOCAL_COVERAGE_TEST executes code coverage process - ## -------------------------- - ctest_start (${MODEL} TRACK ${MODEL}) - if (LOCAL_UPDATE) - ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}") - endif () - configure_file (${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) - ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") - ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) - if (LOCAL_SUBMIT) - ctest_submit (PARTS Update Configure Notes) - endif () - if (${res} LESS 0 OR ${res} GREATER 0) - file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") - endif () - - ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res NUMBER_ERRORS errval) - if (LOCAL_SUBMIT) - ctest_submit (PARTS Build) - endif () - if (${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) - file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n") - endif () - - if (NOT LOCAL_SKIP_TEST) - if (NOT LOCAL_MEMCHECK_TEST) +cmake_minimum_required (VERSION 3.10) +######################################################## +# This dashboard is maintained by The HDF Group +# For any comments please contact cdashhelp@hdfgroup.org +# +######################################################## +# ----------------------------------------------------------- +# -- Get environment +# ----------------------------------------------------------- +if (NOT SITE_OS_NAME) + ## machine name not provided - attempt to discover with uname + ## -- set hostname + ## -------------------------- + find_program (HOSTNAME_CMD NAMES hostname) + exec_program (${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME) + set (CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}") + find_program (UNAME NAMES uname) + macro (getuname name flag) + exec_program ("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") + endmacro () + + getuname (osname -s) + getuname (osrel -r) + getuname (cpu -m) + message (STATUS "Dashboard script uname output: ${osname}-${osrel}-${cpu}\n") + + set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") + if (SITE_BUILDNAME_SUFFIX) + set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}") + endif () + set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}") +else () + ## machine name provided + ## -------------------------- + if (CMAKE_HOST_UNIX) + set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}") + else () + set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}") + endif () + if (SITE_BUILDNAME_SUFFIX) + set (CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}") + endif () + set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") +endif () + +#----------------------------------------------------------------------------- +# MAC machines need special option +#----------------------------------------------------------------------------- +if (APPLE) + # Compiler choice + execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set (ENV{CC} "${XCODE_CC}") + set (ENV{CXX} "${XCODE_CXX}") + + set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") +endif () + +#----------------------------------------------------------------------------- +set (NEED_REPOSITORY_CHECKOUT 0) +set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") +if (CTEST_USE_TAR_SOURCE) + ## Uncompress source if tar file provided + ## -------------------------- + if (WIN32) + message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]") + execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) + else () + message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar]") + execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) + endif () + + if (NOT rv EQUAL 0) + message (STATUS "extracting... [error-(${rv}) clean up]") + file (REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") + message (FATAL_ERROR "error: extract of ${CTEST_USE_TAR_SOURCE} failed") + endif () + + file (RENAME ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE} ${CTEST_SOURCE_DIRECTORY}) + set (LOCAL_SKIP_UPDATE "TRUE") +else () + if (LOCAL_UPDATE) + if (CTEST_USE_GIT_SOURCE) + find_program (CTEST_GIT_COMMAND NAMES git git.cmd) + set (CTEST_GIT_UPDATE_OPTIONS) + + if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") + set (NEED_REPOSITORY_CHECKOUT 1) + endif () + + if (${NEED_REPOSITORY_CHECKOUT}) + if (REPOSITORY_BRANCH) + set (CTEST_GIT_options "clone \"${REPOSITORY_URL}\" --branch \"${REPOSITORY_BRANCH}\" --single-branch \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules") + else () + set (CTEST_GIT_options "clone \"${REPOSITORY_URL}\" \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules") + endif () + set (CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} ${CTEST_GIT_options}") + else () + set (CTEST_GIT_options "pull") + endif () + set (CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}") + else () + ## -------------------------- + ## use subversion to get source + #----------------------------------------------------------------------------- + ## cygwin does not handle the find_package() call + ## -------------------------- + set (CTEST_UPDATE_COMMAND "SVNCommand") + if (NOT SITE_CYGWIN}) + find_package (Subversion) + set (CTEST_SVN_COMMAND "${Subversion_SVN_EXECUTABLE}") + set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}") + else () + set (CTEST_SVN_COMMAND "/usr/bin/svn") + set (CTEST_UPDATE_COMMAND "/usr/bin/svn") + endif () + + if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") + set (NEED_REPOSITORY_CHECKOUT 1) + endif () + + if (NOT CTEST_REPO_VERSION) + set (CTEST_REPO_VERSION "HEAD") + endif () + if (${NEED_REPOSITORY_CHECKOUT}) + set (CTEST_CHECKOUT_COMMAND + "\"${CTEST_SVN_COMMAND}\" co ${REPOSITORY_URL} \"${CTEST_SOURCE_DIRECTORY}\" -r ${CTEST_REPO_VERSION}") + else () + if (CTEST_REPO_VERSION) + set (CTEST_SVN_UPDATE_OPTIONS "-r ${CTEST_REPO_VERSION}") + endif () + endif () + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +## Clear the build directory +## -------------------------- +set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) +if (NOT EXISTS "${CTEST_BINARY_DIRECTORY}") + file (MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +else () + ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY}) +endif () + +# Use multiple CPU cores to build +include (ProcessorCount) +ProcessorCount (N) +if (NOT N EQUAL 0) + if (NOT WIN32) + set (CTEST_BUILD_FLAGS -j${N}) + endif () + set (ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) +endif () + +#----------------------------------------------------------------------------- +# Send the main script as a note. +list (APPEND CTEST_NOTES_FILES + "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" + "${CMAKE_CURRENT_LIST_FILE}" + "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake" +) + +#----------------------------------------------------------------------------- +# Check for required variables. +# -------------------------- +foreach (req + CTEST_CMAKE_GENERATOR + CTEST_SITE + CTEST_BUILD_NAME + ) + if (NOT DEFINED ${req}) + message (FATAL_ERROR "The containing script must set ${req}") + endif () +endforeach () + +#----------------------------------------------------------------------------- +# Initialize the CTEST commands +#------------------------------ +if(CMAKE_GENERATOR_TOOLSET) + set(CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}") +else () + set(CTEST_CONFIGURE_TOOLSET "") +endif() +if (LOCAL_MEMCHECK_TEST) + find_program (CTEST_MEMORYCHECK_COMMAND NAMES valgrind) + set (CTEST_CONFIGURE_COMMAND + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\"" + ) +else () + if (LOCAL_COVERAGE_TEST) + find_program (CTEST_COVERAGE_COMMAND NAMES gcov) + endif () + set (CTEST_CONFIGURE_COMMAND + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\"" + ) +endif () + +#----------------------------------------------------------------------------- +## -- set output to english +set ($ENV{LC_MESSAGES} "en_EN") + +# Print summary information. +foreach (v + CTEST_SITE + CTEST_BUILD_NAME + CTEST_SOURCE_DIRECTORY + CTEST_BINARY_DIRECTORY + CTEST_CMAKE_GENERATOR + CTEST_CONFIGURATION_TYPE + CTEST_GIT_COMMAND + CTEST_CHECKOUT_COMMAND + CTEST_CONFIGURE_COMMAND + CTEST_SCRIPT_DIRECTORY + CTEST_USE_LAUNCHERS + ) + set (vars "${vars} ${v}=[${${v}}]\n") +endforeach () +message (STATUS "Dashboard script configuration:\n${vars}\n") + +#----------------------------------------------------------------------------- +#----------------------------------------------------------------------------- + ## NORMAL process + ## -- LOCAL_UPDATE updates the source folder from svn + ## -- LOCAL_SUBMIT reports to CDash server + ## -- LOCAL_SKIP_TEST skips the test process (only builds) + ## -- LOCAL_MEMCHECK_TEST executes the Valgrind testing + ## -- LOCAL_COVERAGE_TEST executes code coverage process + ## -------------------------- + ctest_start (${MODEL} TRACK ${MODEL}) + if (LOCAL_UPDATE) + ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}") + endif () + configure_file (${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) + ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") + ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) + if (LOCAL_SUBMIT) + ctest_submit (PARTS Update Configure Notes) + endif () + if (${res} LESS 0 OR ${res} GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") + endif () + + ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res NUMBER_ERRORS errval) + if (LOCAL_SUBMIT) + ctest_submit (PARTS Build) + endif () + if (${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n") + endif () + + if (NOT LOCAL_SKIP_TEST) + if (NOT LOCAL_MEMCHECK_TEST) if (NOT LOCAL_BATCH_TEST) ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) + if (LOCAL_SUBMIT) + ctest_submit (PARTS Test) + endif () else () - execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_NAME}) + file(STRINGS ${CTEST_BINARY_DIRECTORY}/Testing/TAG TAG_CONTENTS REGEX "^2([0-9]+)[-]([0-9]+)$") + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${CTEST_SOURCE_DIRECTORY}/bin/batch/${LOCAL_BATCH_SCRIPT_NAME}) + message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") + execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) + while(result) + ctest_sleep(60) + message(STATUS "Checking again for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") + execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) + endwhile(result) + if (LOCAL_SUBMIT) + ctest_submit (PARTS Test) + endif () + message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml. Renaming to SerialTest.xml") + file (RENAME ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/SerialTest.xml) + message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") + unset(result CACHE) + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${CTEST_SOURCE_DIRECTORY}/bin/batch/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) + message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") + execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) + while(result) + ctest_sleep(60) + message(STATUS "Checking again for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") + execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) + endwhile(result) + if (LOCAL_SUBMIT) + ctest_submit (PARTS Test) + endif () + message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml. Done with parallel batch tests.") + endif () + if (${res} LESS 0 OR ${res} GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") + endif () + else () + ctest_memcheck (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args}) + if (LOCAL_SUBMIT) + ctest_submit (PARTS MemCheck) + endif () + endif () + if (LOCAL_COVERAGE_TEST) + ctest_coverage (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) + if (LOCAL_SUBMIT) + ctest_submit (PARTS Coverage) endif () - if (LOCAL_SUBMIT) - ctest_submit (PARTS Test) - endif () - if (${res} LESS 0 OR ${res} GREATER 0) - file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") - endif () - else () - ctest_memcheck (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args}) - if (LOCAL_SUBMIT) - ctest_submit (PARTS MemCheck) - endif () - endif () - if (LOCAL_COVERAGE_TEST) - ctest_coverage (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) - if (LOCAL_SUBMIT) - ctest_submit (PARTS Coverage) - endif () - endif () - endif () - - if (NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE AND NOT LOCAL_SKIP_BUILD) - ##----------------------------------------------- - ## Package the product - ##----------------------------------------------- - execute_process (COMMAND cpack -C ${CTEST_CONFIGURATION_TYPE} -V - WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} - RESULT_VARIABLE cpackResult - OUTPUT_VARIABLE cpackLog - ERROR_VARIABLE cpackLog.err - ) - file (WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") - if (cpackResult GREATER 0) - file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed packaging: ${cpackResult}:${cpackLog.err} \n") - endif () - endif () -#----------------------------------------------------------------------------- + endif () + endif () + + if (NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE AND NOT LOCAL_SKIP_BUILD) + ##----------------------------------------------- + ## Package the product + ##----------------------------------------------- + execute_process (COMMAND cpack -C ${CTEST_CONFIGURATION_TYPE} -V + WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} + RESULT_VARIABLE cpackResult + OUTPUT_VARIABLE cpackLog + ERROR_VARIABLE cpackLog.err + ) + file (WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") + if (cpackResult GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed packaging: ${cpackResult}:${cpackLog.err} \n") + endif () + endif () +#----------------------------------------------------------------------------- diff --git a/config/cmake/scripts/wait_H5Tinit.cmake b/config/cmake/scripts/wait_H5Tinit.cmake new file mode 100755 index 0000000..14976ce --- /dev/null +++ b/config/cmake/scripts/wait_H5Tinit.cmake @@ -0,0 +1,10 @@ +cmake_minimum_required (VERSION 3.10) + +message(STATUS "Check for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") +execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET) +while(H5TI_result) + ctest_sleep(30) + message(STATUS "Checking again for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") + execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET) +endwhile(H5TI_result) +message(STATUS "Found ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 31a38be..8affc6d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -947,28 +947,33 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY ) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c COMMAND ${HDF5_BATCH_CMD} ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} + COMMAND ${CMAKE_COMMAND} + ARGS -E echo "Executed batch command to create H5Tinit.c" DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) + add_custom_target (gen_H5Tinit + COMMAND ${CMAKE_COMMAND} -P ${HDF5_SOURCE_DIR}/config/cmake/scripts/wait_H5Tinit.cmake + ) else () add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) endif () - add_custom_target (gen_H5Tinit ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp" "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" - DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp - ) +# add_custom_target (gen_H5Tinit ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp) +# add_custom_command ( +# OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c +# COMMAND ${CMAKE_COMMAND} +# ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp" "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" +# DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp +# ) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) endif () if (BUILD_SHARED_LIBS) -- cgit v0.12 From 38f7e3c86b2ce51ec7fb7c003192b9cef333d720 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 14 Nov 2018 11:35:36 -0600 Subject: Really don't run parallel tests without option specifying script. --- config/cmake/scripts/CTestScript.cmake | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index fd56ffa..41366bd 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -275,28 +275,27 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) while(result) ctest_sleep(60) - message(STATUS "Checking again for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) endwhile(result) if (LOCAL_SUBMIT) ctest_submit (PARTS Test) endif () - message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml. Renaming to SerialTest.xml") - file (RENAME ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/SerialTest.xml) - message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") - unset(result CACHE) - execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${CTEST_SOURCE_DIRECTORY}/bin/batch/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) - message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") - execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) - while(result) - ctest_sleep(60) - message(STATUS "Checking again for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") + if (LOCAL_BATCH_SCRIPT_PARALLEL_NAME) + message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml. Renaming to SerialTest.xml") + file (RENAME ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/SerialTest.xml) + unset(result CACHE) + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${CTEST_SOURCE_DIRECTORY}/bin/batch/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) + message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) - endwhile(result) - if (LOCAL_SUBMIT) - ctest_submit (PARTS Test) - endif () - message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml. Done with parallel batch tests.") + while(result) + ctest_sleep(60) + execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) + endwhile(result) + if (LOCAL_SUBMIT) + ctest_submit (PARTS Test) + endif () + message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml. Done with parallel batch tests.") + endif() endif () if (${res} LESS 0 OR ${res} GREATER 0) file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") -- cgit v0.12 From 78af4c21cb717d400141d5ed15505e8257497ec9 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Wed, 14 Nov 2018 14:31:37 -0600 Subject: HDFFV-10571 Divided by Zero vulnerability. Minor fix: I added an error check to make sure the chunk size is not zero. --- src/H5Dchunk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 22dc05a..fabae54 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -695,6 +695,10 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, /* Compute the # of chunks in dataset dimensions */ for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) { + /* Just in case that something goes very wrong, such as file corruption. */ + if(layout->dim[u] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be positive: layout->dim[%u] = %u ", u, layout->dim[u]) + /* Round up to the next integer # of chunks, to accommodate partial chunks */ layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; if(H5S_UNLIMITED == max_dims[u]) -- cgit v0.12 From 1d89a55590d106ea4d242402d0cd57a9d1ce5252 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Wed, 14 Nov 2018 14:54:03 -0600 Subject: HDFFV-10571: Minor change - revised the comment to be clearer. --- src/H5Dchunk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index fabae54..659d580 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -697,7 +697,7 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) { /* Just in case that something goes very wrong, such as file corruption. */ if(layout->dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be positive: layout->dim[%u] = %u ", u, layout->dim[u]) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk dimension must be positive: layout->dim[%u] = %u ", u, layout->dim[u]) /* Round up to the next integer # of chunks, to accommodate partial chunks */ layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; -- cgit v0.12 From 3edd97731e90b7fc3a378e2c6e9c043a23327d93 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 14 Nov 2018 13:37:31 -0800 Subject: Renamed h5repart's -family_to_sec2 to -family_to_single. --- release_docs/RELEASE.txt | 14 +++++++++-- src/H5FDlog.c | 16 ++++++------ src/H5FDsec2.c | 16 ++++++------ src/H5Fprivate.h | 2 +- src/H5Pfapl.c | 15 ++++++------ tools/src/misc/h5repart.c | 45 ++++++++++++++++++++-------------- tools/test/misc/CMakeTestsRepart.cmake | 5 ++++ tools/test/misc/repart_test.c | 21 ++++++++++------ tools/test/misc/testh5repart.sh.in | 6 +++-- 9 files changed, 86 insertions(+), 54 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index dcc9892..4661b59 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -170,7 +170,7 @@ New Features (DER - 2018/10/26, HDFFV-10614) - Parallel Library: + Parallel Library: ----------------- - @@ -233,7 +233,17 @@ New Features Tools: ------ - - + - The h5repart -family-to-sec2 argument was changed to -family-to-single + + In order to better support other single-file VFDs which could work with + h5repart, the -family-to-sec2 argument was renamed to -family-to-single. + This is just a name change and the functionality of the argument has not + changed. + + The -family-to-sec2 argument has been kept for backwards-compatibility. + This argument should be considered deprecated. + + (DER - 2018/11/14, HDFFV-10633) High-Level APIs: --------------- diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 7c2297a..3dcd7f5 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -117,7 +117,7 @@ typedef struct H5FD_log_t { * Whether to eliminate the family driver info and convert this file to * a single file */ - hbool_t fam_to_sec2; + hbool_t fam_to_single; /* Fields for tracking I/O operations */ unsigned char *nread; /* Number of reads from a file location */ @@ -635,13 +635,13 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Check for non-default FAPL */ if(H5P_FILE_ACCESS_DEFAULT != fapl_id) { /* This step is for h5repart tool only. If user wants to change file driver from - * family to sec2 while using h5repart, this private property should be set so that - * in the later step, the library can ignore the family driver information saved - * in the superblock. + * family to one that uses single files (sec2, etc.) while using h5repart, this + * private property should be set so that in the later step, the library can ignore + * the family driver information saved in the superblock. */ - if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0) - if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2") + if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0) + if(H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single") } /* end if */ /* Set return value */ @@ -900,7 +900,7 @@ H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default VFD */ /* Check for flags that are set by h5repart */ - if(file && file->fam_to_sec2) + if(file && file->fam_to_single) *flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */ } /* end if */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 32aff0f..06c008d 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -94,7 +94,7 @@ typedef struct H5FD_sec2_t { * Whether to eliminate the family driver info and convert this file to * a single file. */ - hbool_t fam_to_sec2; + hbool_t fam_to_single; } H5FD_sec2_t; @@ -386,13 +386,13 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "not a file access property list") /* This step is for h5repart tool only. If user wants to change file driver from - * family to sec2 while using h5repart, this private property should be set so that - * in the later step, the library can ignore the family driver information saved - * in the superblock. + * family to one that uses single files (sec2, etc.) while using h5repart, this + * private property should be set so that in the later step, the library can ignore + * the family driver information saved in the superblock. */ - if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0) - if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2") + if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0) + if(H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single") } /* end if */ /* Set return value */ @@ -532,7 +532,7 @@ H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default VFD */ /* Check for flags that are set by h5repart */ - if(file && file->fam_to_sec2) + if(file && file->fam_to_single) *flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */ } /* end if */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 6595677..a4b7880 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -483,7 +483,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ #define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */ -#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" /* Whether to convert family to sec2 driver. (private property only used by h5repart) */ +#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single" /* Whether to convert family to a single-file driver. (private property only used by h5repart) */ #define H5F_ACS_MULTI_TYPE_NAME "multi_type" /* Data type in multi file driver */ #define H5F_ACS_LIBVER_LOW_BOUND_NAME "libver_low_bound" /* 'low' bound of library format versions */ #define H5F_ACS_LIBVER_HIGH_BOUND_NAME "libver_high_bound" /* 'high' bound of library format versions */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index a50c5ee..23eb924 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -135,10 +135,11 @@ * property only used by h5repart */ #define H5F_ACS_FAMILY_NEWSIZE_SIZE sizeof(hsize_t) #define H5F_ACS_FAMILY_NEWSIZE_DEF 0 -/* Definition for whether to convert family to sec2 driver. It's private - * property only used by h5repart */ -#define H5F_ACS_FAMILY_TO_SEC2_SIZE sizeof(hbool_t) -#define H5F_ACS_FAMILY_TO_SEC2_DEF FALSE +/* Definition for whether to convert family to a single-file driver. + * It's a private property only used by h5repart. + */ +#define H5F_ACS_FAMILY_TO_SINGLE_SIZE sizeof(hbool_t) +#define H5F_ACS_FAMILY_TO_SINGLE_DEF FALSE /* Definition for data type in multi file driver */ #define H5F_ACS_MULTI_TYPE_SIZE sizeof(H5FD_mem_t) #define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT @@ -391,7 +392,7 @@ static const unsigned H5F_def_gc_ref_g = H5F_ACS_GARBG_COLCT_REF_DEF; static const H5F_close_degree_t H5F_def_close_degree_g = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */ static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */ static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */ -static const hbool_t H5F_def_family_to_sec2_g = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */ +static const hbool_t H5F_def_family_to_single_g = H5F_ACS_FAMILY_TO_SINGLE_DEF; /* Default ?? for family VFD */ static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */ static const H5F_libver_t H5F_def_libver_low_bound_g = H5F_ACS_LIBVER_LOW_BOUND_DEF; /* Default setting for "low" bound of format version */ @@ -527,9 +528,9 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */ + /* Register the private property of whether convert family to a single-file driver. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P__register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g, + if(H5P__register_real(pclass, H5F_ACS_FAMILY_TO_SINGLE_NAME, H5F_ACS_FAMILY_TO_SINGLE_SIZE, &H5F_def_family_to_single_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index cdc554f..2f4d93e 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -29,11 +29,12 @@ #define NAMELEN 4096 #define GB *1024*1024*1024 -/*Make these 2 private properties(defined in H5Fprivate.h) available to h5repart. - *The first one updates the member file size in the superblock. The second one - *change file driver from family to sec2. */ +/* Make these 2 private properties(defined in H5Fprivate.h) available to h5repart. + * The first one updates the member file size in the superblock. The second one + * change file driver from family to a single file driver. + */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" -#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" +#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single" /*------------------------------------------------------------------------- @@ -53,13 +54,14 @@ static void usage (const char *progname) { - fprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2] SRC DST\n", + fprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2|-family_to_single] SRC DST\n", progname); fprintf(stderr, " -v Produce verbose output\n"); fprintf(stderr, " -V Print a version number and exit\n"); fprintf(stderr, " -b N The I/O block size, defaults to 1kB\n"); fprintf(stderr, " -m N The destination member size or 1GB\n"); - fprintf(stderr, " -family_to_sec2 Change file driver from family to sec2\n"); + fprintf(stderr, " -family_to_sec2 Deprecated version of -family_to_single (below)\n"); + fprintf(stderr, " -family_to_single Change file driver from family to the default single-file VFD (windows or sec2)\n"); fprintf(stderr, " SRC The name of the source file\n"); fprintf(stderr, " DST The name of the destination files\n"); fprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or " @@ -186,7 +188,7 @@ main (int argc, char *argv[]) hid_t fapl; /*file access property list */ hid_t file; hsize_t hdsize; /*destination logical memb size */ - hbool_t family_to_sec2=FALSE; /*change family to sec2 driver? */ + hbool_t family_to_single = FALSE; /*change family to single file driver? */ /* * Get the program name from argv[0]. Use only the last component. @@ -206,7 +208,10 @@ main (int argc, char *argv[]) prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); exit(EXIT_SUCCESS); } else if (!strcmp (argv[argno], "-family_to_sec2")) { - family_to_sec2 = TRUE; + family_to_single = TRUE; + argno++; + } else if (!strcmp (argv[argno], "-family_to_single")) { + family_to_single = TRUE; argno++; } else if ('b'==argv[argno][1]) { blk_size = (size_t)get_size (prog_name, &argno, argc, argv); @@ -422,11 +427,12 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } - if(family_to_sec2) { - /* The user wants to change file driver from family to sec2. Open the file - * with sec2 driver. This property signals the library to ignore the family - * driver information saved in the superblock. */ - if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) { + if(family_to_single) { + /* The user wants to change file driver from family to a single-file VFD. + * Open the file with the sec2, windows, etc. driver. This property signals + * the library to ignore the family driver information saved in the superblock. + */ + if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SINGLE_NAME, &family_to_single) < 0) { perror ("H5Pset"); exit (EXIT_FAILURE); } @@ -449,13 +455,14 @@ main (int argc, char *argv[]) /* If the new file is a family file, try to open file for "read and write" to * flush metadata. Flushing metadata will update the superblock to the new - * member size. If the original file is a family file and the new file is a sec2 - * file, the property FAMILY_TO_SEC2 will signal the library to switch to sec2 - * driver when the new file is opened. If the original file is a sec2 file and the - * new file can only be a sec2 file, reopen the new file should fail. There's - * nothing to do in this case. */ + * member size. If the original file is a family file and the new file is a single + * file, the property FAMILY_TO_SINGLE will signal the library to switch to default + * single-file driver when the new file is opened. If the original file is a single + * file and the new file can only be a single file, reopen the new file should fail. + * There's nothing to do in this case. + */ H5E_BEGIN_TRY { - file=H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); + file = H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); } H5E_END_TRY; if(file>=0) { diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 37da903..830de11 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -68,6 +68,7 @@ scd_family00001.h5 scd_family00002.h5 scd_family00003.h5 + family_to_single.h5 family_to_sec2.h5 ) if (NOT "${last_test}" STREQUAL "") @@ -84,6 +85,10 @@ set_tests_properties (H5REPART-h5repart_5K PROPERTIES DEPENDS H5REPART-clearall-objects) # convert family file to sec2 file of 20,000 bytes + add_test (NAME H5REPART-h5repart_single COMMAND $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) + set_tests_properties (H5REPART-h5repart_single PROPERTIES DEPENDS H5REPART-clearall-objects) + + # convert family file to sec2 file of 20,000 bytes (old argument) add_test (NAME H5REPART-h5repart_sec2 COMMAND $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES DEPENDS H5REPART-clearall-objects) diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c index 4016ee8..b8e0292 100644 --- a/tools/test/misc/repart_test.c +++ b/tools/test/misc/repart_test.c @@ -26,12 +26,13 @@ const char *FILENAME[] = { "fst_family%05d.h5", "scd_family%05d.h5", + "family_to_single.h5", "family_to_sec2.h5", NULL }; herr_t test_family_h5repart_opens(void); -herr_t test_sec2_h5repart_opens(void); +herr_t test_single_h5repart_opens(void); /*------------------------------------------------------------------------- @@ -90,23 +91,28 @@ error: /*------------------------------------------------------------------------- - * Function: test_sec2_h5repart_opens + * Function: test_single_h5repart_opens * - * Purpose: Tries to reopen a sec2 file. + * Purpose: Tries to reopen a single file. * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -test_sec2_h5repart_opens(void) +test_single_h5repart_opens(void) { hid_t fid = -1; - /* open the sec2 file */ + /* open the single file */ if ((fid = H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto error; + if (H5Fclose(fid) < 0) + goto error; + /* open the single file (created using the old argument) */ + if ((fid = H5Fopen(FILENAME[3], H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + goto error; if (H5Fclose(fid) < 0) goto error; @@ -119,7 +125,7 @@ error: return FAIL; -} /* end test_sec2_h5repart_opens() */ +} /* end test_single_h5repart_opens() */ /*------------------------------------------------------------------------- @@ -137,7 +143,7 @@ main(void) int nerrors = 0; nerrors += test_family_h5repart_opens() < 0 ? 1 : 0; - nerrors += test_sec2_h5repart_opens() < 0 ? 1 : 0; + nerrors += test_single_h5repart_opens() < 0 ? 1 : 0; if (nerrors) goto error; @@ -150,3 +156,4 @@ error: nerrors, 1 == nerrors ? "" : "S"); HDexit(EXIT_FAILURE); } /* end main() */ + diff --git a/tools/test/misc/testh5repart.sh.in b/tools/test/misc/testh5repart.sh.in index 594d37e..143f607 100644 --- a/tools/test/misc/testh5repart.sh.in +++ b/tools/test/misc/testh5repart.sh.in @@ -171,7 +171,9 @@ COPY_TESTFILES_TO_TESTDIR TOOLTEST -m 20000 family_file%05d.h5 fst_family%05d.h5 # repartition family member size to 5 KB. TOOLTEST -m 5k family_file%05d.h5 scd_family%05d.h5 -# convert family file to sec2 file of 20,000 bytes +# convert family file to single file of 20,000 bytes +TOOLTEST -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5 +# convert family file to single file of 20,000 bytes (old argument) TOOLTEST -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5 # test the output files repartitioned above. @@ -183,7 +185,7 @@ CLEAN_TESTFILES_AND_TESTDIR if test -z "$HDF5_NOCLEANUP"; then cd $actual_dir - rm -f fst_family*.h5 scd_family*.h5 family_to_sec2.h5 + rm -f fst_family*.h5 scd_family*.h5 family_to_single.h5 family_to_sec2.h5 fi if test $nerrors -eq 0 ; then -- cgit v0.12 From cd13d24e5140578a880aebe4e2d8b899179d0870 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Wed, 14 Nov 2018 17:30:23 -0600 Subject: HDFFV-10601: I added error checking to the HDF5 functions. --- tools/test/perform/chunk_cache.c | 226 ++++++++++++++++++++++++++++----------- 1 file changed, 161 insertions(+), 65 deletions(-) diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 9a6315a..01571e2 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -17,6 +17,8 @@ * 2. number of slots in chunk cache is smaller than the number of chunks * in the fastest-growing dimension. */ +#include +#include #include #include "hdf5.h" @@ -133,49 +135,87 @@ test_time_subtract(test_time_t in1, test_time_t in2) return out; } +/*------------------------------------------------------------------------- + * Function: cleanup + * + * Purpose: Removes test files + * + * Return: void + * + * Programmer: Robb Matzke + * Thursday, June 4, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +cleanup (void) +{ + if (!getenv ("HDF5_NOCLEANUP")) { + remove (FILENAME); + } +} /*------------------------------------------------------------------------------- * Create a chunked dataset with partial chunks along either dimensions: * dataset dimension: 9000 x 9 * chunk dimension: 2000 x 2 */ -static void create_dset1(hid_t file) +static int create_dset1(hid_t file) { hid_t dataspace, dataset; hid_t dcpl; hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2}; - herr_t status; hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2}; int data[DSET1_DIM1][DSET1_DIM2]; /* data for writing */ int i, j; /* Create the data space. */ - dataspace = H5Screate_simple (RANK, dims, NULL); + if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0) + goto error; /* Modify dataset creation properties, i.e. enable chunking */ - dcpl = H5Pcreate (H5P_DATASET_CREATE); - status = H5Pset_chunk (dcpl, RANK, chunk_dims); + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk (dcpl, RANK, chunk_dims) < 0) + goto error; /* Set the dummy filter simply for counting the number of bytes being read into the memory */ - H5Zregister(H5Z_COUNTER); - H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL); + if(H5Zregister(H5Z_COUNTER) < 0) + goto error; + + if(H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL) < 0) + goto error; /* Create a new dataset within the file using chunk creation properties. */ - dataset = H5Dcreate2 (file, DSET1_NAME, H5T_NATIVE_INT, dataspace, - H5P_DEFAULT, dcpl, H5P_DEFAULT); + if((dataset = H5Dcreate2 (file, DSET1_NAME, H5T_NATIVE_INT, dataspace, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; for (i = 0; i < DSET1_DIM1; i++) for (j = 0; j < DSET1_DIM2; j++) data[i][j] = i+j; /* Write data to dataset */ - status = H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, data); + if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, data) < 0) + goto error; /* Close resources */ - status = H5Dclose (dataset); - status = H5Pclose (dcpl); - status = H5Sclose (dataspace); + H5Dclose (dataset); + H5Pclose (dcpl); + H5Sclose (dataspace); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose (dataset); + H5Pclose (dcpl); + H5Sclose (dataspace); + } H5E_END_TRY; + + return 1; } /*--------------------------------------------------------------------------- @@ -183,56 +223,72 @@ static void create_dset1(hid_t file) * dataset dimensions: 300 x 600 * chunk dimensions: 100 x 100 */ -static void create_dset2(hid_t file) +static int create_dset2(hid_t file) { hid_t dataspace, dataset; hid_t dcpl; hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2}; - herr_t status; hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2}; int data[DSET2_DIM1][DSET2_DIM2]; /* data for writing */ int i, j; /* Create the data space. */ - dataspace = H5Screate_simple (RANK, dims, NULL); + if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0) + goto error; /* Modify dataset creation properties, i.e. enable chunking */ - dcpl = H5Pcreate (H5P_DATASET_CREATE); - status = H5Pset_chunk (dcpl, RANK, chunk_dims); + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk (dcpl, RANK, chunk_dims) < 0) + goto error; /* Set the dummy filter simply for counting the number of bytes being read into the memory */ - H5Zregister(H5Z_COUNTER); - H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL); + if(H5Zregister(H5Z_COUNTER) < 0) + goto error; + if(H5Pset_filter(dcpl, FILTER_COUNTER, 0, 0, NULL) < 0) + goto error; /* Create a new dataset within the file using chunk creation properties. */ - dataset = H5Dcreate2 (file, DSET2_NAME, H5T_NATIVE_INT, dataspace, - H5P_DEFAULT, dcpl, H5P_DEFAULT); + if((dataset = H5Dcreate2 (file, DSET2_NAME, H5T_NATIVE_INT, dataspace, + H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; for (i = 0; i < DSET2_DIM1; i++) for (j = 0; j < DSET2_DIM2; j++) data[i][j] = i+j; /* Write data to dataset */ - status = H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, data); + if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, data) < 0) + goto error; /* Close resources */ - status = H5Dclose (dataset); - status = H5Pclose (dcpl); - status = H5Sclose (dataspace); + H5Dclose (dataset); + H5Pclose (dcpl); + H5Sclose (dataspace); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose (dataset); + H5Pclose (dcpl); + H5Sclose (dataspace); + } H5E_END_TRY; + + return 1; } /*--------------------------------------------------------------------------- * Check the performance of the chunk cache when partial chunks exist * along the dataset dimensions. */ -static void check_partial_chunks_perf(hid_t file) +static int check_partial_chunks_perf(hid_t file) { hid_t dataset; hid_t filespace; hid_t memspace; hid_t dapl; - herr_t status; int rdata[DSET1_DIM2]; /* data for reading */ int i; @@ -242,8 +298,10 @@ static void check_partial_chunks_perf(hid_t file) hsize_t count[RANK] = {1, DSET1_DIM2}; test_time_t t = {0, 0}, t1 = {0, 0}, t2 = {0, 0}; - dapl = H5Pcreate(H5P_DATASET_ACCESS); - status = H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0); + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + goto error; + if(H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0) < 0) + goto error; dataset = H5Dopen2 (file, DSET1_NAME, dapl); @@ -257,11 +315,13 @@ static void check_partial_chunks_perf(hid_t file) /* Read the data row by row */ for(i = 0; i < DSET1_DIM1; i++) { start[0] = i; - status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, - start, NULL, count, NULL); + if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, + start, NULL, count, NULL) < 0) + goto error; - status = H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace, - H5P_DEFAULT, rdata); + if(H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, rdata) < 0) + goto error; } test_time_get_current(&t2); @@ -269,10 +329,20 @@ static void check_partial_chunks_perf(hid_t file) printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", test_time_to_double(t), nbytes_global); - status = H5Dclose (dataset); - status = H5Sclose (filespace); - status = H5Sclose (memspace); - status = H5Pclose (dapl); + H5Dclose (dataset); + H5Sclose (filespace); + H5Sclose (memspace); + H5Pclose (dapl); + + return 0; +error: + H5E_BEGIN_TRY { + H5Dclose (dataset); + H5Sclose (filespace); + H5Sclose (memspace); + H5Pclose (dapl); + } H5E_END_TRY; + return 1; } /*--------------------------------------------------------------------------- @@ -280,14 +350,13 @@ static void check_partial_chunks_perf(hid_t file) * is smaller than the number of chunks along the fastest-growing * dimension of the dataset. */ -static void check_hash_value_perf(hid_t file) +static int check_hash_value_perf(hid_t file) { hid_t dataset; hid_t filespace; hid_t memspace; hid_t dapl; - herr_t status; int rdata[DSET2_DIM1]; /* data for reading */ int i; @@ -297,13 +366,17 @@ static void check_hash_value_perf(hid_t file) hsize_t count[RANK] = {DSET2_DIM1, 1}; test_time_t t = {0, 0}, t1 = {0, 0}, t2 = {0, 0}; - dapl = H5Pcreate(H5P_DATASET_ACCESS); - status = H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0); - - dataset = H5Dopen2 (file, DSET2_NAME, dapl); + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + goto error; + if(H5Pset_chunk_cache (dapl, RDCC_NSLOTS, RDCC_NBYTES, RDCC_W0) < 0) + goto error; - memspace = H5Screate_simple(column_rank, column_dim, NULL); - filespace = H5Dget_space(dataset); + if((dataset = H5Dopen2 (file, DSET2_NAME, dapl)) < 0) + goto error; + if((memspace = H5Screate_simple(column_rank, column_dim, NULL)) < 0) + goto error; + if((filespace = H5Dget_space(dataset)) < 0) + goto error; nbytes_global = 0; @@ -312,11 +385,13 @@ static void check_hash_value_perf(hid_t file) /* Read the data column by column */ for(i = 0; i < DSET2_DIM2; i++) { start[1] = i; - status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, - start, NULL, count, NULL); + if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, + start, NULL, count, NULL) < 0) + goto error; - status = H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace, - H5P_DEFAULT, rdata); + if(H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, rdata) < 0) + goto error; } test_time_get_current(&t2); @@ -324,10 +399,20 @@ static void check_hash_value_perf(hid_t file) printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", test_time_to_double(t), nbytes_global); - status = H5Dclose (dataset); - status = H5Sclose (filespace); - status = H5Sclose (memspace); - status = H5Pclose (dapl); + H5Dclose (dataset); + H5Sclose (filespace); + H5Sclose (memspace); + H5Pclose (dapl); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose (dataset); + H5Sclose (filespace); + H5Sclose (memspace); + H5Pclose (dapl); + } H5E_END_TRY; + return 1; } /*------------------------------------------------------------------------------------- @@ -340,22 +425,33 @@ int main (void) { hid_t file; /* handles */ - + int nerrors = 0; + /* Create a new file. If file exists its contents will be overwritten. */ - file = H5Fcreate (FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if((file = H5Fcreate (FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; - create_dset1(file); - create_dset2(file); + nerrors += create_dset1(file); + nerrors += create_dset2(file); - H5Fclose (file); + if(H5Fclose (file) < 0) + goto error; /* Re-open the file for testing performance. */ - file = H5Fopen (FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + if((file = H5Fopen (FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + goto error; - check_partial_chunks_perf(file); - check_hash_value_perf(file); + nerrors += check_partial_chunks_perf(file); + nerrors += check_hash_value_perf(file); - H5Fclose (file); + if(H5Fclose (file) < 0) + goto error; + if (nerrors>0) goto error; + cleanup(); return 0; + +error: + fprintf(stderr, "*** ERRORS DETECTED ***\n"); + return 1; } -- cgit v0.12 From c132cb5565de02fd4e1e2cfe8ea7b89b21f785ac Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Thu, 15 Nov 2018 14:57:26 -0600 Subject: HDFFV-10571: Minor change - adding the error check right after decoding of chunk dimension for safeguard. --- src/H5Dchunk.c | 8 ++++---- src/H5Olayout.c | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 659d580..00a6b50 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -684,6 +684,7 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims, const hsize_t *max_dims) { unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -695,10 +696,9 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, /* Compute the # of chunks in dataset dimensions */ for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) { - /* Just in case that something goes very wrong, such as file corruption. */ - if(layout->dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk dimension must be positive: layout->dim[%u] = %u ", u, layout->dim[u]) - + /* Sanity check */ + HDassert(layout->dim[u] > 0); + /* Round up to the next integer # of chunks, to accommodate partial chunks */ layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; if(H5S_UNLIMITED == max_dims[u]) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 5f16837..11d5d1c 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -243,9 +243,14 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); /* Chunk dimensions */ - for(u = 0; u < mesg->u.chunk.ndims; u++) + for(u = 0; u < mesg->u.chunk.ndims; u++) { UINT32DECODE(p, mesg->u.chunk.dim[u]); + /* Just in case that something goes very wrong, such as file corruption. */ + if(mesg->u.chunk.dim[u] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "chunk dimension must be positive: mesg->u.chunk.dim[%u] = %u", u, mesg->u.chunk.dim[u]) + } + /* Compute chunk size */ for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++) mesg->u.chunk.size *= mesg->u.chunk.dim[u]; -- cgit v0.12 From 198bc059b0d91aa804efe859f0a8961e3ee0cf8f Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Thu, 15 Nov 2018 15:05:23 -0600 Subject: HDFFV-10571: Minor change - reformatting the error check. --- src/H5Olayout.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 11d5d1c..b720f93 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -248,7 +248,8 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Just in case that something goes very wrong, such as file corruption. */ if(mesg->u.chunk.dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "chunk dimension must be positive: mesg->u.chunk.dim[%u] = %u", u, mesg->u.chunk.dim[u]) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "chunk dimension must be positive: mesg->u.chunk.dim[%u] = %u", + u, mesg->u.chunk.dim[u]) } /* Compute chunk size */ -- cgit v0.12 From c923cdad6e515c842f3795a5b6d754ad94021e09 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Thu, 15 Nov 2018 16:50:13 -0600 Subject: HDFFV-10571: Minor format changes. --- src/H5Dchunk.c | 1 - src/H5Olayout.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 00a6b50..67cfe62 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -684,7 +684,6 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims, const hsize_t *max_dims) { unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Olayout.c b/src/H5Olayout.c index b720f93..2b65e0c 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -250,7 +250,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, if(mesg->u.chunk.dim[u] == 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "chunk dimension must be positive: mesg->u.chunk.dim[%u] = %u", u, mesg->u.chunk.dim[u]) - } + } /* end for */ /* Compute chunk size */ for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++) -- cgit v0.12 From d25afb294cbd921431ea3cb76e7856fc02676a7d Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Fri, 16 Nov 2018 12:06:30 -0600 Subject: HDFFV-10601: Some compiler doesn't support clock_gettime(). So I changed to use gettimeofday (HDgettimeofday in the HDF5 library). --- tools/test/perform/chunk_cache.c | 102 ++++++++++----------------------------- 1 file changed, 25 insertions(+), 77 deletions(-) diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 01571e2..429f70a 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -17,10 +17,8 @@ * 2. number of slots in chunk cache is smaller than the number of chunks * in the fastest-growing dimension. */ -#include -#include -#include #include "hdf5.h" +#include "H5private.h" #define FILENAME "chunk_cache_perf.h5" @@ -81,74 +79,18 @@ counter (unsigned flags, size_t cd_nelmts, } /*---------------------------------------------------------------------------*/ -static int -test_time_get_current(test_time_t *tv) +double retrieve_time(void) { - struct timespec tp; - - if (!tv) - return -1; - if (clock_gettime(CLOCK_MONOTONIC, &tp)) - return -1; - - tv->tv_sec = tp.tv_sec; - tv->tv_usec = tp.tv_nsec / 1000; - - return 0; -} - -/*---------------------------------------------------------------------------*/ -static double -test_time_to_double(test_time_t tv) -{ - return (double) tv.tv_sec + (double) (tv.tv_usec) * 0.000001; -} - -/*---------------------------------------------------------------------------*/ -static test_time_t -test_time_add(test_time_t in1, test_time_t in2) -{ - test_time_t out; - - out.tv_sec = in1.tv_sec + in2.tv_sec; - out.tv_usec = in1.tv_usec + in2.tv_usec; - if(out.tv_usec > 1000000) { - out.tv_usec -= 1000000; - out.tv_sec += 1; - } - - return out; +#ifdef H5_HAVE_GETTIMEOFDAY + struct timeval t; + HDgettimeofday(&t, NULL); + return ((double)t.tv_sec + (double)t.tv_usec / 1000000); +#else + return 0.0; +#endif } /*---------------------------------------------------------------------------*/ -static test_time_t -test_time_subtract(test_time_t in1, test_time_t in2) -{ - test_time_t out; - - out.tv_sec = in1.tv_sec - in2.tv_sec; - out.tv_usec = in1.tv_usec - in2.tv_usec; - if(out.tv_usec < 0) { - out.tv_usec += 1000000; - out.tv_sec -= 1; - } - - return out; -} -/*------------------------------------------------------------------------- - * Function: cleanup - * - * Purpose: Removes test files - * - * Return: void - * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ static void cleanup (void) { @@ -296,7 +238,7 @@ static int check_partial_chunks_perf(hid_t file) hsize_t row_dim[1] = {DSET1_DIM2}; hsize_t start[RANK] = {0, 0}; hsize_t count[RANK] = {1, DSET1_DIM2}; - test_time_t t = {0, 0}, t1 = {0, 0}, t2 = {0, 0}; + double start_t, end_t; if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) goto error; @@ -310,7 +252,7 @@ static int check_partial_chunks_perf(hid_t file) nbytes_global = 0; - test_time_get_current(&t1); + start_t = retrieve_time(); /* Read the data row by row */ for(i = 0; i < DSET1_DIM1; i++) { @@ -324,10 +266,13 @@ static int check_partial_chunks_perf(hid_t file) goto error; } - test_time_get_current(&t2); - t = test_time_add(t, test_time_subtract(t2, t1)); + end_t = retrieve_time(); - printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", test_time_to_double(t), nbytes_global); +#ifdef H5_HAVE_GETTIMEOFDAY + printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); +#else + printf("1. Partial chunks: no total read time because gettimeofday() is not available; number of bytes being read from file is %lu\n", nbytes_global); +#endif H5Dclose (dataset); H5Sclose (filespace); @@ -364,7 +309,7 @@ static int check_hash_value_perf(hid_t file) hsize_t column_dim[1] = {DSET2_DIM1}; hsize_t start[RANK] = {0, 0}; hsize_t count[RANK] = {DSET2_DIM1, 1}; - test_time_t t = {0, 0}, t1 = {0, 0}, t2 = {0, 0}; + double start_t, end_t; if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) goto error; @@ -380,7 +325,7 @@ static int check_hash_value_perf(hid_t file) nbytes_global = 0; - test_time_get_current(&t1); + start_t = retrieve_time(); /* Read the data column by column */ for(i = 0; i < DSET2_DIM2; i++) { @@ -394,10 +339,13 @@ static int check_hash_value_perf(hid_t file) goto error; } - test_time_get_current(&t2); - t = test_time_add(t, test_time_subtract(t2, t1)); + end_t = retrieve_time(); - printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", test_time_to_double(t), nbytes_global); +#ifdef H5_HAVE_GETTIMEOFDAY + printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); +#else + printf("2. Hash value: no total read time because gettimeofday() is not available; number of bytes being read from file is %lu\n", nbytes_global); +#endif H5Dclose (dataset); H5Sclose (filespace); -- cgit v0.12 From 4f5a52e595194562644517b7600f3b96d4008c17 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Fri, 16 Nov 2018 16:25:50 -0600 Subject: HDFFV-10601: Adding the new hdf5/tools/test/perform/chunk_cache.c to MANIFEST. --- MANIFEST | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST b/MANIFEST index e586b3b..82b17a5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2615,6 +2615,7 @@ ./tools/test/perform/build_h5perf_alone.sh ./tools/test/perform/build_h5perf_serial_alone.sh ./tools/test/perform/chunk.c +./tools/test/perform/chunk_cache.c ./tools/test/perform/direct_write_perf.c ./tools/test/perform/gen_report.pl ./tools/test/perform/iopipe.c -- cgit v0.12 From 59c28780d35924b6512fe18a0eeb49d55e03f0fc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 18 Nov 2018 00:38:29 -0600 Subject: Add VOL connector info to the flie access property list returned from H5Fget_access_plist(). Also, other misc. cleanups, etc. --- src/H5F.c | 122 ++++++++++++++++++++------------------- src/H5Fint.c | 164 ++++++++++++++++++++++++++++++++++++++--------------- src/H5Fpkg.h | 22 +++---- src/H5Ofill.c | 4 +- src/H5Pfapl.c | 113 +++--------------------------------- src/H5VLcallback.c | 150 ++++++++++++++++++++++++++++++++++++++++++------ src/H5VLint.c | 103 +++++++++++++++++++++++++++++++-- src/H5VLnative.c | 18 +++++- src/H5VLprivate.h | 22 ++++--- src/H5VLpublic.h | 7 ++- src/H5trace.c | 3 + test/vol.c | 51 +++++++++++++++-- 12 files changed, 511 insertions(+), 268 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index b7fc126..a5017d8 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -43,10 +43,24 @@ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ +/* User data for traversal routine to get ID counts */ +typedef struct { + size_t obj_count; /* Number of objects counted so far */ + unsigned types; /* Types of objects to be counted */ +} H5F_trav_obj_cnt_t; + +/* User data for traversal routine to get ID lists */ +typedef struct { + size_t max_objs; /* Maximum # of IDs to record */ + hid_t *oid_list; /* Array of recorded IDs*/ + size_t obj_count; /* Number of objects counted so far */ +} H5F_trav_obj_ids_t; + /********************/ /* Package Typedefs */ @@ -200,11 +214,11 @@ H5F__close_cb(H5VL_object_t *file_vol_obj) /* Close the file */ if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") /* Free the VOL object */ if(H5VL_free_object(file_vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object"); + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") done: FUNC_LEAVE_NOAPI(ret_value) @@ -306,7 +320,7 @@ H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, FUNC_ENTER_STATIC_NOERR - *(udata->obj_count) = *(udata->obj_count) + 1; + udata->obj_count++; FUNC_LEAVE_NOAPI(ret_value) } /* H5F_get_all_count_cb */ @@ -353,36 +367,33 @@ H5Fget_obj_count(hid_t file_id, unsigned types) } /* If we passed in the 'special' ID, get the count for everything open in the * library, iterating over all open files and getting the object count for each. - * - * XXX: Consider making this a helper function in H5I. */ else { H5F_trav_obj_cnt_t udata; - udata.obj_count = &ret_value; + /* Set up callback context */ udata.types = types | H5F_OBJ_LOCAL; + udata.obj_count = 0; - if(types & H5F_OBJ_FILE) { + if(types & H5F_OBJ_FILE) if(H5I_iterate(H5I_FILE, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed"); - } - if(types & H5F_OBJ_DATASET) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed") + if(types & H5F_OBJ_DATASET) if(H5I_iterate(H5I_DATASET, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed"); - } - if(types & H5F_OBJ_GROUP) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed") + if(types & H5F_OBJ_GROUP) if(H5I_iterate(H5I_GROUP, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed"); - } - if(types & H5F_OBJ_DATATYPE) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed") + if(types & H5F_OBJ_DATATYPE) if(H5I_iterate(H5I_DATATYPE, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed"); - } - if(types & H5F_OBJ_ATTR) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed") + if(types & H5F_OBJ_ATTR) if(H5I_iterate(H5I_ATTR, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed"); - } - } + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed") + + /* Set return value */ + ret_value = (ssize_t)udata.obj_count; + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -408,11 +419,12 @@ H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key) FUNC_ENTER_STATIC_NOERR - if(*udata->obj_count >= udata->max_objs) + if(udata->obj_count >= udata->max_objs) HGOTO_DONE(H5_ITER_STOP); - udata->oid_list[*udata->obj_count] = obj_id; - *(udata->obj_count) = *(udata->obj_count) + 1; + /* Add the ID to the array */ + udata->oid_list[udata->obj_count] = obj_id; + udata->obj_count++; done: FUNC_LEAVE_NOAPI(ret_value) @@ -427,6 +439,9 @@ done: * NOTE: Type mismatch - You can ask for more objects than can be * returned. * + * NOTE: Currently, the IDs' ref counts are not incremented. Is this + * intentional and documented? + * * Return: Success: The number of IDs in oid_list * * Failure: -1 @@ -465,7 +480,6 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) /* If we passed in the 'special' ID, get the count for everything open in the * library, iterating over all open files and getting the object count for each. * - * XXX: Consider making this a helper function in H5I. * XXX: Note that the RM states that passing in a negative value for max_objs * gets you all the objects. This technically works, but is clearly wrong * behavior since max_objs is an unsigned type. @@ -473,30 +487,29 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) else { H5F_trav_obj_ids_t udata; + /* Set up callback context */ udata.max_objs = max_objs; udata.oid_list = oid_list; - udata.obj_count = &ret_value; + udata.obj_count = 0; - if(types & H5F_OBJ_FILE) { + if(types & H5F_OBJ_FILE) if(H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed"); - } /* end if */ - if(types & H5F_OBJ_DATASET) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed") + if(types & H5F_OBJ_DATASET) if(H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed"); - } /* end if */ - if(types & H5F_OBJ_GROUP) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed") + if(types & H5F_OBJ_GROUP) if(H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed"); - } /* end if */ - if(types & H5F_OBJ_DATATYPE) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed") + if(types & H5F_OBJ_DATATYPE) if(H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed"); - } /* end if */ - if(types & H5F_OBJ_ATTR) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed") + if(types & H5F_OBJ_ATTR) if(H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed"); - } /* end if */ + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed") + + /* Set return value */ + ret_value = (ssize_t)udata.obj_count; } /* end else */ done: @@ -605,11 +618,9 @@ done: hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - void *new_file = NULL; /* file struct for new file */ - + H5F_t *new_file = NULL; /* File struct for new file */ H5P_genplist_t *plist; /* Property list pointer */ - H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -645,8 +656,6 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID") /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for @@ -657,7 +666,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* Create a new file or truncate an existing file through the VOL */ - if(NULL == (new_file = H5VL_file_create(cls, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (new_file = (H5F_t *)H5VL_file_create(&connector_prop, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ @@ -691,11 +700,10 @@ done: hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - void *new_file = NULL; /* file struct for new file */ - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - H5VL_class_t *cls = NULL; /* VOL class structure for callback info */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* File struct for new file */ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -724,11 +732,9 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL connector ID") /* Open the file through the VOL layer */ - if(NULL == (new_file = H5VL_file_open(cls, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (new_file = (H5F_t *)H5VL_file_open(&connector_prop, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") /* Get an ID for the file */ @@ -836,7 +842,7 @@ hid_t H5Freopen(hid_t file_id) { H5VL_object_t *vol_obj = NULL; - void *file; /* File token from VOL connector */ + H5F_t *file = NULL; /* File struct for new file */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) diff --git a/src/H5Fint.c b/src/H5Fint.c index c085e83..9c01c71 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -79,6 +79,7 @@ static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/); +static H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); static herr_t H5F__flush_phase1(H5F_t *f); static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); @@ -107,6 +108,53 @@ H5FL_DEFINE(H5F_file_t); /*------------------------------------------------------------------------- + * Function: H5F__set_vol_conn + * + * Purpose: Set the VOL connector ID and info for a file. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info) +{ + void *new_connector_info = NULL; /* Copy of connector info */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(file); + + /* Only cache VOL connector ID & info the first time the file is opened */ + if(file->shared->nrefs == 1) { + /* Copy connector info, if it exists */ + if(vol_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(vol_id))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, vol_info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed") + } /* end if */ + + /* Cache the connector ID & info for the container */ + file->shared->vol_id = vol_id; + file->shared->vol_info = new_connector_info; + if(H5I_inc_ref(file->shared->vol_id, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__set_vol_conn() */ + + +/*------------------------------------------------------------------------- * Function: H5F_get_access_plist * * Purpose: Returns a copy of the file access property list of the @@ -129,6 +177,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) H5P_genplist_t *old_plist; /* Old property list */ H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ unsigned efc_size = 0; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -141,60 +190,60 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Copy properties of the file access property list */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(f->shared->rdcc_nslots)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size") if(H5P_set(new_plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks") if(H5P_set(new_plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold") if(H5P_set(new_plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment") if(H5P_set(new_plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference") if(H5P_set(new_plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size") if(H5P_set(new_plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size") if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size") if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions") if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions") - if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions") + if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->orig_read_attempts)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag") if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback") if(f->shared->efc) efc_size = H5F__efc_max_nfiles(f->shared->efc); if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size") if(f->shared->page_buf != NULL) { if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size") if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer") if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer") } /* end if */ #ifdef H5_HAVE_PARALLEL if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") #endif /* H5_HAVE_PARALLEL */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") /* Prepare the driver property */ driver_prop.driver_id = f->shared->lf->driver_id; @@ -203,13 +252,19 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) /* Set the driver property */ if(H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info") + + /* Set the VOL connector property */ + connector_prop.connector_id = f->shared->vol_id; + connector_prop.connector_info = f->shared->vol_info; + if(H5P_set(new_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector ID & info") /* Set the file close degree appropriately */ if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") done: /* Release the copy of the driver info, if it was set up */ @@ -835,13 +890,13 @@ done: * *------------------------------------------------------------------------- */ -H5F_t * +static H5F_t * H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) { H5F_t *f = NULL; H5F_t *ret_value = NULL; - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC if(NULL == (f = H5FL_CALLOC(H5F_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") @@ -991,8 +1046,9 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ f->shared->use_tmp_space = !H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI); /* Retrieve the # of read attempts here so that sohm in superblock will get the correct # of attempts */ - if(H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &f->shared->read_attempts) < 0) + if(H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &f->shared->orig_read_attempts) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get the # of read attempts") + f->shared->read_attempts = f->shared->orig_read_attempts; /* When opening file with SWMR access, the # of read attempts is H5F_SWMR_METADATA_READ_ATTEMPTS if not set */ /* When opening file without SWMR access, the # of read attempts is always H5F_METADATA_READ_ATTEMPTS (set or not set) */ @@ -1005,12 +1061,12 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ f->shared->feature_flags &= ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA; if(H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD") - } + } /* end if */ else { /* If no value for read attempts has been set, use the default */ if(!f->shared->read_attempts) f->shared->read_attempts = H5F_METADATA_READ_ATTEMPTS; - } + } /* end else */ /* Determine the # of bins for metdata read retries */ if(H5F_set_retries(f) < 0) @@ -1296,6 +1352,25 @@ H5F__dest(H5F_t *f, hbool_t flush) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close property list") + /* Clean up the cached VOL connector ID & info */ + if(f->shared->vol_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(f->shared->vol_id))) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Free the connector info */ + if(H5VL_free_connector_info(connector, f->shared->vol_info) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + } /* end if */ + if(f->shared->vol_id > 0) + if(H5I_dec_ref(f->shared->vol_id) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close VOL connector ID") + /* Close the file */ if(H5FD_close(f->shared->lf) < 0) /* Push error, but keep going*/ @@ -1535,7 +1610,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the 'top' file structure */ if(NULL == (file = H5F__new(NULL, flags, fcpl_id, fapl_id, lf))) { /* If this is the only time the file has been opened and the struct - * returned is NULL, H5FD_close() will never be called via H5F_dest() + * returned is NULL, H5FD_close() will never be called via H5F__dest() * so we have to close lf here before heading to the error handling. */ if(H5FD_close(lf) < 0) @@ -1634,16 +1709,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) */ if(H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree") - - /* This is a private property to clear the status_flags in the super block */ - /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */ - if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) { - if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags") - else if(clear) - file->shared->sblock->status_flags = 0; - } /* end if */ - if(shared->nrefs == 1) { if(fc_degree == H5F_CLOSE_DEFAULT) shared->fc_degree = lf->cls->fc_degree; @@ -1657,6 +1722,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match") } /* end if */ + /* This is a private property to clear the status_flags in the super block */ + /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */ + if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) { + if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags") + else if(clear) + file->shared->sblock->status_flags = 0; + } /* end if */ + /* Record the evict-on-close MDC behavior. If it's the first time opening * the file, set it to access property list value; if it's the second time * or later, verify that the access property list value matches the value @@ -2099,7 +2173,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) /* Delay flush until the shared file struct is closed, in H5F__dest. If the * application called H5Fclose, it would have been flushed in that function - * (unless it will have been flushed in H5F_dest anyways). + * (unless it will have been flushed in H5F__dest anyways). */ /* Destroy the H5F_t struct and decrement the reference count for the @@ -2135,7 +2209,7 @@ done: H5F_t * H5F__reopen(H5F_t *f) { - H5F_t *ret_value = NULL; + H5F_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -2183,7 +2257,7 @@ H5F_get_id(H5F_t *file) else { /* Increment reference count on existing ID */ if(H5I_inc_ref(ret_value, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed") } /* end else */ done: diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 990a6b9..192262c 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -292,7 +292,7 @@ struct H5F_file_t { /* begin on file access/create */ char *mdc_log_location; /* location of mdc log */ hid_t fcpl_id; /* File creation property list ID */ - H5F_close_degree_t fc_degree; /* File close behavior degree */ + H5F_close_degree_t fc_degree; /* File close behavior degree */ hbool_t evict_on_close; /* If the file's objects should be evicted from the metadata cache on close */ size_t rdcc_nslots; /* Size of raw data chunk cache (slots) */ size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ @@ -310,6 +310,10 @@ struct H5F_file_t { H5FO_t *open_objs; /* Open objects in file */ H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ + /* Cached VOL connector ID & info */ + hid_t vol_id; /* ID of VOL connector for the container */ + void *vol_info; /* Copy of VOL connector info for container */ + /* File space allocation information */ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ hsize_t fs_threshold; /* Free space section threshold */ @@ -349,6 +353,7 @@ struct H5F_file_t { /* Metadata retry info */ unsigned read_attempts; /* The # of reads to try when reading metadata with checksum */ + unsigned orig_read_attempts; /* Original value from the property: The # of reads to try when reading metadata with checksum */ unsigned retries_nbins; /* # of bins for each retries[] */ uint32_t *retries[H5AC_NTYPES]; /* Track # of read retries for metdata items with checksum */ @@ -407,19 +412,6 @@ typedef enum H5VL_file_optional_t { H5VL_FILE_SET_LIBVER_BOUNDS } H5VL_file_optional_t; -/* User data for traversal routine to get ID counts */ -typedef struct { - ssize_t *obj_count; /* number of objects counted so far */ - unsigned types; /* types of objects to be counted */ -} H5F_trav_obj_cnt_t; - -/* User data for traversal routine to get ID lists */ -/* XXX (VOL MERGE): Should the type of obj_count and max_objs be identical? */ -typedef struct { - size_t max_objs; - hid_t *oid_list; - ssize_t *obj_count; /* number of objects counted so far */ -} H5F_trav_obj_ids_t; /*****************************/ /* Package Private Variables */ @@ -438,7 +430,6 @@ H5FL_EXTERN(H5F_file_t); /* General routines */ H5_DLL H5F_t *H5F__reopen(H5F_t *f); -H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); H5_DLL herr_t H5F__flush(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id); @@ -450,6 +441,7 @@ H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type); H5_DLL hid_t H5F__get_file_id(H5F_t *file); +H5_DLL herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info); /* File mount related routines */ H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id); diff --git a/src/H5Ofill.c b/src/H5Ofill.c index adf36b9..125da36 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -347,9 +347,9 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, if(NULL == (dt = (H5T_t *)H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't read DTYPE message") /* Verify size */ - if(fill->size != H5T_GET_SIZE(dt)) + if(fill->size != (ssize_t)H5T_GET_SIZE(dt)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "inconsistent fill value size") - } + } /* end if */ if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 820c291..f4dbd0a 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -5125,7 +5125,7 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info) /* Get the connector property */ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property") /* Copy connector info, if it exists */ if(connector_prop.connector_info) { @@ -5152,105 +5152,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5P__vol_copy - * - * Purpose: Copy VOL connector ID & info. - * - * Note: This is an "in-place" copy, since this routine gets called - * after the top-level copy has been performed and this routine - * finishes the "deep" part of the copy. - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__vol_copy(void *value) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - if(value) { - H5VL_connector_prop_t *connector_prop = (H5VL_connector_prop_t *)value; /* connector ID & info struct */ - - /* Copy the connector ID & info, if there is one */ - if(connector_prop->connector_id > 0) { - /* Increment the reference count on connector ID and copy connector info */ - if(H5I_inc_ref(connector_prop->connector_id, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") - - /* Copy connector info, if it exists */ - if(connector_prop->connector_info) { - H5VL_class_t *connector; /* Pointer to connector */ - void *new_connector_info = NULL; /* Copy of connector info */ - - /* Retrieve the connector for the ID */ - if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") - - /* Allocate and copy connector info */ - if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop->connector_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") - - /* Set the connector info to the copy */ - connector_prop->connector_info = new_connector_info; - } /* end if */ - } /* end if */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__vol_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__vol_free - * - * Purpose: Free VOL connector ID & info. - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__vol_free(void *value) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - if(value) { - H5VL_connector_prop_t *info = (H5VL_connector_prop_t *)value; /* connector ID & info struct */ - - /* Free the connector info (if it exists) and decrement the ID */ - if(info->connector_id > 0) { - if(info->connector_info) { - H5VL_class_t *connector; /* Pointer to connector */ - - /* Retrieve the connector for the ID */ - if(NULL == (connector = (H5VL_class_t *)H5I_object(info->connector_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") - - /* Free the connector info */ - if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */ - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") - } /* end if */ - - /* Decrement reference count for connector ID */ - if(H5I_dec_ref(info->connector_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID") - } /* end if */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__vol_free() */ - - -/*------------------------------------------------------------------------- * Function: H5P__facc_vol_create * connectorose: Create callback for the VOL connector ID & info property. @@ -5268,7 +5169,7 @@ H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size FUNC_ENTER_STATIC /* Make copy of the VOL connector */ - if(H5P__vol_copy(value) < 0) + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: @@ -5298,7 +5199,7 @@ H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, HDassert(value); /* Make copy of VOL connector ID & info */ - if(H5P__vol_copy(value) < 0) + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: @@ -5328,7 +5229,7 @@ H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, HDassert(value); /* Make copy of VOL connector */ - if(H5P__vol_copy(value) < 0) + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: @@ -5354,7 +5255,7 @@ H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, FUNC_ENTER_STATIC /* Free the VOL connector ID & info */ - if(H5P__vol_free(value) < 0) + if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") done: @@ -5380,7 +5281,7 @@ H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC /* Make copy of VOL connector */ - if(H5P__vol_copy(value) < 0) + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: @@ -5460,7 +5361,7 @@ H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC /* Free the VOL connector */ - if(H5P__vol_free(value) < 0) + if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") done: diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 52d1296..e921dea 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -95,6 +95,12 @@ static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req, ...); +static void * H5VL__file_create(const H5VL_class_t *cls, const char *name, + unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void * H5VL__file_open(const H5VL_class_t *cls, const char *name, + unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, @@ -2463,7 +2469,43 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_file_create + * Function: H5VL__file_cache_connector + * + * Purpose: Wrap varargs and reissue 'cache VOL connector' operation + * to file specific call + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Re-issue call to internal file specific callback routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__file_specific(obj, cls, H5VL_FILE_CACHE_VOL_CONN, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_cache_connector() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_create * * Purpose: Creates a file through the VOL * @@ -2475,13 +2517,13 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, void **req) +static void * +H5VL__file_create(const H5VL_class_t *cls, const char *name, + unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->file_cls.create) @@ -2493,6 +2535,45 @@ H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_ done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_create + * + * Purpose: Creates a file through the VOL + * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * + * Return: Success: Pointer to new file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, + unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL Class structure for callback info */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Get the connector's class */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed") + + /* Cache the connector ID & info */ + if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_create() */ @@ -2529,7 +2610,7 @@ H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create file") done: @@ -2538,25 +2619,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_file_open + * Function: H5VL__file_open * * Purpose: Opens a file through the VOL. * - * Note: Does not have a 'static' version of the routine, since there's - * no objects in the container before this operation completes. - * * Return: Success: Pointer to file. * Failure: NULL * *------------------------------------------------------------------------- */ -void * -H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, - hid_t dxpl_id, void **req) +static void * +H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigned flags, + hid_t fapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->file_cls.open) @@ -2568,6 +2646,45 @@ H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_open + * + * Purpose: Opens a file through the VOL. + * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * + * Return: Success: Pointer to file. + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, + unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL Class structure for callback info */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Get the connector's class */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + + /* Cache the connector ID & info */ + if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_open() */ @@ -2604,7 +2721,7 @@ H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open file") done: @@ -2816,7 +2933,6 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t cls = vol_obj->connector->cls; } /* end else */ - /* Call the corresponding internal VOL routine */ if(H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") diff --git a/src/H5VLint.c b/src/H5VLint.c index 4590885..167d098 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -225,7 +225,7 @@ H5VL__free_cls(H5VL_class_t *cls) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") /* Release the class */ - H5MM_xfree(cls->name); + H5MM_xfree((void *)cls->name); /* Casting away const OK -QAK */ H5FL_FREE(H5VL_class_t, cls); done: @@ -333,6 +333,99 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_conn_copy + * + * Purpose: Copy VOL connector ID & info. + * + * Note: This is an "in-place" copy. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_conn_copy(H5VL_connector_prop_t *connector_prop) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if(connector_prop) { + /* Copy the connector ID & info, if there is one */ + if(connector_prop->connector_id > 0) { + /* Increment the reference count on connector ID and copy connector info */ + if(H5I_inc_ref(connector_prop->connector_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") + + /* Copy connector info, if it exists */ + if(connector_prop->connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ + void *new_connector_info = NULL; /* Copy of connector info */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") + + /* Set the connector info to the copy */ + connector_prop->connector_info = new_connector_info; + } /* end if */ + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_conn_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_conn_free + * + * Purpose: Free VOL connector ID & info. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_conn_free(const H5VL_connector_prop_t *info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if(info) { + /* Free the connector info (if it exists) and decrement the ID */ + if(info->connector_id > 0) { + if(info->connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(info->connector_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Free the connector info */ + if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */ + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + } /* end if */ + + /* Decrement reference count for connector ID */ + if(H5I_dec_ref(info->connector_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID") + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_conn_free() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_register * * Purpose: VOL-aware version of H5I_register. Constructs an H5VL_object_t @@ -436,19 +529,19 @@ H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool FUNC_ENTER_NOAPI(FAIL) /* Get the VOL class object from the connector's ID */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID") /* Setup VOL info struct */ - if (NULL == (connector = H5FL_CALLOC(H5VL_t))) + if(NULL == (connector = H5FL_CALLOC(H5VL_t))) HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate VOL info struct") connector->cls = cls; connector->id = connector_id; - if (H5I_inc_ref(connector->id, FALSE) < 0) + if(H5I_inc_ref(connector->id, FALSE) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") /* Get an ID for the VOL object */ - if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0) + if((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: diff --git a/src/H5VLnative.c b/src/H5VLnative.c index bf847c5..e506af4 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -1685,13 +1685,13 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, /* Call the flush routine for mounted file hierarchies */ if(H5F_flush_mounts(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") - } + } /* end if */ else { /* Call the flush routine, for this file */ if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") - } - } + } /* end else */ + } /* end if */ break; } @@ -1759,6 +1759,18 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, break; } + /* H5Fcreate / H5Fopen */ + case H5VL_FILE_CACHE_VOL_CONN: + { + hid_t vol_id = va_arg(arguments, hid_t); + void *vol_info = va_arg(arguments, void *); + + /* Call private routine */ + if(H5F__set_vol_conn((H5F_t *)obj, vol_id, vol_info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cache VOL connector ID & info failed") + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") } /* end switch */ diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 83e9600..6b69d93 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -56,11 +56,8 @@ typedef struct H5VL_connector_prop_t { /* Utility functions */ H5_DLL herr_t H5VL_init(void); H5_DLL int H5VL_cmp_connector_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls); -H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, - const void *src_info); -H5_DLL int H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *info1, - const void *info2); -H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info); +H5_DLL herr_t H5VL_conn_copy(H5VL_connector_prop_t *value); +H5_DLL herr_t H5VL_conn_free(const H5VL_connector_prop_t *info); /* Functions that deal with VOL connectors */ H5_DLL hid_t H5VL_register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id); @@ -98,9 +95,16 @@ H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref); H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref); H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id); -/****************************** +/********************************** * VOL connector callback wrappers - *****************************/ + *********************************/ + +/* Connector "management" functions */ +H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, + const void *src_info); +H5_DLL int H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *info1, + const void *info2); +H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info); /* Attribute functions */ H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); @@ -123,8 +127,8 @@ H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* File functions */ -H5_DLL void *H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 7049930..26e841d 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -121,10 +121,11 @@ typedef enum H5VL_file_get_t { /* types for file SPECIFIC callback */ typedef enum H5VL_file_specific_t { H5VL_FILE_FLUSH, /* Flush file */ - H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */ - H5VL_FILE_REOPEN, /* Reopen the file */ + H5VL_FILE_REOPEN, /* Reopen the file */ H5VL_FILE_MOUNT, /* Mount a file */ - H5VL_FILE_UNMOUNT /* Un-Mount a file */ + H5VL_FILE_UNMOUNT, /* Unmount a file */ + H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */ + H5VL_FILE_CACHE_VOL_CONN /* Cache VOL connector ID & info */ } H5VL_file_specific_t; /* types for group GET callback */ diff --git a/src/H5trace.c b/src/H5trace.c index de63c4c..db26d83 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2743,6 +2743,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_IS_ACCESSIBLE: HDfprintf(out, "H5VL_FILE_IS_ACCESSIBLE"); break; + case H5VL_FILE_CACHE_VOL_CONN: + HDfprintf(out, "H5VL_FILE_CACHE_VOL_CONN"); + break; default: HDfprintf(out, "%ld", (long)specific); break; diff --git a/test/vol.c b/test/vol.c index d9157cf..38b7e62 100644 --- a/test/vol.c +++ b/test/vol.c @@ -240,6 +240,7 @@ test_basic_file_operation(void) hid_t fid = H5I_INVALID_HID; hid_t fid_reopen = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; + hid_t fapl_id2 = H5I_INVALID_HID; hid_t fcpl_id = H5I_INVALID_HID; ssize_t obj_count; @@ -252,8 +253,23 @@ test_basic_file_operation(void) TESTING("Basic VOL file operations"); + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + + /* Set the file close degree to a non-default value, to make the H5Pequal + * work out. This is kinda odd, but the library's current behavior with + * a default value is to return the value chosen (H5F_CLOSE_SEMI) instead + * of the default value (H5F_CLOSE_DEFAULT) from the property and then + * the H5Pequal doesn't detect that the property lists are the same. Since + * this is the documented behavior for file close degree for many years, + * I'm not fighting it, just getting the testing to verify that the VOL + * connector property is returned correctly. -QAK, 2018/11/17 + */ + if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0) + TEST_ERROR; + /* H5Fcreate */ - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; /* H5Fget_obj_count */ @@ -271,9 +287,11 @@ test_basic_file_operation(void) TEST_ERROR; /* H5Fget_access_plist */ - if ((fapl_id = H5Fget_access_plist(fid)) < 0) + if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; - if (H5Pclose(fapl_id) < 0) + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) TEST_ERROR; /* H5Fget_create_plist */ @@ -315,19 +333,41 @@ test_basic_file_operation(void) TEST_ERROR; /* H5Fis_accessible */ - if (H5Fis_accessible(NATIVE_VOL_TEST_FILENAME, H5P_DEFAULT) < 0) + if (H5Fis_accessible(NATIVE_VOL_TEST_FILENAME, fapl_id) < 0) TEST_ERROR; /* H5Fopen */ - if ((fid = H5Fopen(NATIVE_VOL_TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + if ((fid = H5Fopen(NATIVE_VOL_TEST_FILENAME, H5F_ACC_RDWR, fapl_id)) < 0) + TEST_ERROR; + + /* H5Fget_access_plist */ + if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) TEST_ERROR; + if ((fid_reopen = H5Freopen(fid)) < 0) TEST_ERROR; + + /* H5Fget_access_plist */ + if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) + TEST_ERROR; + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) TEST_ERROR; if (H5Fclose(fid_reopen) < 0) TEST_ERROR; + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + HDremove(NATIVE_VOL_TEST_FILENAME); PASSED(); @@ -338,6 +378,7 @@ error: H5Fclose(fid); H5Fclose(fid_reopen); H5Pclose(fapl_id); + H5Pclose(fapl_id2); H5Pclose(fcpl_id); } H5E_END_TRY; -- cgit v0.12 From 6c99961bb2772dd809ff200bf9a6c456f8e9a1d9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 18 Nov 2018 00:57:09 -0600 Subject: Revert some of the changes to support the original property list value of metadata read attempts. --- src/H5Fint.c | 5 ++--- src/H5Fpkg.h | 1 - test/vol.c | 11 +++++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index 9c01c71..1ef5013 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -219,7 +219,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions") if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions") - if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->orig_read_attempts)) < 0) + if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag") if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback") @@ -1046,9 +1046,8 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ f->shared->use_tmp_space = !H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI); /* Retrieve the # of read attempts here so that sohm in superblock will get the correct # of attempts */ - if(H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &f->shared->orig_read_attempts) < 0) + if(H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &f->shared->read_attempts) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get the # of read attempts") - f->shared->read_attempts = f->shared->orig_read_attempts; /* When opening file with SWMR access, the # of read attempts is H5F_SWMR_METADATA_READ_ATTEMPTS if not set */ /* When opening file without SWMR access, the # of read attempts is always H5F_METADATA_READ_ATTEMPTS (set or not set) */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 192262c..fc902b0 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -353,7 +353,6 @@ struct H5F_file_t { /* Metadata retry info */ unsigned read_attempts; /* The # of reads to try when reading metadata with checksum */ - unsigned orig_read_attempts; /* Original value from the property: The # of reads to try when reading metadata with checksum */ unsigned retries_nbins; /* # of bins for each retries[] */ uint32_t *retries[H5AC_NTYPES]; /* Track # of read retries for metdata items with checksum */ diff --git a/test/vol.c b/test/vol.c index 38b7e62..357fa45 100644 --- a/test/vol.c +++ b/test/vol.c @@ -265,8 +265,19 @@ test_basic_file_operation(void) * I'm not fighting it, just getting the testing to verify that the VOL * connector property is returned correctly. -QAK, 2018/11/17 */ + /* Set the file close degree to a non-default value, to make the H5Pequal + * work out. This is kinda odd, but the library's current behavior with + * a default value is to return the value chosen (H5F_CLOSE_SEMI) instead + * of the default value (H5F_CLOSE_DEFAULT) from the property and then + * the H5Pequal doesn't detect that the property lists are the same. Since + * this is the documented behavior for file close degree for many years, + * I'm not fighting it, just getting the testing to verify that the VOL + * connector property is returned correctly. -QAK, 2018/11/17 + */ if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0) TEST_ERROR; + if(H5Pset_metadata_read_attempts(fapl_id, 9) < 0) + FAIL_STACK_ERROR /* H5Fcreate */ if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) -- cgit v0.12 From a26aedce040dc8fc04e7d839b17f50480d9ec524 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 19 Nov 2018 10:02:40 -0600 Subject: Check PARALLEL_LEVEL maximum --- config/cmake/scripts/CTestScript.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 43cd48d..f5c15be 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -158,7 +158,12 @@ endif () # Use multiple CPU cores to build include (ProcessorCount) ProcessorCount (N) -if (NOT N EQUAL 0) +if (NOT N EQUAL 0) + if (MAX_PROC_COUNT) + if (N GREATER MAX_PROC_COUNT) + set (N ${MAX_PROC_COUNT) + endif () + endif () if (NOT WIN32) set (CTEST_BUILD_FLAGS -j${N}) endif () -- cgit v0.12 From d9fbacff90d4c4d7d2342a265c32ad8ec3a83804 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 19 Nov 2018 11:02:20 -0600 Subject: add max count to options file --- config/cmake/scripts/HDF5options.cmake | 48 ++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 629d277..6d1a57a 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -17,8 +17,12 @@ ### uncomment/comment and change the following lines for other configuration options ############################################################################################# +#### maximum parallel processor count for build and test #### +#set (MAX_PROC_COUNT 8) + +############################################################################################# #### alternate toolsets #### -#set(CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0") +#set (CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0") ############################################################################################# #### Only build static libraries #### @@ -50,54 +54,54 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTA #### ext libraries #### ### ext libs from tgz -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}") ### ext libs from git -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT") ### ext libs on system -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") ### disable ext zlib building -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") ### disable ext szip building -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") #### package examples #### -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.10.9-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.10.9-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}") ############################################################################################# ### 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_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") ############################################################################################# ### 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_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_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") ############################################################################################# ### disable test program builds -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") ############################################################################################# ### disable packaging -#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON") ### Create install package with external libraries (szip, zlib) -set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") +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/toolchain/intel.cmake") +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake") ############################################################################################# -- cgit v0.12 From 4bc283a0f2cc80aa3041aad5ad24b5abfd20954e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 19 Nov 2018 11:03:42 -0600 Subject: Standardize script --- config/cmake/scripts/CTestScript.cmake | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index f5c15be..9943288 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -36,10 +36,6 @@ if (NOT SITE_OS_NAME) message (STATUS "Dashboard script uname output: ${osname}-${osrel}-${cpu}\n") set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") - if (SITE_BUILDNAME_SUFFIX) - set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}") - endif () - set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}") else () ## machine name provided ## -------------------------- @@ -48,11 +44,11 @@ else () else () set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}") endif () - if (SITE_BUILDNAME_SUFFIX) - set (CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}") - endif () - set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") endif () +if (SITE_BUILDNAME_SUFFIX) + set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}") +endif () +set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") #----------------------------------------------------------------------------- # MAC machines need special option @@ -194,10 +190,10 @@ endforeach () #----------------------------------------------------------------------------- # Initialize the CTEST commands #------------------------------ -if(CMAKE_GENERATOR_TOOLSET) - set(CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}") +if (CMAKE_GENERATOR_TOOLSET) + set (CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}") else () - set(CTEST_CONFIGURE_TOOLSET "") + set (CTEST_CONFIGURE_TOOLSET "") endif() if (LOCAL_MEMCHECK_TEST) find_program (CTEST_MEMORYCHECK_COMMAND NAMES valgrind) -- cgit v0.12 From 3dc4055aaf2c0917569cba38d47df051cc0eeb79 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 19 Nov 2018 11:41:11 -0600 Subject: Fix typo --- config/cmake/scripts/CTestScript.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 9943288..a3f2229 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -157,7 +157,7 @@ ProcessorCount (N) if (NOT N EQUAL 0) if (MAX_PROC_COUNT) if (N GREATER MAX_PROC_COUNT) - set (N ${MAX_PROC_COUNT) + set (N ${MAX_PROC_COUNT}) endif () endif () if (NOT WIN32) -- cgit v0.12 From 720bbdfe614660c885cd2dd31e5e4678422fcbcf Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 20 Nov 2018 11:03:58 -0600 Subject: Changes to CMake code to pause cmake/ctest, waiting for batch jobs to run and finish. --- config/cmake/scripts/CTestScript.cmake | 19 ++++++++---------- config/cmake/scripts/wait_H5Tinit.cmake | 1 + src/CMakeLists.txt | 34 +++++++++++++++++---------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 41366bd..09ff63b 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -265,9 +265,6 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") if (NOT LOCAL_MEMCHECK_TEST) if (NOT LOCAL_BATCH_TEST) ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) - if (LOCAL_SUBMIT) - ctest_submit (PARTS Test) - endif () else () file(STRINGS ${CTEST_BINARY_DIRECTORY}/Testing/TAG TAG_CONTENTS REGEX "^2([0-9]+)[-]([0-9]+)$") execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${CTEST_SOURCE_DIRECTORY}/bin/batch/${LOCAL_BATCH_SCRIPT_NAME}) @@ -277,11 +274,11 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") ctest_sleep(60) execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) endwhile(result) - if (LOCAL_SUBMIT) - ctest_submit (PARTS Test) - endif () if (LOCAL_BATCH_SCRIPT_PARALLEL_NAME) - message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml. Renaming to SerialTest.xml") + if (LOCAL_SUBMIT) + ctest_submit (PARTS Test) + endif () + message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml for serial tests. Renaming to SerialTest.xml") file (RENAME ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/SerialTest.xml) unset(result CACHE) execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${CTEST_SOURCE_DIRECTORY}/bin/batch/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) @@ -291,12 +288,12 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") ctest_sleep(60) execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) endwhile(result) - if (LOCAL_SUBMIT) - ctest_submit (PARTS Test) - endif () - message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml. Done with parallel batch tests.") + message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml for parallel tests.") endif() endif () + if (LOCAL_SUBMIT) + ctest_submit (PARTS Test) + endif () if (${res} LESS 0 OR ${res} GREATER 0) file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") endif () diff --git a/config/cmake/scripts/wait_H5Tinit.cmake b/config/cmake/scripts/wait_H5Tinit.cmake index 14976ce..c0b4d06 100755 --- a/config/cmake/scripts/wait_H5Tinit.cmake +++ b/config/cmake/scripts/wait_H5Tinit.cmake @@ -7,4 +7,5 @@ while(H5TI_result) message(STATUS "Checking again for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET) endwhile(H5TI_result) +file (TOUCH "${HDF5_BINARY_DIR}/H5Tinit_created") message(STATUS "Found ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8affc6d..9660c89 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -958,6 +958,15 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_custom_target (gen_H5Tinit COMMAND ${CMAKE_COMMAND} -P ${HDF5_SOURCE_DIR}/config/cmake/scripts/wait_H5Tinit.cmake ) + if (BUILD_SHARED_LIBS) + add_custom_command ( + 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 gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created + ) + 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 @@ -966,25 +975,18 @@ if (NOT EXISTS ${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_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 + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () endif () -# add_custom_target (gen_H5Tinit ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp) -# add_custom_command ( -# OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c -# COMMAND ${CMAKE_COMMAND} -# ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp" "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" -# DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp -# ) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) endif () -if (BUILD_SHARED_LIBS) - add_custom_command ( - 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 - ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) -endif () add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -- cgit v0.12 From 7bf6e98bd921c4ef1899144ab8a1f0d66a141141 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 20 Nov 2018 12:09:14 -0600 Subject: Move wait_H5init.cmake up to config/cmake. --- MANIFEST | 2 +- config/cmake/scripts/wait_H5Tinit.cmake | 11 ----------- config/cmake/wait_H5Tinit.cmake | 11 +++++++++++ src/CMakeLists.txt | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) delete mode 100755 config/cmake/scripts/wait_H5Tinit.cmake create mode 100644 config/cmake/wait_H5Tinit.cmake diff --git a/MANIFEST b/MANIFEST index a2b1a07..95d8b39 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3196,6 +3196,7 @@ ./config/cmake/UseJavaSymlinks.cmake ./config/cmake/userblockTest.cmake ./config/cmake/vfdTest.cmake +./config/cmake/wait_H5Tinit.cmake ./config/cmake_ext_mod/ConfigureChecks.cmake ./config/cmake_ext_mod/CTestCustom.cmake @@ -3328,7 +3329,6 @@ ./config/cmake/scripts/CTestScript.cmake ./config/cmake/scripts/HDF5config.cmake ./config/cmake/scripts/HDF5options.cmake -./config/cmake/scripts/wait_H5Tinit.cmake # Files generated by autogen ./aclocal.m4 diff --git a/config/cmake/scripts/wait_H5Tinit.cmake b/config/cmake/scripts/wait_H5Tinit.cmake deleted file mode 100755 index c0b4d06..0000000 --- a/config/cmake/scripts/wait_H5Tinit.cmake +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required (VERSION 3.10) - -message(STATUS "Check for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") -execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET) -while(H5TI_result) - ctest_sleep(30) - message(STATUS "Checking again for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") - execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET) -endwhile(H5TI_result) -file (TOUCH "${HDF5_BINARY_DIR}/H5Tinit_created") -message(STATUS "Found ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") diff --git a/config/cmake/wait_H5Tinit.cmake b/config/cmake/wait_H5Tinit.cmake new file mode 100644 index 0000000..c0b4d06 --- /dev/null +++ b/config/cmake/wait_H5Tinit.cmake @@ -0,0 +1,11 @@ +cmake_minimum_required (VERSION 3.10) + +message(STATUS "Check for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") +execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET) +while(H5TI_result) + ctest_sleep(30) + message(STATUS "Checking again for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") + execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET) +endwhile(H5TI_result) +file (TOUCH "${HDF5_BINARY_DIR}/H5Tinit_created") +message(STATUS "Found ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9660c89..bca5a92 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -956,7 +956,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) add_custom_target (gen_H5Tinit - COMMAND ${CMAKE_COMMAND} -P ${HDF5_SOURCE_DIR}/config/cmake/scripts/wait_H5Tinit.cmake + COMMAND ${CMAKE_COMMAND} -P ${HDF5_SOURCE_DIR}/config/cmake/wait_H5Tinit.cmake ) if (BUILD_SHARED_LIBS) add_custom_command ( -- cgit v0.12 From 8939a2190f50ab42c6b59c0d2df33ac66bb625e7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 21 Nov 2018 00:56:13 -0600 Subject: Add info_to_str and str_to_info "management" callbacks for serializing and deserializing a connector's info object. --- examples/h5_vol_external_log_native.c | 2 + src/H5PLint.c | 39 +++++++---- src/H5PLpath.c | 2 +- src/H5PLpkg.h | 6 +- src/H5PLplugin_cache.c | 4 +- src/H5PLprivate.h | 15 ++-- src/H5VL.c | 127 ++++++++++++++++++++++++++++------ src/H5VLcallback.c | 115 +++++++++++++++++++++++++++++- src/H5VLnative.c | 2 + src/H5VLprivate.h | 8 +++ src/H5VLpublic.h | 20 ++++-- src/H5Z.c | 8 +-- 12 files changed, 295 insertions(+), 53 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index 0d48b73..19eaa5e 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -53,6 +53,8 @@ static const H5VL_class_t H5VL_log_g = { NULL, /* info copy */ NULL, /* info compare */ NULL, /* info free */ + NULL, /* info to str */ + NULL, /* str to info */ NULL, /* get_object */ NULL, /* get_wrap_ctx */ NULL, /* free_wrap_ctx */ diff --git a/src/H5PLint.c b/src/H5PLint.c index 166b300..bbe71fe 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -30,7 +30,6 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5MMprivate.h" /* Memory management */ #include "H5PLpkg.h" /* Plugin */ -#include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5Zprivate.h" /* Filter pipeline */ @@ -236,7 +235,7 @@ done: *------------------------------------------------------------------------- */ const void * -H5PL_load(H5PL_type_t type, H5PL_key_t key) +H5PL_load(H5PL_type_t type, const H5PL_key_t *key) { H5PL_search_params_t search_params; /* Plugin search parameters */ hbool_t found = FALSE; /* Whether the plugin was found */ @@ -263,7 +262,7 @@ H5PL_load(H5PL_type_t type, H5PL_key_t key) /* Set up the search parameters */ search_params.type = type; - search_params.key.id = key.id; + search_params.key.id = key->id; /* Search in the table of already loaded plugin libraries */ if(H5PL__find_plugin_in_cache(&search_params, &found, &plugin_info) < 0) @@ -308,7 +307,8 @@ done: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" herr_t -H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, const void **plugin_info) +H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, + hbool_t *success, const void **plugin_info) { H5PL_HANDLE handle = NULL; H5PL_get_plugin_info_t get_plugin_info = NULL; @@ -350,29 +350,44 @@ H5PL__open(const char *path, H5PL_type_t type, H5PL_key_t key, hbool_t *success, HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin") /* If the filter IDs match, we're done. Set the output parameters. */ - if (filter_info->id == key.id) { + if (filter_info->id == key->id) { *plugin_info = (const void *)filter_info; *success = TRUE; } break; } + case H5PL_TYPE_VOL: { - const H5VL_class_t *cls = NULL; + const H5VL_class_t *cls; /* Get the plugin info */ - if (NULL == (cls = (const H5VL_class_t *)(*get_plugin_info)())) + if(NULL == (cls = (const H5VL_class_t *)(*get_plugin_info)())) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VOL driver info from plugin") - /* If the plugin names match, we're done. Set the output parameters. */ - if (cls->name && !HDstrcmp(cls->name, key.name)) { - *plugin_info = (const void *)cls; - *success = TRUE; - } + /* Which kind of key are we looking for? */ + if(key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) { + /* If the plugin names match, we're done. Set the output parameters. */ + if(cls->name && !HDstrcmp(cls->name, key->vol.u.name)) { + *plugin_info = (const void *)cls; + *success = TRUE; + } /* end if */ + } /* end if */ + else { + /* Sanity check */ + HDassert(key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE); + + /* If the plugin values match, we're done. Set the output parameters. */ + if(cls->value == key->vol.u.value) { + *plugin_info = (const void *)cls; + *success = TRUE; + } /* end if */ + } /* end else */ break; } + case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 972f1d0..460f19d 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -689,7 +689,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo continue; /* attempt to open the dynamic library as a filter library */ - if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0) + if (H5PL__open(path, search_params->type, &(search_params->key), found, plugin_info) < 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed") if (*found) HGOTO_DONE(SUCCEED) diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h index dfaa4af..d60da82 100644 --- a/src/H5PLpkg.h +++ b/src/H5PLpkg.h @@ -134,13 +134,15 @@ H5_DLL herr_t H5PL__get_plugin_control_mask(unsigned int *mask /*out*/); H5_DLL herr_t H5PL__set_plugin_control_mask(unsigned int mask); /* Plugin search and manipulation */ -H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, H5PL_key_t key, hbool_t *success /*out*/, const void **plugin_info /*out*/); +H5_DLL herr_t H5PL__open(const char *libname, H5PL_type_t type, const H5PL_key_t *key, + hbool_t *success /*out*/, const void **plugin_info /*out*/); H5_DLL herr_t H5PL__close(H5PL_HANDLE handle); /* Plugin cache calls */ H5_DLL herr_t H5PL__create_plugin_cache(void); H5_DLL herr_t H5PL__close_plugin_cache(hbool_t *already_closed /*out*/); -H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle); +H5_DLL herr_t H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key, + H5PL_HANDLE handle); H5_DLL herr_t H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found /*out*/, const void **plugin_info /*out*/); /* Plugin search path calls */ diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c index e905ac2..7fe676d 100644 --- a/src/H5PLplugin_cache.c +++ b/src/H5PLplugin_cache.c @@ -216,7 +216,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle) +H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key, H5PL_HANDLE handle) { herr_t ret_value = SUCCEED; @@ -229,7 +229,7 @@ H5PL__add_plugin(H5PL_type_t type, H5PL_key_t key, H5PL_HANDLE handle) /* Store the plugin info and bump the # of plugins */ H5PL_cache_g[H5PL_num_plugins_g].type = type; - H5PL_cache_g[H5PL_num_plugins_g].key = key; + H5PL_cache_g[H5PL_num_plugins_g].key = *key; H5PL_cache_g[H5PL_num_plugins_g].handle = handle; H5PL_num_plugins_g++; diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index 2af1b70..5ce9b87 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -21,7 +21,8 @@ #include "H5PLpublic.h" /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /**************************/ @@ -35,8 +36,14 @@ /* The key that will be used to find the plugin */ typedef union H5PL_key_t { - int id; /* filters */ - const char *name; /* VOL drivers */ + int id; /* I/O filters */ + struct { + H5VL_get_connector_kind_t kind; /* Kind of VOL lookup to do */ + union { + H5VL_class_value_t value; /* VOL connector value */ + const char *name; /* VOL connector name */ + } u; + } vol; } H5PL_key_t; @@ -50,7 +57,7 @@ typedef union H5PL_key_t { /***************************************/ /* Internal API routines */ -H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, H5PL_key_t key); +H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, const H5PL_key_t *key); #endif /* _H5PLprivate_H */ diff --git a/src/H5VL.c b/src/H5VL.c index 0a835a2..5eeb201 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -41,38 +41,51 @@ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ /* Information needed for iterating over the registered VOL connector hid_t IDs. - * The name of the new VOL connector that is being registered is stored in the - * name field and the found_id field is initialized to H5I_INVALID_HID (-1). - * If we find a VOL connector with the same name, we set the found_id field to - * the existing ID for return to the function. + * The name or value of the new VOL connector that is being registered is + * stored in the name (or value) field and the found_id field is initialized to + * H5I_INVALID_HID (-1). If we find a VOL connector with the same name / value, + * we set the found_id field to the existing ID for return to the function. */ typedef struct { - const char *name; /* The name of the VOL connector to check */ - hid_t found_id; /* The library ID if we found a match */ + /* IN */ + H5VL_get_connector_kind_t kind; /* Which kind of connector search to make */ + union { + const char *name; /* The name of the VOL connector to check */ + H5VL_class_value_t value; /* The value of the VOL connector to check */ + } u; + + /* OUT */ + hid_t found_id; /* The connector ID, if we found a match */ } H5VL_get_connector_ud_t; + /********************/ /* Local Prototypes */ /********************/ static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data); + /*********************/ /* Package Variables */ /*********************/ + /*****************************/ /* Library Private Variables */ /*****************************/ + /*******************/ /* Local Variables */ /*******************/ + /*------------------------------------------------------------------------- * Function: H5VL__get_connector_cb @@ -95,10 +108,19 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data) FUNC_ENTER_STATIC_NOERR - if (0 == HDstrcmp(cls->name, op_data->name)) { - op_data->found_id = id; - ret_value = H5_ITER_STOP; + if(H5VL_GET_CONNECTOR_BY_NAME == op_data->kind) { + if(0 == HDstrcmp(cls->name, op_data->u.name)) { + op_data->found_id = id; + ret_value = H5_ITER_STOP; + } /* end if */ } /* end if */ + else { + HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->kind); + if(cls->value == op_data->u.value) { + op_data->found_id = id; + ret_value = H5_ITER_STOP; + } /* end if */ + } /* end else */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__get_connector_cb() */ @@ -139,8 +161,9 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id) if (cls->get_wrap_ctx && !cls->free_wrap_ctx) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided") + op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.u.name = cls->name; op_data.found_id = H5I_INVALID_HID; - op_data.name = cls->name; /* check if connector is already registered */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) @@ -192,16 +215,17 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id) if (0 == HDstrlen(name)) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed") + op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.u.name = name; op_data.found_id = H5I_INVALID_HID; - op_data.name = name; /* Check if connector is already registered */ - if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) + if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") /* If connector alread registered, increment ref count on ID and return ID */ - if (op_data.found_id != H5I_INVALID_HID) { - if (H5I_inc_ref(op_data.found_id, TRUE) < 0) + if(op_data.found_id != H5I_INVALID_HID) { + if(H5I_inc_ref(op_data.found_id, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") ret_value = op_data.found_id; } /* end if */ @@ -210,12 +234,13 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id) const H5VL_class_t *cls; /* Try loading the connector */ - key.name = name; - if (NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, key))) + key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME; + key.vol.u.name = name; + if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector") /* Register the connector we loaded */ - if ((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0) + if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") } /* end else */ @@ -225,6 +250,66 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLregister_connector_by_value + * + * Purpose: Registers a new VOL connector as a member of the virtual object + * layer class. + * + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is + * unregistered. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id) +{ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ + hid_t ret_value = H5I_INVALID_HID; + + FUNC_ENTER_API(H5I_INVALID_HID) + + /* Check arguments */ + if(value < 0) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed") + + op_data.kind = H5VL_GET_CONNECTOR_BY_VALUE; + op_data.u.value = value; + op_data.found_id = H5I_INVALID_HID; + + /* Check if connector is already registered */ + if(H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") + + /* If connector alread registered, increment ref count on ID and return ID */ + if(op_data.found_id != H5I_INVALID_HID) { + if(H5I_inc_ref(op_data.found_id, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + ret_value = op_data.found_id; + } /* end if */ + else { + H5PL_key_t key; + const H5VL_class_t *cls; + + /* Try loading the connector */ + key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME; + key.vol.u.value = value; + if(NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector") + + /* Register the connector we loaded */ + if((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") + } /* end else */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLregister_connector_by_value() */ + + +/*------------------------------------------------------------------------- * Function: H5VLis_connector_registered * * Purpose: Tests whether a VOL class has been registered or not @@ -246,8 +331,9 @@ H5VLis_connector_registered(const char *name) FUNC_ENTER_API(FAIL) H5TRACE1("t", "*s", name); + op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.u.name = name; op_data.found_id = H5I_INVALID_HID; - op_data.name = name; /* Check arguments */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) @@ -280,8 +366,9 @@ H5VLget_connector_id(const char *name) FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*s", name); - op_data.found_id = H5I_INVALID_HID; - op_data.name = name; + op_data.kind = H5VL_GET_CONNECTOR_BY_NAME; + op_data.u.name = name; + op_data.found_id = H5I_INVALID_HID; /* Check arguments */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index e921dea..7b67964 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -291,6 +291,37 @@ done: } /* H5VLget_cap_flags */ +/*--------------------------------------------------------------------------- + * Function: H5VLget_value + * + * Purpose: Retrieves the 'value' for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_value(hid_t connector_id, H5VL_class_value_t *value) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Retrieve connector value */ + if(value) + *value = cls->value; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_value */ + + /*------------------------------------------------------------------------- * Function: H5VL_copy_connector_info * @@ -523,6 +554,88 @@ done: /*--------------------------------------------------------------------------- + * Function: H5VLconnector_info_to_str + * + * Purpose: Serialize a connector's info into a string + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + /* Only serialize info object, if it's non-NULL */ + if(info) { + H5VL_class_t *cls; /* VOL connector's class struct */ + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allow the connector to serialize info */ + if(cls->info_to_str) { + if((cls->info_to_str)(info, str) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize connector info") + } /* end if */ + else + *str = NULL; + } /* end if */ + else + *str = NULL; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLconnector_info_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLconnector_str_to_info + * + * Purpose: Deserialize a string into a connector's info + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + /* Only deserialize string, if it's non-NULL */ + if(str) { + H5VL_class_t *cls; /* VOL connector's class struct */ + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allow the connector to deserialize info */ + if(cls->str_to_info) { + if((cls->str_to_info)(str, info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info") + } /* end if */ + else + *info = NULL; + } /* end if */ + else + *info = NULL; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLconnector_str_to_info() */ + + +/*--------------------------------------------------------------------------- * Function: H5VLget_object * * Purpose: Retrieves an underlying object. @@ -658,7 +771,7 @@ H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_free_connector_info() */ +} /* end H5VL_free_wrap_ctx() */ /*--------------------------------------------------------------------------- diff --git a/src/H5VLnative.c b/src/H5VLnative.c index e506af4..71f4276 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -130,6 +130,8 @@ static H5VL_class_t H5VL_native_cls_g = { NULL, /* info copy */ NULL, /* info compare */ NULL, /* info free */ + NULL, /* info to str */ + NULL, /* str to info */ NULL, /* get_object */ NULL, /* get_wrap_ctx */ NULL, /* free_wrap_ctx */ diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 6b69d93..97e9119 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -45,10 +45,18 @@ typedef struct H5VL_connector_prop_t { const void *connector_info; /* VOL connector info, for open callbacks */ } H5VL_connector_prop_t; +/* Which kind of VOL connector field to use for searching */ +typedef enum H5VL_get_connector_kind_t { + H5VL_GET_CONNECTOR_BY_NAME, /* Name field is set */ + H5VL_GET_CONNECTOR_BY_VALUE /* Value field is set */ +} H5VL_get_connector_kind_t; + + /*****************************/ /* Library Private Variables */ /*****************************/ + /******************************/ /* Library Private Prototypes */ /******************************/ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 26e841d..9fe5bcd 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -382,13 +382,15 @@ typedef struct H5VL_class_t { herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */ herr_t (*terminate)(void); /* Connector termination callback */ size_t info_size; /* size of the vol info */ - void * (*info_copy)(const void *info); /* callback to create a copy of the vol info */ - int (*info_cmp)(const void *info1, const void *info2); /* callback to compare vol info */ - herr_t (*info_free)(void *info); /* callback to release the vol info copy */ - void * (*get_object)(const void *obj); /* callback to retrieve underlying object */ - herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* callback to retrieve the object wrapping context for the connector */ - herr_t (*free_wrap_ctx)(void *wrap_ctx); /* callback to release the object wrapping context for the connector */ - void* (*wrap_object)(void *obj, void *wrap_ctx); /* callback to wrap an object */ + void * (*info_copy)(const void *info); /* Callback to create a copy of the vol info */ + int (*info_cmp)(const void *info1, const void *info2); /* Callback to compare vol info */ + herr_t (*info_free)(void *info); /* Callback to release the vol info copy */ + herr_t (*info_to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */ + herr_t (*str_to_info)(const char *str, void **info); /* Callback to deserialize a string into connector's info */ + void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */ + herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */ + herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */ + void* (*wrap_object)(void *obj, void *wrap_ctx); /* Callback to wrap an object */ /* Data Model */ H5VL_attr_class_t attr_cls; /* attribute class callbacks */ @@ -422,6 +424,7 @@ extern "C" { /* VOL Connector Functionality */ H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id); +H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id); H5_DLL htri_t H5VLis_connector_registered(const char *name); H5_DLL hid_t H5VLget_connector_id(const char *name); H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name/*out*/, size_t size); @@ -442,10 +445,13 @@ H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connect H5_DLL herr_t H5VLinitialize(hid_t connector_id, hid_t vipl_id); H5_DLL herr_t H5VLterminate(hid_t connector_id); H5_DLL herr_t H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags); +H5_DLL herr_t H5VLget_value(hid_t connector_id, H5VL_class_value_t *conn_value); H5_DLL herr_t H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info); H5_DLL herr_t H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, const void *info2); H5_DLL herr_t H5VLfree_connector_info(hid_t connector_id, void *vol_info); +H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str); +H5_DLL herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info); H5_DLL void *H5VLget_object(void *obj, hid_t connector_id); H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx); H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id); diff --git a/src/H5Z.c b/src/H5Z.c index aeb7602..f41588f 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -697,11 +697,11 @@ H5Z_filter_avail(H5Z_filter_t id) HGOTO_DONE(TRUE) key.id = (int)id; - if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) { - if (H5Z_register(filter_info) < 0) + if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) { + if(H5Z_register(filter_info) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter") HGOTO_DONE(TRUE) - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1289,7 +1289,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, /* Try loading the filter */ key.id = (int)(pline->filter[idx].id); - if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, key))) { + if(NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) { /* Register the filter we loaded */ if(H5Z_register(filter_info) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") -- cgit v0.12 From 3055e499d527d9847c7f71f6a1596e69101183b3 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 21 Nov 2018 23:12:24 -0600 Subject: Switch loc_params to VOL callbacks to pass struct by pointer instead of by value. --- examples/h5_vol_external_log_native.c | 28 +-- src/H5A.c | 38 ++-- src/H5Adeprec.c | 8 +- src/H5D.c | 6 +- src/H5Ddeprec.c | 4 +- src/H5G.c | 12 +- src/H5Gdeprec.c | 34 ++-- src/H5I.c | 2 +- src/H5L.c | 34 ++-- src/H5Lexternal.c | 2 +- src/H5O.c | 32 +-- src/H5Ocopy.c | 2 +- src/H5Odeprec.c | 10 +- src/H5Oflush.c | 4 +- src/H5R.c | 10 +- src/H5Rdeprec.c | 4 +- src/H5Tcommit.c | 6 +- src/H5Tdeprec.c | 4 +- src/H5VLcallback.c | 168 +++++++-------- src/H5VLnative.c | 373 +++++++++++++++++----------------- src/H5VLprivate.h | 36 ++-- src/H5VLpublic.h | 84 ++++---- 22 files changed, 450 insertions(+), 451 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index 19eaa5e..accae03 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -10,14 +10,14 @@ static herr_t H5VL_log_init(hid_t vipl_id); static herr_t H5VL_log_term(void); /* Datatype callbacks */ -static void *H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -static void *H5VL_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL_log_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL_log_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); static herr_t H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req); /* Dataset callbacks */ -static void *H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -static void *H5VL_log_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL_log_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL_log_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); static herr_t H5VL_log_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); static herr_t H5VL_log_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, @@ -31,14 +31,14 @@ static herr_t H5VL_log_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl static herr_t H5VL_log_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */ -static void *H5VL_log_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL_log_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); static herr_t H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req); /* Link callbacks */ /* Object callbacks */ -static void *H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -static herr_t H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static void *H5VL_log_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL_log_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); hid_t native_connector_id = -1; @@ -321,7 +321,7 @@ H5VL_log_file_close(void *file, hid_t dxpl_id, void **req) } static void * -H5VL_log_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, +H5VL_log_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_log_t *group; @@ -348,7 +348,7 @@ H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req) } static void * -H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, +H5VL_log_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { H5VL_log_t *dt; @@ -364,7 +364,7 @@ H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *na } static void * -H5VL_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +H5VL_log_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { H5VL_log_t *dt; H5VL_log_t *o = (H5VL_log_t *)obj; @@ -404,7 +404,7 @@ H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req) } static void * -H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req) +H5VL_log_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { H5VL_log_t *new_obj; H5VL_log_t *o = (H5VL_log_t *)obj; @@ -418,7 +418,7 @@ H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened } static herr_t -H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, +H5VL_log_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_log_t *o = (H5VL_log_t *)obj; @@ -430,7 +430,7 @@ H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_sp } static void * -H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +H5VL_log_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_log_t *dset; H5VL_log_t *o = (H5VL_log_t *)obj; @@ -444,7 +444,7 @@ H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *nam } static void * -H5VL_log_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) +H5VL_log_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_log_t *dset; H5VL_log_t *o = (H5VL_log_t *)obj; diff --git a/src/H5A.c b/src/H5A.c index bfbb6e4..0d20912 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -296,7 +296,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj, loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -401,7 +401,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj, loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -469,7 +469,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) 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 */ @@ -551,7 +551,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute") /* Register the attribute and get an ID for it */ @@ -642,7 +642,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -908,7 +908,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) loc_params.obj_type = H5I_get_type(attr_id); /* Get the attribute name */ - if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, buf_size, buf, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, buf_size, buf, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") done: @@ -973,7 +973,7 @@ H5Aget_name_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 name */ - if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name") done: @@ -1051,7 +1051,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) loc_params.obj_type = H5I_get_type(attr_id); /* Get the attribute information */ - if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1107,7 +1107,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1170,7 +1170,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1221,7 +1221,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Rename the attribute */ - if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name) < 0) + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1281,7 +1281,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Rename the attribute */ - if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name) < 0) + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1358,7 +1358,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) + if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: @@ -1446,7 +1446,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) + if((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed"); done: @@ -1499,7 +1499,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ - if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name) < 0) + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1557,7 +1557,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ - if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name) < 0) + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1627,7 +1627,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute through the VOL */ - if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0) + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1705,7 +1705,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) loc_params.obj_type = H5I_get_type(obj_id); /* Check if the attribute exists */ - if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -1759,7 +1759,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Check existence of attribute */ - if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) + if(H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index af3ab4d..b43e41d 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -156,7 +156,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj, loc_params, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -221,7 +221,7 @@ H5Aopen_name(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -289,7 +289,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -343,7 +343,7 @@ H5Aget_num_attrs(hid_t loc_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the number of attributes for the object */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, &oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object") H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t); diff --git a/src/H5D.c b/src/H5D.c index 67c2876..1e16868 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -158,7 +158,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj, loc_params, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ @@ -249,7 +249,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj, loc_params, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ @@ -311,7 +311,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj, loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Register an atom for the dataset */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index d778e83..76827b4 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -161,7 +161,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(vol_obj, loc_params, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ @@ -220,7 +220,7 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj, loc_params, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Get an atom for the dataset */ diff --git a/src/H5G.c b/src/H5G.c index 114f3bf..20df130 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -365,7 +365,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ @@ -444,7 +444,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ @@ -505,7 +505,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - if(NULL == (grp = H5VL_group_open(vol_obj, loc_params, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Register an ID for the group */ @@ -590,7 +590,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info) /* Retrieve the group's information */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = id_type; - if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -642,7 +642,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -702,7 +702,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 6ed5344..a15703e 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -232,7 +232,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ @@ -293,7 +293,7 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the group */ - if(NULL == (grp = H5VL_group_open(vol_obj, loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Get an atom for the group */ @@ -372,7 +372,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new tmp_vol_obj.connector = vol_obj->connector; /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { @@ -393,7 +393,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else-if */ else @@ -467,7 +467,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { @@ -493,7 +493,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else-if */ else @@ -540,7 +540,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if(H5VL_link_move(vol_obj, loc_params1, NULL, loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: @@ -594,7 +594,7 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if(H5VL_link_move(vol_obj1, loc_params1, vol_obj2, loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -637,7 +637,7 @@ H5Gunlink(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: @@ -681,7 +681,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value") done: @@ -734,7 +734,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set the comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: @@ -795,7 +795,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, buf, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, buf, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") done: @@ -868,7 +868,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") /* Call private iteration function, through VOL callback */ - if((ret_value = H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_ITERATE_OLD, loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) + if((ret_value = H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_ITERATE_OLD, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links"); /* Set the index we stopped at */ @@ -924,7 +924,7 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the group's information */ - if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, &grp_info) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, &grp_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") /* Set the number of objects [i.e. links] in the group */ @@ -985,7 +985,7 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_GET_OBJINFO, loc_params, (unsigned)follow_link, statbuf) < 0) + if(H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_GET_OBJINFO, &loc_params, (unsigned)follow_link, statbuf) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) } /* end if */ @@ -1189,7 +1189,7 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Call internal function */ - if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name") done: @@ -1239,7 +1239,7 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) /* Retrieve the object's basic information (which includes its type) */ fields = H5O_INFO_BASIC; - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, &oinfo, fields) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info") /* Map to group object type */ diff --git a/src/H5I.c b/src/H5I.c index f4a221f..68cbe55 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2181,7 +2181,7 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) loc_params.obj_type = H5I_get_type(id); /* Retrieve object's name */ - if(H5VL_object_get(vol_obj, loc_params, H5VL_ID_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_ID_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: diff --git a/src/H5L.c b/src/H5L.c index 6a86a34..9c14fce 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -331,7 +331,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") /* Move the link */ - if(H5VL_link_move(vol_obj1, loc_params1, vol_obj2, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -418,7 +418,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, tmp_vol_obj.connector = (vol_obj1 ? vol_obj1->connector : vol_obj2->connector); /* Copy the link */ - if(H5VL_link_copy(&tmp_vol_obj, loc_params1, vol_obj2, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_copy(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link") done: @@ -497,7 +497,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Create the link */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") done: @@ -599,7 +599,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector); /* Create the link */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link") done: @@ -680,7 +680,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") /* Create external link */ - if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -734,7 +734,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Unlink */ - if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -797,7 +797,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -853,7 +853,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: @@ -917,7 +917,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value") done: @@ -968,7 +968,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check for the existence of the link */ - if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1019,7 +1019,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link information */ - if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1079,7 +1079,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link information */ - if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1275,7 +1275,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the link information */ - if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name") done: @@ -1333,7 +1333,7 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.obj_type = H5I_get_type(group_id); /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1403,7 +1403,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1471,7 +1471,7 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1546,7 +1546,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Visit the links */ - if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index ad0344e..73f7b89 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -414,7 +414,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") /* Create an external link */ - if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link") done: diff --git a/src/H5O.c b/src/H5O.c index 01b16ce..2ea8c10 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -130,7 +130,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Get an atom for the object */ @@ -203,7 +203,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &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(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) @@ -270,7 +270,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Register the dataset ID */ @@ -376,7 +376,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector); /* Create a link to the object */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") done: @@ -426,7 +426,7 @@ H5Oincr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -476,7 +476,7 @@ H5Odecr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -528,7 +528,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Check if the object exists */ - if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -575,7 +575,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -633,7 +633,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -698,7 +698,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -746,7 +746,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) loc_params.obj_type = H5I_get_type(obj_id); /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: @@ -801,7 +801,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, &loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: @@ -844,7 +844,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) loc_params.obj_type = H5I_get_type(obj_id); /* Retrieve the object's comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: @@ -898,7 +898,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Retrieve the object's comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: @@ -971,7 +971,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.obj_type = H5I_get_type(obj_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: @@ -1055,7 +1055,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 213a697..a3d4884 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -247,7 +247,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.obj_type = H5I_get_type(dst_loc_id); /* Copy the object */ - if(H5VL_object_copy(vol_obj1, loc_params1, src_name, vol_obj2, loc_params2, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_object_copy(vol_obj1, &loc_params1, src_name, vol_obj2, &loc_params2, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index dca1835..93fc18a 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -109,7 +109,7 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -160,7 +160,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -221,7 +221,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -289,7 +289,7 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.obj_type = H5I_get_type(obj_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: @@ -368,7 +368,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 4b429f8..3e1ae46 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -92,7 +92,7 @@ H5Oflush(hid_t obj_id) loc_params.obj_type = H5I_get_type(obj_id); /* Flush the object */ - if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") done: @@ -256,7 +256,7 @@ H5Orefresh(hid_t oid) loc_params.obj_type = H5I_get_type(oid); /* Refresh the object */ - if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: diff --git a/src/H5R.c b/src/H5R.c index fa25375..b7866b1 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -127,7 +127,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") /* Create reference */ - if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, ref_type, space_id)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, ref_type, space_id)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference") done: @@ -198,7 +198,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &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(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) @@ -257,7 +257,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Get the dataspace with the correct region selected */ - if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") done: @@ -314,7 +314,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the object type */ - if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, ref_type, ref) < 0) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") done: @@ -381,7 +381,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get name */ - if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path") done: diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index ba71a4b..827506e 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -126,7 +126,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier") /* Get the object information */ - if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ @@ -182,7 +182,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") /* Get an atom for the object */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index b02f8ce..610c628 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -150,7 +150,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Commit the type */ - if(NULL == (data = H5VL_datatype_commit(vol_obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (data = H5VL_datatype_commit(vol_obj, &loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Set up VOL object */ @@ -303,7 +303,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Commit the datatype */ - if(NULL == (dt = H5VL_datatype_commit(vol_obj, loc_params, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dt = H5VL_datatype_commit(vol_obj, &loc_params, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Setup VOL object */ @@ -591,7 +591,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Open the datatype */ - if(NULL == (dt = H5VL_datatype_open(vol_obj, loc_params, name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dt = H5VL_datatype_open(vol_obj, &loc_params, name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 3385794..9bd5ddd 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -137,7 +137,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Commit the datatype */ - if(NULL == (data = H5VL_datatype_commit(vol_obj, loc_params, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (data = H5VL_datatype_commit(vol_obj, &loc_params, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Set up VOL object */ @@ -194,7 +194,7 @@ H5Topen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the datatype */ - if(NULL == (dt = H5VL_datatype_open(vol_obj, loc_params, name, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dt = H5VL_datatype_open(vol_obj, &loc_params, name, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 7b67964..2c77416 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -56,10 +56,10 @@ /********************/ /* Local Prototypes */ /********************/ -static void *H5VL__attr_create(void *obj, H5VL_loc_params_t loc_params, +static void *H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -static void *H5VL__attr_open(void *obj, H5VL_loc_params_t loc_params, +static void *H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, @@ -68,17 +68,17 @@ static herr_t H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_typ const void *buf, hid_t dxpl_id, void **req); static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__attr_specific(void *obj, H5VL_loc_params_t loc_params, +static herr_t H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); -static void *H5VL__dataset_create(void *obj, H5VL_loc_params_t loc_params, +static void *H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -static void *H5VL__dataset_open(void *obj, H5VL_loc_params_t loc_params, +static void *H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, @@ -109,10 +109,10 @@ static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl void **req, va_list arguments); static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); -static void *H5VL__group_create(void *obj, H5VL_loc_params_t loc_params, +static void *H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -static void *H5VL__group_open(void *obj, H5VL_loc_params_t loc_params, +static void *H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, @@ -124,40 +124,40 @@ static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxp static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, - H5VL_loc_params_t loc_params, const H5VL_class_t *cls, hid_t lcpl_id, + const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__link_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, +static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__link_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, +static herr_t H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__link_get(void *obj, H5VL_loc_params_t loc_params, +static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__link_specific(void *obj, H5VL_loc_params_t loc_params, +static herr_t H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments); -static void *H5VL__object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, +static void *H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -static herr_t H5VL__object_copy(void *src_obj, H5VL_loc_params_t src_loc_params, - const char *src_name, void *dst_obj, H5VL_loc_params_t dst_loc_params, +static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, + const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__object_get(void *obj, H5VL_loc_params_t loc_params, +static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__object_specific(void *obj, H5VL_loc_params_t loc_params, +static herr_t H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments); -static void * H5VL__datatype_commit(void *obj, H5VL_loc_params_t loc_params, +static void * H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -static void *H5VL__datatype_open(void *obj, H5VL_loc_params_t loc_params, +static void *H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, @@ -886,7 +886,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -917,7 +917,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_attr_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -954,7 +954,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, +H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -990,7 +990,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, +H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -1021,7 +1021,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_attr_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -1058,7 +1058,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, +H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -1411,7 +1411,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { @@ -1443,7 +1443,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -1488,7 +1488,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, +H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -1726,7 +1726,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -1757,7 +1757,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_dataset_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -1794,7 +1794,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, +H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -1830,7 +1830,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, +H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -1861,7 +1861,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_dataset_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -1898,7 +1898,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, +H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -3324,7 +3324,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -3355,7 +3355,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_group_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -3392,7 +3392,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, +H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -3428,7 +3428,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -3459,7 +3459,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_group_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -3496,7 +3496,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, +H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -3972,7 +3972,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, +H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4004,7 +4004,7 @@ done: */ herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, - H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, + const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { H5VL_object_t tmp_vol_obj; /* Temporary object token of */ @@ -4059,7 +4059,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, +H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -4093,8 +4093,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, +H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, + const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4125,8 +4125,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_copy(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, - const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, +H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { const H5VL_object_t *vol_obj; /* VOL object for object with data */ @@ -4167,8 +4167,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t connector_id, hid_t lcpl_id, +H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, + const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -4202,8 +4202,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, +H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, + const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4234,8 +4234,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_move(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, - const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, +H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { const H5VL_object_t *vol_obj; /* VOL object for object with data */ @@ -4276,8 +4276,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t connector_id, hid_t lcpl_id, +H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, + const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -4311,7 +4311,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4342,7 +4342,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -4387,7 +4387,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_link_get_t get_type, +H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -4423,7 +4423,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4454,7 +4454,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -4499,7 +4499,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, +H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -4644,7 +4644,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, +H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -4675,7 +4675,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_object_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t params, +H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -4712,7 +4712,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t connector_id, H5I_type_t *opened_type, +H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -4748,8 +4748,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__object_copy(void *src_obj, H5VL_loc_params_t src_loc_params, const char *src_name, - void *dst_obj, H5VL_loc_params_t dst_loc_params, const char *dst_name, +H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, + void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { @@ -4781,8 +4781,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_copy(const H5VL_object_t *src_obj, H5VL_loc_params_t src_loc_params, - const char *src_name, const H5VL_object_t *dst_obj, H5VL_loc_params_t dst_loc_params, +H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_params, + const char *src_name, const H5VL_object_t *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { @@ -4824,8 +4824,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_copy(void *src_obj, H5VL_loc_params_t src_loc_params, - const char *src_name, void *dst_obj, H5VL_loc_params_t dst_loc_params, +H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, + const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { @@ -4863,7 +4863,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4894,7 +4894,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -4939,7 +4939,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_object_get_t get_type, +H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -4975,7 +4975,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { @@ -5007,7 +5007,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -5052,7 +5052,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, +H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ @@ -5201,7 +5201,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { @@ -5233,7 +5233,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_datatype_commit(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { @@ -5271,7 +5271,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, +H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { @@ -5308,7 +5308,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, +H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -5339,7 +5339,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_datatype_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, +H5VL_datatype_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -5376,7 +5376,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, +H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls; /* VOL connector's class struct */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 71f4276..3fad8e1 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -53,18 +53,18 @@ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; static herr_t H5VL__native_term(void); /* Atrribute callbacks */ -static void *H5VL__native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -static void *H5VL__native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); static herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); static herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req); /* Dataset callbacks */ -static void *H5VL__native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -static void *H5VL__native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); static herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, @@ -83,8 +83,8 @@ static herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, static herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */ -static void *H5VL__native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -static void *H5VL__native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); @@ -92,28 +92,28 @@ static herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req); /* Link callbacks */ static herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, - H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, + const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, +static herr_t H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); /* Object callbacks */ -static void *H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -static herr_t H5VL__native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, +static void *H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Datatype callbacks */ -static void *H5VL__native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -static void *H5VL__native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); @@ -298,7 +298,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, +H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { @@ -324,7 +324,7 @@ H5VL__native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *at if(H5P_get(plist, H5VL_PROP_ATTR_SPACE_ID, &space_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id") - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") if(0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, NULL, "no write intent on file") @@ -337,15 +337,15 @@ H5VL__native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *at if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data space") - if(loc_params.type == H5VL_OBJECT_BY_SELF) { + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Acreate */ /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Acreate_by_name */ - if(NULL == (attr = H5A__create_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name, type, space, acpl_id))) + if(NULL == (attr = H5A__create_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name, type, space, acpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") } /* end else-if */ else @@ -376,7 +376,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, +H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Object location */ @@ -386,28 +386,28 @@ H5VL__native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr FUNC_ENTER_STATIC /* check arguments */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") - if(loc_params.type == H5VL_OBJECT_BY_SELF) { + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aopen */ /* Open the attribute */ if(NULL == (attr = H5A__open(&loc, attr_name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name) } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aopen_by_name */ /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name))) + if(NULL == (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") } /* end else-if */ - else if(loc_params.type == H5VL_OBJECT_BY_IDX) { + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Aopen_by_idx */ /* Open the attribute in the object header */ - if(NULL == (attr = H5A__open_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, - loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, - loc_params.loc_data.loc_by_idx.n))) + if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, + loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, + loc_params->loc_data.loc_by_idx.n))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute") } /* end else-if */ else @@ -545,30 +545,30 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, /* H5Aget_name */ case H5VL_ATTR_GET_NAME: { - H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *); size_t buf_size = va_arg(arguments, size_t); char *buf = va_arg(arguments, char *); ssize_t *ret_val = va_arg(arguments, ssize_t *); H5A_t *attr = NULL; - if(H5VL_OBJECT_BY_SELF == loc_params.type) { + if(H5VL_OBJECT_BY_SELF == loc_params->type) { attr = (H5A_t *)obj; /* Call private function in turn */ if(0 > (*ret_val = H5A__get_name(attr, buf_size, buf))) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name") } - else if(H5VL_OBJECT_BY_IDX == loc_params.type) { + else if(H5VL_OBJECT_BY_IDX == loc_params->type) { H5G_loc_t loc; /* check arguments */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, - loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, - loc_params.loc_data.loc_by_idx.n))) + if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, + loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, + loc_params->loc_data.loc_by_idx.n))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the length of the name */ @@ -594,26 +594,25 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, /* H5Aget_info */ case H5VL_ATTR_GET_INFO: { - H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *); H5A_info_t *ainfo = va_arg(arguments, H5A_info_t *); H5A_t *attr = NULL; - if(H5VL_OBJECT_BY_SELF == loc_params.type) { + if(H5VL_OBJECT_BY_SELF == loc_params->type) { attr = (H5A_t *)obj; if(H5A__get_info(attr, ainfo) < 0) HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get attribute info") } - else if(H5VL_OBJECT_BY_NAME == loc_params.type) { + else if(H5VL_OBJECT_BY_NAME == loc_params->type) { char *attr_name = va_arg(arguments, char *); H5G_loc_t loc; /* check arguments */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_name(&loc, loc_params.loc_data.loc_by_name.name, - attr_name))) + if(NULL == (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -624,18 +623,18 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, if(attr && H5A__close(attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") } - else if(H5VL_OBJECT_BY_IDX == loc_params.type) { + else if(H5VL_OBJECT_BY_IDX == loc_params->type) { H5G_loc_t loc; /* check arguments */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Open the attribute on the object header */ - if(NULL == (attr = H5A__open_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, - loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, - loc_params.loc_data.loc_by_idx.n))) + if(NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, + loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, + loc_params->loc_data.loc_by_idx.n))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -685,7 +684,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, +H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; @@ -694,7 +693,7 @@ H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_sp FUNC_ENTER_STATIC /* Get location for passed-in object */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") switch(specific_type) { @@ -702,23 +701,23 @@ H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_sp { char *attr_name = va_arg(arguments, char *); - if(H5VL_OBJECT_BY_SELF == loc_params.type) { + if(H5VL_OBJECT_BY_SELF == loc_params->type) { /* H5Adelete */ /* Delete the attribute from the location */ if(H5O__attr_remove(loc.oloc, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") } /* end if */ - else if(H5VL_OBJECT_BY_NAME == loc_params.type) { + else if(H5VL_OBJECT_BY_NAME == loc_params->type) { /* H5Adelete_by_name */ /* Delete the attribute */ - if(H5A__delete_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name) < 0) + if(H5A__delete_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") } /* end else-if */ - else if(H5VL_OBJECT_BY_IDX == loc_params.type) { + else if(H5VL_OBJECT_BY_IDX == loc_params->type) { /* H5Adelete_by_idx */ /* Delete the attribute from the location */ - if(H5A__delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n) < 0) + if(H5A__delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") } /* end else-if */ else @@ -731,14 +730,14 @@ H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_sp const char *attr_name = va_arg(arguments, const char *); htri_t *ret = va_arg(arguments, htri_t *); - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */ + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */ /* Check if the attribute exists */ if((*ret = H5O__attr_exists(loc.oloc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */ /* Check if the attribute exists */ - if((*ret = H5A__exists_by_name(loc, loc_params.loc_data.loc_by_name.name, attr_name)) < 0) + if((*ret = H5A__exists_by_name(loc, loc_params->loc_data.loc_by_name.name, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") } /* end else-if */ else @@ -754,14 +753,14 @@ H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_sp H5A_operator2_t op = va_arg(arguments, H5A_operator2_t); void *op_data = va_arg(arguments, void *); - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */ + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */ /* Iterate over attributes */ if((ret_value = H5A__iterate(&loc, ".", idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */ /* Iterate over attributes by name */ - if((ret_value = H5A__iterate(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, idx, op, op_data)) < 0) + if((ret_value = H5A__iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed"); } /* end else-if */ else @@ -775,14 +774,14 @@ H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_sp const char *old_name = va_arg(arguments, const char *); const char *new_name = va_arg(arguments, const char *); - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Arename */ + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Arename */ /* Call attribute rename routine */ if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */ /* Call attribute rename routine */ - if(H5A__rename_by_name(loc, loc_params.loc_data.loc_by_name.name, old_name, new_name) < 0) + if(H5A__rename_by_name(loc, loc_params->loc_data.loc_by_name.name, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end else-if */ else @@ -883,7 +882,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__native_dataset_create(void *obj, H5VL_loc_params_t loc_params, +H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { @@ -911,7 +910,7 @@ H5VL__native_dataset_create(void *obj, H5VL_loc_params_t loc_params, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id") /* Check arguments */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") if(H5I_DATATYPE != H5I_get_type(type_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype ID") @@ -964,7 +963,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, +H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5D_t *dset = NULL; @@ -973,7 +972,7 @@ H5VL__native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *n FUNC_ENTER_STATIC - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") /* Open the dataset */ @@ -2203,7 +2202,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, +H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { @@ -2224,7 +2223,7 @@ H5VL__native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *n HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id") /* Set up the location */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") /* if name is NULL then this is from H5Gcreate_anon */ @@ -2281,7 +2280,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, +H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Location to open group */ @@ -2291,7 +2290,7 @@ H5VL__native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *nam FUNC_ENTER_STATIC /* Set up the location */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") /* Open the group */ @@ -2337,33 +2336,33 @@ H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, /* H5Gget_info */ case H5VL_GROUP_GET_INFO: { - H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *); H5G_info_t *group_info = va_arg(arguments, H5G_info_t *); H5G_loc_t loc; - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(loc_params.type == H5VL_OBJECT_BY_SELF) { + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Gget_info */ /* Retrieve the group's information */ if(H5G__obj_info(loc.oloc, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") } /* end if */ - else if (loc_params.type == H5VL_OBJECT_BY_NAME) { + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Gget_info_by_name */ /* Retrieve the group's information */ - if(H5G__get_info_by_name(&loc, loc_params.loc_data.loc_by_name.name, group_info) < 0) + if(H5G__get_info_by_name(&loc, loc_params->loc_data.loc_by_name.name, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") } /* end else-if */ - else if(loc_params.type == H5VL_OBJECT_BY_IDX) { + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Gget_info_by_idx */ /* Retrieve the group's information */ - if(H5G__get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, group_info) < 0) + if(H5G__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") } /* end else-if */ else @@ -2454,7 +2453,7 @@ H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, /* H5Giterate (deprecated) */ case H5VL_GROUP_ITERATE_OLD: { - H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *); hsize_t idx = va_arg(arguments, hsize_t); hsize_t *last_obj = va_arg(arguments, hsize_t *); const H5G_link_iterate_t *lnk_op = va_arg(arguments, const H5G_link_iterate_t *); @@ -2462,11 +2461,11 @@ H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, H5G_loc_t grp_loc; /* Get the location struct for the object */ - if(H5G_loc_real(obj, loc_params.obj_type, &grp_loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Call the actual iteration routine */ - if((ret_value = H5G_iterate(&grp_loc, loc_params.loc_data.loc_by_name.name, H5_INDEX_NAME, H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0) + if((ret_value = H5G_iterate(&grp_loc, loc_params->loc_data.loc_by_name.name, H5_INDEX_NAME, H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0) HERROR(H5E_VOL, H5E_BADITER, "error iterating over group's links"); break; @@ -2475,17 +2474,17 @@ H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, /* H5Gget_objinfo (deprecated) */ case H5VL_GROUP_GET_OBJINFO: { - H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + const H5VL_loc_params_t *loc_params = va_arg(arguments, const H5VL_loc_params_t *); hbool_t follow_link = va_arg(arguments, unsigned); H5G_stat_t *statbuf = va_arg(arguments, H5G_stat_t *); H5G_loc_t grp_loc; /* Get the location struct for the object */ - if(H5G_loc_real(obj, loc_params.obj_type, &grp_loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Call the actual group objinfo routine */ - if(H5G__get_objinfo(&grp_loc, loc_params.loc_data.loc_by_name.name, follow_link, statbuf) < 0) + if(H5G__get_objinfo(&grp_loc, loc_params->loc_data.loc_by_name.name, follow_link, statbuf) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") break; @@ -2539,7 +2538,7 @@ done: */ static herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, - H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, + const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ @@ -2566,7 +2565,7 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, if(NULL != cur_obj && H5G_loc_real(cur_obj, cur_params.obj_type, &cur_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(NULL != obj && H5G_loc_real(obj, loc_params.obj_type, &link_loc) < 0) + if(NULL != obj && H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* H5Lcreate_hard */ @@ -2585,12 +2584,12 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, /* Create the link */ if((ret_value = H5L_create_hard(cur_loc_p, cur_params.loc_data.loc_by_name.name, - link_loc_p, loc_params.loc_data.loc_by_name.name, lcpl_id)) < 0) + link_loc_p, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else { /* H5Olink */ /* Link to the object */ - if(H5L_link(&link_loc, loc_params.loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0) + if(H5L_link(&link_loc, loc_params->loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") } /* end else */ break; @@ -2601,14 +2600,14 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, char *target_name; H5G_loc_t link_loc; /* Group location for new link */ - if(H5G_loc_real(obj, loc_params.obj_type, &link_loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") if(H5P_get(plist, H5VL_PROP_LINK_TARGET_NAME, &target_name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for targe name") /* Create the link */ - if((ret_value = H5L_create_soft(target_name, &link_loc, loc_params.loc_data.loc_by_name.name, lcpl_id)) < 0) + if((ret_value = H5L_create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; } @@ -2620,7 +2619,7 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, void *udata; size_t udata_size; - if(H5G_loc_real(obj, loc_params.obj_type, &link_loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") if(H5P_get(plist, H5VL_PROP_LINK_TYPE, &link_type) < 0) @@ -2631,7 +2630,7 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for udata size") /* Create link */ - if(H5L__create_ud(&link_loc, loc_params.loc_data.loc_by_name.name, udata, udata_size, + if(H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size, link_type, lcpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; @@ -2664,8 +2663,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, +H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { @@ -2675,9 +2674,9 @@ H5VL__native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, FUNC_ENTER_STATIC - if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) + if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2.obj_type, &dst_loc) < 0) + if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Set up src & dst location pointers */ @@ -2689,8 +2688,8 @@ H5VL__native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, dst_loc_p = src_loc_p; /* Copy the link */ - if(H5L_move(src_loc_p, loc_params1.loc_data.loc_by_name.name, - dst_loc_p, loc_params2.loc_data.loc_by_name.name, + if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name, + dst_loc_p, loc_params2->loc_data.loc_by_name.name, TRUE, lcpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link") @@ -2717,8 +2716,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, +H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { @@ -2728,9 +2727,9 @@ H5VL__native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, FUNC_ENTER_STATIC - if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) + if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2.obj_type, &dst_loc) < 0) + if(NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Set up src & dst location pointers */ @@ -2742,8 +2741,8 @@ H5VL__native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, dst_loc_p = src_loc_p; /* Move the link */ - if(H5L_move(src_loc_p, loc_params1.loc_data.loc_by_name.name, - dst_loc_p, loc_params2.loc_data.loc_by_name.name, + if(H5L_move(src_loc_p, loc_params1->loc_data.loc_by_name.name, + dst_loc_p, loc_params2->loc_data.loc_by_name.name, FALSE, lcpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") @@ -2766,7 +2765,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, +H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; @@ -2774,7 +2773,7 @@ H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t g FUNC_ENTER_STATIC - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") switch(get_type) { @@ -2784,13 +2783,13 @@ H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t g H5L_info_t *linfo = va_arg(arguments, H5L_info_t *); /* Get the link information */ - if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */ - if(H5L_get_info(&loc, loc_params.loc_data.loc_by_name.name, linfo) < 0) + if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */ + if(H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */ - if(H5L_get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, linfo) < 0) + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */ + if(H5L_get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") } /* end else-if */ else @@ -2806,8 +2805,8 @@ H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t g ssize_t *ret = va_arg(arguments, ssize_t *); /* Get the link name */ - if((*ret = H5L_get_name_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, name, size)) < 0) + if((*ret = H5L_get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, name, size)) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") break; @@ -2820,14 +2819,14 @@ H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t g size_t size = va_arg(arguments, size_t); /* Get the link information */ - if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */ - if(H5L_get_val(&loc, loc_params.loc_data.loc_by_name.name, buf, size) < 0) + if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */ + if(H5L_get_val(&loc, loc_params->loc_data.loc_by_name.name, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value") } - else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */ + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */ - if(H5L_get_val_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, buf, size) < 0) + if(H5L_get_val_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val") } else @@ -2859,7 +2858,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, +H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2872,11 +2871,11 @@ H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_sp htri_t *ret = va_arg(arguments, htri_t *); H5G_loc_t loc; - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Check for the existence of the link */ - if((*ret = H5L_exists(&loc, loc_params.loc_data.loc_by_name.name)) < 0) + if((*ret = H5L_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info") break; } @@ -2892,11 +2891,11 @@ H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_sp void *op_data = va_arg(arguments, void *); /* Get the location */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Visit or iterate over the links */ - if(loc_params.type == H5VL_OBJECT_BY_SELF) { + if(loc_params->type == H5VL_OBJECT_BY_SELF) { if(recursive) { /* H5Lvisit */ if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0) @@ -2908,15 +2907,15 @@ H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_sp HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") } /* end else */ } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { if(recursive) { /* H5Lvisit_by_name */ - if((ret_value = H5G_visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, op, op_data)) < 0) + if((ret_value = H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") } /* end if */ else { /* H5Literate_by_name */ - if((ret_value = H5L_iterate(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") } /* end else */ } /* end else-if */ @@ -2930,17 +2929,17 @@ H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_sp { H5G_loc_t loc; - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Unlink */ - if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ - if(H5L_delete(&loc, loc_params.loc_data.loc_by_name.name) < 0) + if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ + if(H5L_delete(&loc, loc_params->loc_data.loc_by_name.name) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ - if(H5L_delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n) < 0) + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ + if(H5L_delete_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") } /* end else-if */ else @@ -2971,7 +2970,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, +H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; @@ -2979,14 +2978,14 @@ H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *op FUNC_ENTER_STATIC - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") - switch(loc_params.type) { + switch(loc_params->type) { case H5VL_OBJECT_BY_NAME: { /* Open the object */ - if(NULL == (ret_value = H5O_open_name(&loc, loc_params.loc_data.loc_by_name.name, opened_type))) + if(NULL == (ret_value = H5O_open_name(&loc, loc_params->loc_data.loc_by_name.name, opened_type))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name") break; } @@ -2994,8 +2993,8 @@ H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *op case H5VL_OBJECT_BY_IDX: { /* Open the object */ - if(NULL == (ret_value = H5O_open_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, opened_type))) + if(NULL == (ret_value = H5O_open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, opened_type))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index") break; } @@ -3003,7 +3002,7 @@ H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *op case H5VL_OBJECT_BY_ADDR: { /* Open the object */ - if(NULL == (ret_value = H5O_open_by_addr(&loc, loc_params.loc_data.loc_by_addr.addr, opened_type))) + if(NULL == (ret_value = H5O_open_by_addr(&loc, loc_params->loc_data.loc_by_addr.addr, opened_type))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address") break; } @@ -3017,9 +3016,9 @@ H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *op file = loc.oloc->file; /* Create reference */ - if((temp_id = H5R__dereference(file, loc_params.loc_data.loc_by_ref.lapl_id, - loc_params.loc_data.loc_by_ref.ref_type, - loc_params.loc_data.loc_by_ref._ref)) < 0) + if((temp_id = H5R__dereference(file, loc_params->loc_data.loc_by_ref.lapl_id, + loc_params->loc_data.loc_by_ref.ref_type, + loc_params->loc_data.loc_by_ref._ref)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, NULL, "unable to dereference object") *opened_type = H5I_get_type(temp_id); @@ -3052,8 +3051,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, +H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t src_loc; /* Source object group location */ @@ -3063,9 +3062,9 @@ H5VL__native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const cha FUNC_ENTER_STATIC /* get location for objects */ - if(H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) + if(H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - if(H5G_loc_real(dst_obj, loc_params2.obj_type, &dst_loc) < 0) + if(H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Copy the object */ @@ -3090,7 +3089,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, +H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3098,7 +3097,7 @@ H5VL__native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get FUNC_ENTER_STATIC - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") switch(get_type) { @@ -3182,7 +3181,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, +H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; @@ -3190,7 +3189,7 @@ H5VL__native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_objec FUNC_ENTER_STATIC - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") switch(specific_type) { @@ -3211,10 +3210,10 @@ H5VL__native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_objec { htri_t *ret = va_arg(arguments, htri_t *); - if(loc_params.type == H5VL_OBJECT_BY_NAME) { + if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* Check if the object exists */ - if((*ret = H5G_loc_exists(&loc, loc_params.loc_data.loc_by_name.name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", loc_params.loc_data.loc_by_name.name) + if((*ret = H5G_loc_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", loc_params->loc_data.loc_by_name.name) } /* end if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters") @@ -3230,14 +3229,14 @@ H5VL__native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_objec unsigned fields = va_arg(arguments, unsigned); /* Call internal object visitation routine */ - if(loc_params.type == H5VL_OBJECT_BY_SELF) { + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Ovisit */ if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Ovisit_by_name */ - if((ret_value = H5O__visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, op, op_data, fields)) < 0) + if((ret_value = H5O__visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") } /* end else-if */ else @@ -3313,13 +3312,13 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5VL_object_optional_t optional_type = va_arg(arguments, H5VL_object_optional_t); - H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + H5VL_loc_params_t *loc_params = va_arg(arguments, H5VL_loc_params_t *); H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") switch(optional_type) { @@ -3329,17 +3328,17 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, H5O_info_t *obj_info = va_arg(arguments, H5O_info_t *); unsigned fields = va_arg(arguments, unsigned); - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */ + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */ /* Retrieve the object's information */ if(H5G_loc_info(&loc, ".", obj_info, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ /* Retrieve the object's information */ - if(H5G_loc_info(&loc, loc_params.loc_data.loc_by_name.name, obj_info, fields) < 0) + if(H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, obj_info, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") } /* end else-if */ - else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ @@ -3350,10 +3349,10 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, H5G_loc_reset(&obj_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, - loc_params.loc_data.loc_by_idx.idx_type, - loc_params.loc_data.loc_by_idx.order, - loc_params.loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0) + if(H5G_loc_find_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, + loc_params->loc_data.loc_by_idx.idx_type, + loc_params->loc_data.loc_by_idx.order, + loc_params->loc_data.loc_by_idx.n, &obj_loc/*out*/) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") /* Retrieve the object's information */ @@ -3379,12 +3378,12 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, ssize_t *ret = va_arg(arguments, ssize_t *); /* Retrieve the object's comment */ - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */ + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */ if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */ - if((*ret = H5G_loc_get_comment(&loc, loc_params.loc_data.loc_by_name.name, comment/*out*/, bufsize)) < 0) + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */ + if((*ret = H5G_loc_get_comment(&loc, loc_params->loc_data.loc_by_name.name, comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") } /* end else-if */ else @@ -3397,14 +3396,14 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, { const char *comment = va_arg(arguments, char *); - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */ + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */ /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, ".", comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") } /* end if */ - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */ /* (Re)set the object's comment */ - if(H5G_loc_set_comment(&loc, loc_params.loc_data.loc_by_name.name, comment) < 0) + if(H5G_loc_set_comment(&loc, loc_params->loc_data.loc_by_name.name, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") } /* end else-if */ else @@ -3435,7 +3434,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, +H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { @@ -3447,7 +3446,7 @@ H5VL__native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char FUNC_ENTER_STATIC /* check arguments */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -3506,7 +3505,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, +H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *type = NULL; /* Datatype opened in file */ @@ -3515,7 +3514,7 @@ H5VL__native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char * FUNC_ENTER_STATIC - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") /* Open the datatype */ diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 97e9119..ca0c87e 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -115,18 +115,18 @@ H5_DLL int H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *in H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info); /* Attribute functions */ -H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_attr_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Dataset functions */ -H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_dataset_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); @@ -143,31 +143,31 @@ H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, vo H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Group functions */ -H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_group_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Link functions */ -H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_link_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); /* Object functions */ -H5_DLL void *H5VL_object_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, H5VL_loc_params_t src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, H5VL_loc_params_t dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_object_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL void *H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); /* Datatype functions */ -H5_DLL void *H5VL_datatype_commit(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_datatype_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_datatype_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 9fe5bcd..92664aa 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -238,14 +238,14 @@ typedef struct H5VL_loc_params_t { /* H5A routines */ typedef struct H5VL_attr_class_t { - void *(*create)(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); - void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); herr_t (*write)(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, + herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); herr_t (*close) (void *attr, hid_t dxpl_id, void **req); @@ -253,9 +253,9 @@ typedef struct H5VL_attr_class_t { /* H5D routines */ typedef struct H5VL_dataset_class_t { - void *(*create)(void *obj, H5VL_loc_params_t loc_params, const char *name, + void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); - void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *name, + void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, void * buf, void **req); @@ -270,9 +270,9 @@ typedef struct H5VL_dataset_class_t { /* H5T routines*/ typedef struct H5VL_datatype_class_t { - void *(*commit)(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, + void *(*commit)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); - void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char * name, + void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char * name, hid_t tapl_id, hid_t dxpl_id, void **req); herr_t (*get) (void *obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, H5VL_datatype_specific_t specific_type, @@ -295,9 +295,9 @@ typedef struct H5VL_file_class_t { /* H5G routines */ typedef struct H5VL_group_class_t { - void *(*create)(void *obj, H5VL_loc_params_t loc_params, const char *name, + void *(*create)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); - void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *name, + void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, H5VL_group_specific_t specific_type, @@ -308,31 +308,31 @@ typedef struct H5VL_group_class_t { /* H5L routines */ typedef struct H5VL_link_class_t { - herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); - herr_t (*copy)(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, + herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req); - herr_t (*move)(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, + herr_t (*move)(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req); - herr_t (*get)(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, + herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, + herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); } H5VL_link_class_t; /* H5O routines */ typedef struct H5VL_object_class_t { - void *(*open)(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, + void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); - herr_t (*copy)(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, + herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); - herr_t (*get)(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, + herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, + herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); } H5VL_object_class_t; @@ -458,18 +458,18 @@ H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id); H5_DLL void *H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx); /* Public wrappers for attribute callbacks */ -H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for dataset callbacks */ -H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); H5_DLL herr_t H5VLdataset_write(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); H5_DLL herr_t H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); @@ -486,37 +486,37 @@ H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, vo H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for group callbacks */ -H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for link callbacks */ -H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t connector_id, +H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t connector_id, +H5_DLL herr_t H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); /* Public wrappers for object callbacks */ -H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, +H5_DLL void *H5VLobject_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, + void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name, hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); /* Public wrappers for named datatype callbacks */ -H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); -- cgit v0.12 From 340b7a4fb80230d298e652a7bb35344ad6ce049d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 22 Nov 2018 01:08:47 -0600 Subject: Remove unused test for unimplemented routine. --- MANIFEST | 1 - test/chunk_info.c | 150 ------------------------------------------------------ 2 files changed, 151 deletions(-) delete mode 100644 test/chunk_info.c diff --git a/MANIFEST b/MANIFEST index 144b165..4342d97 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1147,7 +1147,6 @@ ./test/test_filters_le.h5 ./test/test_filters_be.h5 ./test/gen_filters.c -./test/chunk_info.c ./test/vds.c ./test/vds_swmr.h ./test/vds_swmr_gen.c diff --git a/test/chunk_info.c b/test/chunk_info.c deleted file mode 100644 index e3006cc..0000000 --- a/test/chunk_info.c +++ /dev/null @@ -1,150 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Pedro Vicente - * April 7, 2008 - * - * Purpose: Tests the H5Dget_chunk_info API function - * This program writes a 4x4 dataset by iterating on 2x2 chunks - * at a time - */ - - -#include "h5test.h" - -#define PRINT_DATA -#define H5FILE_NAME "chunk_info.h5" -#define DATASETNAME "2d" -#define RANK 2 - - -int main( void ) -{ - - hid_t fid; /* file ID */ - hid_t did; /* dataset ID */ - hid_t f_sid; /* file space ID */ - hid_t m_sid; /* memory space ID */ - hid_t pid; /* property list ID */ - hsize_t start[2]; /* chunk location to start writing */ - hsize_t dims[2] = { 4, 4}; - hsize_t chunk_dims[2] = { 2, 2 }; - int chunk_data[2][2] = { {1, 1}, {1, 1} }; - int buf[4][4]; - int fillvalue = 0; - int i, j, ii, jj; - - /* create a new file using default properties. */ - if ((fid = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; - /* create the file space */ - if ((f_sid = H5Screate_simple(RANK, dims, dims)) < 0) TEST_ERROR; - /* create the memory space with chunk dimensions */ - if ((m_sid = H5Screate_simple(RANK, chunk_dims, chunk_dims)) < 0) TEST_ERROR; - start[0] = 0; - start[1] = 0; - if (H5Sselect_hyperslab(m_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR; - - TESTING("chunk info"); - - /*------------------------------------------------------------------------- - * create a dataset - *------------------------------------------------------------------------- - */ - - /* modify dataset creation properties, i.e. enable chunking. */ - if ((pid = H5Pcreate (H5P_DATASET_CREATE)) < 0) TEST_ERROR; - if (H5Pset_chunk(pid, RANK, chunk_dims) < 0) TEST_ERROR; - if (H5Pset_fill_value(pid, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR; - - /* create a new dataset */ - if((did = H5Dcreate2(fid , DATASETNAME, H5T_NATIVE_INT, f_sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR; - - - /*------------------------------------------------------------------------- - * write the dataset in 2x2 chunks - *------------------------------------------------------------------------- - */ - - /* iterate in dim 0 */ - for (j = 0; j < chunk_dims[0]; j++) - { - - /* reset start in dim 1 */ - start[1] = 0; - - /* iterate in dim 1 */ - for (i = 0; i < chunk_dims[1]; i++) - { - - /* select file hyperslab to save a 2x2 chunk */ - if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR; - - /* write the data to the hyperslab. */ - if (H5Dwrite(did, H5T_NATIVE_INT, m_sid, f_sid, H5P_DEFAULT, chunk_data) < 0) TEST_ERROR; - - /* read back and display complete dataset 4x4 */ - if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR; - - -#if defined (PRINT_DATA) - printf("\n"); - printf("dataset: \n"); - for (jj = 0; jj < dims[0]; jj++) { - for (ii = 0; ii < dims[1]; ii++) printf("%d ", buf[jj][ii]); - printf("\n"); - } -#endif - - - /* increment start in dim 1 */ - start[1] += 2; - - - } - - /* increment start in dim 0 */ - start[0] += 2; - } - - - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if (H5Dclose(did) < 0) TEST_ERROR - if (H5Sclose(f_sid) < 0) TEST_ERROR - if (H5Sclose(m_sid) < 0) TEST_ERROR - if (H5Pclose(pid) < 0) TEST_ERROR - if (H5Fclose(fid) < 0) TEST_ERROR - - PASSED(); - - puts("All chunk info tests passed."); - return 0; - - -error: - H5Dclose( did ); - H5Sclose( f_sid ); - H5Sclose( m_sid ); - H5Pclose( pid ); - H5Fclose( fid ); - H5_FAILED(); - return 1; -} - - - -- cgit v0.12 From 3217ffa1ac0c427aedb2c1cc460484c902b89be2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 22 Nov 2018 01:21:50 -0600 Subject: Add using FAPL from h5_fileaccess() to more tests. --- test/accum.c | 11 ++- test/cache_image.c | 12 +-- test/cache_tagging.c | 204 +++++++++++++++++++++++++++++++++++++++++++-------- test/cmpd_dset.c | 6 +- 4 files changed, 194 insertions(+), 39 deletions(-) diff --git a/test/accum.c b/test/accum.c index 40829f9..87628d8 100644 --- a/test/accum.c +++ b/test/accum.c @@ -91,14 +91,23 @@ main(void) unsigned nerrors = 0; /* track errors */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t fid = -1; + hid_t fapl = -1; /* File access property list */ H5F_t * f = NULL; /* File for all tests */ /* Test Setup */ puts("Testing the metadata accumulator"); + /* File access property list */ + if((fapl = h5_fileaccess()) < 0) + FAIL_STACK_ERROR + /* Create a test file */ - if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR + + /* Closing and remove the file */ + if(H5Pclose(fapl) < 0) + FAIL_STACK_ERROR /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR diff --git a/test/cache_image.c b/test/cache_image.c index 4d6b065..10e9a8a 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -586,12 +586,12 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, /* create a file access propertly list. */ if ( pass ) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + fapl_id = h5_fileaccess(); if ( fapl_id < 0 ) { pass = FALSE; - failure_mssg = "H5Pcreate() failed.\n"; + failure_mssg = "h5_fileaccess() failed.\n"; } } @@ -928,12 +928,12 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, /* create a file access propertly list. */ if ( pass ) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + fapl_id = h5_fileaccess(); if ( fapl_id < 0 ) { pass = FALSE; - failure_mssg = "H5Pcreate() failed.\n"; + failure_mssg = "h5_fileaccess() failed.\n"; } } @@ -6688,12 +6688,12 @@ cache_image_api_error_check_4(void) */ if ( pass ) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); + fapl_id = h5_fileaccess(); if ( fapl_id < 0 ) { pass = FALSE; - failure_mssg = "H5Pcreate() failed.\n"; + failure_mssg = "h5_fileaccess() failed.\n"; } } diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 8d90eb6..752dd27 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -440,14 +440,20 @@ check_file_creation_tags(hid_t fcpl_id, int type) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ int verbose = FALSE; /* verbose test outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t sbe_tag = 0; /* Testing Macro */ TESTING("tag application during file creation"); + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; #ifndef NDEBUG /* if verbose, print cache index to screen before verification . */ @@ -521,6 +527,7 @@ check_file_open_tags(hid_t fcpl, int type) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag; /* Root Group Tag */ haddr_t sbe_tag; /* Sblock Extension Tag */ @@ -531,8 +538,13 @@ check_file_open_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -628,6 +640,7 @@ check_group_creation_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */ haddr_t g_tag; /* Group Tag */ @@ -638,8 +651,13 @@ check_group_creation_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -733,7 +751,7 @@ check_multi_group_creation_tags(void) TESTING("tag application during multiple group creation"); /* Create Fapl */ - if ( (fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; /* Set latest version of library */ if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; @@ -816,6 +834,7 @@ check_multi_group_creation_tags(void) /* Close open objects and file */ /* =========================== */ + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; if ( H5Fclose(fid) < 0 ) TEST_ERROR; /* ========================================== */ @@ -855,15 +874,21 @@ check_link_iteration_tags(void) haddr_t root_tag = 0; /* Root Group Tag Value */ char dsetname[500]; /* Name of dataset */ H5G_info_t ginfo; /* Group Info Struct */ + hid_t fapl = -1; /* File access prop list */ hid_t root_group = -1; /* Root Group Identifier */ /* Testing Macro */ TESTING("tag application during iteration over links in a group"); + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* =========== */ /* Create File */ /* =========== */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* Get root group tag */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -975,7 +1000,7 @@ check_dense_attribute_tags(void) TESTING("tag application during dense attribute manipulation"); /* Create Fapl */ - if ( (fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; /* Create Dcpl */ @@ -986,6 +1011,8 @@ check_dense_attribute_tags(void) /* =========== */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; + /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1145,6 +1172,7 @@ check_group_open_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file output */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; @@ -1155,8 +1183,13 @@ check_group_open_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1248,6 +1281,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t sid = -1; /* Dataspace Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; /* Root group tag */ haddr_t g_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1260,8 +1294,11 @@ check_attribute_creation_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1341,6 +1378,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) if ( H5Aclose(aid) < 0 ) TEST_ERROR; if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; if ( H5Fclose(fid) < 0 ) TEST_ERROR; /* ========================================== */ @@ -1377,6 +1415,7 @@ check_attribute_open_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t sid = -1; /* Dataspace Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1389,8 +1428,13 @@ check_attribute_open_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1510,6 +1554,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) int verbose = FALSE; /* verbose file outout */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1530,8 +1575,13 @@ check_attribute_rename_tags(hid_t fcpl, int type) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1689,6 +1739,7 @@ check_attribute_delete_tags(hid_t fcpl, int type) int verbose = FALSE; /* verbose file outout */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1709,8 +1760,13 @@ check_attribute_delete_tags(hid_t fcpl, int type) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1847,6 +1903,7 @@ check_dataset_creation_tags(hid_t fcpl, int type) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1859,7 +1916,12 @@ check_dataset_creation_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -1974,6 +2036,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -1987,7 +2050,12 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2105,6 +2173,7 @@ check_dataset_open_tags(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2117,8 +2186,13 @@ check_dataset_open_tags(void) /* Open File */ /* ========= */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2225,6 +2299,7 @@ check_dataset_write_tags(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2242,8 +2317,13 @@ check_dataset_write_tags(void) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2360,6 +2440,7 @@ check_attribute_write_tags(hid_t fcpl, int type) int verbose = FALSE; /* verbose file outout */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2375,8 +2456,13 @@ check_attribute_write_tags(hid_t fcpl, int type) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2508,6 +2594,7 @@ check_dataset_read_tags(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2525,8 +2612,13 @@ check_dataset_read_tags(void) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2639,6 +2731,7 @@ check_dataset_size_retrieval(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2657,8 +2750,13 @@ check_dataset_size_retrieval(void) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2772,6 +2870,7 @@ check_dataset_extend_tags(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ @@ -2790,8 +2889,13 @@ check_dataset_extend_tags(void) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -2900,6 +3004,7 @@ check_object_info_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file output */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; H5O_info_t oinfo; /* Object info struct */ @@ -2911,8 +3016,13 @@ check_object_info_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -3003,6 +3113,7 @@ check_object_copy_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file output */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; haddr_t copy_tag; @@ -3014,8 +3125,13 @@ check_object_copy_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -3121,6 +3237,7 @@ check_link_removal_tags(hid_t fcpl, int type) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; haddr_t g_tag = 0; @@ -3139,8 +3256,13 @@ check_link_removal_tags(hid_t fcpl, int type) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -3274,6 +3396,7 @@ check_link_getname_tags(void) hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t d_tag = 0; haddr_t g_tag = 0; @@ -3292,8 +3415,13 @@ check_link_getname_tags(void) /* Allocate array */ if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; @@ -3414,6 +3542,7 @@ check_external_link_creation_tags(void) hid_t fid2 = -1; /* File Identifier */ hid_t gid = -1; /* Dataspace Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; /* Testing Macro */ @@ -3423,21 +3552,26 @@ check_external_link_creation_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; /* Close and Reopen the file */ if ( H5Fclose(fid) < 0 ) TEST_ERROR; - if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0 ) TEST_ERROR; /* Evict as much as we can from the cache so we can track full tag path */ if ( evict_entries(fid) < 0 ) TEST_ERROR; /* Create a second file */ - if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* Create group in second file */ if ( (gid = H5Gcreate2(fid2, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -3514,6 +3648,7 @@ check_external_link_open_tags(void) hid_t gid = -1; /* Dataspace Identifier */ hid_t xid = -1; /* Dataspace Identifier */ int verbose = FALSE; /* verbose file outout */ + hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t root2_tag = 0; @@ -3524,14 +3659,19 @@ check_external_link_open_tags(void) /* Setup */ /* ===== */ + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; /* Create a second file */ - if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* determine tag value of root group's object header */ if ( get_object_header_tag(fid2, &root2_tag) < 0 ) TEST_ERROR; @@ -3638,6 +3778,7 @@ check_invalid_tag_application(void) hid_t fid = -1; haddr_t addr; H5HL_t * lheap = NULL; + hid_t fapl = -1; /* File access prop list */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ #endif /* H5C_DO_TAGGING_SANITY_CHECKS */ @@ -3645,8 +3786,13 @@ check_invalid_tag_application(void) TESTING("failure on invalid tag application"); #if H5C_DO_TAGGING_SANITY_CHECKS + /* Create Fapl */ + if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + /* Create a test file */ - if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* Push API context */ if(H5CX_push() < 0) TEST_ERROR diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 5d6cfc7..b011bc2 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2032,7 +2032,7 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_ooo_order(char *filename) +test_ooo_order(char *filename, hid_t fapl_id) { hid_t file = -1; /* File ID */ hid_t dtype = -1; /* Datatype IDs */ @@ -2042,7 +2042,7 @@ test_ooo_order(char *filename) TESTING("that compound member insertion order is preserved") /* Create the file */ - if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR /* Create the compound */ @@ -2242,7 +2242,7 @@ main (int argc, char *argv[]) nerrors += test_pack_ooo(); puts("Testing compound member ordering:"); - nerrors += test_ooo_order(fname); + nerrors += test_ooo_order(fname, fapl_id); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); -- cgit v0.12 From d517bdf9d36f423e7abad34e109b6ce694fd03c8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 24 Nov 2018 11:56:28 -0800 Subject: Pulled the RELEASE.txt note concerning HDFFV-10633 since that change was pushed to hdf5_1_10 in case we release the Windows VFD in 1.10.5. --- release_docs/RELEASE.txt | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 4661b59..c17cdcd 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -233,17 +233,7 @@ New Features Tools: ------ - - The h5repart -family-to-sec2 argument was changed to -family-to-single - - In order to better support other single-file VFDs which could work with - h5repart, the -family-to-sec2 argument was renamed to -family-to-single. - This is just a name change and the functionality of the argument has not - changed. - - The -family-to-sec2 argument has been kept for backwards-compatibility. - This argument should be considered deprecated. - - (DER - 2018/11/14, HDFFV-10633) + - High-Level APIs: --------------- -- cgit v0.12 From 38c202df4db8eddd5e6f6f7d6506ce97912a3111 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 26 Nov 2018 22:10:06 -0800 Subject: Updated H5S to use the MPI-2 function MPI_Type_get_exten() where available. OpenMPI 4.0 removed the deprecated MPI-1 MPI_type_extent() call by default, so this avoids needing a special OpenMPI build. --- src/H5Smpio.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 2bd275a..e71e2cb 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -879,7 +879,18 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) } - MPI_Type_extent (inner_type, &inner_extent); +#if MPI_VERSION >= 2 +{ + /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default, + * so we're using the MPI-2 version even though we don't need the lb + * value. + */ + MPI_Aint unused_lb_arg; + MPI_Type_get_extent(inner_type, &unused_lb_arg, &inner_extent); +} +#else + MPI_Type_extent(inner_type, &inner_extent); +#endif stride_in_bytes = inner_extent * (MPI_Aint)d[i].strid; /* If the element count is larger than what a 32 bit integer can hold, @@ -1500,7 +1511,18 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements, } } - MPI_Type_extent (old_type, &old_extent); +#if MPI_VERSION >= 2 +{ + /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default, + * so we're using the MPI-2 version even though we don't need the lb + * value. + */ + MPI_Aint unused_lb_arg; + MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent); +} +#else + MPI_Type_extent(old_type, &old_extent); +#endif /* Set up the arguments for MPI_Type_struct constructor */ type[0] = outer_type; -- cgit v0.12 From 14de476c8cb1b797ad43bea3c71dfb32bcd2131c Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Tue, 27 Nov 2018 09:04:42 -0600 Subject: HDFFV-10607 Fixing two compiler warnings in the library. --- src/H5Ocache.c | 2 +- src/H5RS.c | 4 ++-- src/H5RSprivate.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5Ocache.c b/src/H5Ocache.c index e7cad83..fba4f6e 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -1619,7 +1619,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image done: if(ret_value < 0 && udata->cont_msg_info->msgs) { - udata->cont_msg_info->msgs = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_cont_t, udata->cont_msg_info->msgs); + udata->cont_msg_info->msgs = H5FL_SEQ_FREE(H5O_cont_t, udata->cont_msg_info->msgs); udata->cont_msg_info->alloc_nmsgs = 0; } FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5RS.c b/src/H5RS.c index 0a3fff0..ae500c5 100644 --- a/src/H5RS.c +++ b/src/H5RS.c @@ -137,7 +137,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5RS_str_t * -H5RS_wrap(char *s) +H5RS_wrap(const char *s) { H5RS_str_t *ret_value; /* Return value */ @@ -148,7 +148,7 @@ H5RS_wrap(char *s) HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the internal fields */ - ret_value->s = s; + ret_value->s = (char *)s; ret_value->wrapped = 1; ret_value->n = 1; diff --git a/src/H5RSprivate.h b/src/H5RSprivate.h index f69624a..1d26a18 100644 --- a/src/H5RSprivate.h +++ b/src/H5RSprivate.h @@ -44,7 +44,7 @@ typedef struct H5RS_str_t H5RS_str_t; /* Private routines */ /********************/ H5_DLL H5RS_str_t *H5RS_create(const char *s); -H5_DLL H5RS_str_t *H5RS_wrap(char *s); +H5_DLL H5RS_str_t *H5RS_wrap(const char *s); H5_DLL H5RS_str_t *H5RS_own(char *s); H5_DLL herr_t H5RS_decr(H5RS_str_t *rs); H5_DLL herr_t H5RS_incr(H5RS_str_t *rs); -- cgit v0.12 From 8cf3bfb14bd2a80f13d269a9e84cd99f86f19254 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 27 Nov 2018 10:31:54 -0800 Subject: Yanked all MPI-1 calls --- src/H5.c | 2 +- src/H5Smpio.c | 24 ++++++++---------------- testpar/t_cache.c | 20 ++++++++++---------- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/H5.c b/src/H5.c index d1967e6..bf4643c 100644 --- a/src/H5.c +++ b/src/H5.c @@ -138,7 +138,7 @@ H5_init_library(void) if (mpi_initialized && !mpi_finalized) { int key_val; - if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_NULL_COPY_FN, + if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN, (MPI_Comm_delete_attr_function *)H5_mpi_delete_cb, &key_val, NULL))) HMPI_GOTO_ERROR(FAIL, "MPI_Comm_create_keyval failed", mpi_code) diff --git a/src/H5Smpio.c b/src/H5Smpio.c index e71e2cb..935d279 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -879,18 +879,14 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) } -#if MPI_VERSION >= 2 -{ /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default, * so we're using the MPI-2 version even though we don't need the lb * value. */ - MPI_Aint unused_lb_arg; - MPI_Type_get_extent(inner_type, &unused_lb_arg, &inner_extent); -} -#else - MPI_Type_extent(inner_type, &inner_extent); -#endif + { + MPI_Aint unused_lb_arg; + MPI_Type_get_extent(inner_type, &unused_lb_arg, &inner_extent); + } stride_in_bytes = inner_extent * (MPI_Aint)d[i].strid; /* If the element count is larger than what a 32 bit integer can hold, @@ -1511,18 +1507,14 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements, } } -#if MPI_VERSION >= 2 -{ /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default, * so we're using the MPI-2 version even though we don't need the lb * value. */ - MPI_Aint unused_lb_arg; - MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent); -} -#else - MPI_Type_extent(old_type, &old_extent); -#endif + { + MPI_Aint unused_lb_arg; + MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent); + } /* Set up the arguments for MPI_Type_struct constructor */ type[0] = outer_type; diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 5e15ec2..ca5ded9 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -1217,15 +1217,15 @@ setup_derived_types(void) struct mssg_t sample; /* used to compute displacements */ /* setup the displacements array */ - if ( ( MPI_SUCCESS != MPI_Address(&sample.req, &displs[0]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.src, &displs[1]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.dest, &displs[2]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.mssg_num, &displs[3]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.base_addr, &displs[4]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.len, &displs[5]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.ver, &displs[6]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.count, &displs[7]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.magic, &displs[8]) ) ) { + if ( ( MPI_SUCCESS != MPI_Get_address(&sample.req, &displs[0]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.src, &displs[1]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.dest, &displs[2]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.mssg_num, &displs[3]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.base_addr, &displs[4]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.len, &displs[5]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.ver, &displs[6]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.count, &displs[7]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.magic, &displs[8]) ) ) { nerrors++; success = FALSE; @@ -1245,7 +1245,7 @@ setup_derived_types(void) if ( success ) { - result = MPI_Type_struct(9, block_len, displs, mpi_types, &mpi_mssg_t); + result = MPI_Type_create_struct(9, block_len, displs, mpi_types, &mpi_mssg_t); if ( result != MPI_SUCCESS ) { -- cgit v0.12 From 6fccabed2e8b522747ee8056a196273917af78c7 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 27 Nov 2018 11:50:35 -0800 Subject: Missed some function renames in error text. --- testpar/t_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testpar/t_cache.c b/testpar/t_cache.c index ca5ded9..da83884 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -1230,7 +1230,7 @@ setup_derived_types(void) nerrors++; success = FALSE; if ( verbose ) { - HDfprintf(stdout, "%d:%s: MPI_Address() call failed.\n", + HDfprintf(stdout, "%d:%s: MPI_Get_address() call failed.\n", world_mpi_rank, FUNC); } @@ -1252,7 +1252,7 @@ setup_derived_types(void) nerrors++; success = FALSE; if ( verbose ) { - HDfprintf(stdout, "%d:%s: MPI_Type_struct() call failed.\n", + HDfprintf(stdout, "%d:%s: MPI_Type_create_struct() call failed.\n", world_mpi_rank, FUNC); } } -- cgit v0.12 From bf79e1bd766c0660ecd5b26daf2658b98f2732a0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 27 Nov 2018 22:15:34 -0600 Subject: Added 'notify' callback for async requests; switched VOL class and info comparison to return comparison value as parameter, so they can return error values; "cancelled" -> "canceled"; switched order of 'wrap_object' and 'free_wrap_ctx' management callbacks. --- examples/h5_vol_external_log_native.c | 1 + src/H5ESpublic.h | 2 +- src/H5Pfapl.c | 14 ++- src/H5VL.c | 3 +- src/H5VLcallback.c | 184 ++++++++++++++++++++++++++++++---- src/H5VLint.c | 64 +++++++----- src/H5VLnative.c | 47 ++++----- src/H5VLprivate.h | 7 +- src/H5VLpublic.h | 13 ++- src/H5trace.c | 4 +- 10 files changed, 257 insertions(+), 82 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index accae03..24fc254 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -120,6 +120,7 @@ static const H5VL_class_t H5VL_log_g = { }, { /* request_cls */ NULL, /* wait */ + NULL, /* notify */ NULL, /* cancel */ NULL, /* specific */ NULL, /* optional */ diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h index 2df1a6e..e3b1b56 100644 --- a/src/H5ESpublic.h +++ b/src/H5ESpublic.h @@ -29,7 +29,7 @@ typedef enum H5ES_status_t { H5ES_STATUS_IN_PROGRESS, /* Operation has not yet completed */ H5ES_STATUS_SUCCEED, /* Operation has completed, successfully */ H5ES_STATUS_FAIL, /* Operation has completed, but failed */ - H5ES_STATUS_CANCELLED /* Operation has not completed and was cancelled */ + H5ES_STATUS_CANCELED /* Operation has not completed and was canceled */ } H5ES_status_t; diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index a792e57..e802e3b 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -5309,7 +5309,8 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED const H5VL_connector_prop_t *info1 = (const H5VL_connector_prop_t *)_info1; /* Create local aliases for values */ const H5VL_connector_prop_t *info2 = (const H5VL_connector_prop_t *)_info2; H5VL_class_t *cls1, *cls2; /* connector class for each property */ - int cmp_value; /* Value from comparison */ + int cmp_value = 0; /* Value from comparison */ + herr_t status; /* Status from info comparison */ int ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -5324,7 +5325,9 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED HGOTO_DONE(-1) if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->connector_id))) HGOTO_DONE(1) - if(0 != (cmp_value = H5VL_cmp_connector_cls(cls1, cls2))) + status = H5VL_cmp_connector_cls(&cmp_value, cls1, cls2); + HDassert(status >= 0); + if(cmp_value != 0) HGOTO_DONE(cmp_value); /* At this point, we should be able to assume that we are dealing with @@ -5336,8 +5339,11 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED * info objects */ HDassert(cls1->info_cmp == cls2->info_cmp); - if(0 != (cmp_value = H5VL_cmp_connector_info(cls1, info1->connector_info, info2->connector_info))) - HGOTO_DONE(cmp_value); + status = H5VL_cmp_connector_info(cls1, &cmp_value, info1->connector_info, info2->connector_info); + HDassert(status >= 0); + + /* Set return value */ + ret_value = cmp_value; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5VL.c b/src/H5VL.c index 5eeb201..268b9d2 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -512,7 +512,8 @@ H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Compare the two VOL connector classes */ - *cmp = H5VL_cmp_connector_cls(cls1, cls2); + if(H5VL_cmp_connector_cls(cmp, cls1, cls2) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 2c77416..74448af 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -171,6 +171,8 @@ static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxp void **req); static herr_t H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout, H5ES_status_t *status); +static herr_t H5VL__request_notify(void *req, const H5VL_class_t *cls, + H5VL_request_notify_t cb, void *ctx); static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls); static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_t specific_type, va_list arguments); @@ -403,44 +405,53 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_cmp_connector_info * - * Purpose: Compare VOL info for a connector + * Purpose: Compare VOL info for a connector. Sets *cmp_value to + * positive if INFO1 is greater than INFO2, negative if + * INFO2 is greater than INFO1 and zero if INFO1 and + * INFO2 are equal. * - * Return: Positive if VALUE1 is greater than VALUE2, negative if - * VALUE2 is greater than VALUE1 and zero if VALUE1 and - * VALUE2 are equal. + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -int -H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *info1, - const void *info2) +herr_t +H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value, + const void *info1, const void *info2) { - int cmp_value; /* Value from comparison */ - int ret_value = 0; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ HDassert(connector); + HDassert(cmp_value); + + /* Take care of cases where one or both pointers is NULL */ + if(info1 == NULL && info2 != NULL) { + *cmp_value = -1; + HGOTO_DONE(SUCCEED); + } /* end if */ + if(info1 != NULL && info2 == NULL) { + *cmp_value = 1; + HGOTO_DONE(SUCCEED); + } /* end if */ + if(info1 == NULL && info2 == NULL) { + *cmp_value = 0; + HGOTO_DONE(SUCCEED); + } /* end if */ /* Use the class's info comparison routine to compare the info objects, * if there is a a callback, otherwise just compare the info objects as * memory buffers */ if(connector->info_cmp) { - if(0 != (cmp_value = (connector->info_cmp)(info1, info2))) - HGOTO_DONE(cmp_value); + if((connector->info_cmp)(cmp_value, info1, info2) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector info") } /* end if */ else { - if(info1 == NULL && info2 != NULL) - HGOTO_DONE(-1); - if(info1 != NULL && info2 == NULL) - HGOTO_DONE(1); - if(info1) { - HDassert(connector->info_size > 0); - if(0 != (cmp_value = HDmemcmp(info1, info2, connector->info_size))) - HGOTO_DONE(cmp_value); - } /* end if */ + HDassert(connector->info_size > 0); + *cmp_value = HDmemcmp(info1, info2, connector->info_size); } /* end else */ done: @@ -478,7 +489,7 @@ H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, const vo /* Compare the two VOL connector info objects */ if(cmp) - *cmp = H5VL_cmp_connector_info(cls, info1, info2); + H5VL_cmp_connector_info(cls, cmp, info1, info2); done: FUNC_LEAVE_API(ret_value) @@ -5846,6 +5857,9 @@ done: * * Purpose: Waits on an asychronous request through the VOL * + * Note: Releases the request if the operation has completed and the + * connector callback succeeds + * * Return: Success: Non-negative * Failure: Negative * @@ -5882,6 +5896,9 @@ done: * * Purpose: Waits on an asychronous request through the VOL * + * Note: Releases the request if the operation has completed and the + * connector callback succeeds + * * Return: Success: Non-negative * Failure: Negative * @@ -5922,6 +5939,9 @@ done: * * Purpose: Waits on a request * + * Note: Releases the request if the operation has completed and the + * connector callback succeeds + * * Return: Success: Non-negative * Failure: Negative * @@ -5950,10 +5970,128 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__request_notify + * + * Purpose: Registers a user callback to be invoked when an asynchronous + * operation completes + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t cb, + void *ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.notify) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async notify' method") + + /* Call the corresponding VOL callback */ + if((cls->request_cls.notify)(req, cb, ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request notify failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_notify() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_notify + * + * Purpose: Registers a user callback to be invoked when an asynchronous + * operation completes + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, + void *ctx) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_notify(vol_obj->data, vol_obj->connector->cls, cb, ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "request notify failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_notify() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_notify + * + * Purpose: Registers a user callback to be invoked when an asynchronous + * operation completes + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, + void *ctx) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_notify(req, cls, cb, ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to register notify callback for request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_notify() */ + + +/*------------------------------------------------------------------------- * Function: H5VL__request_cancel * * Purpose: Cancels an asynchronous request through the VOL * + * Note: Releases the request, if connector callback succeeds + * * Return: Success: Non-negative * Failure: Negative * @@ -5988,6 +6126,8 @@ done: * * Purpose: Cancels an asynchronous request through the VOL * + * Note: Releases the request, if connector callback succeeds + * * Return: Success: Non-negative * Failure: Negative * @@ -6027,6 +6167,8 @@ done: * * Purpose: Cancels a request * + * Note: Releases the request, if connector callback succeeds + * * Return: Success: Non-negative * Failure: Negative * diff --git a/src/H5VLint.c b/src/H5VLint.c index 167d098..82886cd 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -883,47 +883,65 @@ done: * *------------------------------------------------------------------------- */ -int -H5VL_cmp_connector_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls2) +herr_t +H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_class_t *cls2) { - int cmp_value; /* Value from comparison */ - int ret_value = 0; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ HDassert(cls1); - HDassert(cls1); + HDassert(cls2); /* Compare connector "values" */ - if(cls1->value < cls2->value) - HGOTO_DONE(-1) - if(cls1->value > cls2->value) - HGOTO_DONE(1) + if(cls1->value < cls2->value) { + *cmp_value = -1; + HGOTO_DONE(SUCCEED) + } /* end if */ + if(cls1->value > cls2->value) { + *cmp_value = 1; + HGOTO_DONE(SUCCEED) + } /* end if */ HDassert(cls1->value == cls2->value); /* Compare connector names */ - if(cls1->name == NULL && cls2->name != NULL) - HGOTO_DONE(-1); - if(cls1->name != NULL && cls2->name == NULL) - HGOTO_DONE(1); - if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) - HGOTO_DONE(cmp_value); + if(cls1->name == NULL && cls2->name != NULL) { + *cmp_value = -1; + HGOTO_DONE(SUCCEED) + } /* end if */ + if(cls1->name != NULL && cls2->name == NULL) { + *cmp_value = 1; + HGOTO_DONE(SUCCEED) + } /* end if */ + if(0 != (*cmp_value = HDstrcmp(cls1->name, cls2->name))) + HGOTO_DONE(SUCCEED) /* Compare connector VOL API versions */ - if(cls1->version < cls2->version) - HGOTO_DONE(-1) - if(cls1->version > cls2->version) - HGOTO_DONE(1) + if(cls1->version < cls2->version) { + *cmp_value = -1; + HGOTO_DONE(SUCCEED) + } /* end if */ + if(cls1->version > cls2->version) { + *cmp_value = 1; + HGOTO_DONE(SUCCEED) + } /* end if */ HDassert(cls1->version == cls2->version); /* Compare connector info */ - if(cls1->info_size < cls2->info_size) - HGOTO_DONE(-1) - if(cls1->info_size > cls2->info_size) - HGOTO_DONE(1) + if(cls1->info_size < cls2->info_size) { + *cmp_value = -1; + HGOTO_DONE(SUCCEED) + } /* end if */ + if(cls1->info_size > cls2->info_size) { + *cmp_value = 1; + HGOTO_DONE(SUCCEED) + } /* end if */ HDassert(cls1->info_size == cls2->info_size); + /* Set comparison value to 'equal' */ + *cmp_value = 0; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_cmp_connector_cls() */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 3fad8e1..6c51d95 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -134,8 +134,8 @@ static H5VL_class_t H5VL_native_cls_g = { NULL, /* str to info */ NULL, /* get_object */ NULL, /* get_wrap_ctx */ - NULL, /* free_wrap_ctx */ NULL, /* wrap_object */ + NULL, /* free_wrap_ctx */ { /* attribute_cls */ H5VL__native_attr_create, /* create */ H5VL__native_attr_open, /* open */ @@ -197,6 +197,7 @@ static H5VL_class_t H5VL_native_cls_g = { }, { /* request_cls */ NULL, /* wait */ + NULL, /* notify */ NULL, /* cancel */ NULL, /* specific */ NULL, /* optional */ @@ -292,7 +293,7 @@ done: * * Purpose: Creates an attribute on an object. * - * Return: Success: attr id. + * Return: Success: Pointer to attribute object * Failure: NULL * *------------------------------------------------------------------------- @@ -365,9 +366,9 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_attr_open * - * Purpose: Opens a attr inside a native h5 file. + * Purpose: Opens an attr inside a native H5 file. * - * Return: Success: attr id. + * Return: Success: Pointer to attribute object * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -423,9 +424,9 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_attr_read * - * Purpose: Reads in data from attribute. + * Purpose: Reads data from attribute. * - * Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Mohamad Chaarawi * March, 2012 @@ -456,9 +457,9 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_attr_write * - * Purpose: Writes out data to attribute. + * Purpose: Writes data to attribute. * - * Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Mohamad Chaarawi * March, 2012 @@ -489,7 +490,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_attr_get * - * Purpose: Gets certain information about an attribute + * Purpose: Gets information about an attribute * * Return: Success: 0 * Failure: -1 @@ -673,7 +674,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_attr_specific * - * Purpose: Specific operations for attributes + * Purpose: Specific operation on attribute * * Return: Success: 0 * Failure: -1 @@ -1176,7 +1177,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_dataset_specific * - * Purpose: Specific operations for datasets + * Purpose: Specific operation on dataset * * Return: SUCCEED/FAIL * @@ -1496,7 +1497,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_file_get * - * Purpose: Gets certain data about a file + * Purpose: Get info about a file * * Return: SUCCEED/FAIL * @@ -1648,7 +1649,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_file_specific * - * Purpose: Perform an operation + * Purpose: Specific operation on file * * Return: SUCCEED/FAIL * @@ -2307,7 +2308,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_group_get * - * Purpose: Gets data about a group + * Purpose: Get info about a group * * Return: SUCCEED/FAIL * @@ -2754,7 +2755,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_link_get * - * Purpose: Gets certain data about a link + * Purpose: Get info about a link * * Return: Success: 0 * Failure: -1 @@ -2847,7 +2848,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_link_specific * - * Purpose: Specific operations with links + * Purpose: Specific operation on a link * * Return: Success: 0 * Failure: -1 @@ -2959,7 +2960,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_object_open * - * Purpose: Opens a object inside a native h5 file. + * Purpose: Opens an object inside a native h5 file. * * Return: Success: object id. * Failure: NULL @@ -3040,10 +3041,10 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_object_copy * - * Purpose: Copys a object inside a native h5 file. + * Purpose: Copies an object inside a native h5 file. * - * Return: Success: object id. - * Failure: NULL + * Return: Success: 0 + * Failure: -1 * * Programmer: Mohamad Chaarawi * March, 2012 @@ -3174,7 +3175,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_object_specific * - * Purpose: Perform a connector-specific operation for an objectibute + * Purpose: Specific operation on an object * * Return: SUCCEED/FAIL * @@ -3533,7 +3534,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_datatype_get * - * Purpose: Gets certain information about a datatype + * Purpose: Get information about a datatype * * Return: Success: 0 * Failure: -1 @@ -3639,7 +3640,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__native_datatype_close * - * Purpose: Closes an datatype. + * Purpose: Closes a datatype. * * Return: Success: 0 * Failure: -1, datatype not closed. diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index ca0c87e..ef5a81e 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -63,7 +63,7 @@ typedef enum H5VL_get_connector_kind_t { /* Utility functions */ H5_DLL herr_t H5VL_init(void); -H5_DLL int H5VL_cmp_connector_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls); +H5_DLL herr_t H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_class_t *cls2); H5_DLL herr_t H5VL_conn_copy(H5VL_connector_prop_t *value); H5_DLL herr_t H5VL_conn_free(const H5VL_connector_prop_t *info); @@ -110,8 +110,8 @@ H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5V /* Connector "management" functions */ H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, const void *src_info); -H5_DLL int H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *info1, - const void *info2); +H5_DLL herr_t H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value, + const void *info1, const void *info2); H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info); /* Attribute functions */ @@ -175,6 +175,7 @@ H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, v /* Asynchronous functions */ H5_DLL herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5ES_status_t *status); +H5_DLL herr_t H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, void *ctx); H5_DLL herr_t H5VL_request_cancel(const H5VL_object_t *vol_obj); H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...); H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, ...); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 92664aa..b89946d 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -337,9 +337,13 @@ typedef struct H5VL_object_class_t { herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); } H5VL_object_class_t; -/* Async operation routines */ +/* Asynchronous request 'notify' callback */ +typedef herr_t (*H5VL_request_notify_t)(void *ctx, H5ES_status_t status); + +/* Async request operation routines */ typedef struct H5VL_request_class_t { herr_t (*wait)(void *req, uint64_t timeout, H5ES_status_t *status); + herr_t (*notify)(void *req, H5VL_request_notify_t cb, void *ctx); herr_t (*cancel)(void *req); herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments); herr_t (*optional)(void *req, va_list arguments); @@ -383,14 +387,14 @@ typedef struct H5VL_class_t { herr_t (*terminate)(void); /* Connector termination callback */ size_t info_size; /* size of the vol info */ void * (*info_copy)(const void *info); /* Callback to create a copy of the vol info */ - int (*info_cmp)(const void *info1, const void *info2); /* Callback to compare vol info */ + herr_t (*info_cmp)(int *cmp_value, const void *info1, const void *info2); /* Callback to compare vol info */ herr_t (*info_free)(void *info); /* Callback to release the vol info copy */ herr_t (*info_to_str)(const void *info, char **str); /* Callback to serialize connector's info into a string */ herr_t (*str_to_info)(const char *str, void **info); /* Callback to deserialize a string into connector's info */ void * (*get_object)(const void *obj); /* Callback to retrieve underlying object */ herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* Callback to retrieve the object wrapping context for the connector */ - herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */ void* (*wrap_object)(void *obj, void *wrap_ctx); /* Callback to wrap an object */ + herr_t (*free_wrap_ctx)(void *wrap_ctx); /* Callback to release the object wrapping context for the connector */ /* Data Model */ H5VL_attr_class_t attr_cls; /* attribute class callbacks */ @@ -454,8 +458,8 @@ H5_DLL herr_t H5VLconnector_info_to_str(const void *info, hid_t connector_id, ch H5_DLL herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info); H5_DLL void *H5VLget_object(void *obj, hid_t connector_id); H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx); -H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id); H5_DLL void *H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx); +H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id); /* Public wrappers for attribute callbacks */ H5_DLL void *H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); @@ -524,6 +528,7 @@ H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, vo /* Public wrappers for asynchronous request callbacks */ H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void *ctx); H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t connector_id); H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments); H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments); diff --git a/src/H5trace.c b/src/H5trace.c index db26d83..d69ab28 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -834,8 +834,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5ES_STATUS_FAIL: HDfprintf(out, "H5ES_STATUS_FAIL"); break; - case H5ES_STATUS_CANCELLED: - HDfprintf(out, "H5ES_STATUS_CANCELLED"); + case H5ES_STATUS_CANCELED: + HDfprintf(out, "H5ES_STATUS_CANCELED"); break; default: -- cgit v0.12 From 2db4b6df1354a6d006b15fa411684639a08d7243 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 28 Nov 2018 10:22:29 -0600 Subject: Update API tracing info for VOL functions and regenerate trace macros for VOL API calls. --- bin/trace | 2 ++ src/H5VL.c | 1 + src/H5VLcallback.c | 42 +++++++++++++++++++++++------------------- src/H5trace.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 19 deletions(-) diff --git a/bin/trace b/bin/trace index f665d9d..50660fe 100755 --- a/bin/trace +++ b/bin/trace @@ -99,6 +99,7 @@ $Source = ""; "unsigned long long" => "UL", "H5VL_attr_get_t" => "Va", "H5VL_attr_specific_t" => "Vb", + "H5VL_class_value_t" => "VC", "H5VL_dataset_get_t" => "Vc", "H5VL_dataset_specific_t" => "Vd", "H5VL_datatype_get_t" => "Ve", @@ -169,6 +170,7 @@ $Source = ""; "H5VL_t" => "x", "H5VL_class_t" => "x", "H5VL_loc_params_t" => "x", + "H5VL_request_notify_t" => "x", "H5Z_func_t" => "x", "H5Z_filter_func_t" => "x", "va_list" => "x", diff --git a/src/H5VL.c b/src/H5VL.c index 268b9d2..eedf68d 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -270,6 +270,7 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id) hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE2("i", "VCi", value, vipl_id); /* Check arguments */ if(value < 0) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 74448af..2828262 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -310,6 +310,7 @@ H5VLget_value(hid_t connector_id, H5VL_class_value_t *value) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT + H5TRACE2("e", "i*VC", connector_id, value); /* Check args */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -580,6 +581,7 @@ H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT + H5TRACE3("e", "*xi**s", info, connector_id, str); /* Only serialize info object, if it's non-NULL */ if(info) { @@ -621,6 +623,7 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT + H5TRACE3("e", "*si**x", str, connector_id, info); /* Only deserialize string, if it's non-NULL */ if(str) { @@ -972,7 +975,7 @@ H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_ void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, connector_id, name, acpl_id, + H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, acpl_id, aapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -1076,7 +1079,7 @@ H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, aapl_id, + H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, aapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -1506,7 +1509,7 @@ H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, connector_id, specific_type, + H5TRACE7("e", "*x*xiVbi**xx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments); /* Check args and get class pointer */ @@ -1812,7 +1815,7 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, connector_id, name, dcpl_id, + H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, dcpl_id, dapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -1916,7 +1919,7 @@ H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, dapl_id, + H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, dapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -3410,7 +3413,7 @@ H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, connector_id, name, gcpl_id, + H5TRACE8("*x", "*x*xi*siii**x", obj, loc_params, connector_id, name, gcpl_id, gapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -3514,7 +3517,7 @@ H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, gapl_id, + H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, gapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -4077,7 +4080,7 @@ H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_p herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, connector_id, + H5TRACE8("e", "Vk*x*xiiii**x", create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req); /* Get class pointer */ @@ -4186,7 +4189,7 @@ H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + H5TRACE9("e", "*x*x*x*xiiii**x", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, lapl_id, dxpl_id, req); /* Get class pointer */ @@ -4295,7 +4298,7 @@ H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + H5TRACE9("e", "*x*x*x*xiiii**x", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, lapl_id, dxpl_id, req); /* Get class pointer */ @@ -4405,7 +4408,7 @@ H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVli**xx", obj, loc_params, connector_id, get_type, dxpl_id, + H5TRACE7("e", "*x*xiVli**xx", obj, loc_params, connector_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ @@ -4517,7 +4520,7 @@ H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, connector_id, specific_type, + H5TRACE7("e", "*x*xiVmi**xx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments); /* Check args and get class pointer */ @@ -4730,7 +4733,7 @@ H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("*x", "*xxi*Iti**x", obj, params, connector_id, opened_type, dxpl_id, + H5TRACE6("*x", "*x*xi*Iti**x", obj, params, connector_id, opened_type, dxpl_id, req); /* Check args and get class pointer */ @@ -4844,7 +4847,7 @@ H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE11("e", "*xx*s*xx*siiii**x", src_obj, src_loc_params, src_name, + H5TRACE11("e", "*x*x*s*x*x*siiii**x", src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, connector_id, ocpypl_id, lcpl_id, dxpl_id, req); @@ -4957,7 +4960,7 @@ H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVni**xx", obj, loc_params, connector_id, get_type, dxpl_id, + H5TRACE7("e", "*x*xiVni**xx", obj, loc_params, connector_id, get_type, dxpl_id, req, arguments); /* Check args and get class pointer */ @@ -5070,7 +5073,7 @@ H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, connector_id, specific_type, + H5TRACE7("e", "*x*xiVoi**xx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments); /* Check args and get class pointer */ @@ -5290,8 +5293,8 @@ H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, connector_id, name, type_id, - lcpl_id, tcpl_id, tapl_id, dxpl_id, req); + H5TRACE10("*x", "*x*xi*siiiii**x", obj, loc_params, connector_id, name, + type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); /* Check args and get class pointer */ if(NULL == obj) @@ -5394,7 +5397,7 @@ H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto void *ret_value = NULL; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, tapl_id, + H5TRACE7("*x", "*x*xi*sii**x", obj, loc_params, connector_id, name, tapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -6071,6 +6074,7 @@ H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xix*x", req, connector_id, cb, ctx); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) diff --git a/src/H5trace.c b/src/H5trace.c index d69ab28..47c1c69 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2572,6 +2572,29 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'C': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_class_value_t class_val = (H5VL_class_value_t)va_arg(ap, int); + + switch(class_val) { + case H5_VOL_NATIVE: + HDfprintf(out, "H5_VOL_NATIVE"); + break; + case H5_VOL_MAX_LIB_VALUE: + HDfprintf(out, "H5_VOL_MAX_LIB_VALUE"); + break; + default: + HDfprintf(out, "%ld", (long)class_val); + break; + } /* end switch */ + } /* end else */ + break; case 'c': if(ptr) { if(vp) @@ -2940,6 +2963,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'r': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_request_specific_t specific = (H5VL_request_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_REQUEST_WAITANY: + HDfprintf(out, "H5VL_REQUEST_WAITANY"); + break; + case H5VL_REQUEST_WAITSOME: + HDfprintf(out, "H5VL_REQUEST_WAITSOME"); + break; + case H5VL_REQUEST_WAITALL: + HDfprintf(out, "H5VL_REQUEST_WAITALL"); + break; + default: + HDfprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; default: HDfprintf(out, "BADTYPE(Z%c)", type[1]); goto error; -- cgit v0.12 From 238a207f2dedb9b4e5a33e6701a96e3ab055895d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 28 Nov 2018 10:26:03 -0600 Subject: Add pass-through VOL connector --- MANIFEST | 2 + src/CMakeLists.txt | 2 + src/H5VLpassthru.c | 3061 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5VLpassthru.h | 46 + src/Makefile.am | 4 +- src/hdf5.h | 5 +- 6 files changed, 3116 insertions(+), 4 deletions(-) create mode 100644 src/H5VLpassthru.c create mode 100644 src/H5VLpassthru.h diff --git a/MANIFEST b/MANIFEST index 4342d97..c24fb32 100644 --- a/MANIFEST +++ b/MANIFEST @@ -896,6 +896,8 @@ ./src/H5VLnative.c ./src/H5VLnative.h ./src/H5VLnative_private.h +./src/H5VLpassthru.c +./src/H5VLpassthru.h ./src/H5VLpkg.h ./src/H5VLprivate.h ./src/H5VLpublic.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f1193b8..80b26ff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -628,9 +628,11 @@ set (H5VL_SOURCES ${HDF5_SRC_DIR}/H5VLcallback.c ${HDF5_SRC_DIR}/H5VLint.c ${HDF5_SRC_DIR}/H5VLnative.c + ${HDF5_SRC_DIR}/H5VLpassthru.c ) set (H5VL_HDRS ${HDF5_SRC_DIR}/H5VLnative.h + ${HDF5_SRC_DIR}/H5VLpassthru.h ${HDF5_SRC_DIR}/H5VLpublic.h ) IDE_GENERATED_PROPERTIES ("H5VL" "${H5VL_HDRS}" "${H5VL_SOURCES}" ) diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c new file mode 100644 index 0000000..3181834 --- /dev/null +++ b/src/H5VLpassthru.c @@ -0,0 +1,3061 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: This is a "pass through" VOL connector, which forwards each + * VOL callback to an underlying connector. + * + * It is designed as an example VOL connector for developers to + * use when creating new connectors, especially connectors that + * are outside of the HDF5 library. As such, it should _NOT_ + * include _any_ private HDF5 header files. This connector should + * therefore only make public HDF5 API calls and use standard C / + * POSIX calls. + */ + + +/* Header files needed */ +/* (Public HDF5 and standard C / POSIX only) */ +#include +#include +#include +#include +#include "hdf5.h" +#include "H5VLpassthru.h" + + +/**********/ +/* Macros */ +/**********/ + +/* Whether to display log messge when callback is invoked */ +/* (Uncomment to enable) */ +/* #define ENABLE_LOGGING */ + + +/************/ +/* Typedefs */ +/************/ + +/* The pass through VOL info object */ +typedef struct H5VL_pass_through_t { + hid_t under_vol_id; /* ID for underlying VOL connector */ + void *under_object; /* Info object for underlying VOL connector */ +} H5VL_pass_through_t; + +/* The pass through VOL wrapper context */ +typedef struct H5VL_pass_through_wrap_ctx_t { + hid_t under_vol_id; /* VOL ID for under VOL */ + void *under_wrap_ctx; /* Object wrapping context for under VOL */ +} H5VL_pass_through_wrap_ctx_t; + + +/********************* */ +/* Function prototypes */ +/********************* */ + +/* "Management" callbacks */ +static herr_t H5VL_pass_through_init(hid_t vipl_id); +static herr_t H5VL_pass_through_term(void); +static void *H5VL_pass_through_info_copy(const void *info); +static herr_t H5VL_pass_through_info_cmp(int *cmp_value, const void *info1, const void *info2); +static herr_t H5VL_pass_through_info_free(void *info); +static herr_t H5VL_pass_through_info_to_str(const void *info, char **str); +static herr_t H5VL_pass_through_str_to_info(const char *str, void **info); +static void *H5VL_pass_through_get_object(const void *obj); +static herr_t H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx); +static herr_t H5VL_pass_through_free_wrap_ctx(void *obj); +static void *H5VL_pass_through_wrap_object(void *obj, void *wrap_ctx); + +/* Attribute callbacks */ +static void *H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +static void *H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req); + +/* Dataset callbacks */ +static void *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req); +static herr_t H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req); + +/* Datatype callbacks */ +static void *H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req); + +/* File callbacks */ +static void *H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void *H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req); + +/* Group callbacks */ +static void *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req); + +/* Link callbacks */ +static herr_t H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); + +/* Object callbacks */ +static void *H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +static herr_t H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); + +/* Async request callbacks */ +static herr_t H5VL_pass_through_request_wait(void *req, uint64_t timeout, H5ES_status_t *status); +static herr_t H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx); +static herr_t H5VL_pass_through_request_cancel(void *req); +static herr_t H5VL_pass_through_request_specific(void *req, H5VL_request_specific_t specific_type, va_list arguments); +static herr_t H5VL_pass_through_request_optional(void *req, va_list arguments); +static herr_t H5VL_pass_through_request_free(void *req); + +/*******************/ +/* Local variables */ +/*******************/ + +/* Pass through VOL connector class struct */ +static const H5VL_class_t H5VL_pass_through_g = { + H5VL_PASSTHRU_VERSION, /* version */ + (H5VL_class_value_t)H5VL_PASSTHRU_VALUE, /* value */ + H5VL_PASSTHRU_NAME, /* name */ + 0, /* capability flags */ + H5VL_pass_through_init, /* initialize */ + H5VL_pass_through_term, /* terminate */ + sizeof(H5VL_pass_through_t), /* info size */ + H5VL_pass_through_info_copy, /* info copy */ + H5VL_pass_through_info_cmp, /* info compare */ + H5VL_pass_through_info_free, /* info free */ + H5VL_pass_through_info_to_str, /* info to str */ + H5VL_pass_through_str_to_info, /* str to info */ + H5VL_pass_through_get_object, /* get_object */ + H5VL_pass_through_get_wrap_ctx, /* get_wrap_ctx */ + H5VL_pass_through_wrap_object, /* wrap_object */ + H5VL_pass_through_free_wrap_ctx, /* free_wrap_ctx */ + { /* attribute_cls */ + H5VL_pass_through_attr_create, /* create */ + H5VL_pass_through_attr_open, /* open */ + H5VL_pass_through_attr_read, /* read */ + H5VL_pass_through_attr_write, /* write */ + H5VL_pass_through_attr_get, /* get */ + H5VL_pass_through_attr_specific, /* specific */ + H5VL_pass_through_attr_optional, /* optional */ + H5VL_pass_through_attr_close /* close */ + }, + { /* dataset_cls */ + H5VL_pass_through_dataset_create, /* create */ + H5VL_pass_through_dataset_open, /* open */ + H5VL_pass_through_dataset_read, /* read */ + H5VL_pass_through_dataset_write, /* write */ + H5VL_pass_through_dataset_get, /* get */ + H5VL_pass_through_dataset_specific, /* specific */ + H5VL_pass_through_dataset_optional, /* optional */ + H5VL_pass_through_dataset_close /* close */ + }, + { /* datatype_cls */ + H5VL_pass_through_datatype_commit, /* commit */ + H5VL_pass_through_datatype_open, /* open */ + H5VL_pass_through_datatype_get, /* get_size */ + H5VL_pass_through_datatype_specific, /* specific */ + H5VL_pass_through_datatype_optional, /* optional */ + H5VL_pass_through_datatype_close /* close */ + }, + { /* file_cls */ + H5VL_pass_through_file_create, /* create */ + H5VL_pass_through_file_open, /* open */ + H5VL_pass_through_file_get, /* get */ + H5VL_pass_through_file_specific, /* specific */ + H5VL_pass_through_file_optional, /* optional */ + H5VL_pass_through_file_close /* close */ + }, + { /* group_cls */ + H5VL_pass_through_group_create, /* create */ + H5VL_pass_through_group_open, /* open */ + H5VL_pass_through_group_get, /* get */ + H5VL_pass_through_group_specific, /* specific */ + H5VL_pass_through_group_optional, /* optional */ + H5VL_pass_through_group_close /* close */ + }, + { /* link_cls */ + H5VL_pass_through_link_create, /* create */ + H5VL_pass_through_link_copy, /* copy */ + H5VL_pass_through_link_move, /* move */ + H5VL_pass_through_link_get, /* get */ + H5VL_pass_through_link_specific, /* specific */ + H5VL_pass_through_link_optional, /* optional */ + }, + { /* object_cls */ + H5VL_pass_through_object_open, /* open */ + H5VL_pass_through_object_copy, /* copy */ + H5VL_pass_through_object_get, /* get */ + H5VL_pass_through_object_specific, /* specific */ + H5VL_pass_through_object_optional, /* optional */ + }, + { /* request_cls */ + H5VL_pass_through_request_wait, /* wait */ + H5VL_pass_through_request_notify, /* notify */ + H5VL_pass_through_request_cancel, /* cancel */ + H5VL_pass_through_request_specific, /* specific */ + H5VL_pass_through_request_optional, /* optional */ + H5VL_pass_through_request_free /* free */ + }, + NULL /* optional */ +}; + +/* The connector identification number, initialized at runtime */ +static hid_t H5VL_PASSTHRU_g = 0; + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_register + * + * Purpose: Register the pass-through VOL connector and retrieve an ID + * for it. + * + * Return: Success: The ID for the pass-through VOL connector + * Failure: -1 + * + * Programmer: Quincey Koziol + * Wednesday, November 28, 2018 + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL_pass_through_register(void) +{ + /* Clear the error stack */ + H5Eclear2(H5E_DEFAULT); + + /* Singleton register the pass-through VOL connector ID */ + if(H5I_VOL != H5Iget_type(H5VL_PASSTHRU_g)) + H5VL_PASSTHRU_g = H5VLregister_connector(&H5VL_pass_through_g, H5P_DEFAULT); + + return(H5VL_PASSTHRU_g); +} /* end H5VL_pass_through_register() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_init + * + * Purpose: Initialize this VOL connector, performing any necessary + * operations for the connector that will apply to all containers + * accessed with the connector. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_init(hid_t vipl_id) +{ +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INIT\n"); +#endif + + /* Shut compiler up about unused parameter */ + vipl_id = vipl_id; + + return(0); +} /* end H5VL_pass_through_init() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_term + * + * Purpose: Terminate this VOL connector, performing any necessary + * operations for the connector that release connector-wide + * resources (usually created / initialized with the 'init' + * callback). + * + * Return: Success: 0 + * Failure: (Can't fail) + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_term(void) +{ +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL TERM\n"); +#endif + + /* Reset VOL ID */ + H5VL_PASSTHRU_g = 0; + + return(0); +} /* end H5VL_pass_through_term() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_info_copy + * + * Purpose: Duplicate the connector's info object. + * + * Returns: Success: New connector info object + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_info_copy(const void *_info) +{ + const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info; + H5VL_pass_through_info_t *new_info; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INFO Copy\n"); +#endif + + /* Allocate new VOL info struct for the pass through connector */ + new_info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t)); + + /* Increment reference count on underlying VOL ID, and copy the VOL info */ + new_info->under_vol_id = info->under_vol_id; + H5Iinc_ref(new_info->under_vol_id); + if(info->under_vol_info) + H5VLcopy_connector_info(new_info->under_vol_id, &(new_info->under_vol_info), info->under_vol_info); + + return(new_info); +} /* end H5VL_pass_through_info_copy() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_info_cmp + * + * Purpose: Compare two of the connector's info objects, setting *cmp_value, + * following the same rules as strcmp(). + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info2) +{ + const H5VL_pass_through_info_t *info1 = (const H5VL_pass_through_info_t *)_info1; + const H5VL_pass_through_info_t *info2 = (const H5VL_pass_through_info_t *)_info2; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INFO Compare\n"); +#endif + + /* Sanity checks */ + assert(info1); + assert(info2); + + /* Initialize comparison value */ + *cmp_value = 0; + + /* Compare under VOL connector classes */ + H5VLcmp_connector_cls(cmp_value, info1->under_vol_id, info2->under_vol_id); + if(*cmp_value != 0) + return(0); + + /* Compare under VOL connector info objects */ + H5VLcmp_connector_info(cmp_value, info1->under_vol_id, info1->under_vol_info, info2->under_vol_info); + if(*cmp_value != 0) + return(0); + + return(0); +} /* end H5VL_pass_through_info_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_info_free + * + * Purpose: Release an info object for the connector. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_info_free(void *_info) +{ + H5VL_pass_through_info_t *info = (H5VL_pass_through_info_t *)_info; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INFO Free\n"); +#endif + + /* Release underlying VOL ID and info */ + if(info->under_vol_info) + H5VLfree_connector_info(info->under_vol_id, info->under_vol_info); + H5Idec_ref(info->under_vol_id); + + /* Free pass through info object itself */ + free(info); + + return(0); +} /* end H5VL_pass_through_info_free() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_info_to_str + * + * Purpose: Serialize an info object for this connector into a string + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_info_to_str(const void *_info, char **str) +{ + const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info; + H5VL_class_value_t under_value = (H5VL_class_value_t)-1; + char *under_vol_string = NULL; + size_t under_vol_str_len = 0; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INFO To String\n"); +#endif + + /* Get value and string for underlying VOL connector */ + H5VLget_value(info->under_vol_id, &under_value); + H5VLconnector_info_to_str(info->under_vol_info, info->under_vol_id, &under_vol_string); + + /* Determine length of underlying VOL info string */ + if(under_vol_string) + under_vol_str_len = strlen(under_vol_string); + + /* Allocate space for our info */ + *str = (char *)H5allocate_memory(32 + under_vol_str_len, (hbool_t)0); + assert(*str); + + /* Encode our info */ + snprintf(*str, 32 + under_vol_str_len, "under_val=%u, under_info={%s}", (unsigned)under_value, (under_vol_string ? under_vol_string : "")); + + return(0); +} /* end H5VL_pass_through_info_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_str_to_info + * + * Purpose: Deserialize a string into an info object for this connector. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_str_to_info(const char *str, void **_info) +{ + H5VL_pass_through_info_t *info; + unsigned under_vol_value; + const char *under_vol_info_start, *under_vol_info_end; + hid_t under_vol_id; + void *under_vol_info = NULL; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL INFO String To Info\n"); +#endif + + /* Retrieve the underlying VOL connector value and info */ + sscanf(str, "under_vol=%u,", &under_vol_value); + under_vol_id = H5VLregister_connector_by_value((H5VL_class_value_t)under_vol_value, H5P_DEFAULT); + under_vol_info_start = strchr(str, '{'); + under_vol_info_end = strrchr(str, '}'); + assert(under_vol_info_end > under_vol_info_start); + if(under_vol_info_end != (under_vol_info_start + 1)) { + char *under_vol_info_str; + + under_vol_info_str = (char *)malloc((size_t)(under_vol_info_end - under_vol_info_start)); + memcpy(under_vol_info_str, under_vol_info_start + 1, (size_t)((under_vol_info_end - under_vol_info_start) - 1)); + *(under_vol_info_str + (under_vol_info_end - under_vol_info_start)) = '\0'; + + H5VLconnector_str_to_info(under_vol_info_str, under_vol_id, &under_vol_info); + + free(under_vol_info_str); + } /* end else */ + + /* Allocate new pass-through VOL connector info and set its fields */ + info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t)); + info->under_vol_id = under_vol_id; + info->under_vol_info = under_vol_info; + + /* Set return value */ + *_info = info; + + return(0); +} /* end H5VL_pass_through_str_to_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_get_object + * + * Purpose: Retrieve the 'data' for a VOL object. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_get_object(const void *obj) +{ + const H5VL_pass_through_t *o = (const H5VL_pass_through_t *)obj; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL Get object\n"); +#endif + + return(H5VLget_object(o->under_object, o->under_vol_id)); +} /* end H5VL_pass_through_get_object() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_get_wrap_ctx + * + * Purpose: Retrieve a "wrapper context" for an object + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx) +{ + const H5VL_pass_through_t *o = (const H5VL_pass_through_t *)obj; + H5VL_pass_through_wrap_ctx_t *new_wrap_ctx; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL WRAP CTX Get\n"); +#endif + + /* Allocate new VOL object wrapping context for the pass through connector */ + new_wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)calloc(1, sizeof(H5VL_pass_through_wrap_ctx_t)); + + /* Increment reference count on underlying VOL ID, and copy the VOL info */ + new_wrap_ctx->under_vol_id = o->under_vol_id; + H5Iinc_ref(new_wrap_ctx->under_vol_id); + H5VLget_wrap_ctx(o->under_object, o->under_vol_id, &new_wrap_ctx->under_wrap_ctx); + + /* Set wrap context to return */ + *wrap_ctx = new_wrap_ctx; + + return(0); +} /* end H5VL_pass_through_get_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_wrap_object + * + * Purpose: Use a "wrapper context" to wrap a data object + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_wrap_object(void *obj, void *_wrap_ctx) +{ + H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx; + H5VL_pass_through_t *new_obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL WRAP Object\n"); +#endif + + /* Wrap the object with the underlying VOL */ + under = H5VLwrap_object(obj, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx); + if(under) { + new_obj = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + new_obj->under_object = under; + new_obj->under_vol_id = wrap_ctx->under_vol_id; + H5Iinc_ref(new_obj->under_vol_id); + } /* end if */ + else + new_obj = NULL; + + return(new_obj); +} /* end H5VL_pass_through_wrap_object() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_free_wrap_ctx + * + * Purpose: Release a "wrapper context" for an object + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_free_wrap_ctx(void *_wrap_ctx) +{ + H5VL_pass_through_wrap_ctx_t *wrap_ctx = (H5VL_pass_through_wrap_ctx_t *)_wrap_ctx; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL WRAP CTX Free\n"); +#endif + + /* Release underlying VOL ID and wrap context */ + if(wrap_ctx->under_wrap_ctx) + H5VLfree_wrap_ctx(wrap_ctx->under_wrap_ctx, wrap_ctx->under_vol_id); + H5Idec_ref(wrap_ctx->under_vol_id); + + /* Free pass through wrap context object itself */ + free(wrap_ctx); + + return(0); +} /* end H5VL_pass_through_free_wrap_ctx() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_create + * + * Purpose: Creates an attribute on an object. + * + * Return: Success: Pointer to attribute object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *attr; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Create\n"); +#endif + + under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, acpl_id, aapl_id, dxpl_id, req); + if(under) { + attr = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + attr->under_object = under; + attr->under_vol_id = o->under_vol_id; + H5Iinc_ref(attr->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + attr = NULL; + + return((void*)attr); +} /* end H5VL_pass_through_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_open + * + * Purpose: Opens an attribute on an object. + * + * Return: Success: Pointer to attribute object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *attr; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Open\n"); +#endif + + under = H5VLattr_open(o->under_object, loc_params, o->under_vol_id, name, aapl_id, dxpl_id, req); + if(under) { + attr = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + attr->under_object = under; + attr->under_vol_id = o->under_vol_id; + H5Iinc_ref(attr->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + attr = NULL; + + return((void *)attr); +} /* end H5VL_pass_through_attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_read + * + * Purpose: Reads data from attribute. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Read\n"); +#endif + + ret_value = H5VLattr_read(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_write + * + * Purpose: Writes data to attribute. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Write\n"); +#endif + + ret_value = H5VLattr_write(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_get + * + * Purpose: Gets information about an attribute + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Get\n"); +#endif + + ret_value = H5VLattr_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_specific + * + * Purpose: Specific operation on attribute + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Specific\n"); +#endif + + ret_value = H5VLattr_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return ret_value; +} /* end H5VL_pass_through_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_optional + * + * Purpose: Perform a connector-specific operation on an attribute + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n"); +#endif + + ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return ret_value; +} /* end H5VL_pass_through_attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_attr_close + * + * Purpose: Closes an attribute. + * + * Return: Success: 0 + * Failure: -1, attr not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)attr; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL ATTRIBUTE Close\n"); +#endif + + ret_value = H5VLattr_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + /* Release our wrapper, if underlying attribute was closed */ + if(ret_value >= 0) { + H5Idec_ref(o->under_vol_id); + free(o); + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_create + * + * Purpose: Creates a dataset in a container + * + * Return: Success: Pointer to a dataset object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *dset; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Create\n"); +#endif + + under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id, name, dcpl_id, dapl_id, dxpl_id, req); + if(under) { + dset = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + dset->under_object = under; + dset->under_vol_id = o->under_vol_id; + H5Iinc_ref(dset->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + dset = NULL; + + return((void *)dset); +} /* end H5VL_pass_through_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_open + * + * Purpose: Opens a dataset in a container + * + * Return: Success: Pointer to a dataset object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *dset; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Open\n"); +#endif + + under = H5VLdataset_open(o->under_object, loc_params, o->under_vol_id, name, dapl_id, dxpl_id, req); + if(under) { + dset = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + dset->under_object = under; + dset->under_vol_id = o->under_vol_id; + H5Iinc_ref(dset->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + dset = NULL; + + return((void *)dset); +} /* end H5VL_pass_through_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_read + * + * Purpose: Reads data elements from a dataset into a buffer. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Read\n"); +#endif + + ret_value = H5VLdataset_read(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_write + * + * Purpose: Writes data elements from a buffer into a dataset. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Write\n"); +#endif + + ret_value = H5VLdataset_write(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return ret_value; +} /* end H5VL_pass_through_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_get + * + * Purpose: Gets information about a dataset + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Get\n"); +#endif + + ret_value = H5VLdataset_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return ret_value; +} /* end H5VL_pass_through_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_specific + * + * Purpose: Specific operation on a dataset + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL H5Dspecific\n"); +#endif + + ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } + + return ret_value; +} /* end H5VL_pass_through_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_optional + * + * Purpose: Perform a connector-specific operation on a dataset + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Optional\n"); +#endif + + ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } + + return(ret_value); +} /* end H5VL_pass_through_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_dataset_close + * + * Purpose: Closes a dataset. + * + * Return: Success: 0 + * Failure: -1, dataset not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATASET Close\n"); +#endif + + ret_value = H5VLdataset_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } + + /* Release our wrapper, if underlying dataset was closed */ + if(ret_value >= 0) { + H5Idec_ref(o->under_vol_id); + free(o); + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_commit + * + * Purpose: Commits a datatype inside a container. + * + * Return: Success: Pointer to datatype object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, + hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *dt; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Commit\n"); +#endif + + under = H5VLdatatype_commit(o->under_object, loc_params, o->under_vol_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); + if(under) { + dt = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + dt->under_object = under; + dt->under_vol_id = o->under_vol_id; + H5Iinc_ref(dt->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + dt = NULL; + + return((void *)dt); +} /* end H5VL_pass_through_datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_open + * + * Purpose: Opens a named datatype inside a container. + * + * Return: Success: Pointer to datatype object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *dt; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Open\n"); +#endif + + under = H5VLdatatype_open(o->under_object, loc_params, o->under_vol_id, name, tapl_id, dxpl_id, req); + if(under) { + dt = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + dt->under_object = under; + dt->under_vol_id = o->under_vol_id; + H5Iinc_ref(dt->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + dt = NULL; + + return((void *)dt); +} /* end H5VL_pass_through_datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_get + * + * Purpose: Get information about a datatype + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Get\n"); +#endif + + ret_value = H5VLdatatype_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } + + return(ret_value); +} /* end H5VL_pass_through_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_specific + * + * Purpose: Specific operations for datatypes + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Specific\n"); +#endif + + ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } + + return(ret_value); +} /* end H5VL_pass_through_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_optional + * + * Purpose: Perform a connector-specific operation on a datatype + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Optional\n"); +#endif + + ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } + + return(ret_value); +} /* end H5VL_pass_through_datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_datatype_close + * + * Purpose: Closes a datatype. + * + * Return: Success: 0 + * Failure: -1, datatype not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL DATATYPE Close\n"); +#endif + + assert(o->under_object); + + ret_value = H5VLdatatype_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } + + /* Release our wrapper, if underlying datatype was closed */ + if(ret_value >= 0) { + H5Idec_ref(o->under_vol_id); + free(o); + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_create + * + * Purpose: Creates a container using this connector + * + * Return: Success: Pointer to a file object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_info_t *info; + H5VL_pass_through_t *file; + hid_t under_fapl_id; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL FILE Create\n"); +#endif + + /* Get copy of our VOL info from FAPL */ + H5Pget_vol_info(fapl_id, (void **)&info); + + /* Copy the FAPL */ + under_fapl_id = H5Pcopy(fapl_id); + + /* Set the VOL ID and info for the underlying FAPL */ + H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info); + + /* Open the file with the underlying VOL connector */ + under = H5VLfile_create(name, flags, fcpl_id, under_fapl_id, dxpl_id, req); + if(under) { + file = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + file->under_object = under; + file->under_vol_id = info->under_vol_id; + H5Iinc_ref(file->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = info->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + file = NULL; + + /* Close underlying FAPL */ + H5Pclose(under_fapl_id); + + /* Release copy of our VOL info */ + H5VL_pass_through_info_free(info); + + return((void *)file); +} /* end H5VL_pass_through_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_open + * + * Purpose: Opens a container created with this connector + * + * Return: Success: Pointer to a file object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, + hid_t dxpl_id, void **req) +{ + H5VL_pass_through_info_t *info; + H5VL_pass_through_t *file; + hid_t under_fapl_id; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL FILE Open\n"); +#endif + + /* Get copy of our VOL info from FAPL */ + H5Pget_vol_info(fapl_id, (void **)&info); + + /* Copy the FAPL */ + under_fapl_id = H5Pcopy(fapl_id); + + /* Set the VOL ID and info for the underlying FAPL */ + H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info); + + /* Open the file with the underlying VOL connector */ + under = H5VLfile_open(name, flags, under_fapl_id, dxpl_id, req); + if(under) { + file = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + file->under_object = under; + file->under_vol_id = info->under_vol_id; + H5Iinc_ref(file->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = info->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + file = NULL; + + /* Close underlying FAPL */ + H5Pclose(under_fapl_id); + + /* Release copy of our VOL info */ + H5VL_pass_through_info_free(info); + + return((void *)file); +} /* end H5VL_pass_through_file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_get + * + * Purpose: Get info about a file + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL FILE Get\n"); +#endif + + ret_value = H5VLfile_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_specific_reissue + * + * Purpose: Re-wrap vararg arguments into a va_list and reissue the + * file specific callback to the underlying VOL connector. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id, + H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; + herr_t ret_value; + + va_start(arguments, req); + ret_value = H5VLfile_specific(obj, connector_id, specific_type, dxpl_id, req, arguments); + va_end(arguments); + + return(ret_value); +} /* end H5VL_pass_through_file_specific_reissue() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_specific + * + * Purpose: Specific operation on file + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL FILE Specific\n"); +#endif + + /* Unpack arguments to get at the child file pointer when mounting a file */ + if(specific_type == H5VL_FILE_MOUNT) { + H5I_type_t loc_type; + const char *name; + H5VL_pass_through_t *child_file; + hid_t plist_id; + + /* Retrieve parameters for 'mount' operation, so we can unwrap the child file */ + loc_type = va_arg(arguments, H5I_type_t); + name = va_arg(arguments, const char *); + child_file = (H5VL_pass_through_t *)va_arg(arguments, void *); + plist_id = va_arg(arguments, hid_t); + + /* Keep the correct underlying VOL ID for possible async request token */ + under_vol_id = o->under_vol_id; + + /* Re-issue 'file specific' call, using the unwrapped pieces */ + ret_value = H5VL_pass_through_file_specific_reissue(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, loc_type, name, child_file->under_object, plist_id); + } /* end if */ + else if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5VL_pass_through_info_t *info; + hid_t fapl_id, under_fapl_id; + const char *name; + htri_t *ret; + + /* Get the arguments for the 'is accessible' check */ + fapl_id = va_arg(arguments, hid_t); + name = va_arg(arguments, const char *); + ret = va_arg(arguments, htri_t *); + + /* Get copy of our VOL info from FAPL */ + H5Pget_vol_info(fapl_id, (void **)&info); + + /* Copy the FAPL */ + under_fapl_id = H5Pcopy(fapl_id); + + /* Set the VOL ID and info for the underlying FAPL */ + H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info); + + /* Keep the correct underlying VOL ID for possible async request token */ + under_vol_id = info->under_vol_id; + + /* Re-issue 'file specific' call */ + ret_value = H5VL_pass_through_file_specific_reissue(NULL, info->under_vol_id, specific_type, dxpl_id, req, under_fapl_id, name, ret); + + /* Close underlying FAPL */ + H5Pclose(under_fapl_id); + + /* Release copy of our VOL info */ + H5VL_pass_through_info_free(info); + } /* end else-if */ + else { + va_list my_arguments; + + /* Make a copy of the argument list for later, if reopening */ + if(specific_type == H5VL_FILE_REOPEN) + va_copy(my_arguments, arguments); + + /* Keep the correct underlying VOL ID for possible async request token */ + under_vol_id = o->under_vol_id; + + ret_value = H5VLfile_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Wrap file struct pointer, if we reopened one */ + if(specific_type == H5VL_FILE_REOPEN) { + if(ret_value >= 0) { + void **ret = va_arg(my_arguments, void **); + + if(ret && *ret) { + H5VL_pass_through_t *new_file; + + new_file = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + new_file->under_object = *ret; + new_file->under_vol_id = o->under_vol_id; + H5Iinc_ref(new_file->under_vol_id); + + *ret = new_file; + } /* end if */ + } /* end if */ + + /* Finish use of copied vararg list */ + va_end(my_arguments); + } /* end if */ + } /* end else */ + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + assert(under_vol_id); + r->under_vol_id = under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_optional + * + * Purpose: Perform a connector-specific operation on a file + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL File Optional\n"); +#endif + + ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_file_close + * + * Purpose: Closes a file. + * + * Return: Success: 0 + * Failure: -1, file not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)file; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL FILE Close\n"); +#endif + + ret_value = H5VLfile_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + /* Release our wrapper, if underlying file was closed */ + if(ret_value >= 0) { + H5Idec_ref(o->under_vol_id); + free(o); + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_create + * + * Purpose: Creates a group inside a container + * + * Return: Success: Pointer to a group object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *group; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL GROUP Create\n"); +#endif + + under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, gcpl_id, gapl_id, dxpl_id, req); + if(under) { + group = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + group->under_object = under; + group->under_vol_id = o->under_vol_id; + H5Iinc_ref(group->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + group = NULL; + + return((void *)group); +} /* end H5VL_pass_through_group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_open + * + * Purpose: Opens a group inside a container + * + * Return: Success: Pointer to a group object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, + const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *group; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL GROUP Open\n"); +#endif + + under = H5VLgroup_open(o->under_object, loc_params, o->under_vol_id, name, gapl_id, dxpl_id, req); + if(under) { + group = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + group->under_object = under; + group->under_vol_id = o->under_vol_id; + H5Iinc_ref(group->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + group = NULL; + + return((void *)group); +} /* end H5VL_pass_through_group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_get + * + * Purpose: Get info about a group + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL GROUP Get\n"); +#endif + + ret_value = H5VLgroup_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_specific + * + * Purpose: Specific operation on a group + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL GROUP Specific\n"); +#endif + + ret_value = H5VLgroup_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_optional + * + * Purpose: Perform a connector-specific operation on a group + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL GROUP Optional\n"); +#endif + + ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_group_close + * + * Purpose: Closes a group. + * + * Return: Success: 0 + * Failure: -1, group not closed. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)grp; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL H5Gclose\n"); +#endif + + ret_value = H5VLgroup_close(o->under_object, o->under_vol_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + /* Release our wrapper, if underlying file was closed */ + if(ret_value >= 0) { + H5Idec_ref(o->under_vol_id); + free(o); + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_link_create + * + * Purpose: Creates a hard / soft / UD / external link. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Create\n"); +#endif + + /* Try to retrieve the "under" VOL id */ + if(o) + under_vol_id = o->under_vol_id; + + /* Fix up the link target object for hard link creation */ + if(H5VL_LINK_CREATE_HARD == create_type) { + void *cur_obj; + + /* Retrieve the object for the link target */ + H5Pget(lcpl_id, H5VL_PROP_LINK_TARGET, &cur_obj); + + /* If it's a non-NULL pointer, find the 'under object' and re-set the property */ + if(cur_obj) { + /* Check if we still need the "under" VOL ID */ + if(under_vol_id < 0) + under_vol_id = ((H5VL_pass_through_t *)cur_obj)->under_vol_id; + + /* Set the object for the link target */ + H5Pset(lcpl_id, H5VL_PROP_LINK_TARGET, &(((H5VL_pass_through_t *)cur_obj)->under_object)); + } /* end if */ + } /* end if */ + + ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_link_copy + * + * Purpose: Renames an object within an HDF5 container and copies it to a new + * group. The original name SRC is unlinked from the group graph + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj; + H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Copy\n"); +#endif + + /* Retrieve the "under" VOL id */ + if(o_src) + under_vol_id = o_src->under_vol_id; + else if(o_dst) + under_vol_id = o_dst->under_vol_id; + assert(under_vol_id > 0); + + ret_value = H5VLlink_copy((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: +H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + * + * Purpose: Moves a link within an HDF5 file to a new group. The original + * name SRC is unlinked from the group graph + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, + void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj; + H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj; + hid_t under_vol_id = -1; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Move\n"); +#endif + + /* Retrieve the "under" VOL id */ + if(o_src) + under_vol_id = o_src->under_vol_id; + else if(o_dst) + under_vol_id = o_dst->under_vol_id; + assert(under_vol_id > 0); + + ret_value = H5VLlink_move((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_link_get + * + * Purpose: Get info about a link + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Get\n"); +#endif + + ret_value = H5VLlink_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_link_specific + * + * Purpose: Specific operation on a link + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Specific\n"); +#endif + + ret_value = H5VLlink_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_link_optional + * + * Purpose: Perform a connector-specific operation on a link + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL LINK Optional\n"); +#endif + + ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_link_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_object_open + * + * Purpose: Opens an object inside a container. + * + * Return: Success: Pointer to object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, + H5I_type_t *opened_type, hid_t dxpl_id, void **req) +{ + H5VL_pass_through_t *new_obj; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + void *under; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL OBJECT Open\n"); +#endif + + under = H5VLobject_open(o->under_object, loc_params, o->under_vol_id, opened_type, dxpl_id, req); + if(under) { + new_obj = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); + new_obj->under_object = under; + new_obj->under_vol_id = o->under_vol_id; + H5Iinc_ref(new_obj->under_vol_id); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + } /* end if */ + else + new_obj = NULL; + + return((void *)new_obj); +} /* end H5VL_pass_through_object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_object_copy + * + * Purpose: Copies an object inside a container. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, + const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, + const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, + void **req) +{ + H5VL_pass_through_t *o_src = (H5VL_pass_through_t *)src_obj; + H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL OBJECT Copy\n"); +#endif + + ret_value = H5VLobject_copy(o_src->under_object, src_loc_params, src_name, o_dst->under_object, dst_loc_params, dst_name, o_src->under_vol_id, ocpypl_id, lcpl_id, dxpl_id, req); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o_src->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_object_get + * + * Purpose: Get info about an object + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL OBJECT Get\n"); +#endif + + ret_value = H5VLobject_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_object_specific + * + * Purpose: Specific operation on an object + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL OBJECT Specific\n"); +#endif + + ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_object_optional + * + * Purpose: Perform a connector-specific operation for an object + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL OBJECT Optional\n"); +#endif + + ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + + /* Check for async request */ + if(req && *req) { + H5VL_pass_through_t *r; + + r = (H5VL_pass_through_t*)calloc(1, sizeof(H5VL_pass_through_t)); + r->under_object = *req; + r->under_vol_id = o->under_vol_id; + H5Iinc_ref(r->under_vol_id); + + *req = r; + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_wait + * + * Purpose: Wait (with a timeout) for an async operation to complete + * + * Note: Releases the request if the operation has completed and the + * connector callback succeeds + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_wait(void *obj, uint64_t timeout, + H5ES_status_t *status) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Wait\n"); +#endif + + ret_value = H5VLrequest_wait(o->under_object, o->under_vol_id, timeout, status); + + if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) { + H5Idec_ref(o->under_vol_id); + free(o); + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_request_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_notify + * + * Purpose: Registers a user callback to be invoked when an asynchronous + * operation completes + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Wait\n"); +#endif + + ret_value = H5VLrequest_notify(o->under_object, o->under_vol_id, cb, ctx); + + if(ret_value >= 0) { + H5Idec_ref(o->under_vol_id); + free(o); + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_request_notify() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_cancel + * + * Purpose: Cancels an asynchronous operation + * + * Note: Releases the request, if connector callback succeeds + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_cancel(void *obj) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Cancel\n"); +#endif + + ret_value = H5VLrequest_cancel(o->under_object, o->under_vol_id); + + if(ret_value >= 0) { + H5Idec_ref(o->under_vol_id); + free(o); + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_specific_reissue + * + * Purpose: Re-wrap vararg arguments into a va_list and reissue the + * request specific callback to the underlying VOL connector. + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id, + H5VL_request_specific_t specific_type, ...) +{ + va_list arguments; + herr_t ret_value; + + va_start(arguments, specific_type); + ret_value = H5VLrequest_specific(obj, connector_id, specific_type, arguments); + va_end(arguments); + + return(ret_value); +} /* end H5VL_pass_through_request_specific_reissue() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_specific + * + * Purpose: Specific operation on a request + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_type, + va_list arguments) +{ + herr_t ret_value = -1; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Specific\n"); +#endif + + if(H5VL_REQUEST_WAITANY == specific_type || + H5VL_REQUEST_WAITSOME == specific_type || + H5VL_REQUEST_WAITALL == specific_type) { + va_list tmp_arguments; + size_t req_count; + + /* Sanity check */ + assert(obj == NULL); + + /* Get enough info to call the underlying connector */ + va_copy(tmp_arguments, arguments); + req_count = va_arg(tmp_arguments, size_t); + + /* Can only use a request to invoke the underlying VOL connector when there's >0 requests */ + if(req_count > 0) { + void **req_array; + void **under_req_array; + uint64_t timeout; + H5VL_pass_through_t *o; + size_t u; /* Local index variable */ + + /* Get the request array */ + req_array = va_arg(tmp_arguments, void **); + + /* Get a request to use for determining the underlying VOL connector */ + o = (H5VL_pass_through_t *)req_array[0]; + + /* Create array of underlying VOL requests */ + under_req_array = (void **)malloc(req_count * sizeof(void **)); + for(u = 0; u < req_count; u++) + under_req_array[u] = ((H5VL_pass_through_t *)req_array[u])->under_object; + + /* Remove the timeout value from the vararg list (it's used in all the calls below) */ + timeout = va_arg(tmp_arguments, uint64_t); + + /* Release requests that have completed */ + if(H5VL_REQUEST_WAITANY == specific_type) { + size_t *index; /* Pointer to the index of completed request */ + H5ES_status_t *status; /* Pointer to the request's status */ + + /* Retrieve the remaining arguments */ + index = va_arg(tmp_arguments, size_t *); + assert(*index <= req_count); + status = va_arg(tmp_arguments, H5ES_status_t *); + + /* Reissue the WAITANY 'request specific' call */ + ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, index, status); + + /* Release the completed request, if it completed */ + if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) { + H5VL_pass_through_t *tmp_o; + + tmp_o = (H5VL_pass_through_t *)req_array[*index]; + H5Idec_ref(tmp_o->under_vol_id); + free(tmp_o); + } /* end if */ + } /* end if */ + else if(H5VL_REQUEST_WAITSOME == specific_type) { + size_t *outcount; /* # of completed requests */ + unsigned *array_of_indices; /* Array of indices for completed requests */ + H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */ + + /* Retrieve the remaining arguments */ + outcount = va_arg(tmp_arguments, size_t *); + assert(*outcount <= req_count); + array_of_indices = va_arg(tmp_arguments, unsigned *); + array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *); + + /* Reissue the WAITSOME 'request specific' call */ + ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, outcount, array_of_indices, array_of_statuses); + + /* If any requests completed, release them */ + if(ret_value >= 0 && *outcount > 0) { + unsigned *idx_array; /* Array of indices of completed requests */ + + /* Retrieve the array of completed request indices */ + idx_array = va_arg(tmp_arguments, unsigned *); + + /* Release the completed requests */ + for(u = 0; u < *outcount; u++) { + H5VL_pass_through_t *tmp_o; + + tmp_o = (H5VL_pass_through_t *)req_array[idx_array[u]]; + H5Idec_ref(tmp_o->under_vol_id); + free(tmp_o); + } /* end for */ + } /* end if */ + } /* end else-if */ + else { /* H5VL_REQUEST_WAITALL == specific_type */ + H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */ + + /* Retrieve the remaining arguments */ + array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *); + + /* Reissue the WAITALL 'request specific' call */ + ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, array_of_statuses); + + /* Release the completed requests */ + if(ret_value >= 0) { + for(u = 0; u < req_count; u++) { + if(array_of_statuses[u] != H5ES_STATUS_IN_PROGRESS) { + H5VL_pass_through_t *tmp_o; + + tmp_o = (H5VL_pass_through_t *)req_array[u]; + H5Idec_ref(tmp_o->under_vol_id); + free(tmp_o); + } /* end if */ + } /* end for */ + } /* end if */ + } /* end else */ + + /* Release array of requests for underlying connector */ + free(under_req_array); + } /* end if */ + + /* Finish use of copied vararg list */ + va_end(tmp_arguments); + } /* end if */ + else + assert(0 && "Unknown 'specific' operation"); + + return(ret_value); +} /* end H5VL_pass_through_request_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_optional + * + * Purpose: Perform a connector-specific operation for a request + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_optional(void *obj, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Optional\n"); +#endif + + ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, arguments); + + return(ret_value); +} /* end H5VL_pass_through_request_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_request_free + * + * Purpose: Releases a request, allowing the operation to complete without + * application tracking + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_request_free(void *obj) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_LOGGING + printf("------- PASS THROUGH VOL REQUEST Free\n"); +#endif + + ret_value = H5VLrequest_free(o->under_object, o->under_vol_id); + + if(ret_value >= 0) { + H5Idec_ref(o->under_vol_id); + free(o); + } /* end if */ + + return(ret_value); +} /* end H5VL_pass_through_request_free() */ + diff --git a/src/H5VLpassthru.h b/src/H5VLpassthru.h new file mode 100644 index 0000000..e640636 --- /dev/null +++ b/src/H5VLpassthru.h @@ -0,0 +1,46 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 public header file for the pass-through VOL connector. + */ + +#ifndef _H5VLpassthru_H +#define _H5VLpassthru_H + +/* Identifier for the pass-through VOL connector */ +#define H5VL_PASSTHRU (H5VL_pass_through_register()) + +/* Characteristics of the pass-through VOL connector */ +#define H5VL_PASSTHRU_NAME "pass_through" +#define H5VL_PASSTHRU_VALUE 505 /* VOL connector ID */ +#define H5VL_PASSTHRU_VERSION 0 + +/* Pass-through VOL connector info */ +typedef struct H5VL_pass_through_info_t { + hid_t under_vol_id; /* VOL ID for under VOL */ + void *under_vol_info; /* VOL info for under VOL */ +} H5VL_pass_through_info_t; + + +#ifdef __cplusplus +extern "C" { +#endif + +H5_DLL hid_t H5VL_pass_through_register(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _H5VLpassthru_H */ + diff --git a/src/Makefile.am b/src/Makefile.am index d91cca8..69b51b2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -114,7 +114,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Topaque.c \ H5Torder.c \ H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ - H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \ + H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c H5VLpassthru.c \ H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ H5Zscaleoffset.c H5Zszip.c H5Ztrans.c @@ -141,7 +141,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ H5Rpublic.h H5Spublic.h H5Tpublic.h \ - H5VLnative.h H5VLpublic.h H5Zpublic.h + H5VLnative.h H5VLpassthru.h H5VLpublic.h H5Zpublic.h # install libhdf5.settings in lib directory settingsdir=$(libdir) diff --git a/src/hdf5.h b/src/hdf5.h index f19abd9..c12037f 100644 --- a/src/hdf5.h +++ b/src/hdf5.h @@ -52,7 +52,8 @@ #include "H5FDwindows.h" /* Win32 I/O */ #endif -/* Virtual object layer drivers */ -#include "H5VLnative.h" /* Native VOL driver */ +/* Virtual object layer (VOL) connectors */ +#include "H5VLnative.h" /* Native VOL connector */ +#include "H5VLpassthru.h" /* Pass-through VOL connector */ #endif -- cgit v0.12 From 3abf58dce034dd9e5afabbdd7d1d80c1ba4374ad Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 28 Nov 2018 10:38:52 -0600 Subject: Remove example VOL connector, since it's been superceded by the pass-through VOL connector in the src subdirectory. --- MANIFEST | 1 - examples/CMakeLists.txt | 1 - examples/Makefile.am | 7 +- examples/h5_vol_external_log_native.c | 498 ---------------------------------- 4 files changed, 2 insertions(+), 505 deletions(-) delete mode 100644 examples/h5_vol_external_log_native.c diff --git a/MANIFEST b/MANIFEST index c24fb32..625a9fc 100644 --- a/MANIFEST +++ b/MANIFEST @@ -171,7 +171,6 @@ ./examples/h5_vds-percival.c ./examples/h5_vds-percival-unlim.c ./examples/h5_vds-percival-unlim-maxmin.c -./examples/h5_vol_external_log_native.c ./examples/testh5cc.sh.in ./examples/README diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 9956b06..2239d64 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -37,7 +37,6 @@ set (examples h5_vds-percival h5_vds-percival-unlim h5_vds-percival-unlim-maxmin - h5_vol_external_log_native ) foreach (example ${examples}) diff --git a/examples/Makefile.am b/examples/Makefile.am index ae6c092..554ee44 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -37,8 +37,7 @@ EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \ h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg h5_vds h5_vds-exc \ h5_vds-exclim h5_vds-eiger h5_vds-simpleIO h5_vds-percival \ - h5_vds-percival-unlim h5_vds-percival-unlim-maxmin \ - h5_vol_external_log_native + h5_vds-percival-unlim h5_vds-percival-unlim-maxmin TEST_SCRIPT=testh5cc.sh TEST_EXAMPLES_SCRIPT=$(INSTALL_SCRIPT_FILES) @@ -51,8 +50,7 @@ INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \ h5_ref2reg.c h5_shared_mesg.c ph5example.c h5_vds.c h5_vds-exc.c \ h5_vds-exclim.c h5_vds-eiger.c h5_vds-simpleIO.c h5_vds-percival.c \ - h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c \ - h5_vol_external_log_native.c + h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c @@ -129,7 +127,6 @@ h5_vds-simpleIO: $(srcdir)/h5_vds-simpleIO.c h5_vds-percival: $(srcdir)/h5_vds-percival.c h5_vds-percival-unlim: $(srcdir)/h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin: $(srcdir)/h5_vds-percival-unlim-maxmin.c -h5_vol_external_log_native: $(srcdir)/h5_vol_external_log_native.c if BUILD_SHARED_SZIP_CONDITIONAL LD_LIBRARY_PATH=$(LL_PATH) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c deleted file mode 100644 index 24fc254..0000000 --- a/examples/h5_vol_external_log_native.c +++ /dev/null @@ -1,498 +0,0 @@ - -#include -#include -#include -#include "hdf5.h" - -#define LOG 502 - -static herr_t H5VL_log_init(hid_t vipl_id); -static herr_t H5VL_log_term(void); - -/* Datatype callbacks */ -static void *H5VL_log_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -static void *H5VL_log_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req); - -/* Dataset callbacks */ -static void *H5VL_log_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -static void *H5VL_log_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_log_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, void **req); -static herr_t H5VL_log_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -static herr_t H5VL_log_dataset_close(void *dset, hid_t dxpl_id, void **req); - -/* File callbacks */ -static void *H5VL_log_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); -static void *H5VL_log_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_log_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_log_file_close(void *file, hid_t dxpl_id, void **req); - -/* Group callbacks */ -static void *H5VL_log_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req); - -/* Link callbacks */ - -/* Object callbacks */ -static void *H5VL_log_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -static herr_t H5VL_log_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - -hid_t native_connector_id = -1; - -static const H5VL_class_t H5VL_log_g = { - 0, /* VOL class struct version */ - LOG, /* ID of connector */ - "log", /* Name of connector */ - 0, /* capability flags */ - H5VL_log_init, /* initialize */ - H5VL_log_term, /* terminate */ - sizeof(hid_t), /* info size */ - NULL, /* info copy */ - NULL, /* info compare */ - NULL, /* info free */ - NULL, /* info to str */ - NULL, /* str to info */ - NULL, /* get_object */ - NULL, /* get_wrap_ctx */ - NULL, /* free_wrap_ctx */ - NULL, /* wrap_object */ - { /* attribute_cls */ - NULL, /* H5VL_log_attr_create, */ /* create */ - NULL, /* H5VL_log_attr_open, */ /* open */ - NULL, /* H5VL_log_attr_read, */ /* read */ - NULL, /* H5VL_log_attr_write, */ /* write */ - NULL, /* H5VL_log_attr_get, */ /* get */ - NULL, /* H5VL_log_attr_specific, */ /* specific */ - NULL, /* H5VL_log_attr_optional, */ /* optional */ - NULL /* H5VL_log_attr_close */ /* close */ - }, - { /* dataset_cls */ - H5VL_log_dataset_create, /* create */ - H5VL_log_dataset_open, /* open */ - H5VL_log_dataset_read, /* read */ - H5VL_log_dataset_write, /* write */ - NULL, /* H5VL_log_dataset_get, */ /* get */ - NULL, /* H5VL_log_dataset_specific, */ /* specific */ - NULL, /* H5VL_log_dataset_optional, */ /* optional */ - H5VL_log_dataset_close /* close */ - }, - { /* datatype_cls */ - H5VL_log_datatype_commit, /* commit */ - H5VL_log_datatype_open, /* open */ - H5VL_log_datatype_get, /* get_size */ - NULL, /* H5VL_log_datatype_specific, */ /* specific */ - NULL, /* H5VL_log_datatype_optional, */ /* optional */ - H5VL_log_datatype_close /* close */ - }, - { /* file_cls */ - H5VL_log_file_create, /* create */ - H5VL_log_file_open, /* open */ - H5VL_log_file_get, /* get */ - NULL, /* H5VL_log_file_specific, */ /* specific */ - NULL, /* H5VL_log_file_optional, */ /* optional */ - H5VL_log_file_close /* close */ - }, - { /* group_cls */ - H5VL_log_group_create, /* create */ - NULL, /* H5VL_log_group_open, */ /* open */ - NULL, /* H5VL_log_group_get, */ /* get */ - NULL, /* H5VL_log_group_specific, */ /* specific */ - NULL, /* H5VL_log_group_optional, */ /* optional */ - H5VL_log_group_close /* close */ - }, - { /* link_cls */ - NULL, /* H5VL_log_link_create, */ /* create */ - NULL, /* H5VL_log_link_copy, */ /* copy */ - NULL, /* H5VL_log_link_move, */ /* move */ - NULL, /* H5VL_log_link_get, */ /* get */ - NULL, /* H5VL_log_link_specific, */ /* specific */ - NULL /* H5VL_log_link_optional, */ /* optional */ - }, - { /* object_cls */ - H5VL_log_object_open, /* open */ - NULL, /* H5VL_log_object_copy, */ /* copy */ - NULL, /* H5VL_log_object_get, */ /* get */ - H5VL_log_object_specific, /* specific */ - NULL /* H5VL_log_object_optional, */ /* optional */ - }, - { /* request_cls */ - NULL, /* wait */ - NULL, /* notify */ - NULL, /* cancel */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* free */ - }, - NULL -}; - -typedef struct H5VL_log_t { - void *under_object; -} H5VL_log_t; - -static herr_t -visit_cb(hid_t oid, const char *name, const H5O_info_t *oinfo, void *udata) -{ - ssize_t len; - char n[25]; - - if(H5Iget_type(oid) == H5I_GROUP) { - len = H5VLget_connector_name(oid, n, 50); - printf("Visiting GROUP VOL name = %s %zd\n", n, len); - } - if(H5Iget_type(oid) == H5I_DATASET) - printf("visiting dataset\n"); - if(H5Iget_type(oid) == H5I_DATATYPE) - printf("visiting datatype\n"); - - return 1; -} - -int -main(int argc, char **argv) -{ - 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_connector_registered("native") == 1); - - vol_id = H5VLregister_connector(&H5VL_log_g, H5P_DEFAULT); - assert(vol_id > 0); - assert(H5VLis_connector_registered("log") == 1); - - vol_id2 = H5VLget_connector_id("log"); - H5VLclose(vol_id2); - - native_connector_id = H5VLget_connector_id("native"); - assert(native_connector_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_connector_name(file_id, name, 25); - printf("FILE VOL name = %s %zd\n", name, len); - - group_id = H5Gcreate2(file_id, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - len = H5VLget_connector_name(group_id, name, 50); - 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_connector_name(int_id, name, 50); - printf("DT COMMIT name = %s %zd\n", name, len); - H5Tclose(int_id); - - int_id = H5Topen2(file_id, "int", H5P_DEFAULT); - len = H5VLget_connector_name(int_id, name, 50); - printf("DT OPEN name = %s %zd\n", name, len); - H5Tclose(int_id); - - int_id = H5Oopen(file_id,"int",H5P_DEFAULT); - len = H5VLget_connector_name(int_id, name, 50); - printf("DT OOPEN name = %s %zd\n", name, len); - - len = H5Fget_name(file_id, name, 50); - printf("name = %lu %s\n", (unsigned long)len, name); - - data = malloc(sizeof(int)*nelem); - for(i = 0; i < nelem; ++i) - data[i] = i; - - dims [0] = 60; - dataspaceId = H5Screate_simple(1, dims, NULL); - space = H5Screate_simple (2, ds_size, ds_size); - - sprintf(fullpath,"%s/%s",group_name,dataset_name); - datasetId = H5Dcreate2(file_id,fullpath,H5T_NATIVE_INT,dataspaceId,H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); - H5Sclose(dataspaceId); - - len = H5VLget_connector_name(datasetId, name, 50); - printf("DSET name = %s %zd\n", name, len); - - H5Dwrite(datasetId, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); - H5Dclose(datasetId); - - H5Ovisit2(file_id, H5_INDEX_NAME, H5_ITER_NATIVE, visit_cb, NULL, H5O_INFO_ALL); - - free(data); - H5Oclose(int_id); - H5Sclose (space); - H5Gclose(group_id); - H5Fclose(file_id); - H5Pclose(acc_tpl); - H5Pclose(under_fapl); - - H5VLclose(native_connector_id); - H5VLunregister_connector(vol_id); - assert(H5VLis_connector_registered("log") == 0); - - return EXIT_SUCCESS; -} - -static herr_t -H5VL_log_init(hid_t vipl_id) -{ - printf("------- LOG INIT\n"); - return 1; -} - -static herr_t -H5VL_log_term(void) -{ - printf("------- LOG TERM\n"); - return 1; -} - -static void * -H5VL_log_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) -{ - hid_t under_fapl = -1; - H5VL_log_t *file; - - file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - - H5Pget_vol_info(fapl_id, &under_fapl); - file->under_object = H5VLfile_create(name, flags, fcpl_id, under_fapl, dxpl_id, req); - - printf("------- LOG H5Fcreate\n"); - return (void *)file; -} - -static void * -H5VL_log_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) -{ - hid_t under_fapl = -1; - H5VL_log_t *file; - - file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - - H5Pget_vol_info(fapl_id, &under_fapl); - file->under_object = H5VLfile_open(name, flags, under_fapl, dxpl_id, req); - - printf("------- LOG H5Fopen\n"); - return (void *)file; -} - -static herr_t -H5VL_log_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_log_t *f = (H5VL_log_t *)file; - - H5VLfile_get(f->under_object, native_connector_id, get_type, dxpl_id, req, arguments); - - printf("------- LOG H5Fget %d\n", get_type); - return 1; -} - -static herr_t -H5VL_log_file_close(void *file, hid_t dxpl_id, void **req) -{ - H5VL_log_t *f = (H5VL_log_t *)file; - - H5VLfile_close(f->under_object, native_connector_id, dxpl_id, req); - free(f); - - printf("------- LOG H5Fclose\n"); - return 1; -} - -static void * -H5VL_log_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) -{ - H5VL_log_t *group; - H5VL_log_t *o = (H5VL_log_t *)obj; - - group = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - - group->under_object = H5VLgroup_create(o->under_object, loc_params, native_connector_id, name, gcpl_id, gapl_id, dxpl_id, req); - - printf("------- LOG H5Gcreate\n"); - return (void *)group; -} - -static herr_t -H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req) -{ - H5VL_log_t *g = (H5VL_log_t *)grp; - - H5VLgroup_close(g->under_object, native_connector_id, dxpl_id, req); - free(g); - - printf("------- LOG H5Gclose\n"); - return 1; -} - -static void * -H5VL_log_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, - hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) -{ - H5VL_log_t *dt; - H5VL_log_t *o = (H5VL_log_t *)obj; - - dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - - dt->under_object = H5VLdatatype_commit(o->under_object, loc_params, native_connector_id, name, - type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); - - printf("------- LOG H5Tcommit\n"); - return dt; -} - -static void * -H5VL_log_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) -{ - H5VL_log_t *dt; - H5VL_log_t *o = (H5VL_log_t *)obj; - - dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - - dt->under_object = H5VLdatatype_open(o->under_object, loc_params, native_connector_id, name, tapl_id, dxpl_id, req); - - printf("------- LOG H5Topen\n"); - return (void *)dt; -} - -static herr_t -H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_log_t *o = (H5VL_log_t *)dt; - herr_t ret_value; - - ret_value = H5VLdatatype_get(o->under_object, native_connector_id, get_type, dxpl_id, req, arguments); - - printf("------- LOG datatype get\n"); - return ret_value; -} - -static herr_t -H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req) -{ - H5VL_log_t *type = (H5VL_log_t *)dt; - - assert(type->under_object); - - H5VLdatatype_close(type->under_object, native_connector_id, dxpl_id, req); - free(type); - - printf("------- LOG H5Tclose\n"); - return 1; -} - -static void * -H5VL_log_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req) -{ - H5VL_log_t *new_obj; - H5VL_log_t *o = (H5VL_log_t *)obj; - - new_obj = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - - new_obj->under_object = H5VLobject_open(o->under_object, loc_params, native_connector_id, opened_type, dxpl_id, req); - - printf("------- LOG H5Oopen\n"); - return (void *)new_obj; -} - -static herr_t -H5VL_log_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_log_t *o = (H5VL_log_t *)obj; - - H5VLobject_specific(o->under_object, loc_params, native_connector_id, specific_type, dxpl_id, req, arguments); - - printf("------- LOG Object specific\n"); - return 1; -} - -static void * -H5VL_log_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) -{ - H5VL_log_t *dset; - H5VL_log_t *o = (H5VL_log_t *)obj; - - dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - - dset->under_object = H5VLdataset_create(o->under_object, loc_params, native_connector_id, name, dcpl_id, dapl_id, dxpl_id, req); - - printf("------- LOG H5Dcreate\n"); - return (void *)dset; -} - -static void * -H5VL_log_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) -{ - H5VL_log_t *dset; - H5VL_log_t *o = (H5VL_log_t *)obj; - - dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - - dset->under_object = H5VLdataset_open(o->under_object, loc_params, native_connector_id, name, dapl_id, dxpl_id, req); - - printf("------- LOG H5Dopen\n"); - return (void *)dset; -} - -static herr_t -H5VL_log_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, void **req) -{ - H5VL_log_t *d = (H5VL_log_t *)dset; - - H5VLdataset_read(d->under_object, native_connector_id, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, req); - - printf("------- LOG H5Dread\n"); - return 1; -} - -static herr_t -H5VL_log_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, void **req) -{ - H5VL_log_t *d = (H5VL_log_t *)dset; - - H5VLdataset_write(d->under_object, native_connector_id, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, req); - - printf("------- LOG H5Dwrite\n"); - return 1; -} - -static herr_t -H5VL_log_dataset_close(void *dset, hid_t dxpl_id, void **req) -{ - H5VL_log_t *d = (H5VL_log_t *)dset; - - H5VLdataset_close(d->under_object, native_connector_id, dxpl_id, req); - free(d); - - printf("------- LOG H5Dclose\n"); - return 1; -} - -- cgit v0.12 From 6eabeabdaa77642fd4db5fd234ccc756a24125be Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 28 Nov 2018 17:38:03 -0600 Subject: Refactor infrastructure for setting FAPL information from environment variables during testing, including connecting native, pass-through, and dynamically loaded VOL connectors. Also bring native and pass-through VOL connectors into alignment, removing the "H5VLnative_private.h" header. --- MANIFEST | 1 - src/CMakeLists.txt | 1 - src/H5Dvirtual.c | 1 - src/H5Fint.c | 1 - src/H5Gtraverse.c | 1 - src/H5L.c | 1 - src/H5Lexternal.c | 1 - src/H5Oint.c | 1 - src/H5Pfapl.c | 6 +- src/H5VLnative.c | 44 +----- src/H5VLnative.h | 6 +- src/H5VLnative_private.h | 37 ----- src/H5VLpassthru.c | 8 +- test/h5test.c | 360 ++++++++++++++++++++++++++++------------------- test/h5test.h | 10 +- test/vol.c | 1 - 16 files changed, 236 insertions(+), 244 deletions(-) delete mode 100644 src/H5VLnative_private.h diff --git a/MANIFEST b/MANIFEST index 625a9fc..cb22f4d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -894,7 +894,6 @@ ./src/H5VLmodule.h ./src/H5VLnative.c ./src/H5VLnative.h -./src/H5VLnative_private.h ./src/H5VLpassthru.c ./src/H5VLpassthru.h ./src/H5VLpkg.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 80b26ff..cd81ba5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -870,7 +870,6 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5UCprivate.h ${HDF5_SRC_DIR}/H5VLpkg.h - ${HDF5_SRC_DIR}/H5VLnative_private.h ${HDF5_SRC_DIR}/H5VLprivate.h ${HDF5_SRC_DIR}/H5VMprivate.h diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index feb836d..c0d49d8 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -58,7 +58,6 @@ #include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property Lists */ #include "H5Sprivate.h" /* Dataspaces */ -#include "H5VLnative_private.h" /* Native VOL driver */ #include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ diff --git a/src/H5Fint.c b/src/H5Fint.c index 1ef5013..056a98b 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -38,7 +38,6 @@ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 2d8de99..d029bea 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -43,7 +43,6 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppublic.h" /* Property Lists */ #include "H5WBprivate.h" /* Wrapped Buffers */ -#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5L.c b/src/H5L.c index 9c14fce..9506e7d 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -34,7 +34,6 @@ #include "H5Oprivate.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 73f7b89..0f3296f 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -34,7 +34,6 @@ #include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ diff --git a/src/H5Oint.c b/src/H5Oint.c index 059a8a8..52290f2 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -43,7 +43,6 @@ #endif /* H5O_ENABLE_BOGUS */ #include "H5Opkg.h" /* Object headers */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index e802e3b..923c792 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -41,15 +41,15 @@ #include "H5Ppkg.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ -/* Includes needed to set as default file driver */ +/* Includes needed to set default file driver */ #include "H5FDsec2.h" /* POSIX unbuffered I/O */ #include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS #include "H5FDwindows.h" /* Win32 I/O */ #endif -/* Includes needed to set the default VOL connector */ -#include "H5VLnative_private.h" /* Native VOL connector */ +/* Includes needed to set default VOL connector */ +#include "H5VLnative.h" /* Native VOL connector */ /****************/ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 6c51d95..3fc1a7c 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" /* Virtual Object Layer */ -#include "H5VLnative_private.h" /* Native VOL connector */ +#include "H5VLnative.h" /* Native VOL connector */ /* * The VOL connector identification number. @@ -208,10 +208,9 @@ static H5VL_class_t H5VL_native_cls_g = { /*------------------------------------------------------------------------- - * Function: H5VL_native_init + * Function: H5VL_native_register * - * Purpose: Initialize this VOL connector by registering it with the - * library. + * Purpose: Register the native VOL connector and retrieve an ID for it. * * Return: Success: The ID for the native connector * Failure: H5I_INVALID_HID @@ -219,7 +218,7 @@ static H5VL_class_t H5VL_native_cls_g = { *------------------------------------------------------------------------- */ hid_t -H5VL_native_init(hid_t vipl_id) +H5VL_native_register(void) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -227,7 +226,7 @@ H5VL_native_init(hid_t vipl_id) /* Register the native VOL connector, if it isn't already */ if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) - if((H5VL_NATIVE_ID_g = H5VL_register_connector((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, vipl_id)) < 0) + if((H5VL_NATIVE_ID_g = H5VL_register_connector((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, H5P_DEFAULT)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector") /* Set return value */ @@ -235,7 +234,7 @@ H5VL_native_init(hid_t vipl_id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_init() */ +} /* end H5VL_native_register() */ /*--------------------------------------------------------------------------- @@ -252,7 +251,7 @@ H5VL__native_term(void) { FUNC_ENTER_STATIC_NOERR - /* Reset VFL ID */ + /* Reset VOL ID */ H5VL_NATIVE_ID_g = H5I_INVALID_HID; FUNC_LEAVE_NOAPI(SUCCEED) @@ -260,35 +259,6 @@ H5VL__native_term(void) /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_native - * - * Purpose: Modify the file access property list to use the H5VL_NATIVE - * connector defined in this source file. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_fapl_native(hid_t fapl_id) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value; - - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", fapl_id); - - if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - - ret_value = H5P_set_vol(plist, H5VL_NATIVE_ID_g, NULL); - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_fapl_native() */ - - -/*------------------------------------------------------------------------- * Function: H5VL__native_attr_create * * Purpose: Creates an attribute on an object. diff --git a/src/H5VLnative.h b/src/H5VLnative.h index af4ea59..8ae3a66 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -17,6 +17,9 @@ #ifndef _H5VLnative_H #define _H5VLnative_H +/* Identifier for the native VOL connector */ +#define H5VL_NATIVE (H5VL_native_register()) + /* Characteristics of the native VOL connector */ #define H5VL_NATIVE_NAME "native" #define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */ @@ -27,7 +30,8 @@ extern "C" { #endif -H5_DLL herr_t H5Pset_fapl_native(hid_t fapl_id); +H5_DLL hid_t H5VL_native_register(void); + #ifdef __cplusplus } diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h deleted file mode 100644 index 559c8aa..0000000 --- a/src/H5VLnative_private.h +++ /dev/null @@ -1,37 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Purpose: The private header file for the native VOL connector. - */ - -#ifndef _H5VLnative_private_H -#define _H5VLnative_private_H - -/* Include connector's public header */ -#include "H5VLnative.h" - -/* Initializer function for native VOL connector */ -#define H5VL_NATIVE (H5VL_native_init(H5P_DEFAULT)) - - -#ifdef __cplusplus -extern "C" { -#endif - -H5_DLL hid_t H5VL_native_init(hid_t vipl_id); - -#ifdef __cplusplus -} -#endif - -#endif /* _H5VLnative_private_H */ diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 3181834..f8568de 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -237,7 +237,7 @@ static const H5VL_class_t H5VL_pass_through_g = { }; /* The connector identification number, initialized at runtime */ -static hid_t H5VL_PASSTHRU_g = 0; +static hid_t H5VL_PASSTHRU_g = H5I_INVALID_HID; /*------------------------------------------------------------------------- @@ -315,7 +315,7 @@ H5VL_pass_through_term(void) #endif /* Reset VOL ID */ - H5VL_PASSTHRU_g = 0; + H5VL_PASSTHRU_g = H5I_INVALID_HID; return(0); } /* end H5VL_pass_through_term() */ @@ -462,7 +462,7 @@ H5VL_pass_through_info_to_str(const void *_info, char **str) assert(*str); /* Encode our info */ - snprintf(*str, 32 + under_vol_str_len, "under_val=%u, under_info={%s}", (unsigned)under_value, (under_vol_string ? under_vol_string : "")); + snprintf(*str, 32 + under_vol_str_len, "under_val=%u;under_info={%s}", (unsigned)under_value, (under_vol_string ? under_vol_string : "")); return(0); } /* end H5VL_pass_through_info_to_str() */ @@ -492,7 +492,7 @@ H5VL_pass_through_str_to_info(const char *str, void **_info) #endif /* Retrieve the underlying VOL connector value and info */ - sscanf(str, "under_vol=%u,", &under_vol_value); + sscanf(str, "under_vol=%u;", &under_vol_value); under_vol_id = H5VLregister_connector_by_value((H5VL_class_value_t)under_vol_value, H5P_DEFAULT); under_vol_info_start = strchr(str, '{'); under_vol_info_end = strrchr(str, '}'); diff --git a/test/h5test.c b/test/h5test.c index 3c02e4e..0453162 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -792,8 +792,8 @@ h5_rmprefix(const char *filename) * Function: h5_fileaccess * * Purpose: Returns a file access template which is the default template - * but with a file driver set according to the constant or - * environment variable HDF5_DRIVER + * but with a file driver, VOL connector, or libver bound set + * according to a constant or environment variable * * Return: Success: A file access property list * Failure: -1 @@ -806,135 +806,34 @@ h5_rmprefix(const char *filename) hid_t h5_fileaccess(void) { - const char *val = NULL; - const char *name; - char s[1024]; hid_t fapl = -1; - /* First use the environment variable, then the constant */ - val = HDgetenv("HDF5_DRIVER"); -#ifdef HDF5_DRIVER - if(!val) - val = HDF5_DRIVER; -#endif - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) return -1; - if(!val || !*val) - return fapl; /* use default */ - - HDstrncpy(s, val, sizeof s); - s[sizeof(s)-1] = '\0'; - if(NULL == (name = HDstrtok(s, " \t\n\r"))) - return fapl; - - if(!HDstrcmp(name, "sec2")) { - /* Unix read() and write() system calls */ - if (H5Pset_fapl_sec2(fapl) < 0) - return -1; - } - else if(!HDstrcmp(name, "stdio")) { - /* Standard C fread() and fwrite() system calls */ - if (H5Pset_fapl_stdio(fapl) < 0) - return -1; - } - else if(!HDstrcmp(name, "core")) { - /* In-memory driver settings (backing store on, 1 MB increment) */ - if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) - return -1; - } - else if(!HDstrcmp(name, "core_paged")) { - /* In-memory driver with write tracking and paging on */ - if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) - return -1; - if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) - return -1; - } - else if(!HDstrcmp(name, "split")) { - /* Split meta data and raw data each using default driver */ - if(H5Pset_fapl_split(fapl, - "-m.h5", H5P_DEFAULT, - "-r.h5", H5P_DEFAULT) < 0) - return -1; - } - else if(!HDstrcmp(name, "multi")) { - /* Multi-file driver, general case of the split driver */ - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - char *sv[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; - H5FD_mem_t mt; - - HDmemset(memb_map, 0, sizeof memb_map); - HDmemset(memb_fapl, 0, sizeof memb_fapl); - HDmemset(memb_name, 0, sizeof memb_name); - HDmemset(memb_addr, 0, sizeof memb_addr); - - HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_fapl[mt] = H5P_DEFAULT; - if(NULL == (sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN))) - return -1; - HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); - memb_name[mt] = sv[mt]; - memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); - } /* end for */ - if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) - return -1; + /* Attempt to set up a file driver first */ + if(h5_get_vfd_fapl(fapl) < 0) + return -1; - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) - HDfree(sv[mt]); - } - else if(!HDstrcmp(name, "family")) { - hsize_t fam_size = 100*1024*1024; /*100 MB*/ - - /* Family of files, each 1MB and using the default driver */ - if((val = HDstrtok(NULL, " \t\n\r"))) - fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); - if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) - return -1; - } - else if(!HDstrcmp(name, "log")) { - unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; - - /* Log file access */ - if((val = HDstrtok(NULL, " \t\n\r"))) - log_flags = (unsigned)HDstrtol(val, NULL, 0); - if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) - return -1; - } - else if(!HDstrcmp(name, "direct")) { -#ifdef H5_HAVE_DIRECT - /* Linux direct read() and write() system calls. Set memory boundary, file block size, - * and copy buffer size to the default values. */ - if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) - return -1; -#endif - } - else if(!HDstrcmp(name, "latest")) { - /* use the latest format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; - } - else { - /* Unknown driver */ + /* Next, try to set up a VOL connector */ + if(h5_get_vol_fapl(fapl) < 0) return -1; - } - - return fapl; -} + + /* Finally, check for libver bounds */ + if(h5_get_libver_fapl(fapl) < 0) + return -1; + + return(fapl); +} /* end h5_fileaccess() */ /*------------------------------------------------------------------------- * Function: h5_get_vfd_fapl * - * Purpose: Returns a file access property list which is the default - * fapl but with a file driver set according to the constant or - * environment variable HDF5_DRIVER. + * Purpose: Sets the file driver for a FAPL according to the value specified + * in the constant or environment variable "HDF5_DRIVER". * - * Return: Success: A file access property list ID + * Return: Success: 0 * Failure: -1 * * Programmer: Dana Robinson @@ -942,60 +841,58 @@ h5_fileaccess(void) * *------------------------------------------------------------------------- */ -hid_t -h5_get_vfd_fapl(void) +herr_t +h5_get_vfd_fapl(hid_t fapl) { const char *env = NULL; /* HDF5_DRIVER environment variable */ const char *tok = NULL; /* strtok pointer */ char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ - hid_t fapl = -1; /* fapl to be returned */ /* Get the environment variable, if it exists */ env = HDgetenv("HDF5_DRIVER"); - - /* Create a default fapl */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - return -1; +#ifdef HDF5_DRIVER + /* Use the environment variable, then the compile-time constant */ + if(!env) + env = HDF5_DRIVER; +#endif /* If the environment variable was not set, just return - * the default fapl. + * without modifying the FAPL. */ if(!env || !*env) - return fapl; + goto done; /* Get the first 'word' of the environment variable. * If it's nothing (environment variable was whitespace) * just return the default fapl. */ HDstrncpy(buf, env, sizeof(buf)); - HDmemset(buf, 0, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) - return fapl; + goto done; if(!HDstrcmp(tok, "sec2")) { /* POSIX (section 2) read() and write() system calls */ if(H5Pset_fapl_sec2(fapl) < 0) - return -1; + goto error; } else if(!HDstrcmp(tok, "stdio")) { /* Standard C fread() and fwrite() system calls */ if(H5Pset_fapl_stdio(fapl) < 0) - return -1; + goto error; } else if(!HDstrcmp(tok, "core")) { /* In-memory driver settings (backing store on, 1 MB increment) */ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) - return -1; + goto error; } else if(!HDstrcmp(tok, "core_paged")) { /* In-memory driver with write tracking and paging on */ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) - return -1; + goto error; if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) - return -1; + goto error; } else if(!HDstrcmp(tok, "split")) { /* Split meta data and raw data each using default driver */ - if(H5Pset_fapl_split(fapl, - "-m.h5", H5P_DEFAULT, - "-r.h5", H5P_DEFAULT) < 0) - return -1; + if(H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) + goto error; } else if(!HDstrcmp(tok, "multi")) { /* Multi-file driver, general case of the split driver */ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; @@ -1021,19 +918,19 @@ h5_get_vfd_fapl(void) } /* end for */ if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) - return -1; + goto error; for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) HDfree(sv[mt]); } else if(!HDstrcmp(tok, "family")) { /* Family of files, each 1MB and using the default driver */ - hsize_t fam_size = 100*1024*1024; /*100 MB*/ + hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */ /* Was a family size specified in the environment variable? */ if((tok = HDstrtok(NULL, " \t\n\r"))) - fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024*1024); + fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024 * 1024); if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) - return -1; + goto error; } else if(!HDstrcmp(tok, "log")) { /* Log file access */ unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; @@ -1043,25 +940,194 @@ h5_get_vfd_fapl(void) log_flags = (unsigned)HDstrtol(tok, NULL, 0); if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) - return -1; + goto error; #ifdef H5_HAVE_DIRECT } else if(!HDstrcmp(tok, "direct")) { /* Linux direct read() and write() system calls. Set memory boundary, * file block size, and copy buffer size to the default values. */ - if(H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0) - return -1; + if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) + goto error; #endif } else { /* Unknown driver */ - return -1; + goto error; } /* end if */ - return fapl; +done: + return 0; + +error: + return -1; } /* end h5_get_vfd_fapl() */ /*------------------------------------------------------------------------- + * Function: h5_get_libver_fapl + * + * Purpose: Sets the library version bounds for a FAPL according to the + * value in the constant or environment variable "HDF5_LIBVER_BOUNDS". + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * November 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +h5_get_libver_fapl(hid_t fapl) +{ + const char *env = NULL; /* HDF5_DRIVER environment variable */ + const char *tok = NULL; /* strtok pointer */ + char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ + + /* Get the environment variable, if it exists */ + env = HDgetenv("HDF5_LIBVER_BOUNDS"); +#ifdef HDF5_LIBVER_BOUNDS + /* Use the environment variable, then the compile-time constant */ + if(!env) + env = HDF5_LIBVER_BOUNDS; +#endif + + /* If the environment variable was not set, just return + * without modifying the FAPL. + */ + if(!env || !*env) + goto done; + + /* Get the first 'word' of the environment variable. + * If it's nothing (environment variable was whitespace) + * just return the default fapl. + */ + HDstrncpy(buf, env, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; + if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + goto done; + + if(!HDstrcmp(tok, "latest")) { + /* use the latest format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + goto error; + } /* end if */ + else { + /* Unknown setting */ + goto error; + } /* end else */ + +done: + return 0; + +error: + return -1; +} /* end h5_get_vfd_fapl() */ + + +/*------------------------------------------------------------------------- + * Function: h5_get_vol_fapl + * + * Purpose: Returns a file access property list which is the default + * fapl but with a VOL connector set according to the constant + * or environment variable HDF5_VOL_CONNECTOR. + * + * Return: Success: A file access property list ID + * Failure: -1 + * + * Programmer: Jordan Henderson + * November 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +h5_get_vol_fapl(hid_t fapl) +{ + const char *env = NULL; + const char *tok = NULL; + htri_t connector_is_registered; + char buf[1024]; /* Buffer for tokenizing HDF5_VOL_CONNECTOR */ + void *vol_info = NULL; /* VOL connector info */ + hid_t connector_id = -1; + + /* Get the environment variable, if it exists */ + env = HDgetenv("HDF5_VOL_CONNECTOR"); +#ifdef HDF5_VOL_CONNECTOR + /* Use the environment variable, then the compile-time constant */ + if(!env) + env = HDF5_VOL_CONNECTOR; +#endif + + /* If the environment variable was not set, just return. */ + if(!env || !*env) + goto done; + + /* Get the first 'word' of the environment variable. + * If it's nothing (environment variable was whitespace) just return. + */ + HDstrncpy(buf, env, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; + if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + goto done; + + /* First, check to see if the connector is already registered */ + if((connector_is_registered = H5VLis_connector_registered(tok)) < 0) + goto done; + else if(connector_is_registered) { + /* Retrieve the ID of the already-registered VOL connector */ + if((connector_id = H5VLget_connector_id(tok)) < 0) + goto error; + } /* end else-if */ + else { + /* Check for VOL connectors that ship with the library */ + if(!HDstrcmp(tok, "native")) { + connector_id = H5VL_NATIVE; + if(H5Iinc_ref(connector_id) < 0) + goto error; + } else if(!HDstrcmp(tok, "pass_through")) { + connector_id = H5VL_PASSTHRU; + if(H5Iinc_ref(connector_id) < 0) + goto error; + } else { + /* Register the VOL connector */ + /* (NOTE: No provisions for vipl_id currently) */ + if((connector_id = H5VLregister_connector_by_name(tok, H5P_DEFAULT)) < 0) + goto error; + } /* end else */ + } /* end else */ + + /* Was there any connector info specified in the environment variable? */ + if(NULL != (tok = HDstrtok(NULL, " \t\n\r"))) + if(H5VLconnector_str_to_info(tok, connector_id, &vol_info) < 0) + goto error; + + /* Set the VOL connector in the FAPL */ + if(H5Pset_vol(fapl, connector_id, vol_info) < 0) + goto error; + + /* Release VOL connector info, if there was any */ + if(vol_info) + if(H5VLfree_connector_info(connector_id, vol_info) < 0) + goto error; + + /* Close the connector ID */ + if(connector_id >= 0) + if(H5VLunregister_connector(connector_id) < 0) + goto error; + +done: + return 0; + +error: + if(vol_info) + H5VLfree_connector_info(connector_id, vol_info); + if(connector_id >= 0) + H5VLunregister_connector(connector_id); + + return -1; +} /* end h5_get_vol_fapl() */ + + +/*------------------------------------------------------------------------- * Function: h5_no_hwconv * * Purpose: Turn off hardware data type conversions. diff --git a/test/h5test.h b/test/h5test.h index 2fb0e0c..c72f389 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -144,12 +144,10 @@ H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void); H5TEST_DLL H5VL_class_t *h5_get_dummy_vol_class(void); -/* Functions that will replace VFD-dependent functions that violate - * the single responsibility principle. Unlike their predecessors, - * these new functions do not have hidden side effects. - */ -/* h5_fileaccess() replacement */ -H5TEST_DLL hid_t h5_get_vfd_fapl(void); +/* Functions that will replace components of a FAPL */ +H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); +H5TEST_DLL herr_t h5_get_vol_fapl(hid_t fapl_id); +H5TEST_DLL herr_t h5_get_libver_fapl(hid_t fapl_id); /* h5_clean_files() replacements */ H5TEST_DLL void h5_delete_test_file(const char *base_name, hid_t fapl); diff --git a/test/vol.c b/test/vol.c index 357fa45..177c5b8 100644 --- a/test/vol.c +++ b/test/vol.c @@ -19,7 +19,6 @@ */ #include "h5test.h" -#include "H5VLnative_private.h" #define NATIVE_VOL_TEST_FILENAME "native_vol_test" -- cgit v0.12 From d442fe2d9815a83f5010cca9a878974e286c27f9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 28 Nov 2018 19:07:30 -0600 Subject: Add support for "make check-vol", along with a few minor cleanups, etc. --- Makefile.am | 9 +++++++++ bin/makehelp | 1 + bin/snapshot | 6 ++++++ c++/test/tlinks.cpp | 5 ----- config/commence.am | 3 ++- config/conclude.am | 12 ++++++++++++ src/H5VLpassthru.c | 2 +- test/Makefile.am | 3 +++ test/freespace.c | 6 ------ test/h5test.c | 13 +++++++++++-- test/links_env.c | 5 ----- 11 files changed, 45 insertions(+), 20 deletions(-) diff --git a/Makefile.am b/Makefile.am index e3e5e3d..d58b1b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -186,6 +186,15 @@ check-vfd: fi; \ done +# Run tests with different Virtual Object Layer Connectors. +# Currently, only invoke check-vol in the test directory. +check-vol: + for d in src test; do \ + if test $$d != .; then \ + (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ + fi; \ + done + # Automake wants to make config.status depend on configure. This # makes sense, but config.status can't always be regenerated # properly, which can cause builds to fail. diff --git a/bin/makehelp b/bin/makehelp index d6fbda2..4707397 100755 --- a/bin/makehelp +++ b/bin/makehelp @@ -40,6 +40,7 @@ make distclean: remove all files generated by make, make check, or make check-p: Only run parallel tests make check-s: Only run serial tests make check-vfd: Run tests with each virtual file driver +make check-vol: Run tests with each virtual object layer connector HDF5 uses Automake, so any standard Automake targets not listed here should also work. diff --git a/bin/snapshot b/bin/snapshot index 5c78fc8..5900728 100755 --- a/bin/snapshot +++ b/bin/snapshot @@ -132,6 +132,7 @@ DISPLAYUSAGE() Usage: $PROGNAME [all] [checkout] [ftp [diff] [test] [srcdir] [release] [help] [clean] [distclean] [echo] [deploy ] [deploydir ] [zlib ] [releasedir ] [srcdirname ] [check-vfd] + [check-vol] [exec ] [module-load ] [op-configure