diff options
484 files changed, 25742 insertions, 11153 deletions
diff --git a/.gitattributes b/.gitattributes index 1ca4739..2ad5b6e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -216,10 +216,10 @@ java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java -text java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java -text java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java -text java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java -text -java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java -text java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java -text -java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java -text +java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java -text java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java -text +java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java -text java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java -text java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java -text java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java -text @@ -267,6 +267,8 @@ java/src/hdf/hdf5lib/structs/H5G_info_t.java -text java/src/hdf/hdf5lib/structs/H5L_info_t.java -text java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java -text java/src/hdf/hdf5lib/structs/H5O_info_t.java -text +java/src/hdf/hdf5lib/structs/H5O_native_info_t.java -text +java/src/hdf/hdf5lib/structs/H5O_token_t.java -text java/src/hdf/hdf5lib/structs/H5_ih_info_t.java -text java/src/hdf/overview.html -text java/src/jni/CMakeLists.txt -text diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ae0833..1466865 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -394,6 +394,9 @@ HDF_DIR_PATHS(${HDF5_PACKAGE_NAME}) include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake) include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake) +if (HDF5_ENABLE_SANITIZERS) + include (${HDF5_SOURCE_DIR}/config/sanitizer/sanitizers.cmake) +endif () #----------------------------------------------------------------------------- # Targets built within this project are exported at Install time for use @@ -432,17 +435,29 @@ endif () #----------------------------------------------------------------------------- # Option to Build Shared and Static libs, default is both #----------------------------------------------------------------------------- -option (ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF) -set (H5_ENABLE_STATIC_LIB YES) -if (ONLY_SHARED_LIBS) - set (H5_ENABLE_STATIC_LIB NO) - set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries") -endif () +option (BUILD_STATIC_LIBS "Build Static Libraries" ON) +set (H5_ENABLE_STATIC_LIB NO) option (BUILD_SHARED_LIBS "Build Shared Libraries" ON) set (H5_ENABLE_SHARED_LIB NO) +option (ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF) + +if (BUILD_STATIC_LIBS) + set (H5_ENABLE_STATIC_LIB YES) +endif () if (BUILD_SHARED_LIBS) set (H5_ENABLE_SHARED_LIB YES) endif () + +# Force only shared libraries if all OFF +if (NOT BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS) + set (ONLY_SHARED_LIBS ON CACHE BOOL "Only Build Shared Libraries" FORCE) +endif () + +if (ONLY_SHARED_LIBS) + set (H5_ENABLE_STATIC_LIB NO) + set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries") +endif () + set (CMAKE_POSITION_INDEPENDENT_CODE ON) #----------------------------------------------------------------------------- @@ -456,18 +471,30 @@ if (BUILD_STATIC_EXECS) endif () endif () +if (HDF5_ENABLE_ANALYZER_TOOLS) + include (${HDF5_SOURCE_DIR}/config/sanitizer/tools.cmake) +endif () +if (HDF5_ENABLE_SANITIZERS) + include (${HDF5_SOURCE_DIR}/config/sanitizer/sanitizers.cmake) +endif () + #----------------------------------------------------------------------------- # Option to use code coverage #----------------------------------------------------------------------------- option (HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF) if (HDF5_ENABLE_COVERAGE) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage -fprofile-arcs -ftest-coverage") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g --coverage -O0 -fprofile-arcs -ftest-coverage") - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage") - link_libraries (gcov) + include (${HDF5_SOURCE_DIR}/config/sanitizer/code-coverage.cmake) + if(CODE_COVERAGE AND CODE_COVERAGE_ADDED) + add_code_coverage() # Adds instrumentation to all targets else () - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage -fprofile-arcs -ftest-coverage") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g --coverage -O0 -fprofile-arcs -ftest-coverage") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage") + link_libraries (gcov) + else () + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") + endif () endif () endif () @@ -845,6 +872,30 @@ if (BUILD_TESTING) include (${HDF5_SOURCE_DIR}/CTestConfig.cmake) configure_file (${HDF_RESOURCES_DIR}/CTestCustom.cmake ${HDF5_BINARY_DIR}/CTestCustom.ctest @ONLY) + option (HDF5_TEST_SERIAL "Execute non-parallel tests" ON) + mark_as_advanced (HDF5_TEST_SERIAL) + + option (HDF5_TEST_TOOLS "Execute tools tests" ON) + mark_as_advanced (HDF5_TEST_TOOLS) + + option (HDF5_TEST_EXAMPLES "Execute tests on examples" ON) + mark_as_advanced (HDF5_TEST_EXAMPLES) + + option (HDF5_TEST_SWMR "Execute SWMR tests" ON) + mark_as_advanced (HDF5_TEST_SWMR) + + option (HDF5_TEST_PARALLEL "Execute parallel tests" ON) + mark_as_advanced (HDF5_TEST_PARALLEL) + + option (HDF5_TEST_FORTRAN "Execute fortran tests" ON) + mark_as_advanced (HDF5_TEST_FORTRAN) + + option (HDF5_TEST_CPP "Execute cpp tests" ON) + mark_as_advanced (HDF5_TEST_CPP) + + option (HDF5_TEST_JAVA "Execute java tests" ON) + mark_as_advanced (HDF5_TEST_JAVA) + if (NOT HDF5_EXTERNALLY_CONFIGURED) if (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") add_subdirectory (test) @@ -132,6 +132,7 @@ ./config/intel-flags ./config/linux-gnu ./config/linux-gnuaout +./config/linux-gnueabihf ./config/linux-gnulibc1 ./config/linux-gnulibc2 ./config/lt_vers.am @@ -748,6 +749,7 @@ ./src/H5Ipublic.h ./src/H5Itest.c ./src/H5L.c +./src/H5Ldeprec.c ./src/H5Lexternal.c ./src/H5Lmodule.h ./src/H5Lpkg.h @@ -936,7 +938,9 @@ ./src/H5VLnative_file.c ./src/H5VLnative_group.c ./src/H5VLnative_link.c +./src/H5VLnative_introspect.c ./src/H5VLnative_object.c +./src/H5VLnative_token.c ./src/H5VLnative_private.h ./src/H5VLpassthru.c ./src/H5VLpassthru.h @@ -1183,6 +1187,7 @@ ./test/ttime.c ./test/trefer.c ./test/trefer_deprec.c +./test/trefer_shutdown.c ./test/trefstr.c ./test/tselect.c ./test/tsizeslheap.h5 @@ -2173,6 +2178,28 @@ ./tools/testfiles/zerodim.ddl ./tools/testfiles/zerodim.h5 +# h5dump new reference validation +./tools/testfiles/trefer_attrR.ddl +./tools/testfiles/trefer_compatR.ddl +./tools/testfiles/trefer_extR.ddl +./tools/testfiles/trefer_grpR.ddl +./tools/testfiles/trefer_obj_delR.ddl +./tools/testfiles/trefer_objR.ddl +./tools/testfiles/trefer_paramR.ddl +./tools/testfiles/trefer_reg_1dR.ddl +./tools/testfiles/trefer_regR.ddl +# h5dump and h5diff new reference files +./tools/testfiles/trefer_attr.h5 +./tools/testfiles/trefer_compat.h5 +./tools/testfiles/trefer_ext1.h5 +./tools/testfiles/trefer_ext2.h5 +./tools/testfiles/trefer_grp.h5 +./tools/testfiles/trefer_obj_del.h5 +./tools/testfiles/trefer_obj.h5 +./tools/testfiles/trefer_param.h5 +./tools/testfiles/trefer_reg_1d.h5 +./tools/testfiles/trefer_reg.h5 + # Expected output from h5ls tests ./tools/testfiles/nosuchfile.ls ./tools/testfiles/help-1.ls @@ -2353,6 +2380,7 @@ ./tools/test/h5diff/testfiles/h5diff_56.txt ./tools/test/h5diff/testfiles/h5diff_57.txt ./tools/test/h5diff/testfiles/h5diff_58.txt +./tools/test/h5diff/testfiles/h5diff_58_ref.txt ./tools/test/h5diff/testfiles/h5diff_59.txt ./tools/test/h5diff/testfiles/h5diff_60.txt ./tools/test/h5diff/testfiles/h5diff_61.txt @@ -2571,6 +2599,8 @@ ./tools/test/h5diff/testfiles/h5diff_v1.txt ./tools/test/h5diff/testfiles/h5diff_v2.txt ./tools/test/h5diff/testfiles/h5diff_v3.txt +#reg_ref +./tools/test/h5diff/testfiles/h5diff_reg.txt #test files for h5repack ./tools/test/h5repack/testfiles/README @@ -3017,10 +3047,10 @@ ./java/src/hdf/hdf5lib/callbacks/H5D_append_t.java ./java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java ./java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java -./java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java ./java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java -./java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java ./java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java +./java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java ./java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java ./java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java ./java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java @@ -3073,6 +3103,8 @@ ./java/src/hdf/hdf5lib/structs/H5L_info_t.java ./java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java ./java/src/hdf/hdf5lib/structs/H5O_info_t.java +./java/src/hdf/hdf5lib/structs/H5O_native_info_t.java +./java/src/hdf/hdf5lib/structs/H5O_token_t.java ./java/src/hdf/hdf5lib/H5.java ./java/src/hdf/hdf5lib/HDF5Constants.java @@ -3472,6 +3504,13 @@ ./config/cmake/scripts/HDF5config.cmake ./config/cmake/scripts/HDF5options.cmake +# CMake-specific Sanitizer Scripts +./config/sanitizer/code-coverage.cmake +./config/sanitizer/sanitizers.cmake +./config/sanitizer/tools.cmake +./config/sanitizer/LICENSE +./config/sanitizer/README.md + # CMake-specific HPC Scripts ./config/cmake/scripts/HPC/sbatch-HDF5options.cmake ./config/cmake/scripts/HPC/bsub-HDF5options.cmake diff --git a/bin/h5cc.in b/bin/h5cc.in index 9c4e3ca..d6b7a12 100644 --- a/bin/h5cc.in +++ b/bin/h5cc.in @@ -121,13 +121,6 @@ usage() { echo " -echo Show all the shell commands executed" echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" echo " subdirectories [default: $prefix]" - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS] <compile line>" - echo " OPTIONS:" - echo " -help This help message." - echo " -echo Show all the shell commands executed" - echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" - echo " subdirectories [default: $prefix]" echo " -show Show the commands without executing them" echo " -showconfig Show the HDF5 library configuration summary" echo " -shlib Compile with shared HDF5 libraries [default for hdf5 built" diff --git a/bin/make_vers b/bin/make_vers index c6d2c04..f40e29a 100755 --- a/bin/make_vers +++ b/bin/make_vers @@ -9,7 +9,7 @@ use warnings; # need to be decremented. - QAK) # Max. library "index" (0 = v1.0, 1 = 1.2, 2 = 1.4, 3 = 1.6, 4 = 1.8, 5 = 1.10, 6 = 1.12, 7 = 1.14, etc) -$max_idx = 7; +$max_idx = 8; # Min. supported previous library version "index" (0 = v1.0, 1 = 1.2, etc) $min_sup_idx = 3; @@ -90,7 +90,8 @@ sub print_checkoptions ($) { my $curr_idx; # Current API version index # Print the option checking - print $fh "\n/* Issue error if contradicting macros have been defined. */\n"; + print $fh "\n\n/* Issue error if contradicting macros have been defined. */\n"; + print $fh "/* (Can't use an older (deprecated) API version if deprecated symbols have been disabled) */\n"; # Print the #ifdef print $fh "#if ("; @@ -119,26 +120,40 @@ sub print_checkoptions ($) { ############################################################################## # Print "global" API version macro settings # -sub print_globalapivers ($) { +sub print_globalapidefvers ($) { my $fh = shift; # File handle for output file my $curr_idx; # Current API version index # Print the descriptive comment - print $fh "\n\n/* If a particular \"global\" version of the library's interfaces is chosen,\n"; - print $fh " * set the versions for the API symbols affected.\n"; + print $fh "\n\n/* If a particular default \"global\" version of the library's interfaces is\n"; + print $fh " * chosen, set the corresponding version macro for API symbols.\n"; print $fh " *\n"; - print $fh " * Note: If an application has already chosen a particular version for an\n"; - print $fh " * API symbol, the individual API version macro takes priority.\n"; print $fh " */\n"; for $curr_idx ($min_sup_idx .. ($max_idx - 1)) { # Print API version ifdef - print $fh "#if defined(H5_USE_1", ($curr_idx * 2), "_API_DEFAULT) && !defined(H5_USE_1", ($curr_idx * 2), "_API)\n"; + print $fh "\n#if defined(H5_USE_1", ($curr_idx * 2), "_API_DEFAULT) && !defined(H5_USE_1", ($curr_idx * 2), "_API)\n"; # Print API version definition print $fh " " x $indent, "#define H5_USE_1", ($curr_idx * 2), "_API 1\n"; # Print API version endif - print $fh "#endif /* H5_USE_1", ($curr_idx * 2), "_API_DEFAULT && !H5_USE_1", ($curr_idx * 2), "_API */\n\n"; + print $fh "#endif /* H5_USE_1", ($curr_idx * 2), "_API_DEFAULT && !H5_USE_1", ($curr_idx * 2), "_API */\n"; } +} + +############################################################################## +# Print "global" API symbol version macro settings +# +sub print_globalapisymbolvers ($) { + my $fh = shift; # File handle for output file + my $curr_idx; # Current API version index + + # Print the descriptive comment + print $fh "\n\n/* If a particular \"global\" version of the library's interfaces is chosen,\n"; + print $fh " * set the versions for the API symbols affected.\n"; + print $fh " *\n"; + print $fh " * Note: If an application has already chosen a particular version for an\n"; + print $fh " * API symbol, the individual API version macro takes priority.\n"; + print $fh " */\n"; # Loop over supported older library APIs and define the appropriate macros for $curr_idx ($min_sup_idx .. ($max_idx - 1)) { @@ -339,7 +354,18 @@ sub parse_line ($) { my $vers_idx; # Index of version in array # Do some validation on the input - if(!( $_ =~ /v1[02468]/ || $_ =~ /v11[02468]/ )) { + # Note: v111 is allowed because H5O functions were prematurely versioned + # in HDF5 1.10. Because users were affected by this, the versioning + # was rescinded but the H5O version 2 functions were kept to be + # called directly. Now that the version macros are added in 1.12, + # along with a 3rd version of the H5O functions, the H5O function + # version for default api=v110 should be version 1 to work correctly + # with 1.10 applications that were using unversioned H5O functions, + # and the H5O function version should be version 3 for default api=v112 + # (the default api version for 1.12). Allowing a v111 entry and + # incrementing its index 13 lines below allows a version 2 that is + # never accessed via the H5O function macros. + if(!( $_ =~ /v1[02468]/ || $_ =~ /v11[02468]/ || $_ =~ /v111/ )) { die "bad version information: $name"; } if(exists($sym_versions{$_})) { @@ -352,6 +378,9 @@ sub parse_line ($) { #print "parse_line: _=$_\n"; # Get the index of the version ($vers_idx) = ($_ =~ /v1(\d+)/); + if($vers_idx == 11) { + $vers_idx++; + } $vers_idx /= 2; #print "parse_line: vers_idx='$vers_idx'\n"; push(@vers_nums, $vers_idx); @@ -444,8 +473,9 @@ sub create_public ($) { print_copyright(*HEADER); print_warning(*HEADER); print_startprotect(*HEADER, $file); + print_globalapidefvers(*HEADER); print_checkoptions(*HEADER); - print_globalapivers(*HEADER); + print_globalapisymbolvers(*HEADER); print_defaultapivers(*HEADER); print_endprotect(*HEADER, $file); @@ -71,6 +71,7 @@ $Source = ""; "uint32_t" => "Iu", "uint64_t" => "UL", "H5I_type_t" => "It", + "H5O_token_t" => "k", "H5G_link_t" => "Ll", #Same as H5L_type_t now "H5L_type_t" => "Ll", "MPI_Comm" => "Mc", @@ -100,24 +101,35 @@ $Source = ""; "H5T_str_t" => "Tz", "unsigned long" => "Ul", "unsigned long long" => "UL", + "H5VL_subclass_t" => "VS", + "H5VL_get_conn_lvl_t" => "VL", "H5VL_attr_get_t" => "Va", + "H5VL_attr_optional_t" => "Vs", "H5VL_attr_specific_t" => "Vb", "H5VL_blob_specific_t" => "VB", "H5VL_class_value_t" => "VC", "H5VL_dataset_get_t" => "Vc", "H5VL_dataset_specific_t" => "Vd", + "H5VL_dataset_optional_t" => "Vt", "H5VL_datatype_get_t" => "Ve", "H5VL_datatype_specific_t" => "Vf", + "H5VL_datatype_optional_t" => "Vu", "H5VL_file_get_t" => "Vg", "H5VL_file_specific_t" => "Vh", + "H5VL_file_optional_t" => "Vv", "H5VL_group_get_t" => "Vi", "H5VL_group_specific_t" => "Vj", + "H5VL_group_optional_t" => "Vw", "H5VL_link_create_type_t" => "Vk", "H5VL_link_get_t" => "Vl", "H5VL_link_specific_t" => "Vm", + "H5VL_link_optional_t" => "Vx", "H5VL_object_get_t" => "Vn", "H5VL_object_specific_t" => "Vo", + "H5VL_object_optional_t" => "Vy", "H5VL_request_specific_t" => "Vr", + "H5VL_request_optional_t" => "Vz", + "H5VL_blob_optional_t" => "VA", "void" => "x", "FILE" => "x", "H5A_operator_t" => "x", @@ -153,12 +165,18 @@ $Source = ""; "H5I_search_func_t" => "x", "H5L_class_t" => "x", "H5L_elink_traverse_t" => "x", - "H5L_iterate_t" => "x", + "H5L_info1_t" => "x", + "H5L_info2_t" => "x", + "H5L_iterate1_t" => "x", + "H5L_iterate2_t" => "x", "H5M_iterate_t" => 'x', "H5MM_allocate_t" => "x", "H5MM_free_t" => "x", - "H5O_info_t" => "x", - "H5O_iterate_t" => "x", + "H5O_info1_t" => "x", + "H5O_info2_t" => "x", + "H5O_native_info_t" => "x", + "H5O_iterate1_t" => "x", + "H5O_iterate2_t" => "x", "H5O_mcdt_search_cb_t" => "x", "H5P_cls_create_func_t" => "x", "H5P_cls_copy_func_t" => "x", @@ -221,6 +239,7 @@ sub argstring ($$$) { # certain type qualifiers, and indirection. $atype =~ s/^\bconst\b//; $atype =~ s/\bH5_ATTR_UNUSED\b//g; + $atype =~ s/\bH5_ATTR_NDEBUG_UNUSED\b//g; $atype =~ s/\s+/ /g; $ptr = length $1 if $atype =~ s/(\*+)//; $atype =~ s/^\s+//; diff --git a/bin/warnhist b/bin/warnhist index 7e56246..a88474b 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -1,5 +1,6 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl require 5.003; +use warnings; # # Copyright by The HDF Group. @@ -205,8 +206,13 @@ while (<>) { ($last_c_name, $toss) = split /\:/, $_; } + # Retain C/C++ compile line, which comes with the line of warning + if($_ =~ /.*[A-Za-z0-9_]\.[chC]\(.*[0-9]\):.*#.*/) { + $last_c_name = $_; + } + # Skip lines that don't have the word "warning" - next if $_ !~ /[Ww]arning:/; + next if $_ !~ /[Ww]arning/; # Skip warnings from linker next if $_ =~ /ld: warning:/; @@ -256,11 +262,16 @@ while (<>) { } elsif($_ =~ /^\".*, line [0-9]+: *[Ww]arning:.*/) { ($name, $toss, $warning, $extra, $extra2) = split /\:/, $_; ($name, $line) = split /\,/, $name; - $name =~ s/^\"//g; - $name =~ s/\"$//g; - $line =~ s/^\s*line\s*//g; + $name =~ s/^\"//g; + $name =~ s/\"$//g; + $line =~ s/^\s*line\s*//g; # print "name:'", $name, "'-'", $line, "'\n"; # print "warning:'", $warning, "'\n"; + # Check for Intel icc warning + } elsif($_ =~ /.*[A-Za-z0-9_]\.[chC]\(.*[0-9]\):.*#.*/) { + ($last_c_name, $toss, $warning) = split /\:/, $last_c_name; + ($name, $line) = split /\(/, $last_c_name; + $line =~ s/\)//g; } else { # Check for 'character offset' field appended to file & line # # (This is probably specific to GCC) @@ -330,6 +341,7 @@ while (<>) { # Convert all quotes to ' $warning =~ s/‘/'/g; $warning =~ s/’/'/g; + $warning =~ s/"/'/g; # # These skipped messages & "genericizations" may be specific to GCC diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index 58d85c1..89d62f1 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -68,6 +68,6 @@ foreach (example ${tutr_examples}) set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_CPP AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp index fab54cd..271c538 100644 --- a/c++/examples/h5group.cpp +++ b/c++/examples/h5group.cpp @@ -36,7 +36,7 @@ const H5std_string FILE_NAME( "Group.h5" ); const int RANK = 2; // Operator function -extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, +extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata); int main(void) @@ -157,7 +157,7 @@ int main(void) * root directory. */ cout << endl << "Iterating over elements in the file" << endl; - herr_t idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + herr_t idx = H5Literate2(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); cout << endl; /* @@ -175,7 +175,7 @@ int main(void) cout << "\"Data\" is unlinked" << endl; cout << endl << "Iterating over elements in the file again" << endl; - idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + idx = H5Literate2(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); cout << endl; /* @@ -219,7 +219,7 @@ int main(void) * Operator function. */ herr_t -file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) +file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata) { hid_t group; diff --git a/c++/src/C2Cppfunction_map.htm b/c++/src/C2Cppfunction_map.htm index 2d779a3..a9e0a27 100644 --- a/c++/src/C2Cppfunction_map.htm +++ b/c++/src/C2Cppfunction_map.htm @@ -11493,7 +11493,7 @@ normal'><span style='font-size:14.0pt;mso-bidi-font-size:11.0pt;line-height: mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt; mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'> <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: - normal'>H5L_info_t getLinkInfo(const char* link_name,</p> + normal'>H5L_info2_t getLinkInfo(const char* link_name,</p> <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal'><span style='mso-tab-count:1'> </span>const LinkAccPropList& lapl = LinkAccPropList::DEFAULT)</p> @@ -11526,7 +11526,7 @@ normal'><span style='font-size:14.0pt;mso-bidi-font-size:11.0pt;line-height: mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt; mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'> <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: - normal'>H5L_info_t getLinkInfo(const H5std_string& link_name,</p> + normal'>H5L_info2_t getLinkInfo(const H5std_string& link_name,</p> <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal'><span style='mso-tab-count:1'> </span>const LinkAccPropList& lapl = LinkAccPropList::DEFAULT)</p> diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 2641960..764aa12 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -1404,6 +1404,121 @@ void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) c } //-------------------------------------------------------------------------- +// Function: H5Location::getNativeObjinfo +///\brief Retrieves native information about an HDF5 object. +///\param objinfo - OUT: Struct containing the native object info +///\param fields - IN: Indicates the group of information to be retrieved +///\par Description +/// Valid values of \a fields are as follows: +/// \li \c H5O_INFO_HDR (default) +/// \li \c H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getNativeObjinfo(H5O_native_info_t& objinfo, unsigned fields) const +{ + + // Use C API to get information of the object + herr_t ret_value = H5Oget_native_info(getId(), &objinfo, fields); + + // Throw exception if C API returns failure + if (ret_value < 0) + throwException(inMemFunc("getNativeObjinfo"), "H5Oget_native_info failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getNativeObjinfo +///\brief Retrieves native information about an HDF5 object given its name. +///\param name - IN: Name of the object to be queried - \c char * +///\param objinfo - OUT: Struct containing the native object info +///\param fields - IN: Indicates the group of information to be retrieved +/// - default to H5O_INFO_HDR +///\param lapl - IN: Link access property list +///\par Description +/// Valid values of \a fields are as follows: +/// \li \c H5O_INFO_HDR (default) +/// \li \c H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getNativeObjinfo(const char* name, H5O_native_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const +{ + // Use C API to get information of the object + herr_t ret_value = H5Oget_native_info_by_name(getId(), name, &objinfo, fields, lapl.getId()); + + // Throw exception if C API returns failure + if (ret_value < 0) + throwException(inMemFunc("getNativeObjinfo"), "H5Oget_native_info_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getNativeObjinfo +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +///\param name - IN: Name of the object to be queried - \c H5std_string +///\param objinfo - OUT: Struct containing the native object info +///\param fields - IN: Indicates the group of information to be retrieved +/// - default to H5O_INFO_HDR +///\param lapl - IN: Link access property list +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getNativeObjinfo(const H5std_string& name, H5O_native_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const +{ + getNativeObjinfo(name.c_str(), objinfo, fields, lapl); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getNativeObjinfo +///\brief Retrieves native information about an HDF5 object given its index. +///\param grp_name - IN: Group name where the object belongs - \c char * +///\param idx_type - IN: Type of index +///\param order - IN: Order to traverse +///\param idx - IN: Object position +///\param objinfo - OUT: Struct containing the native object info +///\param fields - IN: Indicates the group of information to be retrieved +/// - default to H5O_INFO_HDR +///\param lapl - IN: Link access property list +///\par Description +/// Valid values of \a fields are as follows: +/// \li \c H5O_INFO_HDR (default) +/// \li \c H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getNativeObjinfo(const char* grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, unsigned fields, + const LinkAccPropList& lapl) const +{ + // Use C API to get information of the object + herr_t ret_value = H5Oget_native_info_by_idx(getId(), grp_name, idx_type, order, + idx, &objinfo, fields, lapl.getId()); + + // Throw exception if C API returns failure + if (ret_value < 0) + throwException(inMemFunc("getNativeObjinfo"), "H5Oget_native_info_by_idx failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getObjinfo +///\brief This is an overloaded member function, provided for convenience. +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +///\param name - IN: Name of the object to be queried - \c H5std_string +///\param objinfo - OUT: Struct containing the native object info +///\param fields - IN: Indicates a group of information to be retrieved +/// - default to H5O_INFO_HDR +///\param lapl - IN: Link access property list +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getNativeObjinfo(const H5std_string& grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, unsigned fields, + const LinkAccPropList& lapl) const +{ + getNativeObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl); +} + +//-------------------------------------------------------------------------- // Function: H5Location::getObjinfo ///\brief Retrieves information about an HDF5 object. ///\param objinfo - OUT: Struct containing the object info @@ -1418,15 +1533,15 @@ void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) c /// \li \c H5O_INFO_ALL // July, 2018 //-------------------------------------------------------------------------- -void H5Location::getObjinfo(H5O_info_t& objinfo, unsigned fields) const +void H5Location::getObjinfo(H5O_info2_t& objinfo, unsigned fields) const { // Use C API to get information of the object - herr_t ret_value = H5Oget_info2(getId(), &objinfo, fields); + herr_t ret_value = H5Oget_info3(getId(), &objinfo, fields); // Throw exception if C API returns failure if (ret_value < 0) - throwException(inMemFunc("getObjinfo"), "H5Oget_info2 failed"); + throwException(inMemFunc("getObjinfo"), "H5Oget_info3 failed"); } //-------------------------------------------------------------------------- @@ -1447,10 +1562,10 @@ void H5Location::getObjinfo(H5O_info_t& objinfo, unsigned fields) const /// \li \c H5O_INFO_ALL // July, 2018 //-------------------------------------------------------------------------- -void H5Location::getObjinfo(const char* name, H5O_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const +void H5Location::getObjinfo(const char* name, H5O_info2_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const { // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_name2(getId(), name, &objinfo, fields, lapl.getId()); + herr_t ret_value = H5Oget_info_by_name3(getId(), name, &objinfo, fields, lapl.getId()); // Throw exception if C API returns failure if (ret_value < 0) @@ -1469,7 +1584,7 @@ void H5Location::getObjinfo(const char* name, H5O_info_t& objinfo, unsigned fiel ///\param lapl - IN: Link access property list // July, 2018 //-------------------------------------------------------------------------- -void H5Location::getObjinfo(const H5std_string& name, H5O_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const +void H5Location::getObjinfo(const H5std_string& name, H5O_info2_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const { getObjinfo(name.c_str(), objinfo, fields, lapl); } @@ -1496,11 +1611,11 @@ void H5Location::getObjinfo(const H5std_string& name, H5O_info_t& objinfo, unsig // July, 2018 //-------------------------------------------------------------------------- void H5Location::getObjinfo(const char* grp_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo, unsigned fields, + H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const { // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_idx2(getId(), grp_name, idx_type, order, + herr_t ret_value = H5Oget_info_by_idx3(getId(), grp_name, idx_type, order, idx, &objinfo, fields, lapl.getId()); // Throw exception if C API returns failure @@ -1521,7 +1636,7 @@ void H5Location::getObjinfo(const char* grp_name, H5_index_t idx_type, // July, 2018 //-------------------------------------------------------------------------- void H5Location::getObjinfo(const H5std_string& grp_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo, unsigned fields, + H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const { getObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl); @@ -1596,11 +1711,11 @@ void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const ///\exception H5::FileIException/H5::GroupIException/H5::LocationException // 2000 //-------------------------------------------------------------------------- -H5L_info_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& lapl) const +H5L_info2_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& lapl) const { - H5L_info_t linkinfo; // link info structure + H5L_info2_t linkinfo; // link info structure - herr_t ret_value = H5Lget_info(getId(), link_name, &linkinfo, lapl.getId()); + herr_t ret_value = H5Lget_info2(getId(), link_name, &linkinfo, lapl.getId()); if (ret_value < 0) throwException("getLinkInfo", "H5Lget_info to find buffer size failed"); @@ -1613,7 +1728,7 @@ H5L_info_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& /// It differs from the above function in that it takes an /// \c H5std_string for \a link_name. //-------------------------------------------------------------------------- -H5L_info_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl) const +H5L_info2_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl) const { return(getLinkInfo(link_name.c_str(), lapl)); } @@ -1629,7 +1744,7 @@ H5L_info_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccP //-------------------------------------------------------------------------- H5std_string H5Location::getLinkval(const char* name, size_t size) const { - H5L_info_t linkinfo; + H5L_info2_t linkinfo; char *value_C; // value in C string size_t val_size = size; H5std_string value = ""; @@ -1638,7 +1753,7 @@ H5std_string H5Location::getLinkval(const char* name, size_t size) const // if user doesn't provide buffer size, determine it if (size == 0) { - ret_value = H5Lget_info(getId(), name, &linkinfo, H5P_DEFAULT); + ret_value = H5Lget_info2(getId(), name, &linkinfo, H5P_DEFAULT); if (ret_value < 0) throwException("getLinkval", "H5Lget_info to find buffer size failed"); @@ -1941,11 +2056,11 @@ ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size //-------------------------------------------------------------------------- H5O_type_t H5Location::childObjType(const char* objname) const { - H5O_info_t objinfo; + H5O_info2_t objinfo; H5O_type_t objtype = H5O_TYPE_UNKNOWN; // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_name2(getId(), objname, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); + herr_t ret_value = H5Oget_info_by_name3(getId(), objname, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) @@ -2016,11 +2131,11 @@ H5O_type_t H5Location::childObjType(const H5std_string& objname) const H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, const char* objname) const { herr_t ret_value; - H5O_info_t objinfo; + H5O_info2_t objinfo; H5O_type_t objtype = H5O_TYPE_UNKNOWN; // Use C API to get information of the object - ret_value = H5Oget_info_by_idx2(getId(), objname, index_type, order, index, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret_value = H5Oget_info_by_idx3(getId(), objname, index_type, order, index, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) @@ -2058,11 +2173,11 @@ H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_ite //-------------------------------------------------------------------------- unsigned H5Location::childObjVersion(const char* objname) const { - H5O_info_t objinfo; + H5O_native_info_t objinfo; unsigned version = 0; // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_name2(getId(), objname, &objinfo, H5O_INFO_HDR, H5P_DEFAULT); + herr_t ret_value = H5Oget_native_info_by_name(getId(), objname, &objinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index dc3db75..3bad8bc 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -118,8 +118,8 @@ class H5_DLLCPP H5Location : public IdComponent { DataSet openDataSet(const char* name, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT) const; DataSet openDataSet(const H5std_string& name, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT) const; - H5L_info_t getLinkInfo(const char* link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; - H5L_info_t getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + H5L_info2_t getLinkInfo(const char* link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + H5L_info2_t getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; // Returns the value of a symbolic link. H5std_string getLinkval(const char* link_name, size_t size=0) const; @@ -147,26 +147,47 @@ class H5_DLLCPP H5Location : public IdComponent { unsigned childObjVersion(const H5std_string& objname) const; // Retrieves information about an HDF5 object. - void getObjinfo(H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC) const; + void getObjinfo(H5O_info2_t& objinfo, unsigned fields = H5O_INFO_BASIC) const; // Retrieves information about an HDF5 object, given its name. - void getObjinfo(const char* name, H5O_info_t& objinfo, + void getObjinfo(const char* name, H5O_info2_t& objinfo, unsigned fields = H5O_INFO_BASIC, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; - void getObjinfo(const H5std_string& name, H5O_info_t& objinfo, + void getObjinfo(const H5std_string& name, H5O_info2_t& objinfo, unsigned fields = H5O_INFO_BASIC, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; // Retrieves information about an HDF5 object, given its index. void getObjinfo(const char* grp_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo, + H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo, unsigned fields = H5O_INFO_BASIC, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; void getObjinfo(const H5std_string& grp_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo, + H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo, unsigned fields = H5O_INFO_BASIC, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + // Retrieves native native information about an HDF5 object. + void getNativeObjinfo(H5O_native_info_t& objinfo, unsigned fields = H5O_NATIVE_INFO_HDR) const; + + // Retrieves native information about an HDF5 object, given its name. + void getNativeObjinfo(const char* name, H5O_native_info_t& objinfo, + unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + void getNativeObjinfo(const H5std_string& name, H5O_native_info_t& objinfo, + unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + + // Retrieves native information about an HDF5 object, given its index. + void getNativeObjinfo(const char* grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, + unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + void getNativeObjinfo(const H5std_string& grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, + unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + #ifndef H5_NO_DEPRECATED_SYMBOLS // Returns the type of an object in this group, given the // object's index. diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 8d3334b..081cab7 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -52,9 +52,9 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, } // userVisitOpWrpr interfaces between the user's function and the -// C library function H5Ovisit2 +// C library function H5Ovisit3 extern "C" herr_t userVisitOpWrpr(hid_t obj_id, const char *attr_name, - const H5O_info_t *obj_info, void *op_data) + const H5O_info2_t *obj_info, void *op_data) { H5std_string s_attr_name = H5std_string(attr_name); UserData4Visit* myData = reinterpret_cast<UserData4Visit *> (op_data); @@ -250,13 +250,11 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat ///\param *op_data - IN: User-defined pointer to data required by the /// application for its processing of the object ///\param fields - IN: Flags specifying the fields to be retrieved -/// to the callback op via the H5O_info_t argument. +/// to the callback op via the H5O_info2_t argument. /// \li \c H5O_INFO_BASIC fileno, addr, type, and rc fields /// \li \c H5O_INFO_TIME atime, mtime, ctime, and btime fields /// \li \c H5O_INFO_NUM_ATTRS num_attrs field -/// \li \c H5O_INFO_HDR hdr field -/// \li \c H5O_INFO_META_SIZE meta_size field -/// \li \c H5O_INFO_ALL H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS ///\return /// \li On success: /// \li the return value of the first operator that returns a positive value @@ -266,7 +264,7 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat /// wrong within the library or the operator failed ///\exception H5::Exception ///\par Description -/// For information, please refer to the H5Ovisit2 API in the HDF5 +/// For information, please refer to the H5Ovisit3 API in the HDF5 /// C Reference Manual. // Programmer Binh-Minh Ribler - Feb, 2019 //-------------------------------------------------------------------------- @@ -279,15 +277,15 @@ void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_ userData->obj = this; // Call the C API passing in op wrapper and info - herr_t ret_value = H5Ovisit2(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields); + herr_t ret_value = H5Ovisit3(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields); // Release memory delete userData; - // Throw exception if H5Ovisit2 failed, which could be a failure in + // Throw exception if H5Ovisit3 failed, which could be a failure in // the library or in the call back operator if (ret_value < 0) - throw Exception(inMemFunc("visit"), "H5Ovisit2 failed"); + throw Exception(inMemFunc("visit"), "H5Ovisit3 failed"); } //-------------------------------------------------------------------------- @@ -304,15 +302,15 @@ void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_ //-------------------------------------------------------------------------- unsigned H5Object::objVersion() const { - H5O_info_t objinfo; + H5O_native_info_t objinfo; unsigned version = 0; // Use C API to get information of the object - herr_t ret_value = H5Oget_info2(getId(), &objinfo, H5O_INFO_HDR); + herr_t ret_value = H5Oget_native_info(getId(), &objinfo, H5O_NATIVE_INFO_HDR); // Throw exception if C API returns failure if (ret_value < 0) - throw Exception(inMemFunc("objVersion"), "H5Oget_info failed"); + throw Exception(inMemFunc("objVersion"), "H5Oget_native_info failed"); // Return a valid version or throw an exception for invalid value else { @@ -332,9 +330,9 @@ unsigned H5Object::objVersion() const //-------------------------------------------------------------------------- int H5Object::getNumAttrs() const { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ - if(H5Oget_info2(getId(), &oinfo, H5O_INFO_NUM_ATTRS) < 0) + if(H5Oget_info3(getId(), &oinfo, H5O_INFO_NUM_ATTRS) < 0) throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); else return(static_cast<int>(oinfo.num_attrs)); diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 4a4e909..033b1b7 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -44,10 +44,10 @@ typedef void (*attr_operator_t)(H5Object& loc, const H5std_string attr_name, void *operator_data); -// Define the operator function pointer for H5Ovisit2(). +// Define the operator function pointer for H5Ovisit3(). typedef int (*visit_operator_t)(H5Object& obj, const H5std_string attr_name, - const H5O_info_t *oinfo, + const H5O_info2_t *oinfo, void *operator_data); // User data for attribute iteration diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 75efc3b..5e7134d 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -56,4 +56,6 @@ else () endif () set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp) -include (CMakeTests.cmake) +if (HDF5_TEST_CPP AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 14f1bd4..fc29307 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1116,9 +1116,9 @@ static herr_t test_types(H5File& file) /*------------------------------------------------------------------------- - * Function: test_getObjinfo + * Function: test_getNativeObjinfo * - * Purpose Tests getObjinfo() + * Purpose Tests getNativeObjinfo() * * Return Success: 0 * Failure: -1 @@ -1126,7 +1126,7 @@ static herr_t test_types(H5File& file) * July, 2018 *------------------------------------------------------------------------- */ -static herr_t test_getinfo(H5File& file) +static herr_t test_getnativeinfo(H5File& file) { SUBTEST("Getting object information"); @@ -1142,18 +1142,18 @@ static herr_t test_getinfo(H5File& file) DataSet dataset(file.openDataSet(DSET_CHUNKED_NAME)); // Get dataset header info - H5O_info_t oinfo; - HDmemset(&oinfo, 0, sizeof(oinfo)); - dataset.getObjinfo(oinfo, H5O_INFO_HDR); - verify_val(oinfo.hdr.nchunks, 1, "DataSet::getObjinfo", __LINE__, __FILE__); + H5O_native_info_t ninfo; + HDmemset(&ninfo, 0, sizeof(ninfo)); + dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR); + verify_val(ninfo.hdr.nchunks, 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__); dataset.close(); // Open the dataset we created above and then close it. This is one // way to open an existing dataset for accessing. dataset = file.openDataSet(DSET_DEFAULT_NAME); - HDmemset(&oinfo, 0, sizeof(oinfo)); - dataset.getObjinfo(oinfo, H5O_INFO_ALL); - verify_val(oinfo.hdr.nchunks, 1, "DataSet::getObjinfo", __LINE__, __FILE__); + HDmemset(&ninfo, 0, sizeof(ninfo)); + dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_ALL); + verify_val(ninfo.hdr.nchunks, 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__); dataset.close(); PASSED(); @@ -1169,10 +1169,10 @@ static herr_t test_getinfo(H5File& file) // catch all other exceptions catch (Exception& E) { - issue_fail_msg("test_getinfo", __LINE__, __FILE__); + issue_fail_msg("test_getnativeinfo", __LINE__, __FILE__); return -1; } -} // test_getinfo +} // test_getnativeinfo /*------------------------------------------------------------------------- @@ -1408,7 +1408,7 @@ void test_dset() nerrors += test_create(file) < 0 ? 1:0; nerrors += test_simple_io(file) < 0 ? 1:0; - nerrors += test_getinfo(file) < 0 ? 1:0; + nerrors += test_getnativeinfo(file) < 0 ? 1:0; nerrors += test_tconv(file) < 0 ? 1:0; nerrors += test_compression(file) < 0 ? 1:0; nerrors += test_nbit_compression(file) < 0 ? 1:0; diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 4734755..9485ec6 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -519,7 +519,7 @@ static void test_attr_basic_read() verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); // Verify the correct number of attributes another way - H5O_info_t oinfo; + H5O_info2_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); verify_val(oinfo.num_attrs, 3, "DataSet::getObjinfo", __LINE__, __FILE__); @@ -670,7 +670,7 @@ static void test_attr_compound_read() verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__); // Verify the correct number of attributes another way - H5O_info_t oinfo; + H5O_info2_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); verify_val(oinfo.num_attrs, 1, "DataSet::getObjinfo", __LINE__, __FILE__); diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 055cf23..a0231a6 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -716,10 +716,10 @@ static void test_libver_bounds_real( verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__); // Verify object header version another way - H5O_info_t oinfo; - HDmemset(&oinfo, 0, sizeof(oinfo)); - file.getObjinfo(oinfo, H5O_INFO_HDR); - verify_val(oinfo.hdr.version, oh_vers_create, "H5File::getObjinfo", __LINE__, __FILE__); + H5O_native_info_t ninfo; + HDmemset(&ninfo, 0, sizeof(ninfo)); + file.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR); + verify_val(ninfo.hdr.version, oh_vers_create, "H5File::getNativeObjinfo", __LINE__, __FILE__); /* * Reopen the file and make sure the root group still has the correct @@ -744,9 +744,9 @@ static void test_libver_bounds_real( verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__); // Verify object header version another way - HDmemset(&oinfo, 0, sizeof(oinfo)); - group.getObjinfo(oinfo, H5O_INFO_HDR); - verify_val(oinfo.hdr.version, oh_vers_mod, "Group::getObjinfo", __LINE__, __FILE__); + HDmemset(&ninfo, 0, sizeof(ninfo)); + group.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR); + verify_val(ninfo.hdr.version, oh_vers_mod, "Group::getNativeObjinfo", __LINE__, __FILE__); group.close(); // close "/G1" diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index e77ebcc..c689087 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -96,7 +96,7 @@ int iter_strcmp(const void *s1, const void *s2) * Purpose Custom link iteration callback routine *------------------------------------------------------------------------- */ -static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data) +static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data) { iter_info *info = (iter_info *)op_data; static int count = 0; @@ -158,7 +158,7 @@ static void test_iter_group(FileAccPropList& fapl) /* Test iterating over empty group */ info.command = RET_ZERO; idx = 0; - ret = H5Literate(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); verify_val(ret, SUCCEED, "H5Literate", __LINE__, __FILE__); DataType datatype(PredType::NATIVE_INT); @@ -207,7 +207,7 @@ static void test_iter_group(FileAccPropList& fapl) H5std_string obj_name; for (i = 0; i < nobjs; i++) { - //H5O_info_t oinfo; /* Object info */ + //H5O_info2_t oinfo; /* Object info */ obj_name = root_group.getObjnameByIdx(i); //ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); @@ -287,7 +287,7 @@ static void test_iter_group(FileAccPropList& fapl) /* Test all objects in group, when callback always returns 0 */ info.command = RET_ZERO; idx = 0; - if((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) + if((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) TestErrPrintf("Group iteration function didn't return zero correctly!\n"); /* Test all objects in group, when callback always returns 1 */ @@ -295,7 +295,7 @@ static void test_iter_group(FileAccPropList& fapl) info.command = RET_TWO; i = 0; idx = 0; - while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { + while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ verify_val(ret, 2, "H5Literate", __LINE__, __FILE__); @@ -321,7 +321,7 @@ static void test_iter_group(FileAccPropList& fapl) info.command = new_format ? RET_CHANGE2 : RET_CHANGE; i = 0; idx = 0; - while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { + while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { /* Verify return value from iterator gets propagated correctly */ verify_val(ret, 1, "H5Literate", __LINE__, __FILE__); diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 491cd6a..1bdd442 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -190,7 +190,7 @@ const H5std_string GROUP2NAME("Second_group"); static void test_lcpl(hid_t fapl_id, hbool_t new_format) { - H5L_info_t linfo; + H5L_info2_t linfo; char filename[1024]; hsize_t dims[2]; @@ -604,7 +604,7 @@ const int RANK = 2; const int DIM1 = 2; // Operator function -static int visit_obj_cb(H5Object& obj, const H5std_string name, const H5O_info_t *oinfo, void *_op_data) +static int visit_obj_cb(H5Object& obj, const H5std_string name, const H5O_info2_t *oinfo, void *_op_data) { ovisit_ud_t *op_data = static_cast <ovisit_ud_t *>(_op_data); diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 232ece2..fd0f5ce 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -542,7 +542,7 @@ const H5std_string GROUP1NAME("group1"); const H5std_string GROUP2NAME("group2"); static void test_getobjectinfo_same_file() { - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info2_t oinfo1, oinfo2; /* Object info structs */ // Output message about test being performed SUBTEST("Group::getObjinfo"); diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 562b127..8a6fb51 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -482,7 +482,7 @@ static void test_reference_group() verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); // Check object type using Group::getObjinfo() - H5O_info_t oinfo; + H5O_info2_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, oinfo); verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getObjinfo",__LINE__,__FILE__); diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index f49b674..c803384 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -200,7 +200,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # Append more extra warning flags that only gcc 7.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict") + set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wimplicit-fallthrough=5 -Wrestrict") endif () # Append more extra warning flags that only gcc 8.x+ know about diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index e736b7a..0315536 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -75,16 +75,19 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - if (TEST_MASK_FILE) - STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") - endif () + list(LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (TEST_MASK_FILE) + STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") + endif () - if (NOT ERROR_APPEND) - # write back to original .err file - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - else () - # append error output to the stdout output file - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + if (NOT ERROR_APPEND) + # write back to original .err file + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + else () + # append error output to the stdout output file + file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () endif () endif () @@ -122,146 +125,172 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # compare output files to references unless this must be skipped +set (TEST_COMPARE_RESULT 0) if (NOT TEST_SKIP_COMPARE) if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") - if (WIN32 OR MINGW) - configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) - file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) - #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif () + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + list(LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (WIN32 OR MINGW) + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}.tmp") + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + endif () + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + endif () - if (NOT TEST_SORT_COMPARE) - # now compare the output with the reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) - else () - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) - list (SORT v1) - list (SORT v2) - if (NOT v1 STREQUAL v2) - set(TEST_RESULT 1) + if (NOT TEST_SORT_COMPARE) + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_COMPARE_RESULT + ) + else () + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) + list (SORT v1) + list (SORT v2) + if (NOT v1 STREQUAL v2) + set(TEST_COMPARE_RESULT 1) + endif () endif () - endif () - if (TEST_RESULT) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - list (LENGTH test_ref len_ref) - if (len_act GREATER 0 AND len_ref GREATER 0) - math (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT str_act STREQUAL str_ref) - if (str_act) - set (TEST_RESULT 1) - message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + if (TEST_COMPARE_RESULT) + set (TEST_COMPARE_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (len_act GREATER 0 AND len_ref GREATER 0) + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT str_act STREQUAL str_ref) + if (str_act) + set (TEST_COMPARE_RESULT 1) + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () endif () + endforeach () + else () + if (len_act EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") + endif () + if (len_ref EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () - endforeach () - else () - if (len_act EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if (len_ref EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") + if (NOT len_act EQUAL len_ref) + set (TEST_COMPARE_RESULT 1) endif () endif () - if (NOT len_act EQUAL len_ref) - set (TEST_RESULT 1) - endif () endif () - message (STATUS "COMPARE Result: ${TEST_RESULT}") + message (STATUS "COMPARE Result: ${TEST_COMPARE_RESULT}") # again, if return value is !=0 scream and shout - if (TEST_RESULT) + if (TEST_COMPARE_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif () endif () # now compare the .err file with the error reference, if supplied + set (TEST_ERRREF_RESULT 0) if (TEST_ERRREF) - if (WIN32 OR MINGW) - configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF) - file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF}) - #file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) - #file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") - endif () + file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + list(LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (WIN32 OR MINGW) + configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF) + if (EXISTS "${TEST_FOLDER}/${TEST_ERRREF}.tmp") + file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF}) + endif () + #file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") + endif () - # now compare the error output with the error reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} - RESULT_VARIABLE TEST_RESULT - ) - if (TEST_RESULT) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) - list (LENGTH test_ref len_ref) - math (EXPR _FP_LEN "${len_ref} - 1") - if (len_act GREATER 0 AND len_ref GREATER 0) + # now compare the error output with the error reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} + RESULT_VARIABLE TEST_ERRREF_RESULT + ) + if (TEST_ERRREF_RESULT) + set (TEST_ERRREF_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) + list (LENGTH test_ref len_ref) math (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT str_act STREQUAL str_ref) - if (str_act) - set (TEST_RESULT 1) - message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + if (len_act GREATER 0 AND len_ref GREATER 0) + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT str_act STREQUAL str_ref) + if (str_act) + set (TEST_ERRREF_RESULT 1) + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () endif () + endforeach () + else () + if (len_act EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") + endif () + if (len_ref EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") endif () - endforeach () - else () - if (len_act EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") endif () - if (len_ref EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") + if (NOT len_act EQUAL len_ref) + set (TEST_ERRREF_RESULT 1) endif () endif () - if (NOT len_act EQUAL len_ref) - set (TEST_RESULT 1) - endif () endif () - message (STATUS "COMPARE Result: ${TEST_RESULT}") + message (STATUS "COMPARE Result: ${TEST_ERRREF_RESULT}") # again, if return value is !=0 scream and shout - if (TEST_RESULT) + if (TEST_ERRREF_RESULT) message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") endif () endif () endif () +set (TEST_GREP_RESULT 0) if (TEST_GREP_COMPARE) # now grep the output with the reference file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + list(LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + # TEST_REFERENCE should always be matched + string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_GREP_RESULT) + if (NOT TEST_GREP_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") + endif () - # TEST_REFERENCE should always be matched - string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) - string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) - if (NOT TEST_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") - endif () - - string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) - if (TEST_EXPECT) - # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match - string (LENGTH "${TEST_MATCH}" TEST_RESULT) - if (TEST_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) + if (TEST_EXPECT) + # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match + string (LENGTH "${TEST_MATCH}" TEST_GREP_RESULT) + if (TEST_GREP_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + endif () endif () endif () endif () +# dump the output unless nodisplay option is set +if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + execute_process ( + COMMAND ${CMAKE_COMMAND} -E echo ${TEST_STREAM} + RESULT_VARIABLE TEST_RESULT + ) +endif () + # everything went fine... message (STATUS "${TEST_PROGRAM} Passed") diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index 8425312..3c85d48 100644 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -50,6 +50,17 @@ if (SITE_BUILDNAME_SUFFIX) endif () set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") +# Launchers work only with Makefile and Ninja generators. +if(NOT "${CTEST_CMAKE_GENERATOR}" MATCHES "Make|Ninja") + set(CTEST_USE_LAUNCHERS 0) + set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 0) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=OFF") +else() + set(CTEST_USE_LAUNCHERS 1) + set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 1) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON") +endif() + #----------------------------------------------------------------------------- # MAC machines need special option #----------------------------------------------------------------------------- @@ -219,9 +230,6 @@ else () ) endif () -set(CTEST_USE_LAUNCHERS 1) -set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} 1) - #----------------------------------------------------------------------------- ## -- set output to english set ($ENV{LC_MESSAGES} "en_EN") diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 12ee40b..c07d005 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -64,7 +64,7 @@ if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out TEST_STREAM) - message (STATUS "Output USING ${TEST_VFD}:\n${TEST_STREAM}") + message (STATUS "Output USING ${TEST_VFD}:\n${TEST_STREAM}") endif () endif () message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") diff --git a/config/cmake/volTest.cmake b/config/cmake/volTest.cmake index 1dcd2b1..e735109 100644 --- a/config/cmake/volTest.cmake +++ b/config/cmake/volTest.cmake @@ -64,7 +64,7 @@ if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.out") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.out TEST_STREAM) - message (STATUS "Output USING ${TEST_VOL}:\n${TEST_STREAM}") + message (STATUS "Output USING ${TEST_VOL}:\n${TEST_STREAM}") endif () endif () message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") diff --git a/config/cmake_ext_mod/CTestCustom.cmake b/config/cmake_ext_mod/CTestCustom.cmake index 025bce4..4e292a7 100644 --- a/config/cmake_ext_mod/CTestCustom.cmake +++ b/config/cmake_ext_mod/CTestCustom.cmake @@ -1,16 +1,17 @@ set (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 3000) - + set (CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} - "note.*expected.*void.*but argument is of type.*volatile" - "SZIP.src.*:[ \t]*warning" - "jpeg.src.*:[ \t]*warning" - "POSIX name for this item is deprecated" - "disabling jobserver mode" - "warning.*implicit declaration of function" - "note: expanded from macro" + ".*note.*expected.*void.*but argument is of type.*volatile.*" + ".*src.SZIP.*:[ \t]*warning.*" + ".*src.ZLIB.*:[ \t]*warning.*" + ".*jpeg.src.*:[ \t]*warning.*" + ".*POSIX name for this item is deprecated.*" + ".*disabling jobserver mode.*" + ".*warning.*implicit declaration of function.*" + ".*note: expanded from macro.*" ) - + set (CTEST_CUSTOM_MEMCHECK_IGNORE ${CTEST_CUSTOM_MEMCHECK_IGNORE} ) diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index 78ee0da..c65c951 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -82,91 +82,102 @@ if (TEST_FIND_RESULT GREATER 0) endif () # if the TEST_ERRREF exists grep the error output with the error reference +set (TEST_ERRREF_RESULT 0) if (TEST_ERRREF) # if the .err file exists grep the error output with the error reference before comparing stdout if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_ERR_STREAM) - - # TEST_ERRREF should always be matched - string (REGEX MATCH "${TEST_ERRREF}" TEST_MATCH ${TEST_ERR_STREAM}) - string (COMPARE EQUAL "${TEST_ERRREF}" "${TEST_MATCH}" TEST_RESULT) - if (NOT TEST_RESULT) - message (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not contain ${TEST_ERRREF}") + list(LENGTH TEST_ERR_STREAM test_len) + if (test_len GREATER 0) + # TEST_ERRREF should always be matched + string (REGEX MATCH "${TEST_ERRREF}" TEST_MATCH ${TEST_ERR_STREAM}) + string (COMPARE EQUAL "${TEST_ERRREF}" "${TEST_MATCH}" TEST_ERRREF_RESULT) + if (NOT TEST_ERRREF_RESULT) + message (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not contain ${TEST_ERRREF}") + endif () endif () endif () #always compare output file to reference unless this must be skipped + set (TEST_COMPARE_RESULT 0) if (NOT TEST_SKIP_COMPARE) if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") - if (WIN32 OR MINGW) - configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) - file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) - #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif () - if (NOT TEST_SORT_COMPARE) - # now compare the output with the reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) - else () - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) - list (SORT v1) - list (SORT v2) - if (NOT v1 STREQUAL v2) - set(TEST_RESULT 1) + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + list(LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (WIN32 OR MINGW) + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}.tmp") + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + endif () + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + endif () + if (NOT TEST_SORT_COMPARE) + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_COMPARE_RESULT + ) + else () + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) + list (SORT v1) + list (SORT v2) + if (NOT v1 STREQUAL v2) + set(TEST_COMPARE_RESULT 1) + endif () endif () - endif () - if (TEST_RESULT) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - list (LENGTH test_ref len_ref) - if (len_act GREATER 0 AND len_ref GREATER 0) - math (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT str_act STREQUAL str_ref) - if (str_act) - set (TEST_RESULT 1) - message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + if (TEST_COMPARE_RESULT) + set (TEST_COMPARE_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (len_act GREATER 0 AND len_ref GREATER 0) + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT str_act STREQUAL str_ref) + if (str_act) + set (TEST_COMPARE_RESULT 1) + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () endif () + endforeach () + else () + if (len_act EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") + endif () + if (len_ref EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () - endforeach () - else () - if (len_act EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if (len_ref EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") + if (NOT len_act EQUAL len_ref) + set (TEST_COMPARE_RESULT 1) endif () endif () - if (NOT len_act EQUAL len_ref) - set (TEST_RESULT 1) - endif () endif () - message (STATUS "COMPARE Result: ${TEST_RESULT}") + message (STATUS "COMPARE Result: ${TEST_COMPARE_RESULT}") # again, if return value is !=0 scream and shout - if (TEST_RESULT) + if (TEST_COMPARE_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif () endif () endif () else () # else grep the output with the reference + set (TEST_GREP_RESULT 0) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) # TEST_REFERENCE should always be matched string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) - string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) - if (NOT TEST_RESULT) + string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_GREP_RESULT) + if (NOT TEST_GREP_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") endif () endif () @@ -176,8 +187,8 @@ if (TEST_FILTER) string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) if (TEST_EXPECT) # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match - string (LENGTH "${TEST_MATCH}" TEST_RESULT) - if (TEST_RESULT) + string (LENGTH "${TEST_MATCH}" TEST_GREP_RESULT) + if (TEST_GREP_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") endif () endif () diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 6f633f3..6440c81 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -90,18 +90,21 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - if (TEST_MASK_FILE) - STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") - endif () - # remove special output - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + list(LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (TEST_MASK_FILE) + STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") + endif () + # remove special output + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - if (NOT ERROR_APPEND) - # write back to original .err file - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - else () - # append error output to the stdout output file - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + if (NOT ERROR_APPEND) + # write back to original .err file + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + else () + # append error output to the stdout output file + file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () endif () endif () @@ -198,147 +201,164 @@ endif () if (TEST_REF_FILTER) #message (STATUS "TEST_REF_FILTER: ${TEST_APPEND}${TEST_REF_FILTER}") file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - STRING(REGEX REPLACE "${TEST_REF_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "${TEST_REF_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}") file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () # compare output files to references unless this must be skipped +set (TEST_COMPARE_RESULT 0) if (NOT TEST_SKIP_COMPARE) if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") - if (WIN32 OR MINGW) - configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) - file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) - #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif () + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + list(LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (WIN32 OR MINGW) + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}.tmp") + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + endif () + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + endif () - if (NOT TEST_SORT_COMPARE) - # now compare the output with the reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) - else () - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) - list (SORT v1) - list (SORT v2) - if (NOT v1 STREQUAL v2) - set(TEST_RESULT 1) + if (NOT TEST_SORT_COMPARE) + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_COMPARE_RESULT + ) + else () + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) + list (SORT v1) + list (SORT v2) + if (NOT v1 STREQUAL v2) + set(TEST_COMPARE_RESULT 1) + endif () endif () - endif () - if (TEST_RESULT) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - list (LENGTH test_ref len_ref) - if (len_act GREATER 0 AND len_ref GREATER 0) - math (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT str_act STREQUAL str_ref) - if (str_act) - set (TEST_RESULT 1) - message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + if (TEST_COMPARE_RESULT) + set (TEST_COMPARE_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (len_act GREATER 0 AND len_ref GREATER 0) + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT str_act STREQUAL str_ref) + if (str_act) + set (TEST_COMPARE_RESULT 1) + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () endif () + endforeach () + else () + if (len_act EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") + endif () + if (len_ref EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () - endforeach () - else () - if (len_act EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if (len_ref EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") + if (NOT len_act EQUAL len_ref) + set (TEST_COMPARE_RESULT 1) endif () endif () - if (NOT len_act EQUAL len_ref) - set (TEST_RESULT 1) - endif () endif () - message (STATUS "COMPARE Result: ${TEST_RESULT}") + message (STATUS "COMPARE Result: ${TEST_COMPARE_RESULT}") # again, if return value is !=0 scream and shout - if (TEST_RESULT) + if (TEST_COMPARE_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif () endif () # now compare the .err file with the error reference, if supplied + set (TEST_ERRREF_RESULT 0) if (TEST_ERRREF) - if (WIN32 OR MINGW) - configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF) - file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF}) - #file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) - #file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") - endif () + file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + list(LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (WIN32 OR MINGW) + configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF) + if (EXISTS "${TEST_FOLDER}/${TEST_ERRREF}.tmp") + file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF}) + endif () + #file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") + endif () - # now compare the error output with the error reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} - RESULT_VARIABLE TEST_RESULT - ) - if (TEST_RESULT) - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) - list (LENGTH test_ref len_ref) - math (EXPR _FP_LEN "${len_ref} - 1") - if (len_act GREATER 0 AND len_ref GREATER 0) + # now compare the error output with the error reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} + RESULT_VARIABLE TEST_ERRREF_RESULT + ) + if (TEST_ERRREF_RESULT) + set (TEST_ERRREF_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) + list (LENGTH test_ref len_ref) math (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT str_act STREQUAL str_ref) - if (str_act) - set (TEST_RESULT 1) - message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + if (len_act GREATER 0 AND len_ref GREATER 0) + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT str_act STREQUAL str_ref) + if (str_act) + set (TEST_ERRREF_RESULT 1) + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () endif () + endforeach () + else () + if (len_act EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") + endif () + if (len_ref EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") endif () - endforeach () - else () - if (len_act EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") endif () - if (len_ref EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") + if (NOT len_act EQUAL len_ref) + set (TEST_ERRREF_RESULT 1) endif () endif () - if (NOT len_act EQUAL len_ref) - set (TEST_RESULT 1) - endif () endif () - message (STATUS "COMPARE Result: ${TEST_RESULT}") + message (STATUS "COMPARE Result: ${TEST_ERRREF_RESULT}") # again, if return value is !=0 scream and shout - if (TEST_RESULT) + if (TEST_ERRREF_RESULT) message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") endif () endif () endif () +set (TEST_GREP_RESULT 0) if (TEST_GREP_COMPARE) # now grep the output with the reference file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + list(LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + # TEST_REFERENCE should always be matched + string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_GREP_RESULT) + if (NOT TEST_GREP_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") + endif () - # TEST_REFERENCE should always be matched - string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) - string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) - if (NOT TEST_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") - endif () - - string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) - if (TEST_EXPECT) - # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match - string (LENGTH "${TEST_MATCH}" TEST_RESULT) - if (TEST_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) + if (TEST_EXPECT) + # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match + string (LENGTH "${TEST_MATCH}" TEST_GREP_RESULT) + if (TEST_GREP_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + endif () endif () endif () endif () diff --git a/config/gnu-flags b/config/gnu-flags index 16795d0..a5f3258 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -276,7 +276,7 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 7 if test $cc_vers_major -ge 7; then DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" - H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" + H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wimplicit-fallthrough=5 -Wrestrict" fi # gcc 8 diff --git a/config/linux-gnueabihf b/config/linux-gnueabihf new file mode 100644 index 0000000..326edeb --- /dev/null +++ b/config/linux-gnueabihf @@ -0,0 +1,16 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + +# ARM for Raspberry Pi, etc. +# This is the same as linux-gnulibc1 + +. $srcdir/config/linux-gnulibc1 diff --git a/config/sanitizer/LICENSE b/config/sanitizer/LICENSE new file mode 100644 index 0000000..895657b --- /dev/null +++ b/config/sanitizer/LICENSE @@ -0,0 +1,174 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability.
\ No newline at end of file diff --git a/config/sanitizer/README.md b/config/sanitizer/README.md new file mode 100644 index 0000000..0d5fb6c --- /dev/null +++ b/config/sanitizer/README.md @@ -0,0 +1,307 @@ +# CMake Scripts <!-- omit in toc --> + +[![pipeline status](https://git.stabletec.com/other/cmake-scripts/badges/master/pipeline.svg)](https://git.stabletec.com/other/cmake-scripts/commits/master) +[![license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://git.stabletec.com/other/cmake-scripts/blob/master/LICENSE) + +This is a collection of quite useful scripts that expand the possibilities for building software with CMake, by making some things easier and otherwise adding new build types + +- [C++ Standards `c++-standards.cmake`](#c-standards-c-standardscmake) +- [Sanitizer Builds `sanitizers.cmake`](#sanitizer-builds-sanitizerscmake) +- [Code Coverage `code-coverage.cmake`](#code-coverage-code-coveragecmake) + - [Added Targets](#added-targets) + - [Usage](#usage) + - [Example 1 - All targets instrumented](#example-1---all-targets-instrumented) + - [1a - Via global command](#1a---via-global-command) + - [1b - Via target commands](#1b---via-target-commands) + - [Example 2: Target instrumented, but with regex pattern of files to be excluded from report](#example-2-target-instrumented-but-with-regex-pattern-of-files-to-be-excluded-from-report) + - [Example 3: Target added to the 'ccov' and 'ccov-all' targets](#example-3-target-added-to-the-ccov-and-ccov-all-targets) +- [Compiler Options `compiler-options.cmake`](#compiler-options-compiler-optionscmake) +- [Dependency Graph `dependency-graph.cmake`](#dependency-graph-dependency-graphcmake) + - [Required Arguments](#required-arguments) + - [OUTPUT_TYPE *STR*](#output_type-str) + - [Optional Arguments](#optional-arguments) + - [ADD_TO_DEP_GRAPH](#add_to_dep_graph) + - [TARGET_NAME *STR*](#target_name-str) + - [OUTPUT_DIR *STR*](#output_dir-str) +- [Doxygen `doxygen.cmake`](#doxygen-doxygencmake) + - [Optional Arguments](#optional-arguments-1) + - [ADD_TO_DOC](#add_to_doc) + - [INSTALLABLE](#installable) + - [PROCESS_DOXYFILE](#process_doxyfile) + - [TARGET_NAME *STR*](#target_name-str-1) + - [OUTPUT_DIR *STR*](#output_dir-str-1) + - [INSTALL_PATH *STR*](#install_path-str) + - [DOXYFILE_PATH *STR*](#doxyfile_path-str) +- [Prepare the Catch Test Framework `prepare_catch.cmake`](#prepare-the-catch-test-framework-prepare_catchcmake) + - [Optional Arguments](#optional-arguments-2) + - [COMPILED_CATCH](#compiled_catch) + - [CATCH1](#catch1) + - [CLONE](#clone) +- [Tools `tools.cmake`](#tools-toolscmake) + - [clang-tidy](#clang-tidy) + - [include-what-you-use](#include-what-you-use) + - [cppcheck](#cppcheck) +- [Formatting `formatting.cmake`](#formatting-formattingcmake) + - [clang-format](#clang-format) + - [cmake-format](#cmake-format) + +## C++ Standards [`c++-standards.cmake`](c++-standards.cmake) + +Using the functions `cxx_11()`, `cxx_14()`, `cxx_17()` or `cxx_20()` this adds the appropriate flags for both unix and MSVC compilers, even for those before 3.11 with improper support. + +These obviously force the standard to be required, and also disables compiler-specific extensions, ie `--std=gnu++11`. This helps to prevent fragmenting the code base with items not available elsewhere, adhering to the agreed C++ standards only. + +## Sanitizer Builds [`sanitizers.cmake`](sanitizers.cmake) + +Sanitizers are tools that perform checks during a program’s runtime and returns issues, and as such, along with unit testing, code coverage and static analysis, is another tool to add to the programmers toolbox. And of course, like the previous tools, are tragically simple to add into any project using CMake, allowing any project and developer to quickly and easily use. + +A quick rundown of the tools available, and what they do: +- [LeakSanitizer](https://clang.llvm.org/docs/LeakSanitizer.html) detects memory leaks, or issues where memory is allocated and never deallocated, causing programs to slowly consume more and more memory, eventually leading to a crash. +- [AddressSanitizer](https://clang.llvm.org/docs/AddressSanitizer.html) is a fast memory error detector. It is useful for detecting most issues dealing with memory, such as: + - Out of bounds accesses to heap, stack, global + - Use after free + - Use after return + - Use after scope + - Double-free, invalid free + - Memory leaks (using LeakSanitizer) +- [ThreadSanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html) detects data races for multi-threaded code. +- [UndefinedBehaviourSanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html) detects the use of various features of C/C++ that are explicitly listed as resulting in undefined behaviour. Most notably: + - Using misaligned or null pointer. + - Signed integer overflow + - Conversion to, from, or between floating-point types which would overflow the destination + - Division by zero + - Unreachable code +- [MemorySanitizer](https://clang.llvm.org/docs/MemorySanitizer.html) detects uninitialized reads. + +These are used by declaring the `USE_SANITIZER` CMake variable as one of: +- Address +- Memory +- MemoryWithOrigins +- Undefined +- Thread +- Address;Undefined +- Undefined;Address +- Leak + +## Code Coverage [`code-coverage.cmake`](code-coverage.cmake) + +![Code Coverage Examples](img/code-cov.png) + +> In computer science, test coverage is a measure used to describe the degree to which the source code of a program is executed when a particular test suite runs. A program with high test coverage, measured as a percentage, has had more of its source code executed during testing, which suggests it has a lower chance of containing undetected software bugs compared to a program with low test coverage. Many different metrics can be used to calculate test coverage; some of the most basic are the percentage of program subroutines and the percentage of program statements called during execution of the test suite. +> +> [Wikipedia, Code Coverage](https://en.wikipedia.org/wiki/Code_coverage) + +Code coverage is the detailing of, during the execution of a binary, which regions, functions, or lines of code are *actually* executed. This can be used in a number of ways, from figuring out areas that automated testing is lacking or not touching, to giving a user an instrumented binary to determine which areas of code are used most/least to determine which areas to focus on. Although this does come with the caveat that coverage is no guarantee of good testing, just of what code has been. + +Coverage here is supported on both GCC and Clang. GCC requires the `lcov` program, and Clang requires `llvm-cov` and `llvm-profdata`, often provided with the llvm toolchain. + +To enable, turn on the `CODE_COVERAGE` variable. + +### Added Targets + +- GCOV/LCOV: + - ccov : Generates HTML code coverage report for every target added with 'AUTO' parameter. + - ccov-${TARNGET_NAME} : Generates HTML code coverage report for the associated named target. + - ccov-all : Generates HTML code coverage report, merging every target added with 'ALL' parameter into a single detailed report. + - ccov-all-capture : Generates an all-merged.info file, for use with coverage dashboards (e.g. codecov.io, coveralls). +- LLVM-COV: + - ccov : Generates HTML code coverage report for every target added with 'AUTO' parameter. + - ccov-report : Generates HTML code coverage report for every target added with 'AUTO' parameter. + - ccov-${TARGET_NAME} : Generates HTML code coverage report. + - ccov-rpt-${TARGET_NAME} : Prints to command line summary per-file coverage information. + - ccov-show-${TARGET_NAME} : Prints to command line detailed per-line coverage information. + - ccov-all : Generates HTML code coverage report, merging every target added with 'ALL' parameter into a single detailed report. + - ccov-all-report : Prints summary per-file coverage information for every target added with ALL' parameter to the command line. + +### Usage + +To enable any code coverage instrumentation/targets, the single CMake option of `CODE_COVERAGE` needs to be set to 'ON', either by GUI, ccmake, or on the command line ie `-DCODE_COVERAGE=ON`. + +From this point, there are two primary methods for adding instrumentation to targets: +1. A blanket instrumentation by calling `add_code_coverage()`, where all targets in that directory and all subdirectories are automatically instrumented. +2. Per-target instrumentation by calling `target_code_coverage(<TARGET_NAME>)`, where the target is given and thus only that target is instrumented. This applies to both libraries and executables. + +To add coverage targets, such as calling `make ccov` to generate the actual coverage information for perusal or consumption, call `target_code_coverage(<TARGET_NAME>)` on an *executable* target. + +**NOTE:** For more options, please check the actual [`code-coverage.cmake`](code-coverage.cmake) file. + +#### Example 1 - All targets instrumented + +In this case, the coverage information reported will will be that of the `theLib` library target and `theExe` executable. + +##### 1a - Via global command + +``` +add_code_coverage() # Adds instrumentation to all targets + +add_library(theLib lib.cpp) + +add_executable(theExe main.cpp) +target_link_libraries(theExe PRIVATE theLib) +target_code_coverage(theExe) # As an executable target, adds the 'ccov-theExe' target (instrumentation already added via global anyways) for generating code coverage reports. +``` + +##### 1b - Via target commands + +``` +add_library(theLib lib.cpp) +target_code_coverage(theLib) # As a library target, adds coverage instrumentation but no targets. + +add_executable(theExe main.cpp) +target_link_libraries(theExe PRIVATE theLib) +target_code_coverage(theExe) # As an executable target, adds the 'ccov-theExe' target and instrumentation for generating code coverage reports. +``` + +#### Example 2: Target instrumented, but with regex pattern of files to be excluded from report + +``` +add_executable(theExe main.cpp non_covered.cpp) +target_code_coverage(theExe EXCLUDE non_covered.cpp) # As an executable target, the reports will exclude the non-covered.cpp file. +``` + +#### Example 3: Target added to the 'ccov' and 'ccov-all' targets + +``` +add_code_coverage_all_targets(EXCLUDE test/*) # Adds the 'ccov-all' target set and sets it to exclude all files in test/ folders. + +add_executable(theExe main.cpp non_covered.cpp) +target_code_coverage(theExe AUTO ALL EXCLUDE non_covered.cpp test/*) # As an executable target, adds to the 'ccov' and ccov-all' targets, and the reports will exclude the non-covered.cpp file, and any files in a test/ folder. +``` + +## Compiler Options [`compiler-options.cmake`](compiler-options.cmake) + +Allows for easy use of some pre-made compiler options for the major compilers. + +Using `-DENABLE_ALL_WARNINGS=ON` will enable almost all of the warnings available for a compiler: + +| Compiler | Options | +| :------- | :------------ | +| MSVC | /W4 | +| GCC | -Wall -Wextra | +| Clang | -Wall -Wextra | + +Using `-DENABLE_EFFECTIVE_CXX=ON` adds the `-Weffc++` for both GCC and clang. + +Using `-DGENERATE_DEPENDENCY_DATA=ON` generates `.d` files along with regular object files on a per-source file basis on GCC/Clang compilers. These files contains the list of all header files used during compilation of that compilation unit. + +## Dependency Graph [`dependency-graph.cmake`](dependency-graph.cmake) + +CMake, with the dot application available, will build a visual representation of the library/executable dependencies, like so: +![Dependency Graph](img/dp-graph.png) + +### Required Arguments + +#### OUTPUT_TYPE *STR* +The type of output of `dot` to produce. Can be whatever `dot` itself supports (eg. png, ps, pdf). + +### Optional Arguments + +#### ADD_TO_DEP_GRAPH +If specified, add this generated target to be a dependency of the more general `dep-graph` target. + +#### TARGET_NAME *STR* +The name to give the doc target. (Default: doc-${PROJECT_NAME}) + +#### OUTPUT_DIR *STR* +The directory to place the generated output + +## Doxygen [`doxygen.cmake`](doxygen.cmake) + +Builds doxygen documentation with a default 'Doxyfile.in' or with a specified one, and can make the results installable (under the `doc` install target) + +This can only be used once per project, as each target generated is as `doc-${PROJECT_NAME}` unless TARGET_NAME is specified. + +### Optional Arguments + +#### ADD_TO_DOC +If specified, adds this generated target to be a dependency of the more general `doc` target. + +#### INSTALLABLE +Adds the generated documentation to the generic `install` target, under the `documentation` installation group. + +#### PROCESS_DOXYFILE +If set, then will process the found Doxyfile through the CMAKE `configure_file` function for macro replacements before using it. (@ONLY) + +#### TARGET_NAME *STR* +The name to give the doc target. (Default: doc-${PROJECT_NAME}) + +#### OUTPUT_DIR *STR* +The directory to place the generated output. (Default: ${CMAKE_CURRENT_BINARY_DIR}/doc) + +#### INSTALL_PATH *STR* +The path to install the documenttation under. (if not specified, defaults to 'share/${PROJECT_NAME}) + +#### DOXYFILE_PATH *STR* +The given doxygen file to use/process. (Defaults to'${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile') + +## Prepare the Catch Test Framework [`prepare_catch.cmake`](prepare_catch.cmake) + +The included `prepare_catch` function contained within attempts to add the infrastructure necessary for automatically adding C/C++ tests using the Catch2 library, including either an interface or pre-compiled 'catch' target library. + +It first attempts to find the header on the local machine, and failing that, clones the single header variant for use. It does make the determination between pre-C++11 and will use Catch1.X rather than Catch2 (when cloned), automatically or forced.. Adds a subdirectory of tests/ if it exists from the macro's calling location. + +### Optional Arguments + +#### COMPILED_CATCH +If this option is specified, then generates the 'catch' target as a library with catch already pre-compiled as part of the library. Otherwise acts just an interface library for the header location. + +#### CATCH1 +Force the use of Catch1.X, rather than auto-detecting the C++ version in use. + +#### CLONE +Force cloning of Catch, rather than attempting to use a locally-found variant. + +## Tools [`tools.cmake`](tools.cmake) + +### clang-tidy + +> clang-tidy is a clang-based C++ “linter†tool. Its purpose is to provide an extensible framework for diagnosing and fixing typical programming errors, like style violations, interface misuse, or bugs that can be deduced via static analysis. clang-tidy is modular and provides a convenient interface for writing new checks. +> +> [clang-tidy page](https://clang.llvm.org/extra/clang-tidy/) + +When detected, [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) can be enabled by using the option of `-DCLANG_TIDY=ON`, as it is disabled by default. + +To use, add the `clang_tidy()` function, with the arguments being the options to pass to the clang tidy program, such as '-checks=*'. + +### include-what-you-use + +This tool helps to organize headers for all files encompass all items being used in that file, without accidentally relying upon headers deep down a chain of other headers. This is disabled by default, and can be enabled via have the program installed and adding `-DIWYU=ON`. + +To use, add the `include_what_you_use()` function, with the arguments being the options to pass to the program. + +### cppcheck + +This tool is another static analyzer in the vein of clang-tidy, which focuses on having no false positives. This is by default disabled, and can be enabled via have the program installed and adding `-DCPPCHECK=ON`. + +To use, add the `cppcheck()` function, with the arguments being the options to pass to the program. + +## Formatting [`formatting.cmake`](formatting.cmake) + +### clang-format + +Allows to automatically perform code formatting using the clang-format program, by calling an easy-to-use target ala `make format`. It requires a target name, and the list of files to format. As well, if the target name is the name of another target, then all files associated with that target will be added, and the target name changed to be `format_<TARGET>`. As well, any targets otherwise listed with the files will also have their files imported for formatting. + +``` +file(GLOB_RECURSE ALL_CODE_FILES + ${PROJECT_SOURCE_DIR}/src/*.[ch]pp + ${PROJECT_SOURCE_DIR}/src/*.[ch] + ${PROJECT_SOURCE_DIR}/include/*.[h]pp + ${PROJECT_SOURCE_DIR}/include/*.[h] + ${PROJECT_SOURCE_DIR}/example/*.[ch]pp + ${PROJECT_SOURCE_DIR}/example/*.[ch] +) + +clang_format(TARGET_NAME ${ALL_CODE_FILES}) +``` + +### cmake-format + +Similar to the clang-format above, creates a target `cmake-format` when the `cmake_format(<FILES>)` function is defined in CMake scripts, and any <FILES> passed in will be formatted by the cmake-format program, if it is found. + +``` +file(GLOB_RECURSE CMAKE_FILES + CMakeLists.txt +) + +cmake_format(TARGET_NAME ${CMAKE_FILES}) +```
\ No newline at end of file diff --git a/config/sanitizer/code-coverage.cmake b/config/sanitizer/code-coverage.cmake new file mode 100644 index 0000000..8d765f7 --- /dev/null +++ b/config/sanitizer/code-coverage.cmake @@ -0,0 +1,536 @@ +# +# Copyright (C) 2018 by George Cave - gcave@stablecoder.ca +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +# USAGE: To enable any code coverage instrumentation/targets, the single CMake +# option of `CODE_COVERAGE` needs to be set to 'ON', either by GUI, ccmake, or +# on the command line. +# +# From this point, there are two primary methods for adding instrumentation to +# targets: 1 - A blanket instrumentation by calling `add_code_coverage()`, where +# all targets in that directory and all subdirectories are automatically +# instrumented. 2 - Per-target instrumentation by calling +# `target_code_coverage(<TARGET_NAME>)`, where the target is given and thus only +# that target is instrumented. This applies to both libraries and executables. +# +# To add coverage targets, such as calling `make ccov` to generate the actual +# coverage information for perusal or consumption, call +# `target_code_coverage(<TARGET_NAME>)` on an *executable* target. +# +# Example 1: All targets instrumented +# +# In this case, the coverage information reported will will be that of the +# `theLib` library target and `theExe` executable. +# +# 1a: Via global command +# +# ~~~ +# add_code_coverage() # Adds instrumentation to all targets +# +# add_library(theLib lib.cpp) +# +# add_executable(theExe main.cpp) +# target_link_libraries(theExe PRIVATE theLib) +# target_code_coverage(theExe) # As an executable target, adds the 'ccov-theExe' target (instrumentation already added via global anyways) for generating code coverage reports. +# ~~~ +# +# 1b: Via target commands +# +# ~~~ +# add_library(theLib lib.cpp) +# target_code_coverage(theLib) # As a library target, adds coverage instrumentation but no targets. +# +# add_executable(theExe main.cpp) +# target_link_libraries(theExe PRIVATE theLib) +# target_code_coverage(theExe) # As an executable target, adds the 'ccov-theExe' target and instrumentation for generating code coverage reports. +# ~~~ +# +# Example 2: Target instrumented, but with regex pattern of files to be excluded +# from report +# +# ~~~ +# add_executable(theExe main.cpp non_covered.cpp) +# target_code_coverage(theExe EXCLUDE non_covered.cpp test/*) # As an executable target, the reports will exclude the non-covered.cpp file, and any files in a test/ folder. +# ~~~ +# +# Example 3: Target added to the 'ccov' and 'ccov-all' targets +# +# ~~~ +# add_code_coverage_all_targets(EXCLUDE test/*) # Adds the 'ccov-all' target set and sets it to exclude all files in test/ folders. +# +# add_executable(theExe main.cpp non_covered.cpp) +# target_code_coverage(theExe AUTO ALL EXCLUDE non_covered.cpp test/*) # As an executable target, adds to the 'ccov' and ccov-all' targets, and the reports will exclude the non-covered.cpp file, and any files in a test/ folder. +# ~~~ + +# Options +option( + CODE_COVERAGE + "Builds targets with code coverage instrumentation. (Requires GCC or Clang)" + OFF) + +# Programs +find_program(LLVM_COV_PATH llvm-cov) +find_program(LLVM_PROFDATA_PATH llvm-profdata) +find_program(LCOV_PATH lcov) +find_program(GENHTML_PATH genhtml) + +# Variables +set(CMAKE_COVERAGE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/ccov) + +# Common initialization/checks +if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED) + set(CODE_COVERAGE_ADDED ON) + + # Common Targets + add_custom_target( + ccov-preprocessing + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY} + DEPENDS ccov-clean) + + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" + OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + # Messages + message(STATUS "Building with llvm Code Coverage Tools") + + if(NOT LLVM_COV_PATH) + message(FATAL_ERROR "llvm-cov not found! Aborting.") + else() + # Version number checking for 'EXCLUDE' compatibility + execute_process(COMMAND ${LLVM_COV_PATH} --version + OUTPUT_VARIABLE LLVM_COV_VERSION_CALL_OUTPUT) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" LLVM_COV_VERSION + ${LLVM_COV_VERSION_CALL_OUTPUT}) + + if(LLVM_COV_VERSION VERSION_LESS "7.0.0") + message( + WARNING + "target_code_coverage()/add_code_coverage_all_targets() 'EXCLUDE' option only available on llvm-cov >= 7.0.0" + ) + endif() + endif() + + # Targets + add_custom_target( + ccov-clean + COMMAND rm -f ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + COMMAND rm -f ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list) + + # Used to get the shared object file list before doing the main all- + # processing + add_custom_target( + ccov-libs + COMMAND ; + COMMENT "libs ready for coverage report.") + + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + # Messages + message(STATUS "Building with lcov Code Coverage Tools") + + if(CMAKE_BUILD_TYPE) + string(TOUPPER ${CMAKE_BUILD_TYPE} upper_build_type) + if(NOT ${upper_build_type} STREQUAL "DEBUG") + message( + WARNING + "Code coverage results with an optimized (non-Debug) build may be misleading" + ) + endif() + else() + message( + WARNING + "Code coverage results with an optimized (non-Debug) build may be misleading" + ) + endif() + if(NOT LCOV_PATH) + message(FATAL_ERROR "lcov not found! Aborting...") + endif() + if(NOT GENHTML_PATH) + message(FATAL_ERROR "genhtml not found! Aborting...") + endif() + + # Targets + add_custom_target(ccov-clean COMMAND ${LCOV_PATH} --directory + ${CMAKE_BINARY_DIR} --zerocounters) + + else() + set(CODE_COVERAGE_ADDED OFF) + message(STATUS "Code coverage requires Clang or GCC.(${CMAKE_C_COMPILER_ID})") + endif() +endif() + +# Adds code coverage instrumentation to a library, or instrumentation/targets +# for an executable target. +# ~~~ +# EXECUTABLE ADDED TARGETS: +# GCOV/LCOV: +# ccov : Generates HTML code coverage report for every target added with 'AUTO' parameter. +# ccov-${TARGET_NAME} : Generates HTML code coverage report for the associated named target. +# ccov-all : Generates HTML code coverage report, merging every target added with 'ALL' parameter into a single detailed report. +# +# LLVM-COV: +# ccov : Generates HTML code coverage report for every target added with 'AUTO' parameter. +# ccov-report : Generates HTML code coverage report for every target added with 'AUTO' parameter. +# ccov-${TARGET_NAME} : Generates HTML code coverage report. +# ccov-report-${TARGET_NAME} : Prints to command line summary per-file coverage information. +# ccov-show-${TARGET_NAME} : Prints to command line detailed per-line coverage information. +# ccov-all : Generates HTML code coverage report, merging every target added with 'ALL' parameter into a single detailed report. +# ccov-all-report : Prints summary per-file coverage information for every target added with ALL' parameter to the command line. +# +# Required: +# TARGET_NAME - Name of the target to generate code coverage for. +# Optional: +# AUTO - Adds the target to the 'ccov' target so that it can be run in a batch with others easily. Effective on executable targets. +# ALL - Adds the target to the 'ccov-all' and 'ccov-all-report' targets, which merge several executable targets coverage data to a single report. Effective on executable targets. +# EXTERNAL - For GCC's lcov, allows the profiling of 'external' files from the processing directory +# EXCLUDE <REGEX_PATTERNS> - Excludes files of the patterns provided from coverage. **These do not copy to the 'all' targets.** +# OBJECTS <TARGETS> - For executables ONLY, if the provided targets are shared libraries, adds coverage information to the output +# ~~~ +function(target_code_coverage TARGET_NAME) + # Argument parsing + set(options AUTO ALL EXTERNAL) + set(multi_value_keywords EXCLUDE OBJECTS) + cmake_parse_arguments(target_code_coverage "${options}" "" + "${multi_value_keywords}" ${ARGN}) + + if(CODE_COVERAGE) + + # Add code coverage instrumentation to the target's linker command + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" + OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + target_compile_options(${TARGET_NAME} PRIVATE -fprofile-instr-generate + -fcoverage-mapping) + set_property( + TARGET ${TARGET_NAME} + APPEND_STRING + PROPERTY LINK_FLAGS "-fprofile-instr-generate ") + set_property( + TARGET ${TARGET_NAME} + APPEND_STRING + PROPERTY LINK_FLAGS "-fcoverage-mapping ") + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + target_compile_options(${TARGET_NAME} PRIVATE -fprofile-arcs + -ftest-coverage) + target_link_libraries(${TARGET_NAME} PRIVATE gcov) + endif() + + # Targets + get_target_property(target_type ${TARGET_NAME} TYPE) + + # Add shared library to processing for 'all' targets + if(target_type STREQUAL "SHARED_LIBRARY" AND target_code_coverage_ALL) + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" + OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + add_custom_target( + ccov-run-${TARGET_NAME} + COMMAND echo "-object=$<TARGET_FILE:${TARGET_NAME}>" >> + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + DEPENDS ccov-preprocessing ${TARGET_NAME}) + + if(NOT TARGET ccov-libs) + message( + FATAL_ERROR + "Calling target_code_coverage with 'ALL' must be after a call to 'add_code_coverage_all_targets'." + ) + endif() + + add_dependencies(ccov-libs ccov-run-${TARGET_NAME}) + endif() + endif() + + # For executables add targets to run and produce output + if(target_type STREQUAL "EXECUTABLE") + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" + OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Cc]lang") + + # If there are shared objects to also work with, generate the string to + # add them here + foreach(SO_TARGET ${target_code_coverage_OBJECTS}) + # Check to see if the target is a shared object + if(TARGET ${SO_TARGET}) + get_target_property(SO_TARGET_TYPE ${SO_TARGET} TYPE) + if(${SO_TARGET_TYPE} STREQUAL "SHARED_LIBRARY") + set(SO_OBJECTS ${SO_OBJECTS} -object=$<TARGET_FILE:${SO_TARGET}>) + endif() + endif() + endforeach() + + # Run the executable, generating raw profile data + add_custom_target( + ccov-run-${TARGET_NAME} + COMMAND LLVM_PROFILE_FILE=${TARGET_NAME}.profraw + $<TARGET_FILE:${TARGET_NAME}> + COMMAND echo "-object=$<TARGET_FILE:${TARGET_NAME}>" >> + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list + COMMAND echo "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.profraw " >> + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list + DEPENDS ccov-preprocessing ccov-libs ${TARGET_NAME}) + + # Merge the generated profile data so llvm-cov can process it + add_custom_target( + ccov-processing-${TARGET_NAME} + COMMAND ${LLVM_PROFDATA_PATH} merge -sparse ${TARGET_NAME}.profraw -o + ${TARGET_NAME}.profdata + DEPENDS ccov-run-${TARGET_NAME}) + + # Ignore regex only works on LLVM >= 7 + if(LLVM_COV_VERSION VERSION_GREATER_EQUAL "7.0.0") + foreach(EXCLUDE_ITEM ${target_code_coverage_EXCLUDE}) + set(EXCLUDE_REGEX ${EXCLUDE_REGEX} + -ignore-filename-regex='${EXCLUDE_ITEM}') + endforeach() + endif() + + # Print out details of the coverage information to the command line + add_custom_target( + ccov-show-${TARGET_NAME} + COMMAND + ${LLVM_COV_PATH} show $<TARGET_FILE:${TARGET_NAME}> ${SO_OBJECTS} + -instr-profile=${TARGET_NAME}.profdata -show-line-counts-or-regions + ${EXCLUDE_REGEX} + DEPENDS ccov-processing-${TARGET_NAME}) + + # Print out a summary of the coverage information to the command line + add_custom_target( + ccov-report-${TARGET_NAME} + COMMAND ${LLVM_COV_PATH} report $<TARGET_FILE:${TARGET_NAME}> + ${SO_OBJECTS} -instr-profile=${TARGET_NAME}.profdata + ${EXCLUDE_REGEX} + DEPENDS ccov-processing-${TARGET_NAME}) + + # Generates HTML output of the coverage information for perusal + add_custom_target( + ccov-${TARGET_NAME} + COMMAND + ${LLVM_COV_PATH} show $<TARGET_FILE:${TARGET_NAME}> ${SO_OBJECTS} + -instr-profile=${TARGET_NAME}.profdata -show-line-counts-or-regions + -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${TARGET_NAME} + -format="html" ${EXCLUDE_REGEX} + DEPENDS ccov-processing-${TARGET_NAME}) + + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + set(COVERAGE_INFO + "${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${TARGET_NAME}.info") + + # Run the executable, generating coverage information + add_custom_target( + ccov-run-${TARGET_NAME} + COMMAND $<TARGET_FILE:${TARGET_NAME}> + DEPENDS ccov-preprocessing ${TARGET_NAME}) + + # Generate exclusion string for use + foreach(EXCLUDE_ITEM ${target_code_coverage_EXCLUDE}) + set(EXCLUDE_REGEX ${EXCLUDE_REGEX} --remove ${COVERAGE_INFO} + '${EXCLUDE_ITEM}') + endforeach() + + if(EXCLUDE_REGEX) + set(EXCLUDE_COMMAND ${LCOV_PATH} ${EXCLUDE_REGEX} --output-file + ${COVERAGE_INFO}) + else() + set(EXCLUDE_COMMAND ;) + endif() + + if(NOT ${target_code_coverage_EXTERNAL}) + set(EXTERNAL_OPTION --no-external) + endif() + + # Capture coverage data + add_custom_target( + ccov-capture-${TARGET_NAME} + COMMAND ${CMAKE_COMMAND} -E remove ${COVERAGE_INFO} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --zerocounters + COMMAND $<TARGET_FILE:${TARGET_NAME}> + COMMAND + ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --base-directory + ${CMAKE_SOURCE_DIR} --capture ${EXTERNAL_OPTION} --output-file + ${COVERAGE_INFO} + COMMAND ${EXCLUDE_COMMAND} + DEPENDS ccov-preprocessing ${TARGET_NAME}) + + # Generates HTML output of the coverage information for perusal + add_custom_target( + ccov-${TARGET_NAME} + COMMAND ${GENHTML_PATH} -o + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${TARGET_NAME} + ${COVERAGE_INFO} + DEPENDS ccov-capture-${TARGET_NAME}) + endif() + + add_custom_command( + TARGET ccov-${TARGET_NAME} + POST_BUILD + COMMAND ; + COMMENT + "Open ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/${TARGET_NAME}/index.html in your browser to view the coverage report." + ) + + # AUTO + if(target_code_coverage_AUTO) + if(NOT TARGET ccov) + add_custom_target(ccov) + endif() + add_dependencies(ccov ccov-${TARGET_NAME}) + + if(NOT CMAKE_COMPILER_IS_GNUCXX) + if(NOT TARGET ccov-report) + add_custom_target(ccov-report) + endif() + add_dependencies(ccov-report ccov-report-${TARGET_NAME}) + endif() + endif() + + # ALL + if(target_code_coverage_ALL) + if(NOT TARGET ccov-all-processing) + message( + FATAL_ERROR + "Calling target_code_coverage with 'ALL' must be after a call to 'add_code_coverage_all_targets'." + ) + endif() + + add_dependencies(ccov-all-processing ccov-run-${TARGET_NAME}) + endif() + endif() + endif() +endfunction() + +# Adds code coverage instrumentation to all targets in the current directory and +# any subdirectories. To add coverage instrumentation to only specific targets, +# use `target_code_coverage`. +function(add_code_coverage) + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" + OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + add_compile_options(-fprofile-instr-generate -fcoverage-mapping) + add_link_options(-fprofile-instr-generate -fcoverage-mapping) + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + add_compile_options(-fprofile-arcs -ftest-coverage) + link_libraries(gcov) + endif() +endfunction() + +# Adds the 'ccov-all' type targets that calls all targets added via +# `target_code_coverage` with the `ALL` parameter, but merges all the coverage +# data from them into a single large report instead of the numerous smaller +# reports. Also adds the ccov-all-capture Generates an all-merged.info file, for +# use with coverage dashboards (e.g. codecov.io, coveralls). +# ~~~ +# Optional: +# EXCLUDE <REGEX_PATTERNS> - Excludes files of the regex patterns provided from coverage. +# ~~~ +function(add_code_coverage_all_targets) + # Argument parsing + set(multi_value_keywords EXCLUDE) + cmake_parse_arguments(add_code_coverage_all_targets "" "" + "${multi_value_keywords}" ${ARGN}) + + if(CODE_COVERAGE) + if(CMAKE_C_COMPILER_ID MATCHES "[Cc]lang" + OR CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") + + # Merge the profile data for all of the run executables + add_custom_target( + ccov-all-processing + COMMAND + ${LLVM_PROFDATA_PATH} merge -o + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata -sparse `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/profraw.list`) + + # Regex exclude only available for LLVM >= 7 + if(LLVM_COV_VERSION VERSION_GREATER_EQUAL "7.0.0") + foreach(EXCLUDE_ITEM ${add_code_coverage_all_targets_EXCLUDE}) + set(EXCLUDE_REGEX ${EXCLUDE_REGEX} + -ignore-filename-regex='${EXCLUDE_ITEM}') + endforeach() + endif() + + # Print summary of the code coverage information to the command line + add_custom_target( + ccov-all-report + COMMAND + ${LLVM_COV_PATH} report `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + ${EXCLUDE_REGEX} + DEPENDS ccov-all-processing) + + # Export coverage information so continuous integration tools (e.g. + # Jenkins) can consume it + add_custom_target( + ccov-all-export + COMMAND + ${LLVM_COV_PATH} export `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -format="text" ${EXCLUDE_REGEX} > + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/coverage.json + DEPENDS ccov-all-processing) + + # Generate HTML output of all added targets for perusal + add_custom_target( + ccov-all + COMMAND + ${LLVM_COV_PATH} show `cat + ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/binaries.list` + -instr-profile=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.profdata + -show-line-counts-or-regions + -output-dir=${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged + -format="html" ${EXCLUDE_REGEX} + DEPENDS ccov-all-processing) + + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") + set(COVERAGE_INFO "${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged.info") + + # Nothing required for gcov + add_custom_target(ccov-all-processing COMMAND ;) + + # Exclusion regex string creation + foreach(EXCLUDE_ITEM ${add_code_coverage_all_targets_EXCLUDE}) + set(EXCLUDE_REGEX ${EXCLUDE_REGEX} --remove ${COVERAGE_INFO} + '${EXCLUDE_ITEM}') + endforeach() + + if(EXCLUDE_REGEX) + set(EXCLUDE_COMMAND ${LCOV_PATH} ${EXCLUDE_REGEX} --output-file + ${COVERAGE_INFO}) + else() + set(EXCLUDE_COMMAND ;) + endif() + + # Capture coverage data + add_custom_target( + ccov-all-capture + COMMAND ${CMAKE_COMMAND} -E remove ${COVERAGE_INFO} + COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture + --output-file ${COVERAGE_INFO} + COMMAND ${EXCLUDE_COMMAND} + DEPENDS ccov-all-processing) + + # Generates HTML output of all targets for perusal + add_custom_target( + ccov-all + COMMAND ${GENHTML_PATH} -o ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged + ${COVERAGE_INFO} + DEPENDS ccov-all-capture) + + endif() + + add_custom_command( + TARGET ccov-all + POST_BUILD + COMMAND ; + COMMENT + "Open ${CMAKE_COVERAGE_OUTPUT_DIRECTORY}/all-merged/index.html in your browser to view the coverage report." + ) + endif() +endfunction() diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake new file mode 100644 index 0000000..7a6c195 --- /dev/null +++ b/config/sanitizer/sanitizers.cmake @@ -0,0 +1,96 @@ +# +# Copyright (C) 2018 by George Cave - gcave@stablecoder.ca +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +set(USE_SANITIZER + "" + CACHE + STRING + "Compile with a sanitizer. Options are: Address, Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined'" +) + +function(append value) + foreach(variable ${ARGN}) + set(${variable} + "${${variable}} ${value}" + PARENT_SCOPE) + endforeach(variable) +endfunction() + +if(USE_SANITIZER) + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + + append("-fno-omit-frame-pointer" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + + if(UNIX) + + if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") + append("-O1" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + endif() + + if(USE_SANITIZER MATCHES "([Aa]ddress);([Uu]ndefined)" + OR USE_SANITIZER MATCHES "([Uu]ndefined);([Aa]ddress)") + message(STATUS "Building with Address, Undefined sanitizers") + append("-fsanitize=address,undefined" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + set(MEMCHECK_TYPE AddressSanitizer) + elseif(USE_SANITIZER MATCHES "([Aa]ddress)") + # Optional: -fno-optimize-sibling-calls -fsanitize-address-use-after-scope + message(STATUS "Building with Address sanitizer") + append("-fsanitize=address" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + set(MEMCHECK_TYPE AddressSanitizer) + elseif(USE_SANITIZER MATCHES "([Mm]emory([Ww]ith[Oo]rigins)?)") + # Optional: -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 + append("-fsanitize=memory" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + if(USE_SANITIZER MATCHES "([Mm]emory[Ww]ith[Oo]rigins)") + message(STATUS "Building with MemoryWithOrigins sanitizer") + append("-fsanitize-memory-track-origins" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + else() + message(STATUS "Building with Memory sanitizer") + endif() + set(MEMCHECK_TYPE MemorySanitizer) + elseif(USE_SANITIZER MATCHES "([Uu]ndefined)") + message(STATUS "Building with Undefined sanitizer") + append("-fsanitize=undefined" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + if(EXISTS "${BLACKLIST_FILE}") + append("-fsanitize-blacklist=${BLACKLIST_FILE}" CMAKE_C_FLAGS + CMAKE_CXX_FLAGS) + endif() + set(MEMCHECK_TYPE UndefinedBehaviorSanitizer) + elseif(USE_SANITIZER MATCHES "([Tt]hread)") + message(STATUS "Building with Thread sanitizer") + append("-fsanitize=thread" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + set(MEMCHECK_TYPE ThreadSanitizer) + elseif(USE_SANITIZER MATCHES "([Ll]eak)") + message(STATUS "Building with Leak sanitizer") + append("-fsanitize=leak" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + set(MEMCHECK_TYPE LeakSanitizer) + else() + message( + FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") + endif() + elseif(MSVC) + if(USE_SANITIZER MATCHES "([Aa]ddress)") + message(STATUS "Building with Address sanitizer") + append("-fsanitize=address" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + else() + message( + FATAL_ERROR + "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}" + ) + endif() + else() + message(FATAL_ERROR "USE_SANITIZER is not supported on this platform.") + endif() + +endif() diff --git a/config/sanitizer/tools.cmake b/config/sanitizer/tools.cmake new file mode 100644 index 0000000..a44022f --- /dev/null +++ b/config/sanitizer/tools.cmake @@ -0,0 +1,111 @@ +# +# Copyright (C) 2018 by George Cave - gcave@stablecoder.ca +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +option(CLANG_TIDY "Turns on clang-tidy processing if it is found." OFF) +option(IWYU "Turns on include-what-you-use processing if it is found." OFF) +option(CPPCHECK "Turns on cppcheck processing if it is found." OFF) + +# Adds clang-tidy checks to the compilation, with the given arguments being used +# as the options set. +macro(clang_tidy) + if(CLANG_TIDY AND CLANG_TIDY_EXE) + set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE} ${ARGN}) + endif() +endmacro() + +# Adds include_what_you_use to the compilation, with the given arguments being +# used as the options set. +macro(include_what_you_use) + if(IWYU AND IWYU_EXE) + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${IWYU_EXE};${IWYU_STRING}") + endif() +endmacro() + +# Adds cppcheck to the compilation, with the given arguments being used as the +# options set. +macro(cppcheck) + if(CPPCHECK AND CPPCHECK_EXE) + set(CMAKE_CXX_CPPCHECK "${CPPCHECK_EXE};${CPPCHECK_STRING}") + endif() +endmacro() + +find_program(CLANG_TIDY_EXE NAMES "clang-tidy") +if(CLANG_TIDY_EXE) + message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") + if(NOT CLANG_TIDY) + message(STATUS "clang-tidy NOT ENABLED via 'CLANG_TIDY' variable!") + set(CMAKE_CXX_CLANG_TIDY + "" + CACHE STRING "" FORCE) # delete it + endif() +elseif(CLANG_TIDY) + message(SEND_ERROR "Cannot enable clang-tidy, as executable not found!") + set(CMAKE_CXX_CLANG_TIDY + "" + CACHE STRING "" FORCE) # delete it +else() + message(STATUS "clang-tidy not found!") + set(CMAKE_CXX_CLANG_TIDY + "" + CACHE STRING "" FORCE) # delete it +endif() + +find_program(IWYU_EXE NAMES "include-what-you-use") +if(IWYU_EXE) + message(STATUS "include-what-you-use found: ${IWYU_EXE}") + if(NOT IWYU) + message(STATUS "include-what-you-use NOT ENABLED via 'IWYU' variable!") + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE + "" + CACHE STRING "" FORCE) # delete it + endif() +elseif(IWYU) + message( + SEND_ERROR "Cannot enable include-what-you-use, as executable not found!") + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE + "" + CACHE STRING "" FORCE) # delete it +else() + message(STATUS "include-what-you-use not found!") + set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE + "" + CACHE STRING "" FORCE) # delete it +endif() + +find_program(CPPCHECK_EXE NAMES "cppcheck") +if(CPPCHECK_EXE) + message(STATUS "cppcheck found: ${CPPCHECK_EXE}") + if(CPPECHECK) + set(CMAKE_CXX_CPPCHECK + "${CPPCHECK_EXE};--enable=warning,performance,portability,missingInclude;--template=\"[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)\";--suppress=missingIncludeSystem;--quiet;--verbose;--force" + ) + endif() + if(NOT CPPCHECK) + message(STATUS "cppcheck NOT ENABLED via 'CPPCHECK' variable!") + set(CMAKE_CXX_CPPCHECK + "" + CACHE STRING "" FORCE) # delete it + endif() +elseif(CPPCHECK) + message(SEND_ERROR "Cannot enable cppcheck, as executable not found!") + set(CMAKE_CXX_CPPCHECK + "" + CACHE STRING "" FORCE) # delete it +else() + message(STATUS "cppcheck not found!") + set(CMAKE_CXX_CPPCHECK + "" + CACHE STRING "" FORCE) # delete it +endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 9f42f95..89cafc8 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -67,6 +67,6 @@ if (H5_HAVE_PARALLEL) set_target_properties (ph5example PROPERTIES FOLDER examples) endif () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_EXAMPLES) include (CMakeTests.cmake) endif () diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index ea3b2c5..fd7f1dc 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -64,38 +64,40 @@ set (test_ex_CLEANFILES vds-eiger.h5 ) -# Remove any output file left over from previous test run -add_test ( - NAME EXAMPLES-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_CLEANFILES} -) -set_tests_properties (EXAMPLES-clear-objects PROPERTIES FIXTURES_SETUP clear_EXAMPLES) +if (HDF5_TEST_SERIAL) + # Remove any output file left over from previous test run + add_test ( + NAME EXAMPLES-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_CLEANFILES} + ) + set_tests_properties (EXAMPLES-clear-objects PROPERTIES FIXTURES_SETUP clear_EXAMPLES) -foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:${example}>) - else () - add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:${example}>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${example}.txt" - #-D "TEST_REFERENCE=${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (EXAMPLES-${example} PROPERTIES FIXTURES_REQUIRED clear_EXAMPLES) - if (last_test) - set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-${example}") -endforeach () + foreach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:${example}>) + else () + add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:${example}>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=${example}.txt" + #-D "TEST_REFERENCE=${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (EXAMPLES-${example} PROPERTIES FIXTURES_REQUIRED clear_EXAMPLES) + if (last_test) + set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "EXAMPLES-${example}") + endforeach () +endif () ### Windows pops up a modal permission dialog on this test -if (H5_HAVE_PARALLEL AND NOT WIN32) +if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL AND NOT WIN32) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5example> ${MPIEXEC_POSTFLAGS}) else () diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index e3b5759..0e275c7 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -60,7 +60,7 @@ main (void) float matrix[ADIM1][ADIM2]; /* Attribute data */ herr_t ret; /* Return value */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ unsigned i, j; /* Counters */ char string_out[80]; /* Buffer to read string attribute back */ int point_out; /* Buffer to read scalar attribute back */ @@ -189,7 +189,7 @@ main (void) /* * Find string attribute by iterating through all attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_ALL); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); for(i = 0; i < (unsigned)oinfo.num_attrs; i++) { attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT); atype = H5Aget_type(attr); diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index 229e465..fea1fa2 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -316,7 +316,7 @@ static void hard_link_example(void) { hid_t file_id; hid_t group_id; - H5L_info_t li; + H5L_info2_t li; /* Define the link class that we'll use to register "user-defined hard * links" using the callbacks we defined above. * A link class can have NULL for any callback except its traverse @@ -361,13 +361,13 @@ static void hard_link_example(void) * the target group's address. We do this by calling H5Lget_info * on a hard link to the object. */ - H5Lget_info(file_id, TARGET_GROUP, &li, H5P_DEFAULT); + H5Lget_info2(file_id, TARGET_GROUP, &li, H5P_DEFAULT); /* Now create a user-defined link. We give it the group's address * as its udata. */ - H5Lcreate_ud(file_id, UD_HARD_LINK_NAME, (H5L_type_t)UD_HARD_CLASS, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_ud(file_id, UD_HARD_LINK_NAME, (H5L_type_t)UD_HARD_CLASS, &(li.u.token), + sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT); /* The UD hard link has now incremented the group's reference count * like a normal hard link would. This means that we can unlink the @@ -404,23 +404,23 @@ static void hard_link_example(void) static herr_t UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size, hid_t lcpl_id) { - haddr_t addr; - hid_t target_obj = -1; + H5O_token_t token; + hid_t target_obj = H5I_INVALID_HID; herr_t ret_value = 0; /* Make sure that the address passed in looks valid */ - if(udata_size != sizeof(haddr_t)) + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } - addr = *((const haddr_t *) udata); + token = *((H5O_token_t *) udata); /* Open the object this link points to so that we can increment - * its reference count. This also ensures that the address passed + * its reference count. This also ensures that the token passed * in points to a real object (although this check is not perfect!) */ - target_obj= H5Oopen_by_addr(loc_group, addr); + target_obj = H5Oopen_by_token(loc_group, token); if(target_obj < 0) { ret_value = -1; @@ -448,23 +448,23 @@ done: static herr_t UD_hard_delete(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size) { - haddr_t addr; - hid_t target_obj = -1; + H5O_token_t token; + hid_t target_obj = H5I_INVALID_HID; herr_t ret_value = 0; /* Sanity check; we have already verified the udata's size in the creation * callback. */ - if(udata_size != sizeof(haddr_t)) + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } - addr = *((const haddr_t *) udata); + token = *((H5O_token_t *) udata); /* Open the object this link points to */ - target_obj= H5Oopen_by_addr(loc_group, addr); + target_obj = H5Oopen_by_token(loc_group, token); if(target_obj < 0) { ret_value = -1; @@ -492,21 +492,21 @@ done: static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id) { - haddr_t addr; - hid_t ret_value = -1; + H5O_token_t token; + hid_t ret_value = H5I_INVALID_HID; /* Sanity check; we have already verified the udata's size in the creation * callback. */ - if(udata_size != sizeof(haddr_t)) - return -1; + if(udata_size != sizeof(H5O_token_t)) + return H5I_INVALID_HID; - addr = *((const haddr_t *) udata); + token = *((H5O_token_t *) udata); - /* Open the object by address. If H5Oopen_by_addr fails, ret_value will + /* Open the object by token. If H5Oopen_by_token fails, ret_value will * be negative to indicate that the traversal function failed. */ - ret_value = H5Oopen_by_addr(cur_group, addr); + ret_value = H5Oopen_by_token(cur_group, token); return ret_value; } @@ -621,7 +621,7 @@ static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id) { char * path; - hid_t ret_value = -1; + hid_t ret_value = H5I_INVALID_HID; /* If the link property isn't set or can't be found, traversal fails. */ if(H5Pexist(lapl_id, PLIST_LINK_PROP) < 0) @@ -638,7 +638,7 @@ static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group, return ret_value; error: - return -1; + return H5I_INVALID_HID; } diff --git a/examples/h5_group.c b/examples/h5_group.c index 8e89165..75bed91 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -26,9 +26,9 @@ #define H5FILE_NAME "group.h5" #define RANK 2 -static herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, +static herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata); /* Link iteration operator function */ -static herr_t group_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, +static herr_t group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata); /* Link iteration operator function */ int main(void) @@ -135,7 +135,7 @@ main(void) /* * Use iterator to see the names of the objects in the root group. */ - idx_f = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + idx_f = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); /* * Unlink name "Data" and use iterator to see the names @@ -146,13 +146,13 @@ main(void) else printf("\"Data\" is unlinked \n"); - idx_f = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + idx_f = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); /* * Use iterator to see the names of the objects in the group * /Data_new. */ - idx_g = H5Literate_by_name(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL, H5P_DEFAULT); + idx_g = H5Literate_by_name2(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL, H5P_DEFAULT); /* * Close the file. @@ -168,7 +168,7 @@ main(void) * Operator function. */ static herr_t -file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) +file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata) { /* avoid compiler warnings */ loc_id = loc_id; @@ -189,7 +189,7 @@ file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) * Operator function. */ static herr_t -group_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) +group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata) { hid_t did; /* dataset identifier */ hid_t tid; /* datatype identifier */ diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 800d4d4..40ca466 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -308,8 +308,8 @@ echo "***"Version compatibility tests. # If H5_NO_DEPRECATED_SYMBOLS; # then only v18main works. # else if H5_USE_16_API_DEFAULT; -# then v16main works and -DH5_NO_DEPRECATED_SYMBOLS v18main also works. -# else v18main works and -DH5_USE_16_API_DEFAULT v16main also works. +# then v16main works. +# else v18main works and -DH5_USE_16_API_DEFAULT v16main also works. # if [ -n "$H5_USE_16_API_DEFAULT" ]; then echo "H5_USE_16_API_DEFAULT is defined." @@ -326,7 +326,6 @@ if [ -n "$H5_NO_DEPRECATED_SYMBOLS" ]; then TOOLTEST $v18main elif [ -n "$H5_USE_16_API_DEFAULT" ]; then TOOLTEST $v16main - TOOLTEST -DH5_NO_DEPRECATED_SYMBOLS $v18main else TOOLTEST -DH5_USE_16_API_DEFAULT $v16main TOOLTEST $v18main diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index e8dddd3..be98963 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -173,6 +173,6 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) endif () endif () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_FORTRAN AND HDF5_TEST_EXAMPLES) include (CMakeTests.cmake) endif () diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index 5e7dfa8..a52375b 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -16,77 +16,79 @@ ############################################################################## ############################################################################## -set (test_ex_fortran_CLEANFILES - compound.h5 - copy1.h5 - copy2.h5 - dsetf.h5 - extend.h5 - FORTRAN.h5 - groupf.h5 - groupsf.h5 - h5_cmprss.h5 - mount1.h5 - mount2.h5 - sdsf.h5 - subset.h5 - SDScompound.h5 - test.h5 -) +if (HDF5_TEST_SERIAL) + set (test_ex_fortran_CLEANFILES + compound.h5 + copy1.h5 + copy2.h5 + dsetf.h5 + extend.h5 + FORTRAN.h5 + groupf.h5 + groupsf.h5 + h5_cmprss.h5 + mount1.h5 + mount2.h5 + sdsf.h5 + subset.h5 + SDScompound.h5 + test.h5 + ) -# Remove any output file left over from previous test run -add_test ( - NAME f90_ex-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_fortran_CLEANFILES} -) -set_tests_properties (f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_f90_ex) + # Remove any output file left over from previous test run + add_test ( + NAME f90_ex-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_fortran_CLEANFILES} + ) + set_tests_properties (f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_f90_ex) -foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:f90_ex_${example}>) - else () - add_test (NAME f90_ex_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:f90_ex_${example}>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f90_ex_${example}.txt" - #-D "TEST_REFERENCE=f90_ex_${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (f90_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) - if (last_test) - set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex_${example}") -endforeach () + foreach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:f90_ex_${example}>) + else () + add_test (NAME f90_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:f90_ex_${example}>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=f90_ex_${example}.txt" + #-D "TEST_REFERENCE=f90_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (f90_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) + if (last_test) + set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "f90_ex_${example}") + endforeach () -foreach (example ${F2003_examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:f03_ex_${example}>) - else () - add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f03_ex_${example}.txt" - #-D "TEST_REFERENCE=f03_ex_${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (f03_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) - if (last_test) - set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f03_ex_${example}") -endforeach () + foreach (example ${F2003_examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME f03_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:f03_ex_${example}>) + else () + add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=f03_ex_${example}.txt" + #-D "TEST_REFERENCE=f03_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (f03_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) + if (last_test) + set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "f03_ex_${example}") + endforeach () +endif () -if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) +if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL AND MPI_Fortran_FOUND) add_test (NAME MPI_TEST_f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS}) endif () diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index 31a18fc..5e5bcc0 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -137,13 +137,13 @@ int_f h5aget_num_attrs_c (hid_t_f *obj_id, int_f *attr_num) /******/ { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int_f ret_value = 0; /* Return value */ /* * Call H5Oget_info function. */ - if(H5Oget_info2((hid_t)*obj_id, &oinfo, H5O_INFO_NUM_ATTRS) < 0) + if(H5Oget_info3((hid_t)*obj_id, &oinfo, H5O_INFO_NUM_ATTRS) < 0) HGOTO_DONE(FAIL); /* Set number of attributes */ diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index def67e1..770752d 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -170,7 +170,7 @@ h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name, int_f *obj_namelen, int_f *obj_type) /******/ { - H5O_info_t oinfo; + H5O_info2_t oinfo; hid_t c_loc_id = (hid_t)*loc_id; char *c_name = NULL; size_t c_obj_namelen; @@ -200,7 +200,7 @@ h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, /* Query the object's information */ if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, c_obj_name, c_obj_namelen, H5P_DEFAULT) < 0) goto DONE; - if(H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) goto DONE; /* XXX: Switch from using H5Gget_objtype_by_idx() means that this routine won't diff --git a/fortran/src/H5Lf.c b/fortran/src/H5Lf.c index 31fedfd..b5ff7f2 100644 --- a/fortran/src/H5Lf.c +++ b/fortran/src/H5Lf.c @@ -441,7 +441,7 @@ done: * H5L_LINK_SOFT_F - Soft link * H5L_LINK_EXTERNAL_F - External link * H5L_LINK_ERROR_F - Error - * address - If the link is a hard link, address specifies the file address that the link points to + * token - If the link is a hard link, token specifies the token for the object that the link points to * val_size - If the link is a symbolic link, val_size will be the length of the link value * * RETURNS @@ -456,13 +456,12 @@ done: int_f h5lget_info_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, int_f *cset, int_f *corder, int_f *corder_valid, int_f *link_type, - haddr_t_f *address, size_t_f *val_size, - hid_t_f *lapl_id) + H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id) /******/ { char *c_link_name = NULL; /* Buffer to hold C string */ int_f ret_value = 0; /* Return value */ - H5L_info_t link_buff; + H5L_info2_t link_buff; /* * Convert FORTRAN name to C name @@ -473,7 +472,7 @@ h5lget_info_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, /* * Call H5Linfo function. */ - if(H5Lget_info((hid_t)*link_loc_id, c_link_name, &link_buff, (hid_t)*lapl_id) < 0) + if(H5Lget_info2((hid_t)*link_loc_id, c_link_name, &link_buff, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); /* Unpack the structure */ @@ -482,7 +481,7 @@ h5lget_info_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, *corder_valid = 0; if(link_buff.corder_valid > 0) *corder_valid = 1; *link_type = (int_f)link_buff.type; - *address = (haddr_t_f)link_buff.u.address; + *token = link_buff.u.token; *val_size = (size_t_f)link_buff.u.val_size; done: @@ -525,14 +524,15 @@ done: int_f h5lget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, int_f *index_field, int_f *order, hsize_t_f *n, - int_f *link_type, int_f *corder_valid, int_f *corder, int_f *cset, haddr_t_f *address, size_t_f *val_size, hid_t_f *lapl_id) + int_f *link_type, int_f *corder_valid, int_f *corder, + int_f *cset, H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id) /******/ { char *c_group_name = NULL; /* Buffer to hold C string */ H5_index_t c_index_field; H5_iter_order_t c_order; int_f ret_value = 0; /* Return value */ - H5L_info_t link_buff; + H5L_info2_t link_buff; /* * Convert FORTRAN name to C name @@ -545,7 +545,7 @@ h5lget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, /* * Call H5Linfo_by_idx function. */ - if(H5Lget_info_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, + if(H5Lget_info_by_idx2((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, &link_buff, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); @@ -557,7 +557,7 @@ h5lget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, *corder = (int_f)link_buff.corder; *cset = (int_f)link_buff.cset; *link_type = (int_f)link_buff.type; - *address = (haddr_t_f)link_buff.u.address; + *token = link_buff.u.token; *val_size = (size_t_f)link_buff.u.val_size; done: @@ -988,7 +988,7 @@ done: * SOURCE */ int_f -h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate_t op, void *op_data ) +h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data ) /******/ { int_f ret_value = -1; /* Return value */ @@ -1001,7 +1001,7 @@ h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx, * Call H5Linterate */ - func_ret_value = H5Literate( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, &idx_c, op, op_data); + func_ret_value = H5Literate2( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, &idx_c, op, op_data); ret_value = (int_f)func_ret_value; *idx = (hsize_t_f)idx_c; @@ -1038,7 +1038,7 @@ h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx, * SOURCE */ int_f -h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate_t op, void *op_data, hid_t_f *lapl_id) +h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data, hid_t_f *lapl_id) /******/ { int_f ret_value = -1; /* Return value */ @@ -1058,7 +1058,7 @@ h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, int_f *index * Call H5Linterate */ - func_ret_value = H5Literate_by_name((hid_t)*loc_id, c_name,(H5_index_t)*index_type,(H5_iter_order_t)*order,&idx_c,op,op_data,(hid_t)*lapl_id); + func_ret_value = H5Literate_by_name2((hid_t)*loc_id, c_name,(H5_index_t)*index_type,(H5_iter_order_t)*order,&idx_c,op,op_data,(hid_t)*lapl_id); ret_value = (int_f)func_ret_value; *idx = (hsize_t_f)idx_c; diff --git a/fortran/src/H5Lff.F90 b/fortran/src/H5Lff.F90 index d5bb1d1..f672547 100644 --- a/fortran/src/H5Lff.F90 +++ b/fortran/src/H5Lff.F90 @@ -46,7 +46,7 @@ MODULE H5L ! Fortran2003 Derived Type: ! TYPE, bind(c) :: union_t - INTEGER(haddr_t) :: address + TYPE(H5O_TOKEN_T_F) :: token INTEGER(size_t) :: val_size END TYPE union_t @@ -604,7 +604,7 @@ CONTAINS ! H5L_TYPE_SOFT_F - Soft link ! H5L_TYPE_EXTERNAL_F - External link ! H5L_TYPE_ERROR_ F - Error -! address - If the link is a hard link, address specifies the file address that the link points to +! token - If the link is a hard link, token specifies the object token that the link points to ! val_size - If the link is a symbolic link, val_size will be the length of the link value, e.g., ! the length of the name of the pointed-to object with a null terminator. ! hdferr - Returns 0 if successful and -1 if fails @@ -625,7 +625,7 @@ CONTAINS ! ! SOURCE SUBROUTINE h5lget_info_f(link_loc_id, link_name, & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & hdferr, lapl_id) IMPLICIT NONE @@ -641,7 +641,7 @@ CONTAINS ! H5L_TYPE_SOFT_F - Soft link ! H5L_TYPE_EXTERNAL_F - External link ! H5L_TYPE_ERROR _F - Error - INTEGER(HADDR_T), INTENT(OUT) :: address ! If the link is a hard link, address specifies the file address that the link points to + TYPE(H5O_TOKEN_T_F), INTENT(OUT), TARGET :: token ! If the link is a hard link, token specifies the object token that the link points to INTEGER(SIZE_T), INTENT(OUT) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value, e.g., ! the length of the name of the pointed-to object with a null terminator. INTEGER, INTENT(OUT) :: hdferr ! Error code: @@ -654,17 +654,17 @@ CONTAINS INTERFACE INTEGER FUNCTION h5lget_info_c(link_loc_id, link_name, link_namelen, & - cset, corder, corder_valid, link_type, address, val_size, & + cset, corder, corder_valid, link_type, token, val_size, & lapl_id_default) BIND(C,NAME='h5lget_info_c') IMPORT :: c_char - IMPORT :: HID_T, SIZE_T, HADDR_T + IMPORT :: HID_T, SIZE_T, H5O_TOKEN_T_F IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: link_loc_id CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: link_name INTEGER, INTENT(OUT) :: cset INTEGER, INTENT(OUT) :: corder INTEGER, INTENT(OUT) :: link_type - INTEGER(HADDR_T), INTENT(OUT) :: address + TYPE(H5O_TOKEN_T_F), INTENT(OUT) :: token INTEGER(SIZE_T), INTENT(OUT) :: val_size INTEGER(HID_T) :: lapl_id_default INTEGER(SIZE_T) :: link_namelen @@ -677,10 +677,8 @@ CONTAINS lapl_id_default = H5P_DEFAULT_F IF(PRESENT(lapl_id)) lapl_id_default = lapl_id - hdferr = h5lget_info_c(link_loc_id, link_name, link_namelen, & - cset, corder, corder_valid, link_type, & - address, val_size, & - lapl_id_default) + hdferr = h5lget_info_c(link_loc_id, link_name, link_namelen, cset, & + corder, corder_valid, link_type, token, val_size, lapl_id_default) f_corder_valid =.FALSE. IF(corder_valid .EQ. 1) f_corder_valid =.TRUE. @@ -708,8 +706,8 @@ CONTAINS ! corder_valid - Indicates whether the creation order data is valid for this attribute ! corder - Is a positive integer containing the creation order of the attribute ! cset - Indicates the character set used for the attribute’s name -! address - If the link is a hard link, address specifies the file address that the link points to -! val_size - If the link is a symbolic link, val_size will be the length of the link value, e.g., +! token - If the link is a hard link, token specifies the object token that the link points to +! val_size - If the link is a symbolic link, val_size will be the length of the link value, e.g., ! the length of the name of the pointed-to object with a null terminator. ! hdferr - Returns 0 if successful and -1 if fails ! @@ -729,7 +727,7 @@ CONTAINS ! ! SOURCE SUBROUTINE h5lget_info_by_idx_f(loc_id, group_name, index_field, order, n, & - link_type, f_corder_valid, corder, cset, address, val_size, hdferr, lapl_id) + link_type, f_corder_valid, corder, cset, token, val_size, hdferr, lapl_id) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier specifying location of subject group CHARACTER(LEN=*), INTENT(IN) :: group_name ! Name of subject group @@ -752,7 +750,7 @@ CONTAINS LOGICAL, INTENT(OUT) :: f_corder_valid ! Indicates whether the creation order data is valid for this attribute INTEGER, INTENT(OUT) :: corder ! Is a positive integer containing the creation order of the attribute INTEGER, INTENT(OUT) :: cset ! Indicates the character set used for the attribute’s name - INTEGER(HADDR_T), INTENT(OUT) :: address ! If the link is a hard link, address specifies the file address that the link points to + TYPE(H5O_TOKEN_T_F), INTENT(OUT), TARGET :: token ! If the link is a hard link, token specifies the object token that the link points to INTEGER(SIZE_T), INTENT(OUT) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value, e.g., ! the length of the name of the pointed-to object with a null terminator. INTEGER, INTENT(OUT) :: hdferr ! Error code: @@ -767,10 +765,10 @@ CONTAINS ! INTERFACE INTEGER FUNCTION h5lget_info_by_idx_c(loc_id, group_name, group_namelen, index_field, order, n, & - link_type, corder_valid, corder, cset, address, val_size, lapl_id_default) & + link_type, corder_valid, corder, cset, token, val_size, lapl_id_default) & BIND(C,NAME='h5lget_info_by_idx_c') IMPORT :: c_char - IMPORT :: HID_T, SIZE_T, HSIZE_T, HADDR_T + IMPORT :: HID_T, SIZE_T, HSIZE_T, H5O_TOKEN_T_F IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: loc_id CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: group_name @@ -779,10 +777,10 @@ CONTAINS INTEGER, INTENT(IN) :: order INTEGER(HSIZE_T), INTENT(IN) :: n INTEGER, INTENT(OUT) :: link_type - INTEGER :: corder_valid + INTEGER :: corder_valid INTEGER, INTENT(OUT) :: corder INTEGER, INTENT(OUT) :: cset - INTEGER(HADDR_T), INTENT(OUT) :: address + TYPE(H5O_TOKEN_T_F), INTENT(OUT) :: token INTEGER(SIZE_T), INTENT(OUT) :: val_size INTEGER(HID_T) :: lapl_id_default END FUNCTION h5lget_info_by_idx_c @@ -794,7 +792,7 @@ CONTAINS IF(PRESENT(lapl_id)) lapl_id_default = lapl_id hdferr = h5lget_info_by_idx_c(loc_id, group_name, group_namelen, index_field, order, n, & - link_type, corder_valid, corder, cset, address, val_size, lapl_id_default) + link_type, corder_valid, corder, cset, token, val_size, lapl_id_default) f_corder_valid =.FALSE. IF (corder_valid .EQ. 1) f_corder_valid =.TRUE. diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 08305ea..9780814 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -22,10 +22,10 @@ #include "H5f90.h" #include "H5Eprivate.h" int_f -fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info); +fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info); int_f -fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) { +fill_h5o_info_t_f(H5O_info2_t Oinfo, H5O_info_t_f *object_info) { /* This function does not used the field parameter because we want * this function to fill the unfilled fields with C's default values. @@ -34,7 +34,7 @@ fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) { struct tm *ts; object_info->fileno = Oinfo.fileno; - object_info->addr = (haddr_t_f)Oinfo.addr; + object_info->token = Oinfo.token; object_info->type = (int_f)Oinfo.type; object_info->rc = (int_f)Oinfo.rc; @@ -85,24 +85,6 @@ fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) { object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs; - object_info->hdr.version = (int_f)Oinfo.hdr.version; - object_info->hdr.nmesgs = (int_f)Oinfo.hdr.nmesgs; - object_info->hdr.nchunks = (int_f)Oinfo.hdr.nchunks; - object_info->hdr.flags = (int_f)Oinfo.hdr.flags; - - object_info->hdr.space.total = (hsize_t_f)Oinfo.hdr.space.total; - object_info->hdr.space.meta = (hsize_t_f)Oinfo.hdr.space.meta; - object_info->hdr.space.mesg = (hsize_t_f)Oinfo.hdr.space.mesg; - object_info->hdr.space.free = (hsize_t_f)Oinfo.hdr.space.free; - - object_info->hdr.mesg.present = Oinfo.hdr.mesg.present; - object_info->hdr.mesg.shared = Oinfo.hdr.mesg.shared; - - object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size; - object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size; - object_info->meta_size.attr.index_size = (hsize_t_f)Oinfo.meta_size.attr.index_size; - object_info->meta_size.attr.heap_size = (hsize_t_f)Oinfo.meta_size.attr.heap_size; - return 0; } @@ -248,34 +230,35 @@ h5oclose_c ( hid_t_f *object_id ) * SOURCE */ int_f -h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data, int_f *fields ) +h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate2_t op, + void *op_data, int_f *fields ) /******/ { int_f ret_value = -1; /* Return value */ herr_t func_ret_value; /* H5Linterate return value */ /* - * Call H5Ovisit2 + * Call H5Ovisit */ - func_ret_value = H5Ovisit2( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, (unsigned)*fields); + func_ret_value = H5Ovisit3( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, (unsigned)*fields); ret_value = (int_f)func_ret_value; return ret_value; } -/****if* H5Of/h5oopen_by_addr_c +/****if* H5Of/h5oopen_by_token_c * NAME - * h5oopen_by_addr_c + * h5oopen_by_token_c * PURPOSE - * Calls H5open_by_addr + * Calls H5open_by_token * INPUTS - * loc_id - File or group identifier - * addr - Object’s address in the file + * loc_id - File or group identifier + * token - Object’s token in the file * * OUTPUTS - * obj_id - Dataset identifier + * obj_id - Object identifier * * RETURNS * 0 on success, -1 on failure @@ -285,15 +268,15 @@ h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, * SOURCE */ int_f -h5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) +h5oopen_by_token_c(hid_t_f *loc_id, H5O_token_t *token, hid_t_f *obj_id) /******/ { int_f ret_value = 0; /* Return value */ /* - * Call H5Oopen_by_address function. + * Call H5Oopen_by_token function. */ - if((*obj_id = (hid_t_f)H5Oopen_by_addr((hid_t)*loc_id, (haddr_t)*addr)) < 0) + if((*obj_id = (hid_t_f)H5Oopen_by_token((hid_t)*loc_id, *token)) < 0) HGOTO_DONE(FAIL); done: @@ -328,7 +311,7 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l { char *c_name = NULL; /* Buffer to hold C string */ int_f ret_value = 0; /* Return value */ - H5O_info_t Oinfo; + H5O_info2_t Oinfo; /* * Convert FORTRAN name to C name @@ -339,7 +322,7 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l /* * Call H5Oinfo_by_name function. */ - if(H5Oget_info_by_name2((hid_t)*loc_id, c_name, + if(H5Oget_info_by_name3((hid_t)*loc_id, c_name, &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); @@ -379,10 +362,10 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, { char *c_group_name = NULL; /* Buffer to hold C string */ int_f ret_value = 0; /* Return value */ - H5O_info_t Oinfo; + H5O_info2_t Oinfo; H5_index_t c_index_field; H5_iter_order_t c_order; - + /* * Convert FORTRAN name to C name */ @@ -395,7 +378,7 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, /* * Call H5Oinfo_by_idx function. */ - if(H5Oget_info_by_idx2((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, + if(H5Oget_info_by_idx3((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); @@ -430,12 +413,12 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields) /******/ { int_f ret_value = 0; /* Return value */ - H5O_info_t Oinfo; - + H5O_info2_t Oinfo; + /* * Call H5Oinfo_by_name function. */ - if(H5Oget_info2((hid_t)*object_id, &Oinfo, (unsigned)*fields) < 0) + if(H5Oget_info3((hid_t)*object_id, &Oinfo, (unsigned)*fields) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -528,7 +511,7 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, */ int_f h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order, - H5O_iterate_t op, void *op_data, hid_t_f *lapl_id, int_f *fields ) + H5O_iterate2_t op, void *op_data, hid_t_f *lapl_id, int_f *fields ) /******/ { int_f ret_value = -1; /* Return value */ @@ -542,9 +525,9 @@ h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f HGOTO_DONE(FAIL); /* - * Call H5Ovisit + * Call H5Ovisit_by_name */ - func_ret_value = H5Ovisit_by_name2( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, + func_ret_value = H5Ovisit_by_name3( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, (unsigned)*fields, (hid_t)*lapl_id); ret_value = (int_f)func_ret_value; @@ -934,3 +917,41 @@ h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, return ret_value; } + +/****if* H5Of/h5otoken_cmp_c + * NAME + * h5otoken_cmp_c + * PURPOSE + * Calls H5Otoken_cmp + * INPUTS + * loc_id - Identifier of an object in the file / container. + * token1 - The first token to compare. + * token2 - The second token to compare. + * cmp_value - Whether the tokens are equal. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * Quincey Koziol + * January 10, 2019 + * SOURCE +*/ +int_f +h5otoken_cmp_c(hid_t_f *loc_id, H5O_token_t *token1, H5O_token_t *token2, + int_f *cmp_value_f) +/******/ +{ + int cmp_value; /* Token comparison result */ + int_f ret_value = 0; /* Return value */ + + /* Call H5Otoken_cmp function */ + cmp_value = 0; + if(H5Otoken_cmp((hid_t)*loc_id, token1, token2, &cmp_value) < 0) + HGOTO_DONE(FAIL); + + /* Set the comparison value to return */ + *cmp_value_f = cmp_value; + +done: + return ret_value; +} + diff --git a/fortran/src/H5Off.F90 b/fortran/src/H5Off.F90 index 8c77230..2b025a7 100644 --- a/fortran/src/H5Off.F90 +++ b/fortran/src/H5Off.F90 @@ -44,7 +44,43 @@ MODULE H5O USE H5GLOBAL IMPLICIT NONE -!****t* H5T (F03)/h5o_info_t +!****t* H5O (F03)/h5o_info_t +! +! Fortran2003 Derived Type: +! + TYPE, BIND(C) :: h5o_info_t + INTEGER(C_LONG) :: fileno ! File number that object is located in + TYPE(H5O_TOKEN_T_F) :: token ! Token for object in file + INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.) + INTEGER :: rc ! Reference count of object + + INTEGER, DIMENSION(8) :: atime ! Access time ! -- NOTE -- + INTEGER, DIMENSION(8) :: mtime ! Modification time ! Returns an integer array + INTEGER, DIMENSION(8) :: ctime ! Change time ! as specified in the Fortran + INTEGER, DIMENSION(8) :: btime ! Birth time ! intrinsic DATE_AND_TIME(VALUES) + + INTEGER(hsize_t) :: num_attrs ! # of attributes attached to object + END TYPE h5o_info_t + +! C interoperable structure for h5o_info_t. The Fortran derived type returns the time +! values as an integer array as specified in the Fortran intrinsic DATE_AND_TIME(VALUES). +! Whereas, this derived type does not. + + TYPE, BIND(C) :: c_h5o_info_t + INTEGER(C_LONG) :: fileno ! File number that object is located in + TYPE(H5O_TOKEN_T_F) :: token ! Token for object in file + INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.) + INTEGER(C_INT) :: rc ! Reference count of object + + INTEGER(KIND=TIME_T) :: atime ! Access time + INTEGER(KIND=TIME_T) :: mtime ! Modify time + INTEGER(KIND=TIME_T) :: ctime ! Create time + INTEGER(KIND=TIME_T) :: btime ! Birth time + + INTEGER(hsize_t) :: num_attrs ! # of attributes attached to object + END TYPE c_h5o_info_t + +!****t* H5O (F03)/h5o_native_info_t ! ! Fortran2003 Derived Type: ! @@ -59,13 +95,13 @@ MODULE H5O INTEGER(c_int64_t) :: present ! Flags to indicate presence of message type in header INTEGER(c_int64_t) :: shared ! Flags to indicate message type is shared in header END TYPE mesg_t - + TYPE, BIND(C) :: hdr_t INTEGER :: version ! Version number of header format in file INTEGER :: nmesgs ! Number of object header messages INTEGER :: nchunks ! Number of object header chunks INTEGER :: flags ! Object header status flags - TYPE(space_t) :: space + TYPE(space_t) :: space TYPE(mesg_t) :: mesg END TYPE hdr_t @@ -74,7 +110,7 @@ MODULE H5O INTEGER(C_INT) :: nmesgs ! Number of object header messages INTEGER(C_INT) :: nchunks ! Number of object header chunks INTEGER(C_INT) :: flags ! Object header status flags - TYPE(space_t) :: space + TYPE(space_t) :: space TYPE(mesg_t) :: mesg END TYPE c_hdr_t @@ -88,46 +124,17 @@ MODULE H5O TYPE(H5_ih_info_t) :: obj ! v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets TYPE(H5_ih_info_t) :: attr ! v2 B-tree & heap for attributes ENDTYPE meta_size_t - - TYPE, BIND(C) :: h5o_info_t - INTEGER(C_LONG) :: fileno ! File number that object is located in - INTEGER(haddr_t) :: addr ! Object address in file - INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.) - INTEGER :: rc ! Reference count of object - - INTEGER, DIMENSION(8) :: atime ! Access time ! -- NOTE -- - INTEGER, DIMENSION(8) :: mtime ! Modification time ! Returns an integer array - INTEGER, DIMENSION(8) :: ctime ! Change time ! as specified in the Fortran - INTEGER, DIMENSION(8) :: btime ! Birth time ! intrinsic DATE_AND_TIME(VALUES) - - INTEGER(hsize_t) :: num_attrs ! # of attributes attached to object + TYPE, BIND(C) :: h5o_native_info_t TYPE(hdr_t) :: hdr - TYPE(meta_size_t) :: meta_size - END TYPE h5o_info_t - -! C interoperable structure for h5o_info_t. The Fortran derived type returns the time -! values as an integer array as specified in the Fortran intrinsic DATE_AND_TIME(VALUES). -! Whereas, this derived type does not. - - TYPE, BIND(C) :: c_h5o_info_t - INTEGER(C_LONG) :: fileno ! File number that object is located in - INTEGER(haddr_t) :: addr ! Object address in file - INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.) - INTEGER(C_INT) :: rc ! Reference count of object - - INTEGER(KIND=TIME_T) :: atime ! Access time - INTEGER(KIND=TIME_T) :: mtime ! modify time - INTEGER(KIND=TIME_T) :: ctime ! create time - INTEGER(KIND=TIME_T) :: btime ! Access time - - INTEGER(hsize_t) :: num_attrs ! # of attributes attached to object + END TYPE h5o_native_info_t +! C interoperable structure for h5o_native_info_t. + TYPE, BIND(C) :: c_h5o_native_info_t TYPE(c_hdr_t) :: hdr - TYPE(meta_size_t) :: meta_size - END TYPE c_h5o_info_t + END TYPE c_h5o_native_info_t !***** @@ -292,46 +299,46 @@ CONTAINS END SUBROUTINE h5oclose_f ! -!****s* H5O/h5open_by_addr_f -! NAME -! h5oopen_by_addr_f +!****s* H5O/h5oopen_by_token_f +! NAME +! h5oopen_by_token_f ! ! PURPOSE -! Opens an object using its address within an HDF5 file. +! Opens an object using its token within an HDF5 file. ! -! Inputs: +! Inputs: ! loc_id - File or group identifier. -! addr - Object’s address in the file. +! token - Object’s token in the file. ! ! Outputs: ! obj_id - Object identifier for the opened object. ! hdferr - Returns 0 if successful and -1 if fails. ! -! AUTHOR +! AUTHOR ! M. Scot Breitenfeld ! September 14, 2009 -! +! ! Fortran90 Interface: - SUBROUTINE h5oopen_by_addr_f(loc_id, addr, obj_id, hdferr) + SUBROUTINE h5oopen_by_token_f(loc_id, token, obj_id, hdferr) IMPLICIT NONE - INTEGER(HID_T) , INTENT(IN) :: loc_id - INTEGER(HADDR_T), INTENT(IN) :: addr - INTEGER(HID_T) , INTENT(OUT) :: obj_id - INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN) :: loc_id + TYPE(H5O_TOKEN_T_F), INTENT(IN) :: token + INTEGER(HID_T) , INTENT(OUT) :: obj_id + INTEGER , INTENT(OUT) :: hdferr !***** INTERFACE - INTEGER FUNCTION h5oopen_by_addr_c(loc_id, addr, obj_id) BIND(C,NAME='h5oopen_by_addr_c') - IMPORT :: HID_T, HADDR_T + INTEGER FUNCTION h5oopen_by_token_c(loc_id, token, obj_id) BIND(C,NAME='h5oopen_by_token_c') + IMPORT :: HID_T, H5O_TOKEN_T_F IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: loc_id - INTEGER(HADDR_T), INTENT(IN) :: addr + TYPE(H5O_TOKEN_T_F), INTENT(IN) :: token INTEGER(HID_T), INTENT(OUT) :: obj_id - END FUNCTION h5oopen_by_addr_c + END FUNCTION h5oopen_by_token_c END INTERFACE - hdferr = h5oopen_by_addr_c(loc_id, addr, obj_id) + hdferr = h5oopen_by_token_c(loc_id, token, obj_id) - END SUBROUTINE h5oopen_by_addr_f + END SUBROUTINE h5oopen_by_token_f ! !****s* H5O/h5ocopy_f ! NAME @@ -966,7 +973,7 @@ CONTAINS CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name INTEGER(SIZE_T) , INTENT(IN) :: namelen INTEGER(HID_T) , INTENT(IN) :: lapl_id_default - TYPE(C_PTR),VALUE :: object_info + TYPE(C_PTR), VALUE :: object_info INTEGER , INTENT(IN) :: fields END FUNCTION h5oget_info_by_name_c END INTERFACE @@ -1212,5 +1219,50 @@ CONTAINS END SUBROUTINE h5ovisit_by_name_f +!****s* H5O/h5otoken_cmp_f +! NAME +! h5otoken_cmp_f +! +! PURPOSE +! Compare two tokens, which must be from the same file / containers. +! +! Inputs: +! loc_id - Identifier of an object in the file / container. +! token1 - The first token to compare. +! token2 - The second token to compare. +! +! Outputs: +! cmp_value - Returns 0 if tokens are equal, non-zero for unequal tokens. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! Quincey Koziol +! January 10, 2019 +! +! Fortran90 Interface: + SUBROUTINE h5otoken_cmp_f(loc_id, token1, token2, cmp_value, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + TYPE(H5O_TOKEN_T_F), INTENT(IN) :: token1 ! First token + TYPE(H5O_TOKEN_T_F), INTENT(IN) :: token2 ! First token + INTEGER , INTENT(OUT) :: cmp_value + INTEGER , INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER FUNCTION h5otoken_cmp_c(loc_id, token1, token2, cmp_value) BIND(C,NAME='h5otoken_cmp_c') + IMPORT :: HID_T, C_PTR, H5O_TOKEN_T_F + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: loc_id + TYPE(H5O_TOKEN_T_F), INTENT(IN) :: token1 ! First token + TYPE(H5O_TOKEN_T_F), INTENT(IN) :: token2 ! First token + INTEGER, INTENT(OUT) :: cmp_value + + END FUNCTION h5otoken_cmp_c + END INTERFACE + + hdferr = h5otoken_cmp_c(loc_id, token1, token2, cmp_value) + + END SUBROUTINE h5otoken_cmp_f + END MODULE H5O diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 index e21f38f..eea9dfe 100644 --- a/fortran/src/H5VLff.F90 +++ b/fortran/src/H5VLff.F90 @@ -167,10 +167,49 @@ CONTAINS END SUBROUTINE H5VLis_connector_registered_f ! -!****s* H5VL/H5VLis_connector_registered_f +!****s* H5VL/H5VLget_connector_id_f ! ! NAME -! H5VLis_connector_registered_f +! H5VLget_connector_id_f +! +! PURPOSE +! Retrieves the ID for a registered VOL connector. +! +! INPUTS +! obj_id - Object id +! OUTPUTS +! vol_id - Connector id +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLget_connector_id_f(obj_id, vol_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER(HID_T) FUNCTION H5VLget_connector_id(obj_id) BIND(C,NAME='H5VLget_connector_id') + IMPORT :: HID_T + INTEGER(HID_T), INTENT(IN) :: obj_id + END FUNCTION H5VLget_connector_id + END INTERFACE + + vol_id = H5VLget_connector_id(obj_id) + + IF(vol_id.LT.0)THEN + hdferr = -1 + vol_id = H5I_INVALID_HID_F + ENDIF + + END SUBROUTINE H5VLget_connector_id_f + +! +!****s* H5VL/H5VLget_connector_id_by_name_f +! +! NAME +! H5VLget_connector_id_by_name_f ! ! PURPOSE ! Retrieves the ID for a registered VOL connector. @@ -182,7 +221,7 @@ CONTAINS ! hdferr - Returns 0 if successful and -1 if fails ! SOURCE - SUBROUTINE H5VLget_connector_id_f(name, vol_id, hdferr) + SUBROUTINE H5VLget_connector_id_by_name_f(name, vol_id, hdferr) IMPLICIT NONE CHARACTER(LEN=*), INTENT(IN) :: name INTEGER(HID_T), INTENT(OUT) :: vol_id @@ -191,22 +230,23 @@ CONTAINS CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name INTERFACE - INTEGER(HID_T) FUNCTION H5VLget_connector_id(name) BIND(C,NAME='H5VLget_connector_id') + INTEGER(HID_T) FUNCTION H5VLget_connector_id_by_name(name) BIND(C,NAME='H5VLget_connector_id_by_name') IMPORT :: C_CHAR IMPORT :: HID_T CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name - END FUNCTION H5VLget_connector_id + END FUNCTION H5VLget_connector_id_by_name END INTERFACE c_name = TRIM(name)//C_NULL_CHAR - vol_id = H5VLget_connector_id(c_name) - + vol_id = H5VLget_connector_id_by_name(c_name) + + hdferr = 0 IF(vol_id.LT.0)THEN hdferr = -1 vol_id = H5I_INVALID_HID_F ENDIF - END SUBROUTINE H5VLget_connector_id_f + END SUBROUTINE H5VLget_connector_id_by_name_f SUBROUTINE H5VLget_connector_name_f(obj_id, name, hdferr, name_len) IMPLICIT NONE diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 2d1c6e7..132da7b 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -56,7 +56,6 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes { int ret_value = -1; hid_t c_type_id; - size_t tmp_val; int i; /* Fortran INTEGER may not be the same as C; do all checking to find @@ -133,8 +132,7 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes #endif if ((c_type_id = H5Tcopy(H5T_FORTRAN_S1)) < 0) return ret_value; - tmp_val = 1; - if(H5Tset_size(c_type_id, tmp_val) < 0) return ret_value; + if(H5Tset_size(c_type_id, 1) < 0) return ret_value; if(H5Tset_strpad(c_type_id, H5T_STR_SPACEPAD) < 0) return ret_value; types[8] = (hid_t_f)c_type_id; @@ -313,6 +311,7 @@ h5close_types_c( hid_t_f * types, int_f *lentypes, ret_value = 0; return ret_value; } + /****if* H5_f/h5init_flags_c * NAME * h5init_flags_c @@ -370,7 +369,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, haddr_t_f *h5_haddr_generic_flags) /******/ { - int ret_value = -1; /* * H5D flags */ @@ -538,196 +536,201 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, * but we need to assign each kind of message to a different bit so that * one index can hold multiple types.) */ - h5o_flags[7] = (int_f)H5O_SHMESG_NONE_FLAG; /* No shared messages */ - h5o_flags[8] = (int_f)H5O_SHMESG_SDSPACE_FLAG; /* Simple Dataspace Message. */ - h5o_flags[9] = (int_f)H5O_SHMESG_DTYPE_FLAG; /* Datatype Message. */ - h5o_flags[10] = (int_f)H5O_SHMESG_FILL_FLAG; /* Fill Value Message. */ - h5o_flags[11] = (int_f)H5O_SHMESG_PLINE_FLAG; /* Filter pipeline message. */ - h5o_flags[12] = (int_f)H5O_SHMESG_ATTR_FLAG; /* Attribute Message. */ - h5o_flags[13] = (int_f)H5O_SHMESG_ALL_FLAG; + h5o_flags[7] = (int_f)H5O_SHMESG_NONE_FLAG; /* No shared messages */ + h5o_flags[8] = (int_f)H5O_SHMESG_SDSPACE_FLAG; /* Simple Dataspace Message. */ + h5o_flags[9] = (int_f)H5O_SHMESG_DTYPE_FLAG; /* Datatype Message. */ + h5o_flags[10] = (int_f)H5O_SHMESG_FILL_FLAG; /* Fill Value Message. */ + h5o_flags[11] = (int_f)H5O_SHMESG_PLINE_FLAG; /* Filter pipeline message. */ + h5o_flags[12] = (int_f)H5O_SHMESG_ATTR_FLAG; /* Attribute Message. */ + h5o_flags[13] = (int_f)H5O_SHMESG_ALL_FLAG; /* Object header status flag definitions */ - h5o_flags[14] = (int_f)H5O_HDR_CHUNK0_SIZE; /* 2-bit field indicating # of bytes to store the size of chunk 0's data */ - h5o_flags[15] = (int_f)H5O_HDR_ATTR_CRT_ORDER_TRACKED; /* Attribute creation order is tracked */ - h5o_flags[16] = (int_f)H5O_HDR_ATTR_CRT_ORDER_INDEXED; /* Attribute creation order has index */ - h5o_flags[17] = (int_f)H5O_HDR_ATTR_STORE_PHASE_CHANGE; /* Non-default attribute storage phase change values stored */ - h5o_flags[18] = (int_f)H5O_HDR_STORE_TIMES; /* Store access, modification, change & birth times for object */ - h5o_flags[19] = (int_f)H5O_HDR_ALL_FLAGS; + h5o_flags[14] = (int_f)H5O_HDR_CHUNK0_SIZE; /* 2-bit field indicating # of bytes to store the size of chunk 0's data */ + h5o_flags[15] = (int_f)H5O_HDR_ATTR_CRT_ORDER_TRACKED; /* Attribute creation order is tracked */ + h5o_flags[16] = (int_f)H5O_HDR_ATTR_CRT_ORDER_INDEXED; /* Attribute creation order has index */ + h5o_flags[17] = (int_f)H5O_HDR_ATTR_STORE_PHASE_CHANGE; /* Non-default attribute storage phase change values stored */ + h5o_flags[18] = (int_f)H5O_HDR_STORE_TIMES; /* Store access, modification, change & birth times for object */ + h5o_flags[19] = (int_f)H5O_HDR_ALL_FLAGS; /* Maximum shared message values. Number of indexes is 8 to allow room to add * new types of messages. */ - h5o_flags[20] = (int_f)H5O_SHMESG_MAX_NINDEXES; - h5o_flags[21] = (int_f)H5O_SHMESG_MAX_LIST_SIZE; + h5o_flags[20] = (int_f)H5O_SHMESG_MAX_NINDEXES; + h5o_flags[21] = (int_f)H5O_SHMESG_MAX_LIST_SIZE; /* Types of objects in file */ - h5o_flags[22] = (int_f)H5O_TYPE_UNKNOWN; /* Unknown object type */ - h5o_flags[23] = (int_f)H5O_TYPE_GROUP; /* Object is a group */ - h5o_flags[24] = (int_f)H5O_TYPE_DATASET; /* Object is a dataset */ - h5o_flags[25] = (int_f)H5O_TYPE_NAMED_DATATYPE; /* Object is a named data type */ - h5o_flags[26] = (int_f)H5O_TYPE_NTYPES; /* Number of different object types */ + h5o_flags[22] = (int_f)H5O_TYPE_UNKNOWN; /* Unknown object type */ + h5o_flags[23] = (int_f)H5O_TYPE_GROUP; /* Object is a group */ + h5o_flags[24] = (int_f)H5O_TYPE_DATASET; /* Object is a dataset */ + h5o_flags[25] = (int_f)H5O_TYPE_NAMED_DATATYPE; /* Object is a named data type */ + h5o_flags[26] = (int_f)H5O_TYPE_NTYPES; /* Number of different object types */ /* Flags for H5Oget_info. * These flags determine which fields will be filled in in the H5O_info_t - * struct. + * struct. */ - h5o_flags[27] = (int_f)H5O_INFO_ALL; /* (H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ - h5o_flags[28] = (int_f)H5O_INFO_BASIC; /* Fill in the fileno, addr, type, and rc fields */ - h5o_flags[29] = (int_f)H5O_INFO_TIME; /* Fill in the atime, mtime, ctime, and btime fields */ - h5o_flags[30] = (int_f)H5O_INFO_NUM_ATTRS; /* Fill in the num_attrs field */ - h5o_flags[31] = (int_f)H5O_INFO_HDR; /* Fill in the hdr field */ - h5o_flags[32] = (int_f)H5O_INFO_META_SIZE; /* Fill in the meta_size field */ + h5o_flags[27] = (int_f)H5O_INFO_ALL; /* (H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_NUM_ATTRS) */ + h5o_flags[28] = (int_f)H5O_INFO_BASIC; /* Fill in the fileno, addr, type, and rc fields */ + h5o_flags[29] = (int_f)H5O_INFO_TIME; /* Fill in the atime, mtime, ctime, and btime fields */ + h5o_flags[30] = (int_f)H5O_INFO_NUM_ATTRS; /* Fill in the num_attrs field */ + +/* Flags for H5Oget_native_info. + * These flags determine which fields will be filled in in the H5O_native_info_t + * struct. + */ + h5o_flags[31] = (int_f)H5O_NATIVE_INFO_ALL; /* (H5O_NATIVE_INFO_HDR|H5O_NATIVE_INFO_META_SIZE) */ + h5o_flags[32] = (int_f)H5O_NATIVE_INFO_HDR; /* Fill in the hdr field */ + h5o_flags[33] = (int_f)H5O_NATIVE_INFO_META_SIZE; /* Fill in the meta_size field */ /* * H5P flags */ - h5p_flags[0] = (hid_t_f)H5P_FILE_CREATE; - h5p_flags[1] = (hid_t_f)H5P_FILE_ACCESS; - h5p_flags[2] = (hid_t_f)H5P_DATASET_CREATE; - h5p_flags[3] = (hid_t_f)H5P_DATASET_XFER; - h5p_flags[4] = (hid_t_f)H5P_FILE_MOUNT; - h5p_flags[5] = (hid_t_f)H5P_DEFAULT; - h5p_flags[6] = (hid_t_f)H5P_ROOT; - h5p_flags[7] = (hid_t_f)H5P_OBJECT_CREATE; - h5p_flags[8] = (hid_t_f)H5P_DATASET_ACCESS; - h5p_flags[9] = (hid_t_f)H5P_GROUP_CREATE; - h5p_flags[10] = (hid_t_f)H5P_GROUP_ACCESS; - h5p_flags[11] = (hid_t_f)H5P_DATATYPE_CREATE; - h5p_flags[12] = (hid_t_f)H5P_DATATYPE_ACCESS; - h5p_flags[13] = (hid_t_f)H5P_STRING_CREATE; - h5p_flags[14] = (hid_t_f)H5P_ATTRIBUTE_CREATE; - h5p_flags[15] = (hid_t_f)H5P_OBJECT_COPY; - h5p_flags[16] = (hid_t_f)H5P_LINK_CREATE; - h5p_flags[17] = (hid_t_f)H5P_LINK_ACCESS; + h5p_flags[0] = (hid_t_f)H5P_FILE_CREATE; + h5p_flags[1] = (hid_t_f)H5P_FILE_ACCESS; + h5p_flags[2] = (hid_t_f)H5P_DATASET_CREATE; + h5p_flags[3] = (hid_t_f)H5P_DATASET_XFER; + h5p_flags[4] = (hid_t_f)H5P_FILE_MOUNT; + h5p_flags[5] = (hid_t_f)H5P_DEFAULT; + h5p_flags[6] = (hid_t_f)H5P_ROOT; + h5p_flags[7] = (hid_t_f)H5P_OBJECT_CREATE; + h5p_flags[8] = (hid_t_f)H5P_DATASET_ACCESS; + h5p_flags[9] = (hid_t_f)H5P_GROUP_CREATE; + h5p_flags[10] = (hid_t_f)H5P_GROUP_ACCESS; + h5p_flags[11] = (hid_t_f)H5P_DATATYPE_CREATE; + h5p_flags[12] = (hid_t_f)H5P_DATATYPE_ACCESS; + h5p_flags[13] = (hid_t_f)H5P_STRING_CREATE; + h5p_flags[14] = (hid_t_f)H5P_ATTRIBUTE_CREATE; + h5p_flags[15] = (hid_t_f)H5P_OBJECT_COPY; + h5p_flags[16] = (hid_t_f)H5P_LINK_CREATE; + h5p_flags[17] = (hid_t_f)H5P_LINK_ACCESS; /* * H5P integer flags */ - h5p_flags_int[0] = (int_f)H5P_CRT_ORDER_INDEXED; - h5p_flags_int[1] = (int_f)H5P_CRT_ORDER_TRACKED; + h5p_flags_int[0] = (int_f)H5P_CRT_ORDER_INDEXED; + h5p_flags_int[1] = (int_f)H5P_CRT_ORDER_TRACKED; /* * H5R flags */ - - h5r_flags[0] = (int_f)H5R_OBJECT; - h5r_flags[1] = (int_f)H5R_DATASET_REGION; + h5r_flags[0] = (int_f)H5R_OBJECT; + h5r_flags[1] = (int_f)H5R_DATASET_REGION; /* * H5S flags */ - - h5s_hid_flags[0] = (hid_t_f)H5S_ALL; - - h5s_hsize_flags[0] = (hsize_t_f)H5S_UNLIMITED; - - h5s_flags[0] = (int_f)H5S_SCALAR; - h5s_flags[1] = (int_f)H5S_SIMPLE; - h5s_flags[2] = (int_f)H5S_NULL; - h5s_flags[3] = (int_f)H5S_SELECT_SET; - h5s_flags[4] = (int_f)H5S_SELECT_OR; - - h5s_flags[5] = (int_f)H5S_SELECT_NOOP; - h5s_flags[6] = (int_f)H5S_SELECT_AND; - h5s_flags[7] = (int_f)H5S_SELECT_XOR; - h5s_flags[8] = (int_f)H5S_SELECT_NOTB; - h5s_flags[9] = (int_f)H5S_SELECT_NOTA; - - h5s_flags[10] = (int_f)H5S_SELECT_APPEND; - h5s_flags[11] = (int_f)H5S_SELECT_PREPEND; - h5s_flags[12] = (int_f)H5S_SELECT_INVALID; - h5s_flags[13] = (int_f)H5S_SEL_ERROR; - h5s_flags[14] = (int_f)H5S_SEL_NONE; - - h5s_flags[15] = (int_f)H5S_SEL_POINTS; - h5s_flags[16] = (int_f)H5S_SEL_HYPERSLABS; - h5s_flags[17] = (int_f)H5S_SEL_ALL; + h5s_hid_flags[0] = (hid_t_f)H5S_ALL; + + h5s_hsize_flags[0] = (hsize_t_f)H5S_UNLIMITED; + + h5s_flags[0] = (int_f)H5S_SCALAR; + h5s_flags[1] = (int_f)H5S_SIMPLE; + h5s_flags[2] = (int_f)H5S_NULL; + h5s_flags[3] = (int_f)H5S_SELECT_SET; + h5s_flags[4] = (int_f)H5S_SELECT_OR; + + h5s_flags[5] = (int_f)H5S_SELECT_NOOP; + h5s_flags[6] = (int_f)H5S_SELECT_AND; + h5s_flags[7] = (int_f)H5S_SELECT_XOR; + h5s_flags[8] = (int_f)H5S_SELECT_NOTB; + h5s_flags[9] = (int_f)H5S_SELECT_NOTA; + + h5s_flags[10] = (int_f)H5S_SELECT_APPEND; + h5s_flags[11] = (int_f)H5S_SELECT_PREPEND; + h5s_flags[12] = (int_f)H5S_SELECT_INVALID; + h5s_flags[13] = (int_f)H5S_SEL_ERROR; + h5s_flags[14] = (int_f)H5S_SEL_NONE; + + h5s_flags[15] = (int_f)H5S_SEL_POINTS; + h5s_flags[16] = (int_f)H5S_SEL_HYPERSLABS; + h5s_flags[17] = (int_f)H5S_SEL_ALL; + /* * H5T flags */ - h5t_flags[0] = (int_f)H5T_NO_CLASS; - h5t_flags[1] = (int_f)H5T_INTEGER; - h5t_flags[2] = (int_f)H5T_FLOAT; - h5t_flags[3] = (int_f)H5T_TIME; - h5t_flags[4] = (int_f)H5T_STRING; - h5t_flags[5] = (int_f)H5T_BITFIELD; - h5t_flags[6] = (int_f)H5T_OPAQUE; - h5t_flags[7] = (int_f)H5T_COMPOUND; - h5t_flags[8] = (int_f)H5T_REFERENCE; - h5t_flags[9] = (int_f)H5T_ENUM; - h5t_flags[10] = (int_f)H5T_ORDER_LE; - h5t_flags[11] = (int_f)H5T_ORDER_BE; - h5t_flags[12] = (int_f)H5T_ORDER_MIXED; - h5t_flags[13] = (int_f)H5T_ORDER_VAX; - h5t_flags[14] = (int_f)H5T_ORDER_NONE; - h5t_flags[15] = (int_f)H5T_PAD_ZERO; - h5t_flags[16] = (int_f)H5T_PAD_ONE; - h5t_flags[17] = (int_f)H5T_PAD_BACKGROUND; - h5t_flags[18] = (int_f)H5T_PAD_ERROR; - h5t_flags[19] = (int_f)H5T_SGN_NONE; - h5t_flags[20] = (int_f)H5T_SGN_2; - h5t_flags[21] = (int_f)H5T_SGN_ERROR; - h5t_flags[22] = (int_f)H5T_NORM_IMPLIED; - h5t_flags[23] = (int_f)H5T_NORM_MSBSET; - h5t_flags[24] = (int_f)H5T_NORM_NONE; - h5t_flags[25] = (int_f)H5T_CSET_ASCII; - h5t_flags[26] = (int_f)H5T_CSET_UTF8; - h5t_flags[27] = (int_f)H5T_STR_NULLTERM; - h5t_flags[28] = (int_f)H5T_STR_NULLPAD; - h5t_flags[29] = (int_f)H5T_STR_SPACEPAD; - h5t_flags[30] = (int_f)H5T_STR_ERROR; - h5t_flags[31] = (int_f)H5T_VLEN; - h5t_flags[32] = (int_f)H5T_ARRAY; - h5t_flags[33] = (int_f)H5T_DIR_ASCEND; - h5t_flags[34] = (int_f)H5T_DIR_DESCEND; + h5t_flags[0] = (int_f)H5T_NO_CLASS; + h5t_flags[1] = (int_f)H5T_INTEGER; + h5t_flags[2] = (int_f)H5T_FLOAT; + h5t_flags[3] = (int_f)H5T_TIME; + h5t_flags[4] = (int_f)H5T_STRING; + h5t_flags[5] = (int_f)H5T_BITFIELD; + h5t_flags[6] = (int_f)H5T_OPAQUE; + h5t_flags[7] = (int_f)H5T_COMPOUND; + h5t_flags[8] = (int_f)H5T_REFERENCE; + h5t_flags[9] = (int_f)H5T_ENUM; + h5t_flags[10] = (int_f)H5T_ORDER_LE; + h5t_flags[11] = (int_f)H5T_ORDER_BE; + h5t_flags[12] = (int_f)H5T_ORDER_MIXED; + h5t_flags[13] = (int_f)H5T_ORDER_VAX; + h5t_flags[14] = (int_f)H5T_ORDER_NONE; + h5t_flags[15] = (int_f)H5T_PAD_ZERO; + h5t_flags[16] = (int_f)H5T_PAD_ONE; + h5t_flags[17] = (int_f)H5T_PAD_BACKGROUND; + h5t_flags[18] = (int_f)H5T_PAD_ERROR; + h5t_flags[19] = (int_f)H5T_SGN_NONE; + h5t_flags[20] = (int_f)H5T_SGN_2; + h5t_flags[21] = (int_f)H5T_SGN_ERROR; + h5t_flags[22] = (int_f)H5T_NORM_IMPLIED; + h5t_flags[23] = (int_f)H5T_NORM_MSBSET; + h5t_flags[24] = (int_f)H5T_NORM_NONE; + h5t_flags[25] = (int_f)H5T_CSET_ASCII; + h5t_flags[26] = (int_f)H5T_CSET_UTF8; + h5t_flags[27] = (int_f)H5T_STR_NULLTERM; + h5t_flags[28] = (int_f)H5T_STR_NULLPAD; + h5t_flags[29] = (int_f)H5T_STR_SPACEPAD; + h5t_flags[30] = (int_f)H5T_STR_ERROR; + h5t_flags[31] = (int_f)H5T_VLEN; + h5t_flags[32] = (int_f)H5T_ARRAY; + h5t_flags[33] = (int_f)H5T_DIR_ASCEND; + h5t_flags[34] = (int_f)H5T_DIR_DESCEND; + /* * H5Z flags */ - h5z_flags[0] = (int_f)H5Z_FILTER_ERROR; - h5z_flags[1] = (int_f)H5Z_FILTER_NONE; - h5z_flags[2] = (int_f)H5Z_FILTER_DEFLATE; - h5z_flags[3] = (int_f)H5Z_FILTER_SHUFFLE; - h5z_flags[4] = (int_f)H5Z_FILTER_FLETCHER32; - h5z_flags[5] = (int_f)H5Z_ERROR_EDC; - h5z_flags[6] = (int_f)H5Z_DISABLE_EDC; - h5z_flags[7] = (int_f)H5Z_ENABLE_EDC; - h5z_flags[8] = (int_f)H5Z_NO_EDC; - h5z_flags[9] = (int_f)H5Z_FILTER_SZIP; - h5z_flags[10] = (int_f)H5Z_FLAG_OPTIONAL; - h5z_flags[11] = (int_f)H5Z_FILTER_CONFIG_ENCODE_ENABLED; - h5z_flags[12] = (int_f)H5Z_FILTER_CONFIG_DECODE_ENABLED; - h5z_flags[13] = (int_f)H5Z_FILTER_ALL; - h5z_flags[14] = (int_f)H5Z_FILTER_NBIT; - h5z_flags[15] = (int_f)H5Z_FILTER_SCALEOFFSET; - h5z_flags[16] = (int_f)H5Z_SO_FLOAT_DSCALE; - h5z_flags[17] = (int_f)H5Z_SO_FLOAT_ESCALE; - h5z_flags[18] = (int_f)H5Z_SO_INT; - h5z_flags[19] = (int_f)H5Z_SO_INT_MINBITS_DEFAULT; + h5z_flags[0] = (int_f)H5Z_FILTER_ERROR; + h5z_flags[1] = (int_f)H5Z_FILTER_NONE; + h5z_flags[2] = (int_f)H5Z_FILTER_DEFLATE; + h5z_flags[3] = (int_f)H5Z_FILTER_SHUFFLE; + h5z_flags[4] = (int_f)H5Z_FILTER_FLETCHER32; + h5z_flags[5] = (int_f)H5Z_ERROR_EDC; + h5z_flags[6] = (int_f)H5Z_DISABLE_EDC; + h5z_flags[7] = (int_f)H5Z_ENABLE_EDC; + h5z_flags[8] = (int_f)H5Z_NO_EDC; + h5z_flags[9] = (int_f)H5Z_FILTER_SZIP; + h5z_flags[10] = (int_f)H5Z_FLAG_OPTIONAL; + h5z_flags[11] = (int_f)H5Z_FILTER_CONFIG_ENCODE_ENABLED; + h5z_flags[12] = (int_f)H5Z_FILTER_CONFIG_DECODE_ENABLED; + h5z_flags[13] = (int_f)H5Z_FILTER_ALL; + h5z_flags[14] = (int_f)H5Z_FILTER_NBIT; + h5z_flags[15] = (int_f)H5Z_FILTER_SCALEOFFSET; + h5z_flags[16] = (int_f)H5Z_SO_FLOAT_DSCALE; + h5z_flags[17] = (int_f)H5Z_SO_FLOAT_ESCALE; + h5z_flags[18] = (int_f)H5Z_SO_INT; + h5z_flags[19] = (int_f)H5Z_SO_INT_MINBITS_DEFAULT; /* * H5 Generic flags introduced in version 1.8 */ - /* H5_index_t enum struct */ + /* H5_index_t enum struct */ - h5_generic_flags[0] = (int_f)H5_INDEX_UNKNOWN; /* Unknown index type */ - h5_generic_flags[1] = (int_f)H5_INDEX_NAME; /* Index on names */ - h5_generic_flags[2] = (int_f)H5_INDEX_CRT_ORDER; /* Index on creation order */ - h5_generic_flags[3] = (int_f)H5_INDEX_N; /* Index on creation order */ + h5_generic_flags[0] = (int_f)H5_INDEX_UNKNOWN; /* Unknown index type */ + h5_generic_flags[1] = (int_f)H5_INDEX_NAME; /* Index on names */ + h5_generic_flags[2] = (int_f)H5_INDEX_CRT_ORDER; /* Index on creation order */ + h5_generic_flags[3] = (int_f)H5_INDEX_N; /* Index on creation order */ - /* H5_iter_order_t enum struct */ + /* H5_iter_order_t enum struct */ - h5_generic_flags[4] = (int_f)H5_ITER_UNKNOWN; /* Unknown order */ - h5_generic_flags[5] = (int_f)H5_ITER_INC; /* Increasing order */ - h5_generic_flags[6] = (int_f)H5_ITER_DEC; /* Decreasing order */ - h5_generic_flags[7] = (int_f)H5_ITER_NATIVE; /* No particular order, whatever is fastest */ - h5_generic_flags[8] = (int_f)H5_ITER_N; /* Number of iteration orders */ + h5_generic_flags[4] = (int_f)H5_ITER_UNKNOWN; /* Unknown order */ + h5_generic_flags[5] = (int_f)H5_ITER_INC; /* Increasing order */ + h5_generic_flags[6] = (int_f)H5_ITER_DEC; /* Decreasing order */ + h5_generic_flags[7] = (int_f)H5_ITER_NATIVE; /* No particular order, whatever is fastest */ + h5_generic_flags[8] = (int_f)H5_ITER_N; /* Number of iteration orders */ - h5_haddr_generic_flags[0] = (haddr_t_f)HADDR_UNDEF; /* undefined address */ + h5_haddr_generic_flags[0] = (haddr_t_f)HADDR_UNDEF; /* undefined address */ - ret_value = 0; - return ret_value; + return 0; } int_f diff --git a/fortran/src/H5f90.h b/fortran/src/H5f90.h index eabe3d0..655cb9b 100644 --- a/fortran/src/H5f90.h +++ b/fortran/src/H5f90.h @@ -25,5 +25,8 @@ /* Constants used in H5Gf.c files */ #define OBJECT_NAMELEN_DEFAULT_F -1 + #define H5_MAX(a,b) (((a)>(b)) ? (a) : (b)) + #endif /* _H5f90_H */ + diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index 02e3bc3..dabc0bb 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -54,6 +54,7 @@ MODULE H5GLOBAL ! If you change the value of these parameters, do not forget to change corresponding ! values in the H5f90.h file. INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 + INTEGER, PARAMETER :: H5O_TOKEN_BUF_LEN = 16 ! Matches C defined value in H5public.h ! Parameters used in the function 'h5kind_to_type' located in H5_ff.F90. ! The flag is used to tell the function whether the kind input variable @@ -70,13 +71,17 @@ MODULE H5GLOBAL INTEGER, DIMENSION(1:REF_REG_BUF_LEN) :: ref END TYPE hdset_reg_ref_t_f + TYPE, BIND(C) :: h5o_token_t_f + INTEGER(C_INT8_T), DIMENSION(1:H5O_TOKEN_BUF_LEN) :: token + END TYPE h5o_token_t_f + ! Do not forget to change these values when new predefined ! datatypes are added INTEGER, PARAMETER :: PREDEF_TYPES_LEN = 19 INTEGER, PARAMETER :: FLOATING_TYPES_LEN = 4 INTEGER, PARAMETER :: INTEGER_TYPES_LEN = 27 - ! These arrays need to be global because they are used in + ! These arrays need to be global because they are used in ! both h5open_f and in h5close_f; initialize to fix linking issues ! on OSX and Intel compilers. INTEGER(HID_T), DIMENSION(1:PREDEF_TYPES_LEN) :: predef_types = -1 diff --git a/fortran/src/H5f90i.h b/fortran/src/H5f90i.h index 7d066cd..057edc5 100644 --- a/fortran/src/H5f90i.h +++ b/fortran/src/H5f90i.h @@ -21,8 +21,7 @@ */ #include "H5f90i_gen.h" -/* Define _fcd. These are the same on every system - * but UNICOS. +/* Define _fcd. These are the same on every system but UNICOS. */ #define _fcdtocp(desc) (desc) diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 5faf4b4..e6f5dd4 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -23,7 +23,7 @@ H5_FCDLL void HD5packFstring(char *src, char *dest, size_t len); /* - * Storage info struct used by H5O_info_t and H5F_info_t + * Storage info struct used by H5O_info_t and H5F_info_t * interoperable with Fortran. */ typedef struct H5_ih_info_t_f { @@ -31,7 +31,7 @@ typedef struct H5_ih_info_t_f { hsize_t heap_size; } H5_ih_info_t_f; -/* Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) +/* Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) * interoperable with Fortran. */ typedef struct H5O_hdr_info_t_f { @@ -51,12 +51,11 @@ typedef struct H5O_hdr_info_t_f { } mesg; } H5O_hdr_info_t_f; -/* Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) - * interoperable with Fortran. +/* Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */ typedef struct H5O_info_t_f { unsigned long fileno; /* File number that object is located in */ - haddr_t_f addr; /* Object address in file */ + H5O_token_t token; /* Token of object in file */ int type; /* Basic object type (group, dataset, etc.) */ int_f rc; /* Reference count of object */ int_f atime[8]; /* Access time */ @@ -64,13 +63,18 @@ typedef struct H5O_info_t_f { int_f ctime[8]; /* Change time */ int_f btime[8]; /* Birth time */ hsize_t num_attrs; /* # of attributes attached to object */ +} H5O_info_t_f; + +/* Information struct for native object (for H5Oget_native_info/H5Oget_native_info_by_name/H5Oget_native_info_by_idx) + */ +typedef struct H5O_native_info_t_f { H5O_hdr_info_t_f hdr; /* Object header information */ /* Extra metadata storage for obj & attributes */ struct { H5_ih_info_t_f obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ H5_ih_info_t_f attr; /* v2 B-tree & heap for attributes */ } meta_size; -} H5O_info_t_f; +} H5O_native_info_t_f; /* @@ -312,12 +316,12 @@ H5_FCDLL int_f h5tconvert_c(hid_t_f *src_id, hid_t_f *dst_id, size_t_f *nelmts, H5_FCDLL int_f h5oopen_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, hid_t_f *obj_id); H5_FCDLL int_f h5oclose_c(hid_t_f *object_id ); -H5_FCDLL int_f h5oopen_by_addr_c(hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id); +H5_FCDLL int_f h5oopen_by_token_c(hid_t_f *loc_id, H5O_token_t *token, hid_t_f *obj_id); H5_FCDLL int_f h5olink_c(hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id); -H5_FCDLL int_f h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data, int_f *fields); +H5_FCDLL int_f h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate2_t op, void *op_data, int_f *fields); H5_FCDLL int_f h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order, - H5O_iterate_t op, void *op_data, hid_t_f *lapl_id, int_f *fields ); + H5O_iterate2_t op, void *op_data, hid_t_f *lapl_id, int_f *fields ); H5_FCDLL int_f h5oget_info_c(hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields); H5_FCDLL int_f h5oget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info, int_f *fields); @@ -336,6 +340,8 @@ H5_FCDLL int_f h5oopen_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *gro H5_FCDLL int_f h5oget_comment_c(hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize); H5_FCDLL int_f h5oget_comment_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *name_size, _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id); +H5_FCDLL int_f h5otoken_cmp_c(hid_t_f *loc_id, H5O_token_t *token1, + H5O_token_t *token2, int_f *cmp_value); /* * Functions from H5Pf.c */ @@ -568,11 +574,11 @@ H5_FCDLL int_f h5ldelete_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *gr H5_FCDLL int_f h5lexists_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, int_f *link_exists); H5_FCDLL int_f h5lget_info_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, int_f *cset, int_f *corder, int_f *corder_valid, int_f *link_type, - haddr_t_f *address, size_t_f *val_size, - hid_t_f *lapl_id); + H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id); H5_FCDLL int_f h5lget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, int_f *index_field, int_f *order, hsize_t_f *n, - int_f *link_type, int_f *corder_valid, int_f *corder, int_f *cset, haddr_t_f *address, size_t_f *val_size, hid_t_f *lapl_id); + int_f *link_type, int_f *corder_valid, int_f *corder, + int_f *cset, H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id); H5_FCDLL int_f h5lis_registered_c(int_f *link_cls_id); H5_FCDLL int_f h5lmove_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *dest_loc_id, _fcd dest_name, size_t_f *dest_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id); @@ -582,8 +588,8 @@ H5_FCDLL int_f h5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f * H5_FCDLL int_f h5lget_val_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, size_t_f *size, void *linkval_buff, hid_t_f *lapl_id) ; -H5_FCDLL int_f h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate_t op, void *op_data ); -H5_FCDLL int_f h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate_t op, void *op_data, hid_t_f *lapl_id); +H5_FCDLL int_f h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data ); +H5_FCDLL int_f h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data, hid_t_f *lapl_id); #endif /* _H5f90proto_H */ diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index e39e85a..2a6204d 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -414,13 +414,19 @@ int main(void) return -1; } - /* Need the buffer size for the fortran derive type 'hdset_reg_ref_t_f03' + /* Need the buffer size for the fortran derived type 'hdset_reg_ref_t_f03' * in order to be interoperable with C's structure, the C buffer size * H5R_DSET_REG_REF_BUF_SIZE is (sizeof(haddr_t)+4) */ - + fprintf(fort_header, " INTEGER, PARAMETER :: H5R_DSET_REG_REF_BUF_SIZE_F = %u\n", H5_SIZEOF_HADDR_T + 4 ); + /* Need the buffer size for the fortran derived type 'h5o_token_t' + * in order to be interoperable with C's structure. + */ + + fprintf(fort_header, " INTEGER, PARAMETER :: H5O_MAX_TOKEN_SIZE_F = %u\n", H5O_MAX_TOKEN_SIZE); + /* Close files */ endCfile(); endFfile(); diff --git a/fortran/src/README b/fortran/src/README index a258e07..f9316b5 100644 --- a/fortran/src/README +++ b/fortran/src/README @@ -87,7 +87,7 @@ Quick overview of the Fortran APIs to the file, a C program will read it as a 6x4 two-dimensional dataset into memory. The HDF5 C utilities h5dump and h5ls display transposed data, if data is written from a Fortran program. - + * Fortran indices are 1 based. ============================ @@ -105,29 +105,29 @@ Procedure to add a new function Procedure for passing C variables to Fortran --------------------------------------------- -(1) Find the C struct name you are interested in: +(1) Find the C struct name you are interested in: (a) src/H5public.h if it is a generic type, i.e. H5_* or - (b) src/H5*public.h if is a specific type, i.e. H5*_ - + (b) src/H5*public.h if is a specific type, i.e. H5*_ + (2) Put that structure into an array that will be passed to fortran in: (a) fortran/src/H5_f.c (add to nh5init_flags_c subroutine) (b) edit fortran/src/H5f90proto.h and edit nh5init_flags_c interface call - + (3) Edit the function call in fortran/src/H5_ff.F90 - (a) edit the call: FUNCTION h5init_flags_c + (a) edit the call: FUNCTION h5init_flags_c (b) edit h5init_flags_c call in h5open_f to match the number of arguments passing - -(4) add the size of the array and array to fortran/src/H5f90global.F90 + +(4) add the size of the array and array to fortran/src/H5f90global.F90 - must match the size found it H5_f.c -NOTE: To just add a default C value argument, do steps (2a) and (4) +NOTE: To just add a default C value argument, do steps (2a) and (4) Procedure for adding a new file to the repository -------------------------------------------------- -Add the name of the file to the: +Add the name of the file to the: (1) Makefile.am located in the same directory as the newfile (2) CMakeLists.txt located in the same directory as the newfile (3) MANIFEST located in the top level directory diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index e31a582..7e8b611 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -175,7 +175,7 @@ H5O_mp_H5OGET_COMMENT_F H5O_mp_H5OGET_COMMENT_BY_NAME_F H5O_mp_H5OINCR_REFCOUNT_F H5O_mp_H5OLINK_F -H5O_mp_H5OOPEN_BY_ADDR_F +H5O_mp_H5OOPEN_BY_TOKEN_F H5O_mp_H5OOPEN_BY_IDX_F H5O_mp_H5OOPEN_F H5O_mp_H5OSET_COMMENT_F @@ -185,6 +185,7 @@ H5O_mp_H5OGET_INFO_BY_NAME_F H5O_mp_H5OGET_INFO_F H5O_mp_H5OVISIT_BY_NAME_F H5O_mp_H5OVISIT_F +H5O_mp_H5OTOKEN_CMP_F ; H5P H5P_mp_H5PCREATE_F H5P_mp_H5PSET_PRESERVE_F @@ -459,6 +460,7 @@ H5VL_mp_H5VLREGISTER_CONNECTOR_BY_NAME_F H5VL_mp_H5VLREGISTER_CONNECTOR_BY_VALUE_F H5VL_mp_H5VLIS_CONNECTOR_REGISTERED_F H5VL_mp_H5VLGET_CONNECTOR_ID_F +H5VL_mp_H5VLGET_CONNECTOR_ID_BY_NAME_F H5VL_mp_H5VLGET_CONNECTOR_NAME_F H5VL_mp_H5VLCLOSE_F H5VL_mp_H5VLUNREGISTER_CONNECTOR_F diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 4efd8a8..3c46c9e 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -517,4 +517,6 @@ else () add_dependencies (vol_connector ${HDF5_F90_TEST_LIBSH_TARGET}) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_FORTRAN AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/fortran/test/fortranlib_test_F03.F90 b/fortran/test/fortranlib_test_F03.F90 index 9a74120..808cb4d 100644 --- a/fortran/test/fortranlib_test_F03.F90 +++ b/fortran/test/fortranlib_test_F03.F90 @@ -153,7 +153,7 @@ PROGRAM fortranlibtest_F03 ! write(*,*) ! write(*,*) '=========================================' -! write(*,*) 'Testing GROUP interface ' +! write(*,*) 'Testing OBJECT interface ' ! write(*,*) '=========================================' ret_total_error = 0 @@ -161,11 +161,11 @@ PROGRAM fortranlibtest_F03 CALL write_test_status(ret_total_error, ' Testing object functions ', total_error) ret_total_error = 0 - CALL obj_visit(ret_total_error) + CALL test_obj_visit(ret_total_error) CALL write_test_status(ret_total_error, ' Testing object visiting functions ', total_error) ret_total_error = 0 - CALL obj_info(ret_total_error) + CALL test_obj_info(ret_total_error) CALL write_test_status(ret_total_error, ' Testing object info functions ', total_error) ret_total_error = 0 diff --git a/fortran/test/tH5G_1_8.F90 b/fortran/test/tH5G_1_8.F90 index d3be525..58431a1 100644 --- a/fortran/test/tH5G_1_8.F90 +++ b/fortran/test/tH5G_1_8.F90 @@ -665,11 +665,11 @@ SUBROUTINE group_info(cleanup, fapl, total_error) ! H5L_TYPE_SOFT_F - Soft link ! H5L_TYPE_EXTERNAL_F - External link ! H5L_TYPE_ERROR _F - Error - INTEGER(HADDR_T) :: address ! If the link is a hard link, address specifies the file address that the link points to + TYPE(H5O_TOKEN_T_F) :: token ! If the link is a hard link, token specifies the object token that the link points to INTEGER(SIZE_T) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value -! WRITE(*,*) "link creation (w/new group format)" + WRITE(*,*) "link creation (w/new group format)" ! Create a file CALL h5fcreate_f(FileName, H5F_ACC_TRUNC_F, file, error, H5P_DEFAULT_F, fapl) @@ -698,7 +698,7 @@ SUBROUTINE group_info(cleanup, fapl, total_error) CALL check("H5Lcreate_soft_f", error, total_error) CALL H5Lget_info_f(file, "grp1/soft", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error, H5P_DEFAULT_F) CALL check("H5Lget_info_f",error,total_error) @@ -770,7 +770,7 @@ SUBROUTINE group_info(cleanup, fapl, total_error) ! H5L_TYPE_SOFT_F - Soft link ! H5L_TYPE_EXTERNAL_F - External link ! H5L_TYPE_ERROR _F - Error - INTEGER(HADDR_T) :: address ! If the link is a hard link, address specifies the file address that the link points to + TYPE(H5O_TOKEN_T_F) :: token ! If the link is a hard link, token specifies the object token that the link points to INTEGER(SIZE_T) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value INTEGER :: error @@ -816,7 +816,7 @@ SUBROUTINE group_info(cleanup, fapl, total_error) ! Get the group's link's information CALL H5Lget_info_f(file_id, "group", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error, H5P_DEFAULT_F) CALL check("H5Lget_info_f",error,total_error) @@ -1179,7 +1179,7 @@ SUBROUTINE delete_by_idx(cleanup, fapl, total_error) INTEGER :: cset ! Indicates the character set used for the attribute’s name INTEGER(SIZE_T) :: val_size INTEGER :: link_type - INTEGER(HADDR_T) :: address + TYPE(H5O_TOKEN_T_F) :: token INTEGER :: u ! Local index variable INTEGER :: Input1, i @@ -1309,10 +1309,10 @@ SUBROUTINE delete_by_idx(cleanup, fapl, total_error) ! HDmemset(&linfo, 0, sizeof(linfo)); CALL H5Lget_info_by_idx_f(group_id, ".", idx_type, iorder, INT(0,HSIZE_T), & - link_type, f_corder_valid, corder, cset, address, val_size, error) + link_type, f_corder_valid, corder, cset, token, val_size, error) - CALL H5Oopen_by_addr_f(group_id, address, grp, error) - CALL check("H5Oopen_by_addr_f", error, total_error) + CALL H5Oopen_by_token_f(group_id, token, grp, error) + CALL check("H5Oopen_by_token_f", error, total_error) CALL H5Iget_type_f(grp, id_type, error) CALL check("H5Iget_type_f", error, total_error) @@ -1357,11 +1357,11 @@ SUBROUTINE delete_by_idx(cleanup, fapl, total_error) ! Close the group creation property list CALL H5Pclose_f(gcpl_id, error) - CALL check("delete_by_idx.H5Gclose_f", error, total_error) + CALL check("delete_by_idx.H5Pclose_f", error, total_error) ! Close the file CALL H5Fclose_f(file_id, error) - CALL check("delete_by_idx.H5Gclose_f", error, total_error) + CALL check("delete_by_idx.H5Fclose_f", error, total_error) IF(cleanup) CALL h5_cleanup_f("file0", H5P_DEFAULT_F, error) CALL check("h5_cleanup_f", error, total_error) @@ -1407,7 +1407,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & INTEGER :: corder ! Is a positive integer containing the creation order of the attribute INTEGER :: cset ! Indicates the character set used for the attribute’s name INTEGER :: link_type - INTEGER(HADDR_T) :: address + TYPE(H5O_TOKEN_T_F) :: token INTEGER(SIZE_T) :: val_size ! Indicates the size, in the number of characters, of the attribute CHARACTER(LEN=7) :: tmpname ! Temporary link name @@ -1427,14 +1427,14 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & ! Verify the link information for first link, in increasing creation order ! HDmemset(&linfo, 0, sizeof(linfo)); CALL H5Lget_info_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(0,HSIZE_T), & - link_type, f_corder_valid, corder, cset, address, val_size, error) + link_type, f_corder_valid, corder, cset, token, val_size, error) CALL check("H5Lget_info_by_idx_f", error, total_error) CALL verify("H5Lget_info_by_idx_f", corder, 0, total_error) ! Verify the link information for new link, in increasing creation order ! HDmemset(&linfo, 0, sizeof(linfo)); CALL H5Lget_info_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), & - link_type, f_corder_valid, corder, cset, address, val_size, error) + link_type, f_corder_valid, corder, cset, token, val_size, error) CALL check("H5Lget_info_by_idx_f", error, total_error) CALL verify("H5Lget_info_by_idx_f", corder, n, total_error) @@ -1516,7 +1516,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & ! H5L_TYPE_SOFT_F - Soft link ! H5L_TYPE_EXTERNAL_F - External link ! H5L_TYPE_ERROR _F - Error - INTEGER(HADDR_T) :: address ! If the link is a hard link, address specifies the file address that the link points to + TYPE(H5O_TOKEN_T_F) :: token ! If the link is a hard link, token specifies the object token that the link points to INTEGER(SIZE_T) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value CHARACTER(LEN=1024) :: filename = 'tempfile.h5' @@ -1555,7 +1555,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & ! Check that its character encoding is the default CALL H5Lget_info_f(file_id, "group", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error, H5P_DEFAULT_F) ! File-wide default character encoding can not yet be set via the file @@ -1575,7 +1575,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & ! Check that its character encoding is the default CALL H5Lget_info_f(file_id, "type", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("h5tclose_f", error, total_error) @@ -1636,7 +1636,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & ! Check that its character encoding is the default CALL H5Lget_info_f(file_id, "dataset", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("H5Lget_info_f", error, total_error) @@ -1661,7 +1661,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & ! Check that its character encoding is UTF-8 CALL H5Lget_info_f(file_id, "group2", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("H5Lget_info_f", error, total_error) CALL verify("H5Lget_info_f",cset, H5T_CSET_UTF8_F,total_error) @@ -1679,7 +1679,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & ! Check that its character encoding is UTF-8 CALL H5Lget_info_f(file_id, "type2", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("H5Lget_info_f", error, total_error) CALL verify("H5Lget_info_f",cset, H5T_CSET_UTF8_F,total_error) @@ -1697,7 +1697,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & ! Check that its character encoding is UTF-8 CALL H5Lget_info_f(file_id, "dataset2", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("H5Lget_info_f", error, total_error) CALL verify("H5Lget_info_f2",cset, H5T_CSET_UTF8_F,total_error) @@ -1719,7 +1719,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & ! Check that its character encoding is ASCII CALL H5Lget_info_f(file_id, "/dataset2_link", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("H5Lget_info_f", error, total_error) CALL verify("H5Lget_info_f",cset, H5T_CSET_ASCII_F,total_error) @@ -1727,7 +1727,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & ! Check that the first link's encoding hasn't changed CALL H5Lget_info_f(file_id, "/dataset2", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("H5Lget_info_f", error, total_error) CALL verify("H5Lget_info_f3",cset, H5T_CSET_UTF8_F,total_error) @@ -1742,7 +1742,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & CALL check("H5Lcreate_soft_f", error, total_error) CALL H5Lget_info_f(file_id, "slink_to_dset2", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("H5Lget_info_f", error, total_error) CALL verify("H5Lget_info_f",cset, H5T_CSET_UTF8_F,total_error) @@ -1756,7 +1756,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & CALL check("H5Lmove_f",error, total_error) CALL H5Lget_info_f(file_id, "moved_slink", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("H5Lget_info_f", error, total_error) CALL verify("H5Lget_info_f",cset, H5T_CSET_ASCII_F,total_error) @@ -1770,7 +1770,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & CALL H5Lcopy_f(file_id, "moved_slink", file_id, "copied_slink", error, lcpl_id) CALL H5Lget_info_f(file_id, "copied_slink", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("H5Lget_info_f", error, total_error) CALL verify("H5Lget_info_f",cset, H5T_CSET_UTF8_F,total_error) @@ -1782,7 +1782,7 @@ SUBROUTINE link_info_by_idx_check(group_id, linkname, n, & CALL check("H5Lcreate_external_f", error, total_error) CALL H5Lget_info_f(file_id, "extlink", & - cset, corder, f_corder_valid, link_type, address, val_size, & + cset, corder, f_corder_valid, link_type, token, val_size, & error) CALL check("H5Lget_info_f", error, total_error) CALL verify("H5Lget_info_f",cset, H5T_CSET_UTF8_F,total_error) diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90 index bc3668c..c9ecccc 100644 --- a/fortran/test/tH5O_F03.F90 +++ b/fortran/test/tH5O_F03.F90 @@ -63,27 +63,33 @@ MODULE visit_cb CONTAINS -! Compares the field values of a C h5O_info_t and a Fortran H5O_info_t. +! Compares the field values of a C H5O_info_t and a Fortran H5O_info_t. + + INTEGER FUNCTION compare_h5o_info_t( loc_id, oinfo_f, oinfo_c, field, full_f_field ) RESULT(status) - INTEGER FUNCTION compare_h5o_info_t( oinfo_f, oinfo_c, field, full_f_field ) RESULT(status) - IMPLICIT NONE + INTEGER(HID_T) :: loc_id TYPE(h5o_info_t) :: oinfo_f TYPE(c_h5o_info_t) :: oinfo_c + TYPE(H5O_TOKEN_T_F) :: token_c INTEGER :: field - LOGICAL :: full_f_field ! All the fields of Fortran H5O_info_t where filled + LOGICAL :: full_f_field ! All the fields of Fortran H5O_info_t where filled ! local INTEGER(C_INT), DIMENSION(1:8) :: atime, btime, ctime, mtime + INTEGER :: cmp_value INTEGER :: i + INTEGER :: ierr status = 0 - + IF( (field .EQ. H5O_INFO_BASIC_F).OR.(field .EQ. H5O_INFO_ALL_F) )THEN IF( (oinfo_f%fileno.LE.0) .OR. (oinfo_c%fileno .NE. oinfo_f%fileno) )THEN status = -1 RETURN ENDIF - IF( (oinfo_f%addr.LE.0) .OR. (oinfo_c%addr .NE. oinfo_f%addr) )THEN + token_c%token = oinfo_c%token%token + CALL H5Otoken_cmp_f(loc_id, oinfo_f%token, token_c, cmp_value, ierr); + IF( (ierr .EQ. -1) .OR. (cmp_value .NE. 0) ) THEN status = -1 RETURN ENDIF @@ -131,26 +137,12 @@ CONTAINS ! check other field values are not filled (using only a small subset to check) status = 0 IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1 - IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1 - IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1 - IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1 - IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled. - status = -1 - RETURN - ENDIF - status = 0 ! reset - ENDIF - - IF((field .EQ. H5O_INFO_NUM_ATTRS_F).OR.(field .EQ. H5O_INFO_ALL_F))THEN - IF( (oinfo_f%num_attrs.LT.0) .OR. (oinfo_c%num_attrs .NE. oinfo_f%num_attrs) )THEN + token_c%token = oinfo_c%token%token + CALL H5Otoken_cmp_f(loc_id, oinfo_f%token, token_c, cmp_value, ierr); + IF( (ierr .EQ. -1) .OR. (cmp_value .NE. 0) ) THEN status = -1 RETURN ENDIF - ELSE IF( field .EQ. H5O_INFO_ALL_F.AND.full_f_field)THEN - ! check other field values are not filled (using only a small subset to check) - status = 0 - IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1 - IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1 IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1 IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1 IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled. @@ -158,85 +150,23 @@ CONTAINS RETURN ENDIF status = 0 ! reset - ENDIF - IF((field).EQ.H5O_INFO_HDR_F.OR.(field .EQ. H5O_INFO_ALL_F))THEN - IF( (oinfo_f%hdr%version.LT.0) .OR. (oinfo_c%hdr%version .NE. oinfo_f%hdr%version) )THEN - status = -1 - RETURN - ENDIF - IF( (oinfo_f%hdr%nmesgs.LT.0) .OR. (oinfo_c%hdr%nmesgs .NE. oinfo_f%hdr%nmesgs) )THEN - status = -1 - RETURN - ENDIF - IF( (oinfo_f%hdr%nchunks.LT.0) .OR. (oinfo_c%hdr%nchunks .NE. oinfo_f%hdr%nchunks) )THEN - status = -1 - RETURN - ENDIF - IF( (oinfo_f%hdr%flags.LT.0) .OR. (oinfo_c%hdr%flags .NE. oinfo_f%hdr%flags) )THEN - status = -1 - RETURN - ENDIF - IF( (oinfo_f%hdr%space%total.LT.0) .OR. (oinfo_c%hdr%space%total .NE. oinfo_f%hdr%space%total) )THEN - status = -1 - RETURN - ENDIF - IF( (oinfo_f%hdr%space%meta.LT.0) .OR. (oinfo_c%hdr%space%meta .NE. oinfo_f%hdr%space%meta) )THEN - status = -1 - RETURN - ENDIF - IF( (oinfo_f%hdr%space%mesg.LT.0) .OR. (oinfo_c%hdr%space%mesg .NE. oinfo_f%hdr%space%mesg) )THEN - status = -1 - RETURN - ENDIF - IF( (oinfo_f%hdr%space%free.LT.0) .OR. (oinfo_c%hdr%space%free .NE. oinfo_f%hdr%space%free) )THEN - status = -1 - RETURN - ENDIF - IF( (oinfo_f%hdr%mesg%present.LT.0) .OR. (oinfo_c%hdr%mesg%present .NE. oinfo_f%hdr%mesg%present) )THEN - status = -1 - RETURN - ENDIF - IF( (oinfo_f%hdr%mesg%shared.LT.0) .OR. (oinfo_c%hdr%mesg%shared .NE. oinfo_f%hdr%mesg%shared) )THEN + IF((field .EQ. H5O_INFO_NUM_ATTRS_F).OR.(field .EQ. H5O_INFO_ALL_F))THEN + IF( (oinfo_f%num_attrs.LT.0) .OR. (oinfo_c%num_attrs .NE. oinfo_f%num_attrs) )THEN status = -1 RETURN ENDIF - ELSE IF( field .EQ. H5O_INFO_HDR_F.AND.full_f_field)THEN + ELSE IF( field .EQ. H5O_INFO_ALL_F.AND.full_f_field)THEN ! check other field values are not filled (using only a small subset to check) status = 0 IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1 - IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1 - IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1 - IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1 - IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled. - status = -1 - RETURN - ENDIF - status = 0 ! reset - ENDIF - IF((field).EQ.H5O_INFO_META_SIZE_F.OR.(field .EQ. H5O_INFO_ALL_F))THEN - IF((oinfo_f%meta_size%obj%index_size.LT.0).OR.(oinfo_c%meta_size%obj%index_size.NE.oinfo_f%meta_size%obj%index_size))THEN - status = -1 - RETURN - ENDIF - IF((oinfo_f%meta_size%obj%heap_size.LT.0).OR.(oinfo_c%meta_size%obj%heap_size.NE.oinfo_f%meta_size%obj%heap_size))THEN - status = -1 - RETURN - ENDIF - IF((oinfo_f%meta_size%attr%index_size.LT.0).OR.(oinfo_c%meta_size%attr%index_size.NE.oinfo_f%meta_size%attr%index_size))THEN - status = -1 - RETURN - ENDIF - IF((oinfo_f%meta_size%attr%heap_size.LT.0).OR.(oinfo_c%meta_size%attr%heap_size.NE.oinfo_f%meta_size%attr%heap_size))THEN + token_c%token = oinfo_c%token%token + CALL H5Otoken_cmp_f(loc_id, oinfo_f%token, token_c, cmp_value, ierr); + IF( (ierr .EQ. -1) .OR. (cmp_value .NE. 0) ) THEN status = -1 RETURN ENDIF - ELSE IF( field .EQ. H5O_INFO_META_SIZE_F.AND.full_f_field)THEN - ! check other field values are not filled (using only a small subset to check) - status = 0 - IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1 - IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1 IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1 IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1 IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled. @@ -295,13 +225,13 @@ CONTAINS IF(op_data%field .EQ. H5O_INFO_ALL_F)THEN idx = op_data%idx - + DO i = 1, len IF(op_data%info(idx)%path(i)(1:1) .NE. name(i)(1:1))THEN visit_obj_cb = -1 RETURN ENDIF - + IF(op_data%info(idx)%type_obj .NE. oinfo_c%type)THEN visit_obj_cb = -1 RETURN @@ -310,14 +240,14 @@ CONTAINS ENDIF - ! Check H5Oget_info_by_name_f; if partial field values where filled correctly + ! Check H5Oget_info_by_name_f; if partial field values were filled correctly CALL H5Oget_info_by_name_f(group_id, name2, oinfo_f, ierr); - visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .TRUE. ) + visit_obj_cb = compare_h5o_info_t( group_id, oinfo_f, oinfo_c, op_data%field, .TRUE. ) IF(visit_obj_cb.EQ.-1) RETURN ! Check H5Oget_info_by_name_f, only check field values CALL H5Oget_info_by_name_f(group_id, name2, oinfo_f, ierr, fields = op_data%field); - visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .FALSE. ) + visit_obj_cb = compare_h5o_info_t(group_id, oinfo_f, oinfo_c, op_data%field, .FALSE. ) IF(visit_obj_cb.EQ.-1) RETURN @@ -325,12 +255,12 @@ CONTAINS ! Check H5Oget_info_f, only check field values CALL H5Oget_info_f(group_id, oinfo_f, ierr, fields = op_data%field); - visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .FALSE. ) + visit_obj_cb = compare_h5o_info_t(group_id, oinfo_f, oinfo_c, op_data%field, .FALSE. ) IF(visit_obj_cb.EQ.-1) RETURN ! Check H5Oget_info_f; if partial field values where filled correctly CALL H5Oget_info_f(group_id, oinfo_f, ierr); - visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .TRUE. ) + visit_obj_cb = compare_h5o_info_t(group_id, oinfo_f, oinfo_c, op_data%field, .TRUE. ) IF(visit_obj_cb.EQ.-1) RETURN ENDIF @@ -486,11 +416,11 @@ END SUBROUTINE test_h5o_refcount !**************************************************************** !** -!** test_h5o_refcount(): Test H5O visit functions. +!** test_obj_visit(): Test H5O visit functions. !** !**************************************************************** -SUBROUTINE obj_visit(total_error) +SUBROUTINE test_obj_visit(total_error) USE HDF5 USE TH5_MISC @@ -583,20 +513,6 @@ SUBROUTINE obj_visit(total_error) IF(ret_val.LT.0)THEN CALL check("h5ovisit_f", -1, total_error) ENDIF - udata%field = H5O_INFO_HDR_F - udata%idx = 1 - CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) - CALL check("h5ovisit_f", error, total_error) - IF(ret_val.LT.0)THEN - CALL check("h5ovisit_f", -1, total_error) - ENDIF - udata%field = H5O_INFO_META_SIZE_F - udata%idx = 1 - CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) - CALL check("h5ovisit_f", error, total_error) - IF(ret_val.LT.0)THEN - CALL check("h5ovisit_f", -1, total_error) - ENDIF ! Test h5ovisit_by_name_f object_name = "/" @@ -630,33 +546,19 @@ SUBROUTINE obj_visit(total_error) IF(ret_val.LT.0)THEN CALL check("h5ovisit_by_name_f", -1, total_error) ENDIF - udata%idx = 1 - udata%field = H5O_INFO_HDR_F - CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) - CALL check("h5ovisit_by_name_f", error, total_error) - IF(ret_val.LT.0)THEN - CALL check("h5ovisit_by_name_f", -1, total_error) - ENDIF - udata%idx = 1 - udata%field = H5O_INFO_META_SIZE_F - CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field) - CALL check("h5ovisit_by_name_f", error, total_error) - IF(ret_val.LT.0)THEN - CALL check("h5ovisit_by_name_f", -1, total_error) - ENDIF - + CALL h5fclose_f(fid, error) CALL check("h5fclose_f",error, total_error) -END SUBROUTINE obj_visit +END SUBROUTINE test_obj_visit !**************************************************************** !** -!** test_h5o_refcount(): Test H5O info functions. +!** test_obj_info(): Test H5O info functions. !** !**************************************************************** -SUBROUTINE obj_info(total_error) +SUBROUTINE test_obj_info(total_error) USE HDF5 USE TH5_MISC @@ -796,7 +698,7 @@ SUBROUTINE obj_info(total_error) CALL h5fclose_f(fid, error) CALL check("h5fclose_f", error, total_error) -END SUBROUTINE obj_info +END SUBROUTINE test_obj_info !------------------------------------------------------------------------- ! Function: build_visit_file diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 index aabb2b8..cd05cb1 100644 --- a/fortran/test/vol_connector.F90 +++ b/fortran/test/vol_connector.F90 @@ -74,8 +74,8 @@ CONTAINS CALL check("H5VLis_connector_registered_f",error,total_error) CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) - CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) - CALL check("H5VLget_connector_id_f",error,total_error) + CALL H5VLget_connector_id_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) + CALL check("H5VLget_connector_id_by_name_f",error,total_error) CALL H5Fcreate_f("voltest.h5",H5F_ACC_TRUNC_F, file_id, error) CALL check("H5F_create_f",error,total_error) @@ -201,9 +201,9 @@ CONTAINS CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error) ENDIF - CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) - CALL check("H5VLget_connector_id_f",error,total_error) - CALL VERIFY("H5VLget_connector_id_f", vol_id_out, vol_id, total_error) + CALL H5VLget_connector_id_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) + CALL check("H5VLget_connector_id_by_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_id_by_name_f", vol_id_out, vol_id, total_error) CALL H5Fcreate_f("voltest.h5",H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl_id) CALL check("H5F_create_f",error,total_error) diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 0fe641f..17aa6c3 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -45,4 +45,6 @@ set_target_properties (parallel_test PROPERTIES ) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_FORTRAN AND HDF5_TEST_PARALLEL) + include (CMakeTests.cmake) +endif () diff --git a/hl/CMakeLists.txt b/hl/CMakeLists.txt index 2a71b47..bef034c 100644 --- a/hl/CMakeLists.txt +++ b/hl/CMakeLists.txt @@ -19,7 +19,7 @@ endif () #-- Build the Unit testing if requested if (NOT HDF5_EXTERNALLY_CONFIGURED) - if (BUILD_TESTING) + if (BUILD_TESTING AND HDF5_TEST_SERIAL) add_subdirectory (test) endif () endif () diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 50e08e8..4bd4807 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -23,6 +23,6 @@ else () endif () set_target_properties (ptExampleFL PROPERTIES FOLDER examples/hl/cpp) -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_CPP AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index cfb24a8..429e5c7 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -24,4 +24,6 @@ else () endif () set_target_properties (hl_ptableTest PROPERTIES FOLDER test/hl/cpp) -include (CMakeTests.cmake) +if (HDF5_TEST_CPP AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 86c1770..44115e5 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -39,8 +39,6 @@ foreach (example ${examples}) set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl) endforeach () -if (BUILD_TESTING) - +if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) - endif () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index e41b8fe..449194e 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -52,6 +52,6 @@ foreach (example ${examples}) endif () endforeach () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_FORTRAN AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) include (CMakeTests.cmake) endif () diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index c152142..369692d 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -61,4 +61,6 @@ foreach (h5_test ${H5_TESTS}) ADD_H5_FORTRAN_EXE(${h5_test}) endforeach () -include (CMakeTests.cmake) +if (HDF5_TEST_FORTRAN AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index b24f887..63fb461 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -140,10 +140,10 @@ herr_t H5DSattach_scale(hid_t did, hobj_ref_t ref_j; /* iterator reference */ hvl_t *buf = NULL; /* VL buffer to store in the attribute */ hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */ - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; H5I_type_t it1, it2; int i; - size_t len; + size_t len; int found_ds=0; htri_t is_scale; @@ -156,20 +156,26 @@ herr_t H5DSattach_scale(hid_t did, return FAIL; /* the dataset cannot be a DS dataset */ - if ( is_scale == 1) + if (is_scale == 1) return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info2(did, &oi1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oi1, H5O_INFO_BASIC) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info2(dsid, &oi2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid, &oi2, H5O_INFO_BASIC) < 0) return FAIL; /* same object, not valid */ - if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr) - return FAIL; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0) + return FAIL; + if(!token_cmp) + return FAIL; + } /* end if */ /* get ID type */ if ((it1 = H5Iget_type(did)) < 0) @@ -177,7 +183,7 @@ herr_t H5DSattach_scale(hid_t did, if ((it2 = H5Iget_type(dsid)) < 0) return FAIL; - if (H5I_DATASET!=it1 || H5I_DATASET!=it2) + if (H5I_DATASET != it1 || H5I_DATASET != it2) return FAIL; /* the DS dataset cannot have dimension scales */ @@ -202,19 +208,19 @@ herr_t H5DSattach_scale(hid_t did, return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) + if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* scalar rank */ - if (rank==0) - rank=1; + if (rank == 0) + rank = 1; /* close dataset space */ if (H5Sclose(sid) < 0) return FAIL; /* parameter range checking */ - if (idx>(unsigned)rank-1) + if (idx > (unsigned)rank-1) return FAIL; /*------------------------------------------------------------------------- @@ -324,16 +330,22 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* get info for DS in the parameter list */ - if(H5Oget_info2(dsid, &oi1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid, &oi1, H5O_INFO_BASIC) < 0) goto out; /* get info for this DS */ - if(H5Oget_info2(dsid_j, &oi2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid_j, &oi2, H5O_INFO_BASIC) < 0) goto out; /* same object, so this DS scale is already in this DIM IDX */ - if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr) - found_ds = 1; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0) + goto out; + if(!token_cmp) + found_ds = 1; + } /* end if */ /* close the dereferenced dataset */ if(H5Dclose(dsid_j) < 0) @@ -508,7 +520,7 @@ herr_t H5DSattach_scale(hid_t did, *------------------------------------------------------------------------- */ - if((is_ds=H5DSis_scale(dsid)) < 0) + if((is_ds = H5DSis_scale(dsid)) < 0) return FAIL; if(is_ds == 0) { @@ -586,7 +598,7 @@ herr_t H5DSdetach_scale(hid_t did, int i; size_t j; hssize_t ii; - H5O_info_t did_oi, dsid_oi, tmp_oi; + H5O_info2_t did_oi, dsid_oi, tmp_oi; int found_dset = 0, found_ds = 0; int have_ds = 0; htri_t is_scale; @@ -598,7 +610,7 @@ herr_t H5DSdetach_scale(hid_t did, /* check for valid types of identifiers */ - if(H5I_DATASET!=H5Iget_type(did) || H5I_DATASET!=H5Iget_type(dsid)) + if(H5I_DATASET != H5Iget_type(did) || H5I_DATASET != H5Iget_type(dsid)) return FAIL; if((is_scale = H5DSis_scale(did)) < 0) @@ -609,16 +621,22 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info2(did, &did_oi, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &did_oi, H5O_INFO_BASIC) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info2(dsid, &dsid_oi, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid, &dsid_oi, H5O_INFO_BASIC) < 0) return FAIL; /* same object, not valid */ - if(did_oi.fileno == dsid_oi.fileno && did_oi.addr == dsid_oi.addr) - return FAIL; + if(did_oi.fileno == dsid_oi.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &did_oi.token, &dsid_oi.token, &token_cmp) < 0) + return FAIL; + if(!token_cmp) + return FAIL; + } /* end if */ /*------------------------------------------------------------------------- @@ -626,7 +644,7 @@ herr_t H5DSdetach_scale(hid_t did, *------------------------------------------------------------------------- */ /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ - if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST)) < 0) + if ((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0) return FAIL; if (has_dimlist == 0) @@ -637,7 +655,7 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) + if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* close dataset space */ @@ -645,7 +663,7 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* parameter range checking */ - if (idx>(unsigned)rank-1) + if (idx > (unsigned)rank-1) return FAIL; /*------------------------------------------------------------------------- @@ -696,7 +714,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* get info for this DS */ - if(H5Oget_info2(dsid_j, &tmp_oi, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid_j, &tmp_oi, H5O_INFO_BASIC) < 0) goto out; /* Close the dereferenced dataset */ @@ -704,30 +722,35 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* 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 - 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 - 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]; - len = --buf[idx].len; - if(len == 0) { - HDfree(buf[idx].p); - buf[idx].p = NULL; - } - /* 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; - } + if(dsid_oi.fileno == tmp_oi.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &dsid_oi.token, &tmp_oi.token, &token_cmp) < 0) + goto out; + if(!token_cmp) { + /* 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 + 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]; + len = --buf[idx].len; + if(len == 0) { + HDfree(buf[idx].p); + buf[idx].p = NULL; + } + /* 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; + } /* end if */ + } /* end if */ } /* j */ } /* if */ @@ -795,7 +818,7 @@ herr_t H5DSdetach_scale(hid_t did, if(H5Aread(aid, ntid, dsbuf) < 0) goto out; - for(ii=0; ii<nelmts; ii++) { + for(ii = 0; ii < nelmts; ii++) { /* First check if we have the same dimension index */ if(idx == dsbuf[ii].dim_idx) { /* get the reference to the dataset */ @@ -806,7 +829,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* get info for this dataset */ - if(H5Oget_info2(did_i, &tmp_oi, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did_i, &tmp_oi, H5O_INFO_BASIC) < 0) goto out; /* close the dereferenced dataset */ @@ -814,13 +837,19 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* same object, reset. we want to detach only for this DIM */ - if(did_oi.fileno == tmp_oi.fileno && did_oi.addr == tmp_oi.addr) { - /* copy the last one to replace the one which is found */ - dsbuf[ii] = dsbuf[nelmts-1]; - nelmts--; - found_dset=1; - break; - } /* if */ + if(did_oi.fileno == tmp_oi.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &did_oi.token, &tmp_oi.token, &token_cmp) < 0) + goto out; + if(!token_cmp) { + /* copy the last one to replace the one which is found */ + dsbuf[ii] = dsbuf[nelmts-1]; + nelmts--; + found_dset=1; + break; + } /* end if */ + } /* end if */ } /* if we have the same dimension index */ } /* ii */ @@ -954,7 +983,7 @@ htri_t H5DSis_attached(hid_t did, hvl_t *buf = NULL; /* VL buffer to store in the attribute */ hid_t dsid_j; /* DS dataset ID in DIMENSION_LIST */ hid_t did_i; /* dataset ID in REFERENCE_LIST */ - H5O_info_t oi1, oi2, oi3, oi4; + H5O_info2_t oi1, oi2, oi3, oi4; H5I_type_t it1, it2; int i; int found_dset=0, found_ds=0; @@ -973,16 +1002,22 @@ htri_t H5DSis_attached(hid_t did, return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info2(did, &oi1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oi1, H5O_INFO_BASIC) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info2(dsid, &oi2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid, &oi2, H5O_INFO_BASIC) < 0) return FAIL; /* same object, not valid */ - if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr) - return FAIL; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0) + return FAIL; + if(!token_cmp) + return FAIL; + } /* end if */ /* get ID type */ if ((it1 = H5Iget_type(did)) < 0) @@ -990,7 +1025,7 @@ htri_t H5DSis_attached(hid_t did, if ((it2 = H5Iget_type(dsid)) < 0) return FAIL; - if (H5I_DATASET!=it1 || H5I_DATASET!=it2) + if (H5I_DATASET != it1 || H5I_DATASET != it2) return FAIL; /*------------------------------------------------------------------------- @@ -1040,7 +1075,7 @@ htri_t H5DSis_attached(hid_t did, goto out; /* read */ - if (H5Aread(aid,tid,buf) < 0) + if (H5Aread(aid, tid, buf) < 0) goto out; /* iterate all the REFs in this dimension IDX */ @@ -1050,20 +1085,26 @@ htri_t H5DSis_attached(hid_t did, ref = ((hobj_ref_t *)buf[idx].p)[i]; /* get the scale id for this REF */ - if ((dsid_j = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) + if ((dsid_j = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref)) < 0) goto out; /* get info for DS in the parameter list */ - if(H5Oget_info2(dsid, &oi1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid, &oi1, H5O_INFO_BASIC) < 0) goto out; /* get info for this DS */ - if(H5Oget_info2(dsid_j, &oi2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(dsid_j, &oi2, H5O_INFO_BASIC) < 0) goto out; /* same object */ - if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr) - found_ds = 1; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &oi1.token, &oi2.token, &token_cmp) < 0) + goto out; + if(!token_cmp) + found_ds = 1; + } /* end if */ /* close the dereferenced dataset */ if (H5Dclose(dsid_j) < 0) @@ -1073,7 +1114,7 @@ htri_t H5DSis_attached(hid_t did, /* close */ - if (H5Treclaim(tid,sid,H5P_DEFAULT,buf) < 0) + if (H5Treclaim(tid, sid, H5P_DEFAULT, buf) < 0) goto out; if (H5Sclose(sid) < 0) goto out; @@ -1123,7 +1164,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; /*------------------------------------------------------------------------- @@ -1131,7 +1172,7 @@ htri_t H5DSis_attached(hid_t did, *------------------------------------------------------------------------- */ - for(i=0; i<nelmts; i++) + for(i = 0; i < nelmts; i++) { /* get the reference */ ref = dsbuf[i].ref; @@ -1140,20 +1181,26 @@ htri_t H5DSis_attached(hid_t did, if (ref) { /* get the dataset id */ - if ((did_i = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) + if ((did_i = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &ref)) < 0) goto out; /* get info for dataset in the parameter list */ - if(H5Oget_info2(did, &oi3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oi3, H5O_INFO_BASIC) < 0) goto out; /* get info for this dataset */ - if(H5Oget_info2(did_i, &oi4, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did_i, &oi4, H5O_INFO_BASIC) < 0) goto out; /* same object */ - if(oi3.fileno == oi4.fileno && oi3.addr == oi4.addr && idx==dsbuf[i].dim_idx) - found_dset=1; + if(oi3.fileno == oi4.fileno) { + int token_cmp; + + if(H5Otoken_cmp(did, &oi3.token, &oi4.token, &token_cmp) < 0) + goto out; + if(!token_cmp && (idx == dsbuf[i].dim_idx)) + found_dset=1; + } /* end if */ /* close the dereferenced dataset */ if (H5Dclose(did_i) < 0) diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index bb72ce6..3f6c538 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1360,7 +1360,7 @@ out: */ static herr_t -find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_data) +find_dataset(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *op_data) { /* Define a default zero value for return. This will cause the iterator to continue if * the dataset is not found yet. @@ -1411,7 +1411,7 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_d herr_t H5LTfind_dataset( hid_t loc_id, const char *dset_name ) { - return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name); + return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name); } diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 2959c6c..69f3dae 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -93,4 +93,6 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) set_target_properties (hl_gen_test_ld PROPERTIES FOLDER test/hl/gen) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index 3cd913f..e12588b 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -67,7 +67,7 @@ if (BUILD_SHARED_LIBS) ) endif () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_SERIAL) # -------------------------------------------------------------------- # This executable can generate the actual test files - Currently not # used in the CMake Build system as we rely on the test files that are @@ -83,7 +83,9 @@ if (BUILD_TESTING) # add_test (NAME hl_h52gifgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:hl_h52gifgentest>) endif () - include (CMakeTests.cmake) + if (HDF5_TEST_TOOLS) + include (CMakeTests.cmake) + endif () endif () #----------------------------------------------------------------------------- diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 55081c3..8cd8a8e 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -173,7 +173,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) /* Now read in values from the image descriptor */ IWidth = GifImageDesc->ImageWidth; IHeight = GifImageDesc->ImageHeight; - Interlace = GifImageDesc->PackedField & 0x40; + Interlace = (uint8_t)(GifImageDesc->PackedField & 0x40); /* * Note that I ignore the possible existence of a local color map. I'm diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index b3d65f7..edb78c0 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -26,7 +26,7 @@ if (BUILD_SHARED_LIBS) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5watch-shared) endif () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) #-- Add swmr_check_compat_vfd program set (hl_swmr_check_compat_vfd_SOURCES ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/swmr_check_compat_vfd.c @@ -68,7 +68,9 @@ if (BUILD_TESTING) endif () set_target_properties (h5watchgentest PROPERTIES FOLDER generator/tools/hl) - include (CMakeTests.cmake) + if (HDF5_TEST_TOOLS) + include (CMakeTests.cmake) + endif () endif () #----------------------------------------------------------------------------- diff --git a/hl/tools/h5watch/testh5watch.sh.in b/hl/tools/h5watch/testh5watch.sh.in index d31bcc3..24ff6aa 100644 --- a/hl/tools/h5watch/testh5watch.sh.in +++ b/hl/tools/h5watch/testh5watch.sh.in @@ -18,7 +18,7 @@ # supports SWMR. ./swmr_check_compat_vfd rc=$? -if [[ $rc != 0 ]] ; then +if [ $rc != 0 ] ; then echo echo "The VFD specified by the HDF5_DRIVER environment variable" echo "does not support SWMR." diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 8849524..02b9fdf 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -71,7 +71,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") endforeach () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index b83da0e..f32f645 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -56,7 +56,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") endforeach () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") diff --git a/java/examples/datatypes/H5Ex_T_Float.java b/java/examples/datatypes/H5Ex_T_Float.java index f677479..f15f774 100644 --- a/java/examples/datatypes/H5Ex_T_Float.java +++ b/java/examples/datatypes/H5Ex_T_Float.java @@ -22,6 +22,8 @@ package examples.datatypes; import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; @@ -173,7 +175,7 @@ public class H5Ex_T_Float { } // Output the data to the screen. - DecimalFormat df = new DecimalFormat("#,##0.0000"); + DecimalFormat df = new DecimalFormat("#,##0.0000", new DecimalFormatSymbols(Locale.US)); System.out.println(DATASETNAME + ":"); for (int indx = 0; indx < dims[0]; indx++) { System.out.print(" ["); diff --git a/java/examples/datatypes/H5Ex_T_FloatAttribute.java b/java/examples/datatypes/H5Ex_T_FloatAttribute.java index 2e706d9..12831bc 100644 --- a/java/examples/datatypes/H5Ex_T_FloatAttribute.java +++ b/java/examples/datatypes/H5Ex_T_FloatAttribute.java @@ -22,6 +22,8 @@ package examples.datatypes; import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; @@ -201,7 +203,7 @@ public class H5Ex_T_FloatAttribute { } // Output the data to the screen. - DecimalFormat df = new DecimalFormat("#,##0.0000"); + DecimalFormat df = new DecimalFormat("#,##0.0000", new DecimalFormatSymbols(Locale.US)); System.out.println(ATTRIBUTENAME + ":"); for (int indx = 0; indx < dims[0]; indx++) { System.out.print(" ["); diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 9e43087..e319a7f 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -55,7 +55,7 @@ foreach (h5_file ${HDF_JAVA_TEST_FILES}) endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") diff --git a/java/examples/groups/H5Ex_G_Intermediate.java b/java/examples/groups/H5Ex_G_Intermediate.java index f7d5a50..e97e5f8 100644 --- a/java/examples/groups/H5Ex_G_Intermediate.java +++ b/java/examples/groups/H5Ex_G_Intermediate.java @@ -19,8 +19,8 @@ package examples.groups; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5O_iterate_cb; import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; import hdf.hdf5lib.structs.H5O_info_t; import java.util.ArrayList; @@ -53,9 +53,9 @@ public class H5Ex_G_Intermediate { // Print all the objects in the file_ids to show that intermediate group_ids have been created. System.out.println("Objects in the file_id:"); - // H5O_iterate_t iter_data = null; - H5O_iterate_t iter_data = new H5O_iter_data(); - H5O_iterate_cb iter_cb = new H5O_iter_callback(); + // H5O_iterate_opdata_t iter_data = null; + H5O_iterate_opdata_t iter_data = new H5O_iter_data(); + H5O_iterate_t iter_cb = new H5O_iter_callback(); H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data); } @@ -92,12 +92,12 @@ public class H5Ex_G_Intermediate { } } - private class H5O_iter_data implements H5O_iterate_t { + private class H5O_iter_data implements H5O_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - private class H5O_iter_callback implements H5O_iterate_cb { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + private class H5O_iter_callback implements H5O_iterate_t { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5O_iter_data) op_data).iterdata.add(id); diff --git a/java/examples/groups/H5Ex_G_Iterate.java b/java/examples/groups/H5Ex_G_Iterate.java index 3c9ca82..5acbf65 100644 --- a/java/examples/groups/H5Ex_G_Iterate.java +++ b/java/examples/groups/H5Ex_G_Iterate.java @@ -19,6 +19,7 @@ package examples.groups; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5O_token_t; import java.util.EnumSet; import java.util.HashMap; @@ -75,8 +76,8 @@ public class H5Ex_G_Iterate { String[] oname = new String[count]; int[] otype = new int[count]; int[] ltype = new int[count]; - long[] orefs = new long[count]; - H5.H5Gget_obj_info_all(file_id, DATASETNAME, oname, otype, ltype, orefs, HDF5Constants.H5_INDEX_NAME); + H5O_token_t[] otokens = new H5O_token_t[count]; + H5.H5Gget_obj_info_all(file_id, DATASETNAME, oname, otype, ltype, otokens, HDF5Constants.H5_INDEX_NAME); // Get type of the object and display its name and type. for (int indx = 0; indx < otype.length; indx++) { diff --git a/java/examples/groups/H5Ex_G_Traverse.java b/java/examples/groups/H5Ex_G_Traverse.java index 2a2cba3..6225a9e 100644 --- a/java/examples/groups/H5Ex_G_Traverse.java +++ b/java/examples/groups/H5Ex_G_Traverse.java @@ -25,22 +25,22 @@ package examples.groups; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5L_iterate_cb; import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; import hdf.hdf5lib.structs.H5L_info_t; import hdf.hdf5lib.structs.H5O_info_t; import examples.groups.H5Ex_G_Iterate.H5O_type; -class opdata implements H5L_iterate_t { +class opdata implements H5L_iterate_opdata_t { int recurs; opdata prev; - long addr; + H5O_token_t obj_token; } public class H5Ex_G_Traverse { private static String FILE = "h5ex_g_traverse.h5"; - public static H5L_iterate_cb iter_cb = new H5L_iter_callbackT(); + public static H5L_iterate_t iter_cb = new H5L_iter_callbackT(); private static void OpenGroup() { long file_id = -1; @@ -54,7 +54,7 @@ public class H5Ex_G_Traverse { infobuf = H5.H5Oget_info(file_id); od.recurs = 0; od.prev = null; - od.addr = infobuf.addr; + od.obj_token = infobuf.token; } } catch (Exception e) { @@ -64,7 +64,7 @@ public class H5Ex_G_Traverse { // Print the root group and formatting, begin iteration. try { System.out.println("/ {"); - // H5L_iterate_cb iter_cb = new H5L_iter_callbackT(); + // H5L_iterate_t iter_cb = new H5L_iter_callbackT(); H5.H5Literate(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb, od); System.out.println("}"); } @@ -87,8 +87,8 @@ public class H5Ex_G_Traverse { } } -class H5L_iter_callbackT implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { +class H5L_iter_callbackT implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { H5O_info_t infobuf; int return_val = 0; @@ -105,7 +105,7 @@ class H5L_iter_callbackT implements H5L_iterate_cb { switch (H5O_type.get(infobuf.type)) { case H5O_TYPE_GROUP: System.out.println("Group: " + name + " { "); - // Check group address against linked list of operator + // Check group object token against linked list of operator // data structures. We will always run the check, as the // reference count cannot be relied upon if there are // symbolic links, and H5Oget_info_by_name always follows @@ -114,7 +114,7 @@ class H5L_iter_callbackT implements H5L_iterate_cb { // links, however it could still fail if an object's // reference count was manually manipulated with // H5Odecr_refcount. - if (group_check(od, infobuf.addr)) { + if (group_check(od, infobuf.token)) { for (int i = 0; i < spaces; i++) System.out.print(" "); System.out.println(" Warning: Loop detected!"); @@ -127,8 +127,8 @@ class H5L_iter_callbackT implements H5L_iterate_cb { opdata nextod = new opdata(); nextod.recurs = od.recurs + 1; nextod.prev = od; - nextod.addr = infobuf.addr; - H5L_iterate_cb iter_cb2 = new H5L_iter_callbackT(); + nextod.obj_token = infobuf.token; + H5L_iterate_t iter_cb2 = new H5L_iter_callbackT(); return_val = H5.H5Literate_by_name(group, name, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb2, nextod, HDF5Constants.H5P_DEFAULT); } @@ -153,13 +153,13 @@ class H5L_iter_callbackT implements H5L_iterate_cb { return return_val; } - public boolean group_check(opdata od, long target_addr) { - if (od.addr == target_addr) - return true; // Addresses match + public boolean group_check(opdata od, H5O_token_t target_token) { + if (od.obj_token.equals(target_token)) + return true; // Object tokens match else if (od.recurs == 0) return false; // Root group reached with no matches else - return group_check(od.prev, target_addr); // Recursively examine the next node + return group_check(od.prev, target_token); // Recursively examine the next node } } diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java index f91c707..4255316 100644 --- a/java/examples/groups/H5Ex_G_Visit.java +++ b/java/examples/groups/H5Ex_G_Visit.java @@ -23,10 +23,10 @@ package examples.groups; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5L_iterate_cb; import hdf.hdf5lib.callbacks.H5L_iterate_t; -import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; import hdf.hdf5lib.structs.H5L_info_t; import hdf.hdf5lib.structs.H5O_info_t; @@ -55,13 +55,13 @@ public class H5Ex_G_Visit { // Begin iteration using H5Ovisit System.out.println("Objects in the file:"); - H5O_iterate_t iter_data = new H5O_iter_data(); - H5O_iterate_cb iter_cb = new H5O_iter_callback(); + H5O_iterate_opdata_t iter_data = new H5O_iter_data(); + H5O_iterate_t iter_cb = new H5O_iter_callback(); H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data); System.out.println(); // Repeat the same process using H5Lvisit - H5L_iterate_t iter_data2 = new H5L_iter_data(); - H5L_iterate_cb iter_cb2 = new H5L_iter_callback(); + H5L_iterate_opdata_t iter_data2 = new H5L_iter_data(); + H5L_iterate_t iter_cb2 = new H5L_iter_callback(); System.out.println("Links in the file:"); H5.H5Lvisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb2, iter_data2); @@ -91,12 +91,12 @@ public class H5Ex_G_Visit { } } - private class H5L_iter_data implements H5L_iterate_t { + private class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - private class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + private class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data) op_data).iterdata.add(id); @@ -107,8 +107,8 @@ public class H5Ex_G_Visit { // Get type of the object and display its name and type. The name of the object is passed to this // function by the Library. infobuf = H5.H5Oget_info_by_name(group, name, HDF5Constants.H5P_DEFAULT); - H5O_iterate_cb iter_cbO = new H5O_iter_callback(); - H5O_iterate_t iter_dataO = new H5O_iter_data(); + H5O_iterate_t iter_cbO = new H5O_iter_callback(); + H5O_iterate_opdata_t iter_dataO = new H5O_iter_data(); ret = iter_cbO.callback(group, name, infobuf, iter_dataO); } catch (Exception e) { @@ -119,12 +119,12 @@ public class H5Ex_G_Visit { } } - private class H5O_iter_data implements H5O_iterate_t { + private class H5O_iter_data implements H5O_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - private class H5O_iter_callback implements H5O_iterate_cb { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + private class H5O_iter_callback implements H5O_iterate_t { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5O_iter_data) op_data).iterdata.add(id); diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index b56e3ad..a1ccd6b 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -45,7 +45,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") endforeach () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") diff --git a/java/src/Makefile.am b/java/src/Makefile.am index fcdeae9..b7ad4bd 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -51,10 +51,10 @@ hdf5_java_JAVA = \ ${pkgpath}/callbacks/H5D_iterate_t.java \ ${pkgpath}/callbacks/H5E_walk_cb.java \ ${pkgpath}/callbacks/H5E_walk_t.java \ - ${pkgpath}/callbacks/H5L_iterate_cb.java \ ${pkgpath}/callbacks/H5L_iterate_t.java \ - ${pkgpath}/callbacks/H5O_iterate_cb.java \ + ${pkgpath}/callbacks/H5L_iterate_opdata_t.java \ ${pkgpath}/callbacks/H5O_iterate_t.java \ + ${pkgpath}/callbacks/H5O_iterate_opdata_t.java \ ${pkgpath}/callbacks/H5P_cls_close_func_cb.java \ ${pkgpath}/callbacks/H5P_cls_close_func_t.java \ ${pkgpath}/callbacks/H5P_cls_copy_func_cb.java \ @@ -103,6 +103,8 @@ hdf5_java_JAVA = \ ${pkgpath}/structs/H5G_info_t.java \ ${pkgpath}/structs/H5L_info_t.java \ ${pkgpath}/structs/H5O_info_t.java \ + ${pkgpath}/structs/H5O_native_info_t.java \ + ${pkgpath}/structs/H5O_token_t.java \ ${pkgpath}/structs/H5O_hdr_info_t.java \ ${pkgpath}/structs/H5AC_cache_config_t.java \ ${pkgpath}/H5.java \ diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt index be8f60a..b0293fb 100644 --- a/java/src/hdf/hdf5lib/CMakeLists.txt +++ b/java/src/hdf/hdf5lib/CMakeLists.txt @@ -18,10 +18,10 @@ set (HDF5_JAVA_HDF_HDF5_CALLBACKS_SOURCES callbacks/H5D_iterate_t.java callbacks/H5E_walk_cb.java callbacks/H5E_walk_t.java - callbacks/H5L_iterate_cb.java callbacks/H5L_iterate_t.java - callbacks/H5O_iterate_cb.java + callbacks/H5L_iterate_opdata_t.java callbacks/H5O_iterate_t.java + callbacks/H5O_iterate_opdata_t.java callbacks/H5P_cls_close_func_cb.java callbacks/H5P_cls_close_func_t.java callbacks/H5P_cls_copy_func_cb.java @@ -79,6 +79,8 @@ set (HDF5_JAVA_HDF_HDF5_STRUCTS_SOURCES structs/H5L_info_t.java structs/H5O_hdr_info_t.java structs/H5O_info_t.java + structs/H5O_native_info_t.java + structs/H5O_token_t.java ) set (HDF5_JAVA_HDF_HDF5_SOURCES diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index ba10f5e..5b704dd 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -24,10 +24,10 @@ import hdf.hdf5lib.callbacks.H5D_iterate_cb; import hdf.hdf5lib.callbacks.H5D_iterate_t; import hdf.hdf5lib.callbacks.H5E_walk_cb; import hdf.hdf5lib.callbacks.H5E_walk_t; -import hdf.hdf5lib.callbacks.H5L_iterate_cb; import hdf.hdf5lib.callbacks.H5L_iterate_t; -import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; import hdf.hdf5lib.callbacks.H5P_cls_close_func_cb; import hdf.hdf5lib.callbacks.H5P_cls_close_func_t; import hdf.hdf5lib.callbacks.H5P_cls_copy_func_cb; @@ -55,6 +55,8 @@ import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; import hdf.hdf5lib.structs.H5G_info_t; import hdf.hdf5lib.structs.H5L_info_t; import hdf.hdf5lib.structs.H5O_info_t; +import hdf.hdf5lib.structs.H5O_native_info_t; +import hdf.hdf5lib.structs.H5O_token_t; /** * This class is the Java interface for the HDF5 library. @@ -3577,8 +3579,8 @@ public class H5 implements java.io.Serializable { * OUT: Names of all objects under the group, name. * @param objTypes * OUT: Types of all objects under the group, name. - * @param objRef - * OUT: Reference number of all objects under the group, name. + * @param tokens + * OUT: Object token of all objects under the group, name. * * @return the number of items found * @@ -3588,26 +3590,26 @@ public class H5 implements java.io.Serializable { * - name is null. */ public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] objNames, int[] objTypes, - long[] objRef) throws HDF5LibraryException, NullPointerException { + H5O_token_t[] tokens) throws HDF5LibraryException, NullPointerException { if (objNames == null) { throw new NullPointerException("H5Gget_obj_info_all(): name array is null"); } - return H5Gget_obj_info_all(loc_id, name, objNames, objTypes, null, null, objRef, HDF5Constants.H5_INDEX_NAME); + return H5Gget_obj_info_all(loc_id, name, objNames, objTypes, null, null, tokens, HDF5Constants.H5_INDEX_NAME); } public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] oname, int[] otype, - int[] ltype, long[] ref, int indx_type) throws HDF5LibraryException, NullPointerException { - return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, null, ref, indx_type, -1); + int[] ltype, H5O_token_t[] tokens, int indx_type) throws HDF5LibraryException, NullPointerException { + return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, null, tokens, indx_type, -1); } public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] oname, int[] otype, - int[] ltype, long[] fno, long[] ref, int indx_type) throws HDF5LibraryException, NullPointerException { - return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, ref, oname.length, indx_type, -1); + int[] ltype, long[] fno, H5O_token_t[] tokens, int indx_type) throws HDF5LibraryException, NullPointerException { + return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, tokens, oname.length, indx_type, -1); } public synchronized static int H5Gget_obj_info_full(long loc_id, String name, String[] oname, int[] otype, - int[] ltype, long[] fno, long[] ref, int indx_type, int indx_order) throws HDF5LibraryException, + int[] ltype, long[] fno, H5O_token_t[] tokens, int indx_type, int indx_order) throws HDF5LibraryException, NullPointerException { if (oname == null) { throw new NullPointerException("H5Gget_obj_info_full(): name array is null"); @@ -3629,7 +3631,7 @@ public class H5 implements java.io.Serializable { ltype = new int[otype.length]; if (fno == null) - fno = new long[ref.length]; + fno = new long[tokens.length]; if (indx_type < 0) indx_type = HDF5Constants.H5_INDEX_NAME; @@ -3638,7 +3640,7 @@ public class H5 implements java.io.Serializable { indx_order = HDF5Constants.H5_ITER_INC; log.trace("H5Gget_obj_info_full: oname_len={}", oname.length); - int status = H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, ref, oname.length, indx_type, + int status = H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, tokens, oname.length, indx_type, indx_order); for (int indx = 0; indx < oname.length; indx++) log.trace("H5Gget_obj_info_full: oname={}", oname[indx]); @@ -3646,7 +3648,7 @@ public class H5 implements java.io.Serializable { } private synchronized static native int H5Gget_obj_info_full(long loc_id, String name, String[] oname, int[] otype, - int[] ltype, long[] fno, long[] ref, int n, int indx_type, int indx_order) throws HDF5LibraryException, + int[] ltype, long[] fno, H5O_token_t[] tokens, int n, int indx_type, int indx_order) throws HDF5LibraryException, NullPointerException; /** @@ -3701,8 +3703,8 @@ public class H5 implements java.io.Serializable { * OUT: Types of all objects under the group, name. * @param lnkTypes * OUT: Types of all links under the group, name. - * @param objRef - * OUT: Reference number of all objects under the group, name. + * @param objToken + * OUT: Object token of all objects under the group, name. * @param objMax * IN: Maximum number of all objects under the group, name. * @@ -3714,7 +3716,7 @@ public class H5 implements java.io.Serializable { * - name is null. */ public synchronized static int H5Gget_obj_info_max(long loc_id, String[] objNames, int[] objTypes, int[] lnkTypes, - long[] objRef, long objMax) throws HDF5LibraryException, NullPointerException { + H5O_token_t[] objToken, long objMax) throws HDF5LibraryException, NullPointerException { if (objNames == null) { throw new NullPointerException("H5Gget_obj_info_max(): name array is null"); } @@ -3739,11 +3741,11 @@ public class H5 implements java.io.Serializable { throw new HDF5LibraryException("H5Gget_obj_info_max(): name and type array sizes are different"); } - return H5Gget_obj_info_max(loc_id, objNames, objTypes, lnkTypes, objRef, objMax, objNames.length); + return H5Gget_obj_info_max(loc_id, objNames, objTypes, lnkTypes, objToken, objMax, objNames.length); } private synchronized static native int H5Gget_obj_info_max(long loc_id, String[] oname, int[] otype, int[] ltype, - long[] ref, long amax, int n) throws HDF5LibraryException, NullPointerException; + H5O_token_t[] tokens, long amax, int n) throws HDF5LibraryException, NullPointerException; /** * H5Gn_members report the number of objects in a Group. The 'objects' include everything that will be visited by @@ -4340,8 +4342,8 @@ public class H5 implements java.io.Serializable { * @exception HDF5LibraryException * - Error from the HDF-5 Library. **/ - public synchronized static native int H5Literate(long grp_id, int idx_type, int order, long idx, H5L_iterate_cb op, - H5L_iterate_t op_data) throws HDF5LibraryException; + public synchronized static native int H5Literate(long grp_id, int idx_type, int order, long idx, H5L_iterate_t op, + H5L_iterate_opdata_t op_data) throws HDF5LibraryException; /** * H5Literate_by_name iterates through links in a group. @@ -4372,7 +4374,7 @@ public class H5 implements java.io.Serializable { * - group_name is null. **/ public synchronized static native int H5Literate_by_name(long grp_id, String group_name, int idx_type, int order, - long idx, H5L_iterate_cb op, H5L_iterate_t op_data, long lapl_id) throws HDF5LibraryException, + long idx, H5L_iterate_t op, H5L_iterate_opdata_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; /** @@ -4419,8 +4421,8 @@ public class H5 implements java.io.Serializable { * @exception HDF5LibraryException * - Error from the HDF-5 Library. **/ - public synchronized static native int H5Lvisit(long grp_id, int idx_type, int order, H5L_iterate_cb op, - H5L_iterate_t op_data) throws HDF5LibraryException; + public synchronized static native int H5Lvisit(long grp_id, int idx_type, int order, H5L_iterate_t op, + H5L_iterate_opdata_t op_data) throws HDF5LibraryException; /** * H5Lvisit_by_name recursively visits all links starting from a specified group. @@ -4449,7 +4451,7 @@ public class H5 implements java.io.Serializable { * - group_name is null. **/ public synchronized static native int H5Lvisit_by_name(long loc_id, String group_name, int idx_type, int order, - H5L_iterate_cb op, H5L_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; + H5L_iterate_t op, H5L_iterate_opdata_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; /** @@ -4666,6 +4668,52 @@ public class H5 implements java.io.Serializable { NullPointerException; /** + * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name. + * + * @param loc_id + * IN: File or group identifier specifying location of group in which object is located + * @param name + * IN: Relative name of group + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as + * H5P_DEFAULT.) + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static H5O_info_t H5Oget_info_by_name(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException { + return H5Oget_info_by_name(loc_id, name, HDF5Constants.H5O_INFO_ALL, lapl_id); + } + + /** + * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name. + * + * @param loc_id + * IN: File or group identifier specifying location of group in which object is located + * @param name + * IN: Relative name of group + * @param fields + * IN: Object fields to select + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as + * H5P_DEFAULT.) + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5O_info_t H5Oget_info_by_name(long loc_id, String name, int fields, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** * H5Oget_info_by_idx retrieves the metadata for an object, identifying the object by an index position. * * @param loc_id @@ -4724,7 +4772,47 @@ public class H5 implements java.io.Serializable { int order, long n, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; /** - * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name. + * H5Oget_native_info retrieves the native HDF5-specific metadata for an HDF5 object specified by an identifier. + * Native HDF5-specific metadata includes things like object header information and object storage layout information. + * + * @param loc_id + * IN: Identifier for target object + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static H5O_native_info_t H5Oget_native_info(long loc_id) throws HDF5LibraryException, + NullPointerException { + return H5Oget_native_info(loc_id, HDF5Constants.H5O_NATIVE_INFO_ALL); + } + + /** + * H5Oget_native_info retrieves the native HDF5-specific metadata for an HDF5 object specified by an identifier. + * Native HDF5-specific metadata includes things like object header information and object storage layout information. + * + * @param loc_id + * IN: Identifier for target object + * @param fields + * IN: Object fields to select + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5O_native_info_t H5Oget_native_info(long loc_id, int fields) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Oget_native_info_by_name retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object + * by location and relative name. Native HDF5-specific metadata includes things like object header information and + * object storage layout information. * * @param loc_id * IN: File or group identifier specifying location of group in which object is located @@ -4741,13 +4829,15 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - name is null. **/ - public static H5O_info_t H5Oget_info_by_name(long loc_id, String name, long lapl_id) + public static H5O_native_info_t H5Oget_native_info_by_name(long loc_id, String name, long lapl_id) throws HDF5LibraryException, NullPointerException { - return H5Oget_info_by_name(loc_id, name, HDF5Constants.H5O_INFO_ALL, lapl_id); + return H5Oget_native_info_by_name(loc_id, name, HDF5Constants.H5O_NATIVE_INFO_ALL, lapl_id); } /** - * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name. + * H5Oget_native_info_by_name retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object + * by location and relative name. Native HDF5-specific metadata includes things like object header information and + * object storage layout information. * * @param loc_id * IN: File or group identifier specifying location of group in which object is located @@ -4766,10 +4856,72 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - name is null. **/ - public synchronized static native H5O_info_t H5Oget_info_by_name(long loc_id, String name, int fields, long lapl_id) + public synchronized static native H5O_native_info_t H5Oget_native_info_by_name(long loc_id, String name, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; /** + * H5Oget_native_info_by_idx retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object + * by an index position. Native HDF5-specific metadata includes things like object header information and + * object storage layout information. + * + * @param loc_id + * IN: File or group identifier + * @param group_name + * IN: Name of group, relative to loc_id, in which object is located + * @param idx_type + * IN: Type of index by which objects are ordered + * @param order + * IN: Order of iteration within index + * @param n + * IN: Object to open + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as + * H5P_DEFAULT.) + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static H5O_native_info_t H5Oget_native_info_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException { + return H5Oget_native_info_by_idx(loc_id, group_name, idx_type, order, n, HDF5Constants.H5O_NATIVE_INFO_ALL, lapl_id); + } + + /** + * H5Oget_native_info_by_idx retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object + * by an index position. Native HDF5-specific metadata includes things like object header information and + * object storage layout information. + * + * @param loc_id + * IN: File or group identifier + * @param group_name + * IN: Name of group, relative to loc_id, in which object is located + * @param idx_type + * IN: Type of index by which objects are ordered + * @param order + * IN: Order of iteration within index + * @param n + * IN: Object to open + * @param fields + * IN: Object fields to select + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as + * H5P_DEFAULT.) + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5O_native_info_t H5Oget_native_info_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** * H5Olink creates a new hard link to an object in an HDF5 file. * * @param obj_id @@ -4843,7 +4995,7 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - name is null. **/ - public static int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_cb op, H5O_iterate_t op_data) + public static int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_t op, H5O_iterate_opdata_t op_data) throws HDF5LibraryException, NullPointerException { return H5Ovisit(obj_id, idx_type, order, op, op_data, HDF5Constants.H5O_INFO_ALL); } @@ -4872,8 +5024,8 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - name is null. **/ - public synchronized static native int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_cb op, - H5O_iterate_t op_data, int fields) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_t op, + H5O_iterate_opdata_t op_data, int fields) throws HDF5LibraryException, NullPointerException; /** * H5Ovisit_by_name recursively visits all objects starting from a specified object. @@ -4902,7 +5054,7 @@ public class H5 implements java.io.Serializable { * - name is null. **/ public static int H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order, - H5O_iterate_cb op, H5O_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException { + H5O_iterate_t op, H5O_iterate_opdata_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException { return H5Ovisit_by_name(loc_id, obj_name, idx_type, order, op, op_data, HDF5Constants.H5O_INFO_ALL, lapl_id); } @@ -4935,7 +5087,7 @@ public class H5 implements java.io.Serializable { * - name is null. **/ public synchronized static native int H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order, - H5O_iterate_cb op, H5O_iterate_t op_data, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; + H5O_iterate_t op, H5O_iterate_opdata_t op_data, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; /** @@ -4977,26 +5129,28 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Oincr_refcount(long object_id) throws HDF5LibraryException; /** - * H5Oopen_by_addr opens a group, dataset, or named datatype using its address within an HDF5 file. + * H5Oopen_by_token opens a group, dataset, or named datatype using its object token within an HDF5 file. * * @param loc_id IN: File or group identifier - * @param addr IN: Object's address in the file + * @param token IN: Object's token in the file * * @return an object identifier for the opened object * * @exception HDF5LibraryException - Error from the HDF-5 Library. **/ - public static long H5Oopen_by_addr(long loc_id, long addr) throws HDF5LibraryException { - long id = _H5Oopen_by_addr(loc_id, addr); + public static long H5Oopen_by_token(long loc_id, H5O_token_t token) throws HDF5LibraryException { + long id = _H5Oopen_by_token(loc_id, token); + if (id > 0) { - log.trace("OPEN_IDS: H5Oopen_by_addr add {}", id); + log.trace("OPEN_IDS: H5Oopen_by_token add {}", id); OPEN_IDS.add(id); log.trace("OPEN_IDS: {}", OPEN_IDS.size()); } + return id; } - private synchronized static native long _H5Oopen_by_addr(long loc_id, long addr) + private synchronized static native long _H5Oopen_by_token(long loc_id, H5O_token_t token) throws HDF5LibraryException, NullPointerException; /** @@ -5060,6 +5214,12 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Oenable_mdc_flushes(long object_id); public synchronized static native boolean H5Oare_mdc_flushes_disabled(long object_id); + // /////// unimplemented //////// + // herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, + // int *cmp_value); + // herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str); + // herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token); + // //////////////////////////////////////////////////////////// // // // H5P: Property List Interface Functions // @@ -10736,7 +10896,8 @@ public class H5 implements java.io.Serializable { public synchronized static native long H5VLregister_connector_by_name(String connector_name, long vipl_id); public synchronized static native long H5VLregister_connector_by_value(int connector_value, long vipl_id); public synchronized static native boolean H5VLis_connector_registered(String name); - public synchronized static native long H5VLget_connector_id(String name); + public synchronized static native long H5VLget_connector_id(long object_id); + public synchronized static native long H5VLget_connector_id_by_name(String name); public synchronized static native String H5VLget_connector_name(long object_id); public synchronized static native void H5VLclose(long connector_id); public synchronized static native void H5VLunregister_connector(long connector_id); diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 4aeeb98..beba1d1 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -14,6 +14,8 @@ package hdf.hdf5lib; +import hdf.hdf5lib.structs.H5O_token_t; + /** * /** This class contains C constants and enumerated types of HDF5 library. The * values of these constants are obtained from the library by calling J2C(int @@ -344,9 +346,10 @@ public class HDF5Constants { public static final int H5O_INFO_BASIC = H5O_INFO_BASIC(); public static final int H5O_INFO_TIME = H5O_INFO_TIME(); public static final int H5O_INFO_NUM_ATTRS = H5O_INFO_NUM_ATTRS(); - public static final int H5O_INFO_HDR = H5O_INFO_HDR(); - public static final int H5O_INFO_META_SIZE = H5O_INFO_META_SIZE(); public static final int H5O_INFO_ALL = H5O_INFO_ALL(); + public static final int H5O_NATIVE_INFO_HDR = H5O_NATIVE_INFO_HDR(); + public static final int H5O_NATIVE_INFO_META_SIZE = H5O_NATIVE_INFO_META_SIZE(); + public static final int H5O_NATIVE_INFO_ALL = H5O_NATIVE_INFO_ALL(); public static final int H5O_SHMESG_NONE_FLAG = H5O_SHMESG_NONE_FLAG(); public static final int H5O_SHMESG_SDSPACE_FLAG = H5O_SHMESG_SDSPACE_FLAG(); public static final int H5O_SHMESG_DTYPE_FLAG = H5O_SHMESG_DTYPE_FLAG(); @@ -359,6 +362,8 @@ public class HDF5Constants { public static final int H5O_TYPE_DATASET = H5O_TYPE_DATASET(); public static final int H5O_TYPE_NAMED_DATATYPE = H5O_TYPE_NAMED_DATATYPE(); public static final int H5O_TYPE_NTYPES = H5O_TYPE_NTYPES(); + public static final int H5O_MAX_TOKEN_SIZE = H5O_MAX_TOKEN_SIZE(); + public static final H5O_token_t H5O_TOKEN_UNDEF = H5O_TOKEN_UNDEF(); public static final long H5P_ROOT = H5P_ROOT(); public static final long H5P_OBJECT_CREATE = H5P_OBJECT_CREATE(); @@ -1308,11 +1313,13 @@ public class HDF5Constants { private static native final int H5O_INFO_NUM_ATTRS(); - private static native final int H5O_INFO_HDR(); + private static native final int H5O_INFO_ALL(); - private static native final int H5O_INFO_META_SIZE(); + private static native final int H5O_NATIVE_INFO_HDR(); - private static native final int H5O_INFO_ALL(); + private static native final int H5O_NATIVE_INFO_META_SIZE(); + + private static native final int H5O_NATIVE_INFO_ALL(); private static native final int H5O_SHMESG_NONE_FLAG(); @@ -1338,6 +1345,10 @@ public class HDF5Constants { private static native final int H5O_TYPE_NTYPES(); + private static native final int H5O_MAX_TOKEN_SIZE(); + + private static native final H5O_token_t H5O_TOKEN_UNDEF(); + private static native final long H5P_ROOT(); private static native final long H5P_OBJECT_CREATE(); diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java index ec71911..ad9ad8c 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java @@ -13,9 +13,6 @@ package hdf.hdf5lib.callbacks; -import hdf.hdf5lib.structs.H5L_info_t; +public interface H5L_iterate_opdata_t { -//Information class for link callback(for H5Lvisit/H5Lvisit_by_name) -public interface H5L_iterate_cb extends Callbacks { - int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data); } diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java index 28ffb8a..f92fbc4 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java @@ -13,8 +13,9 @@ package hdf.hdf5lib.callbacks; -public interface H5L_iterate_t { -/** public ArrayList iterdata = new ArrayList(); - * Any derived interfaces must define the single public variable as above. - */ +import hdf.hdf5lib.structs.H5L_info_t; + +// Information class for link callback (for H5Lvisit/H5Lvisit_by_name). +public interface H5L_iterate_t extends Callbacks { + int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data); } diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java index 89cf206..e1c47b5 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java +++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java @@ -13,9 +13,6 @@ package hdf.hdf5lib.callbacks; -import hdf.hdf5lib.structs.H5O_info_t; +public interface H5O_iterate_opdata_t { -//Information class for link callback(for H5Ovisit/H5Ovisit_by_name) -public interface H5O_iterate_cb extends Callbacks { - int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data); } diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java index 1491b09..9a55106 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java @@ -13,8 +13,9 @@ package hdf.hdf5lib.callbacks; -public interface H5O_iterate_t { -/** public ArrayList iterdata = new ArrayList(); - * Any derived interfaces must define the single public variable as above. - */ +import hdf.hdf5lib.structs.H5O_info_t; + +// Information class for link callback(for H5Ovisit/H5Ovisit_by_name) +public interface H5O_iterate_t extends Callbacks { + int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data); } diff --git a/java/src/hdf/hdf5lib/structs/H5L_info_t.java b/java/src/hdf/hdf5lib/structs/H5L_info_t.java index 3bbb189..377e617 100644 --- a/java/src/hdf/hdf5lib/structs/H5L_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5L_info_t.java @@ -15,22 +15,39 @@ package hdf.hdf5lib.structs; import java.io.Serializable; -//Information struct for link (for H5Lget_info/H5Lget_info_by_idx) -public class H5L_info_t implements Serializable{ +import hdf.hdf5lib.HDF5Constants; + +// Information struct for link (for H5Lget_info/H5Lget_info_by_idx) +public class H5L_info_t implements Serializable { private static final long serialVersionUID = -4754320605310155033L; - public int type; - public boolean corder_valid; - public long corder; - public int cset; - public long address_val_size; + public int type; + public boolean corder_valid; + public long corder; + public int cset; + public H5O_token_t token; + public long val_size; + + // Constructor for using object token portion of C union + H5L_info_t (int type, boolean corder_valid, long corder, + int cset, H5O_token_t token) + { + this.type = type; + this.corder_valid = corder_valid; + this.corder = corder; + this.cset = cset; + this.token = token; + this.val_size = -1; + } + // Constructor for using val_size portion of C union H5L_info_t (int type, boolean corder_valid, long corder, - int cset, long address_val_size) + int cset, long val_size) { this.type = type; this.corder_valid = corder_valid; this.corder = corder; this.cset = cset; - this.address_val_size = address_val_size; + this.token = HDF5Constants.H5O_TOKEN_UNDEF; + this.val_size = val_size; } } diff --git a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java index a39c1ed..8d0cc24 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java @@ -16,7 +16,7 @@ package hdf.hdf5lib.structs; import java.io.Serializable; // Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) -public class H5O_hdr_info_t implements Serializable{ +public class H5O_hdr_info_t implements Serializable { private static final long serialVersionUID = 7883826382952577189L; public int version; /* Version number of header format in file */ public int nmesgs; /* Number of object header messages */ @@ -44,4 +44,38 @@ public class H5O_hdr_info_t implements Serializable{ this.mesg_present = mesg_present; this.mesg_shared = mesg_shared; } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + + if (!(o instanceof H5O_hdr_info_t)) + return false; + + H5O_hdr_info_t info = (H5O_hdr_info_t) o; + + if (this.version != info.version) + return false; + if (this.nmesgs != info.nmesgs) + return false; + if (this.nchunks != info.nchunks) + return false; + if (this.flags != info.flags) + return false; + if (this.space_total != info.space_total) + return false; + if (this.space_meta != info.space_meta) + return false; + if (this.space_mesg != info.space_mesg) + return false; + if (this.space_free != info.space_free) + return false; + if (this.mesg_present != info.mesg_present) + return false; + if (this.mesg_shared != info.mesg_shared) + return false; + + return true; + } } diff --git a/java/src/hdf/hdf5lib/structs/H5O_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_info_t.java index ac32f6a..6a26a10 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_info_t.java @@ -15,38 +15,30 @@ package hdf.hdf5lib.structs; import java.io.Serializable; -//Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) -public class H5O_info_t implements Serializable{ +// Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) +public class H5O_info_t implements Serializable { private static final long serialVersionUID = 4691681163544054518L; - public long fileno; /* File number that object is located in */ - public long addr; /* Object address in file */ - public int type; /* Basic object type (group, dataset, etc.) */ - public int rc; /* Reference count of object */ - public long atime; /* Access time */ - public long mtime; /* Modification time */ - public long ctime; /* Change time */ - public long btime; /* Birth time */ - public long num_attrs; /* # of attributes attached to object */ - public H5O_hdr_info_t hdr; /* Object header information */ - /* Extra metadata storage for obj & attributes */ - public H5_ih_info_t meta_size_obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ - public H5_ih_info_t meta_size_attr; /* v2 B-tree & heap for attributes */ + public long fileno; /* File number that object is located in */ + public H5O_token_t token; /* Object token in file */ + public int type; /* Basic object type (group, dataset, etc.) */ + public int rc; /* Reference count of object */ + public long atime; /* Access time */ + public long mtime; /* Modification time */ + public long ctime; /* Change time */ + public long btime; /* Birth time */ + public long num_attrs; /* # of attributes attached to object */ - public H5O_info_t (long fileno, long addr, int type, - int rc, long num_attrs, long atime, long mtime, long ctime, long btime, - H5O_hdr_info_t hdr, H5_ih_info_t meta_size_obj, H5_ih_info_t meta_size_attr) + public H5O_info_t (long fileno, H5O_token_t token, int type, + int rc, long atime, long mtime, long ctime, long btime, long num_attrs) { this.fileno = fileno; - this.addr = addr; + this.token = token; this.type = type; this.rc = rc; - this.num_attrs = num_attrs; this.atime = atime; this.mtime = mtime; this.ctime = ctime; this.btime = btime; - this.hdr = hdr; - this.meta_size_obj = meta_size_obj; - this.meta_size_attr = meta_size_attr; + this.num_attrs = num_attrs; } } diff --git a/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java new file mode 100644 index 0000000..4e80849 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java @@ -0,0 +1,52 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +// Information struct for native HDF5 object info, such as object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx). +public class H5O_native_info_t implements Serializable { + private static final long serialVersionUID = 7883826382952577189L; + + public H5O_hdr_info_t hdr_info; /* Object header information */ + + /* Extra metadata storage for obj & attributes */ + public H5_ih_info_t obj_info; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ + public H5_ih_info_t attr_info; /* v2 B-tree & heap for attributes */ + + H5O_native_info_t (H5O_hdr_info_t oheader_info, H5_ih_info_t obj_info, H5_ih_info_t attr_info) + { + this.hdr_info = oheader_info; + this.obj_info = obj_info; + this.attr_info = attr_info; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + + if (!(o instanceof H5O_native_info_t)) + return false; + + H5O_native_info_t info = (H5O_native_info_t) o; + + if (!this.hdr_info.equals(info.hdr_info) + || !this.obj_info.equals(info.obj_info) + || !this.attr_info.equals(info.attr_info)) + return false; + + return true; + } +}
\ No newline at end of file diff --git a/java/src/hdf/hdf5lib/structs/H5O_token_t.java b/java/src/hdf/hdf5lib/structs/H5O_token_t.java new file mode 100644 index 0000000..8ec0b7f --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5O_token_t.java @@ -0,0 +1,45 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; +import java.util.Arrays; + +import hdf.hdf5lib.HDF5Constants; + +// Object token, which is a unique and permanent identifier, for an HDF5 object within a container. +public class H5O_token_t implements Serializable { + private static final long serialVersionUID = -4754320605310155032L; + public byte[] data; + + H5O_token_t (byte[] data) { + this.data = data; + } + + public boolean isUndefined() { + return this.equals(HDF5Constants.H5O_TOKEN_UNDEF); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + + if (!(o instanceof H5O_token_t)) + return false; + + H5O_token_t token = (H5O_token_t) o; + + return Arrays.equals(this.data, token.data); + } +}
\ No newline at end of file diff --git a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java index ea36d85..7159f02 100644 --- a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java @@ -26,4 +26,22 @@ public class H5_ih_info_t implements Serializable { this.index_size = index_size; this.heap_size = heap_size; } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + + if (!(o instanceof H5_ih_info_t)) + return false; + + H5_ih_info_t info = (H5_ih_info_t) o; + + if (this.index_size != info.index_size) + return false; + if (this.heap_size != info.heap_size) + return false; + + return true; + } } diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c index 0faa0cc..c08b67b 100644 --- a/java/src/jni/exceptionImp.c +++ b/java/src/jni/exceptionImp.c @@ -409,7 +409,7 @@ h5libraryError if (msg_size > 0) { if (NULL == (msg_str = (char *) HDcalloc((size_t)msg_size + 1, sizeof(char)))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5libraryerror: failed to allocate buffer for error message"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5libraryerror: failed to allocate buffer for error message"); if ((msg_size = H5Eget_msg(min_num, &error_msg_type, msg_str, (size_t)msg_size + 1)) < 0) goto done; diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 05dc2ea..77a5d18 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -684,11 +684,13 @@ Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1TIME(JNIEnv *env, jclass cls) { return JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1NUM_1ATTRS(JNIEnv *env, jclass cls) { return H5O_INFO_NUM_ATTRS; } JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1HDR(JNIEnv *env, jclass cls) { return H5O_INFO_HDR; } +Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1ALL(JNIEnv *env, jclass cls) { return H5O_INFO_ALL; } JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1META_1SIZE(JNIEnv *env, jclass cls) { return H5O_INFO_META_SIZE; } +Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1HDR(JNIEnv *env, jclass cls) { return H5O_NATIVE_INFO_HDR; } JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1ALL(JNIEnv *env, jclass cls) { return H5O_INFO_ALL; } +Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1META_1SIZE(JNIEnv *env, jclass cls) { return H5O_NATIVE_INFO_META_SIZE; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1ALL(JNIEnv *env, jclass cls) { return H5O_NATIVE_INFO_ALL; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1NONE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_NONE_FLAG; } JNIEXPORT jint JNICALL @@ -713,6 +715,16 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NAMED_1DATATYPE(JNIEnv *env, jclass cls) { return H5O_TYPE_NAMED_DATATYPE; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NTYPES(JNIEnv *env, jclass cls) { return H5O_TYPE_NTYPES; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5O_1MAX_1TOKEN_1SIZE(JNIEnv *env, jclass cls) { return H5O_MAX_TOKEN_SIZE; } +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5O_1TOKEN_1UNDEF(JNIEnv *env, jclass cls) +{ + H5O_token_t undef_token = H5O_TOKEN_UNDEF; + + /* TODO: Can be optimized by keeping a global reference to the undefined token class */ + return create_H5O_token_t(env, &undef_token, FALSE); +} JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ROOT(JNIEnv *env, jclass cls){return H5P_ROOT;} diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index 85872b2..fb933ad 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -841,10 +841,10 @@ Java_hdf_hdf5lib_H5_H5Aread_1string H5_LIBRARY_ERROR(ENVONLY); if (NULL == (cstr = (char *) HDmalloc(str_len + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_string: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: memory allocation failed"); if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_string: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: memory allocation failed"); if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, c_buf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -855,7 +855,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1string if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_string: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, j_buf, i, jstr); @@ -905,7 +905,7 @@ Java_hdf_hdf5lib_H5_H5Awrite_1string H5_LIBRARY_ERROR(ENVONLY); if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Awrite_string: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Awrite_string: memory allocation failed"); for (i = 0; i < (size_t) n; i++) { if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize) i))) { @@ -1037,7 +1037,7 @@ H5AreadVL_str } if (NULL == (strs = (char **) HDcalloc((size_t)n, sizeof(char *)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadVL_str: failed to allocate variable length string read buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL_str: failed to allocate variable length string read buffer"); if ((status = H5Aread(aid, tid, strs)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1110,7 +1110,7 @@ H5AreadVL_asstr H5_LIBRARY_ERROR(ENVONLY); if (NULL == (readBuf = HDcalloc((size_t)n, typeSize))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadVL_asstr: failed to allocate read buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL_asstr: failed to allocate read buffer"); if ((status = H5Aread(aid, tid, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1119,7 +1119,7 @@ H5AreadVL_asstr h5str_new(&h5str, 4 * typeSize); if (!h5str.s) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadVL_asstr: failed to allocate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL_asstr: failed to allocate buffer"); /* Convert each element to a char string */ for (i = 0; i < (size_t) n; i++) { @@ -1243,7 +1243,7 @@ H5AwriteVL_str } if (NULL == (writeBuf = (char **) HDcalloc((size_t)size + 1, sizeof(char *)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate variable length string write buffer") + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate variable length string write buffer"); for (i = 0; i < size; ++i) { jsize length; @@ -1264,7 +1264,7 @@ H5AwriteVL_str PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5AwriteVL_str: string not pinned"); if (NULL == (writeBuf[i] = (char *) HDmalloc((size_t)length + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate string buffer"); HDstrncpy(writeBuf[i], utf8, (size_t)length); writeBuf[i][length] = '\0'; @@ -1325,7 +1325,7 @@ H5AwriteVL_asstr H5_LIBRARY_ERROR(ENVONLY); if (NULL == (writeBuf = HDcalloc((size_t)n, typeSize))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer"); /* * When repeatedly writing a dataset with a large number of strs (e.g., 1,000,000 strings), @@ -1406,7 +1406,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref } if (NULL == (ref_data = (H5R_ref_t *) HDcalloc(1, (size_t)n * sizeof(H5R_ref_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate read buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate read buffer"); if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, ref_data)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1414,7 +1414,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref h5str_new(&h5str, 1024); if (!h5str.s) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate buffer"); for (i = 0; i < n; i++) { h5str.s[0] = '\0'; @@ -1499,7 +1499,7 @@ Java_hdf_hdf5lib_H5_H5Aget_1name H5_LIBRARY_ERROR(ENVONLY); if (NULL == (attrName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Aget_name: failed to allocate attribute name buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aget_name: failed to allocate attribute name buffer"); if (H5Aget_name((hid_t)attr_id, (size_t)buf_size + 1, attrName) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1856,7 +1856,7 @@ Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx H5_LIBRARY_ERROR(ENVONLY); if (NULL == (attrName = (char *) HDmalloc(sizeof(char) * (size_t) status_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Aget_name_by_idx: failed to allocate buffer for attribute name"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aget_name_by_idx: failed to allocate buffer for attribute name"); if ((H5Aget_name_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t) order, (hsize_t) n, (char *)attrName, (size_t)status_size + 1, (hid_t)lapl_id)) < 0) @@ -2162,7 +2162,7 @@ static herr_t H5A_iterate_cb (hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data) { cb_wrapper *wrapper = (cb_wrapper *)cb_data; - jmethodID constructor, mid; + jmethodID mid; jobject cb_info_t = NULL; jobject visit_callback = wrapper->visit_callback; jstring str; @@ -2191,18 +2191,7 @@ H5A_iterate_cb args[2].i = info->cset; args[3].j = (jlong)info->data_size; - /* Get a reference to your class if you don't have it already */ - if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5A_info_t"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - /* Get a reference to the constructor; the name is <init> */ - if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(ZJIJ)V"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - if (NULL == (cb_info_t = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) { - HDprintf("FATAL ERROR: hdf/hdf5lib/structs/H5A_info_t: Creation failed\n"); - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - } + CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args, cb_info_t); status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, g_id, str, cb_info_t, op_data); CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index 352c047..bcefe12 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -975,10 +975,10 @@ Java_hdf_hdf5lib_H5_H5Dread_1string H5_LIBRARY_ERROR(ENVONLY); if (NULL == (cstr = (char *) HDmalloc(str_len + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_string: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: memory allocation failed"); if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_string: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: memory allocation failed"); if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf)) < 0) @@ -990,7 +990,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1string if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_string: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, j_buf, i, jstr); @@ -1041,7 +1041,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string H5_LIBRARY_ERROR(ENVONLY); if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Dwrite_string: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dwrite_string: memory allocation failed"); for (i = 0; i < (size_t) n; i++) { if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize) i))) { @@ -1177,7 +1177,7 @@ H5DreadVL_str } if (NULL == (strs = (char **) HDcalloc((size_t)n, sizeof(char *)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5DreadVL_str: failed to allocate variable length string read buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL_str: failed to allocate variable length string read buffer"); if ((status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, strs)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1263,7 +1263,7 @@ H5DreadVL_asstr H5_LIBRARY_ERROR(ENVONLY); if (NULL == (readBuf = HDcalloc((size_t)n, typeSize))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5DreadVL_asstr: failed to allocate read buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL_asstr: failed to allocate read buffer"); if ((status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1272,7 +1272,7 @@ H5DreadVL_asstr h5str_new(&h5str, 4 * typeSize); if (!h5str.s) - H5_JNI_FATAL_ERROR(ENVONLY, "H5DreadVL_asstr: failed to allocate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL_asstr: failed to allocate buffer"); if ((tclass = H5Tget_class(tid)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1442,7 +1442,7 @@ H5DwriteVL_str } if (NULL == (writeBuf = (char **) HDcalloc((size_t)size + 1, sizeof(char *)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate variable length string write buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate variable length string write buffer"); for (i = 0; i < size; ++i) { jsize length; @@ -1463,7 +1463,7 @@ H5DwriteVL_str PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5DwriteVL_str: string not pinned"); if (NULL == (writeBuf[i] = (char *) HDmalloc((size_t)length + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate string buffer"); HDstrncpy(writeBuf[i], utf8, (size_t)length + 1); writeBuf[i][length] = '\0'; @@ -1536,7 +1536,7 @@ H5DwriteVL_asstr H5_LIBRARY_ERROR(ENVONLY); if (NULL == (writeBuf = HDcalloc((size_t)n, typeSize))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer"); for (i = 0; i < (size_t) n; ++i) { if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize) i))) { @@ -1646,7 +1646,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref } if (NULL == (ref_data = (H5R_ref_t *) HDcalloc(1, (size_t)n * sizeof(H5R_ref_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate read buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate read buffer"); if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, xfer_plist_id, ref_data)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1654,7 +1654,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref h5str_new(&h5str, 1024); if (!h5str.s) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate buffer"); for (i = 0; i < n; i++) { h5str.s[0] = '\0'; @@ -1909,7 +1909,7 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent PIN_LONG_ARRAY(ENVONLY, buf, dimsBuf, &isCopy, "H5Dset_extent: buffer not pinned"); if (NULL == (dims = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Dset_extent: failed to allocate dataset dimension buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dset_extent: failed to allocate dataset dimension buffer"); for (i = 0; i < rank; i++) dims[i] = (hsize_t)dimsBuf[i]; diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 937323e..7ea4223 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -309,7 +309,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1class_1name H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_class_name: no class name"); if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Eget_class_name: malloc failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Eget_class_name: malloc failed"); if ((H5Eget_class_name((hid_t)cls_id, (char *)namePtr, (size_t)buf_size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -464,10 +464,10 @@ Java_hdf_hdf5lib_H5_H5Eget_1msg H5_LIBRARY_ERROR(ENVONLY); if (!buf_size) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Eget_msg: invalid message"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_msg: invalid message"); if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Eget_msg: malloc failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Eget_msg: malloc failed"); PIN_INT_ARRAY(ENVONLY, error_msg_type_list, theArray, NULL, "H5Eget_msg: error_msg_type_list not pinned"); @@ -517,7 +517,6 @@ H5E_walk_cb (int nindx, const H5E_error2_t *info, void *cb_data) { cb_wrapper *wrapper = (cb_wrapper *)cb_data; - jmethodID constructor; jmethodID mid; jobject visit_callback = wrapper->visit_callback; jstring str1, str2, str3; @@ -559,16 +558,7 @@ H5E_walk_cb args[6].l = str3; - /* Get a reference to your class if you don't have it already */ - if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5E_error2_t"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - /* get a reference to the constructor; the name is <init> */ - if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - if (NULL == (cb_info_t = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); + CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5E_error2_t", "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, cb_info_t); status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, nindx, cb_info_t, op_data); CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 2eb3ad5..3b7b96c 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -131,7 +131,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1name H5_LIBRARY_ERROR(ENVONLY); if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Fget_name: malloc failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Fget_name: malloc failed"); if ((H5Fget_name((hid_t)file_id, namePtr, (size_t)buf_size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -446,7 +446,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids } if (NULL == (id_list = (hid_t *) HDmalloc((size_t)rank * sizeof(hid_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Fget_obj_ids: malloc failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Fget_obj_ids: malloc failed"); if ((ret_val = H5Fget_obj_ids((hid_t)file_id, (unsigned int)types, (size_t)maxObjs, id_list)) < 0) H5_LIBRARY_ERROR(ENVONLY); diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c index a367802..e8030aee 100644 --- a/java/src/jni/h5iImp.c +++ b/java/src/jni/h5iImp.c @@ -71,7 +71,7 @@ Java_hdf_hdf5lib_H5_H5Iget_1name_1long H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Iget_name_long: buf_size < 0"); if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Iget_name_long: malloc failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Iget_name_long: malloc failed"); if ((size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -111,7 +111,7 @@ Java_hdf_hdf5lib_H5_H5Iget_1name H5_LIBRARY_ERROR(ENVONLY); if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Iget_name: malloc failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Iget_name: malloc failed"); if (H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size + 1) < 0) H5_LIBRARY_ERROR(ENVONLY); diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h index 4a94180..f583630 100644 --- a/java/src/jni/h5jni.h +++ b/java/src/jni/h5jni.h @@ -47,195 +47,6 @@ */ #define UNUSED(o) (void) o -/* Macros for class access */ -/* Calling code must define ret_obj as jobject */ -#define CALL_CONSTRUCTOR(env, classname, classsig, args, ret_obj) \ -{ \ - jmethodID constructor; \ - jclass cls; \ - \ - if (NULL == (cls = ENVPTR->FindClass(env, (classname)))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, "JNI error: GetObjectClass"); \ - } \ - if (NULL == (constructor = ENVPTR->GetMethodID(ENVONLY, cls, "<init>", (classsig)))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, "JNI error: GetMethodID failed"); \ - } \ - if (NULL == (ret_obj = ENVPTR->NewObjectA(ENVONLY, cls, constructor, (args)))) { \ - CHECK_JNI_EXCEPTION(env, JNI_FALSE); \ - } \ -} - -/* - * Macros for pinning/unpinning objects. - */ -#define PIN_BYTE_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = ENVPTR->GetByteArrayElements(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define PIN_BYTE_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = (jbyte *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define UNPIN_BYTE_ARRAY(env, pinnedArray, bufToRelease, freeMode) \ -{ \ - ENVPTR->ReleaseByteArrayElements(env, pinnedArray, (jbyte *) bufToRelease, freeMode); \ -} - -#define PIN_SHORT_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = ENVPTR->GetShortArrayElements(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define PIN_SHORT_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = (jshort *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define UNPIN_SHORT_ARRAY(env, pinnedArray, bufToRelease, freeMode) \ -{ \ - ENVPTR->ReleaseShortArrayElements(env, pinnedArray, (jshort *) bufToRelease, freeMode); \ -} - -#define PIN_INT_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = ENVPTR->GetIntArrayElements(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define PIN_INT_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = (jint *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define UNPIN_INT_ARRAY(env, pinnedArray, bufToRelease, freeMode) \ -{ \ - ENVPTR->ReleaseIntArrayElements(env, pinnedArray, (jint *) bufToRelease, freeMode); \ -} - -#define PIN_LONG_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = ENVPTR->GetLongArrayElements(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define PIN_LONG_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = (jlong *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define UNPIN_LONG_ARRAY(env, pinnedArray, bufToRelease, freeMode) \ -{ \ - ENVPTR->ReleaseLongArrayElements(env, pinnedArray, (jlong *) bufToRelease, freeMode); \ -} - -#define PIN_FLOAT_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = ENVPTR->GetFloatArrayElements(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define PIN_FLOAT_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = (jfloat *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define UNPIN_FLOAT_ARRAY(env, pinnedArray, bufToRelease, freeMode) \ -{ \ - ENVPTR->ReleaseFloatArrayElements(env, pinnedArray, (jfloat *) bufToRelease, freeMode); \ -} - -#define PIN_DOUBLE_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = ENVPTR->GetDoubleArrayElements(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define PIN_DOUBLE_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = (jdouble *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define UNPIN_DOUBLE_ARRAY(env, pinnedArray, bufToRelease, freeMode) \ -{ \ - ENVPTR->ReleaseDoubleArrayElements(env, pinnedArray, (jdouble *) bufToRelease, freeMode); \ -} - -#define PIN_BOOL_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = ENVPTR->GetBooleanArrayElements(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define PIN_BOOL_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \ -{ \ - if (NULL == (outBuf = (jboolean *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define UNPIN_BOOL_ARRAY(env, pinnedArray, bufToRelease, freeMode) \ -{ \ - ENVPTR->ReleaseBooleanArrayElements(env, pinnedArray, (jboolean *) bufToRelease, freeMode); \ -} - -#define UNPIN_ARRAY_CRITICAL(env, pinnedArray, bufToRelease, freeMode) \ -{ \ - ENVPTR->ReleasePrimitiveArrayCritical(env, pinnedArray, bufToRelease, freeMode); \ -} - -/* Macros for string access */ -#define PIN_JAVA_STRING(env, stringToPin, outString, isCopy, failErrMsg) \ -{ \ - if (NULL == (outString = ENVPTR->GetStringUTFChars(env, stringToPin, isCopy))) { \ - CHECK_JNI_EXCEPTION(env, JNI_TRUE); \ - H5_JNI_FATAL_ERROR(env, failErrMsg); \ - } \ -} - -#define UNPIN_JAVA_STRING(env, pinnedString, stringToRelease) \ -{ \ - ENVPTR->ReleaseStringUTFChars(env, pinnedString, stringToRelease); \ -} - /* * Macro to check for a JNI exception after a JNI method is called. * If an exception occurred, the value of 'clearException' will determine @@ -246,15 +57,205 @@ * cleanup+return section of the native method, since at that point * cleaning up and returning is the only safe thing that can be done. */ -#define CHECK_JNI_EXCEPTION(env, clearException) \ -{ \ - if (JNI_TRUE == (*env)->ExceptionCheck(env)) { \ - if (JNI_TRUE == clearException) \ - (*env)->ExceptionClear(env); \ - else \ - goto done; \ - } \ -} +#define CHECK_JNI_EXCEPTION(envptr, clearException) \ +do { \ + if (JNI_TRUE == (*envptr)->ExceptionCheck(envptr)) { \ + if (JNI_TRUE == clearException) \ + (*envptr)->ExceptionClear(envptr); \ + else \ + goto done; \ + } \ +} while(0) + +/* Macros for class access */ +/* Calling code must define ret_obj as jobject */ +#define CALL_CONSTRUCTOR(envptr, classname, classsig, args, ret_obj) \ +do { \ + jmethodID constructor; \ + jclass cls; \ + \ + if (NULL == (cls = (*envptr)->FindClass(envptr, (classname)))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, "JNI error: GetObjectClass"); \ + } \ + if (NULL == (constructor = (*envptr)->GetMethodID(envptr, cls, "<init>", (classsig)))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, "JNI error: GetMethodID failed"); \ + } \ + if (NULL == (ret_obj = (*envptr)->NewObjectA(envptr, cls, constructor, (args)))) { \ + HDprintf("FATAL ERROR: %s: Creation failed\n", classname); \ + CHECK_JNI_EXCEPTION(envptr, JNI_FALSE); \ + } \ +} while(0) + +/* + * Macros for pinning/unpinning objects. + */ +#define PIN_BYTE_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (*envptr)->GetByteArrayElements(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define PIN_BYTE_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (jbyte *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define UNPIN_BYTE_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \ +do { \ + (*envptr)->ReleaseByteArrayElements(envptr, pinnedArray, (jbyte *) bufToRelease, freeMode); \ +} while(0) + +#define PIN_SHORT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (*envptr)->GetShortArrayElements(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define PIN_SHORT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (jshort *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define UNPIN_SHORT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \ +do { \ + (*envptr)->ReleaseShortArrayElements(envptr, pinnedArray, (jshort *) bufToRelease, freeMode); \ +} while(0) + +#define PIN_INT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (*envptr)->GetIntArrayElements(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define PIN_INT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (jint *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define UNPIN_INT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \ +do { \ + (*envptr)->ReleaseIntArrayElements(envptr, pinnedArray, (jint *) bufToRelease, freeMode); \ +} while(0) + +#define PIN_LONG_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (*envptr)->GetLongArrayElements(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define PIN_LONG_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (jlong *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define UNPIN_LONG_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \ +do { \ + (*envptr)->ReleaseLongArrayElements(envptr, pinnedArray, (jlong *) bufToRelease, freeMode); \ +} while(0) + +#define PIN_FLOAT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (*envptr)->GetFloatArrayElements(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define PIN_FLOAT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (jfloat *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define UNPIN_FLOAT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \ +do { \ + (*envptr)->ReleaseFloatArrayElements(envptr, pinnedArray, (jfloat *) bufToRelease, freeMode); \ +} while(0) + +#define PIN_DOUBLE_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (*envptr)->GetDoubleArrayElements(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define PIN_DOUBLE_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (jdouble *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define UNPIN_DOUBLE_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \ +do { \ + (*envptr)->ReleaseDoubleArrayElements(envptr, pinnedArray, (jdouble *) bufToRelease, freeMode); \ +} while(0) + +#define PIN_BOOL_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (*envptr)->GetBooleanArrayElements(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define PIN_BOOL_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \ +do { \ + if (NULL == (outBuf = (jboolean *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define UNPIN_BOOL_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \ +do { \ + (*envptr)->ReleaseBooleanArrayElements(envptr, pinnedArray, (jboolean *) bufToRelease, freeMode); \ +} while(0) + +#define UNPIN_ARRAY_CRITICAL(envptr, pinnedArray, bufToRelease, freeMode) \ +do { \ + (*envptr)->ReleasePrimitiveArrayCritical(envptr, pinnedArray, bufToRelease, freeMode); \ +} while(0) + +/* Macros for string access */ +#define PIN_JAVA_STRING(envptr, stringToPin, outString, isCopy, failErrMsg) \ +do { \ + if (NULL == (outString = (*envptr)->GetStringUTFChars(envptr, stringToPin, isCopy))) { \ + CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \ + H5_JNI_FATAL_ERROR(envptr, failErrMsg); \ + } \ +} while(0) + +#define UNPIN_JAVA_STRING(envptr, pinnedString, stringToRelease) \ +do { \ + (*envptr)->ReleaseStringUTFChars(envptr, pinnedString, stringToRelease); \ +} while(0) #ifdef __cplusplus extern "C" { @@ -279,46 +280,46 @@ extern jboolean h5unimplemented( JNIEnv *env, const char *functName); * then do its own error handling, but we instead opt to immediately return. */ #define H5_JNI_FATAL_ERROR(env, message) \ -{ \ +do { \ h5JNIFatalError(env, message); \ goto done; \ -} +} while(0) #define H5_NULL_ARGUMENT_ERROR(env, message) \ -{ \ +do { \ h5nullArgument(env, message); \ goto done; \ -} +} while(0) #define H5_BAD_ARGUMENT_ERROR(env, message) \ -{ \ +do { \ h5badArgument(env, message); \ goto done; \ -} +} while(0) #define H5_OUT_OF_MEMORY_ERROR(env, message) \ -{ \ +do { \ h5outOfMemory(env, message); \ goto done; \ -} +} while(0) #define H5_LIBRARY_ERROR(env) \ -{ \ +do { \ h5libraryError(env); \ goto done; \ -} +} while(0) #define H5_RAISE_EXCEPTION(env, message, exception) \ -{ \ +do { \ h5raiseException(env, message, exception); \ goto done; \ -} +} while(0) #define H5_UNIMPLEMENTED(env, message) \ -{ \ +do { \ h5unimplemented(env, message); \ goto done; \ -} +} while(0) /* implemented at H5.c */ extern jint get_enum_value(JNIEnv *env, jobject enum_obj); @@ -328,6 +329,9 @@ extern jobject get_enum_object(JNIEnv *env, const char* enum_class_name, /* implemented at H5G.c */ extern jobject create_H5G_info_t(JNIEnv *env, H5G_info_t group_info); +/* implemented at h5oimp.c */ +extern jobject create_H5O_token_t(JNIEnv *env, const H5O_token_t *token, hbool_t is_critical_pinning); + #ifdef __cplusplus } /* end extern "C" */ #endif /* __cplusplus */ diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index 7eee3d4..e60e1ab 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -41,7 +41,7 @@ typedef struct _cb_wrapper { /* Local Prototypes */ /********************/ -static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data); +static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info2_t *info, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -281,11 +281,11 @@ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Lget_1info (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) { - H5L_info_t infobuf; - const char *linkName = NULL; - jvalue args[5]; - herr_t status = FAIL; - jobject ret_obj = NULL; + H5L_info2_t infobuf; + const char *linkName = NULL; + jvalue args[5]; + herr_t status = FAIL; + jobject ret_obj = NULL; UNUSED(clss); @@ -294,16 +294,38 @@ Java_hdf_hdf5lib_H5_H5Lget_1info PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lget_info: link name not pinned"); - if ((status = H5Lget_info((hid_t)loc_id, linkName, &infobuf, (hid_t)access_id)) < 0) + if ((status = H5Lget_info2((hid_t)loc_id, linkName, &infobuf, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - args[0].i = infobuf.type; - args[1].z = infobuf.corder_valid; - args[2].j = infobuf.corder; - args[3].i = infobuf.cset; - args[4].j = (infobuf.type == H5L_TYPE_HARD) ? (jlong) infobuf.u.address : (jlong) infobuf.u.val_size; + /* + * Set the last argument based upon whether this is a hard link (which returns object tokens) + * or a soft/user-defined link (which returns the link's value size). Then, call the appropriate + * constructor to instantiate an H5L_info_t object. + */ + if (infobuf.type == H5L_TYPE_HARD) { + jobject token; + + /* Create an H5O_token_t object */ + if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.u.token, FALSE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + args[0].i = infobuf.type; + args[1].z = infobuf.corder_valid; + args[2].j = infobuf.corder; + args[3].i = infobuf.cset; + args[4].l = token; - CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args, ret_obj); + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, ret_obj); + } + else { + args[0].i = infobuf.type; + args[1].z = infobuf.corder_valid; + args[2].j = infobuf.corder; + args[3].i = infobuf.cset; + args[4].j = (jlong)infobuf.u.val_size; + + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args, ret_obj); + } done: if (linkName) @@ -322,11 +344,11 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_field, jint order, jlong link_n, jlong access_id) { - H5L_info_t infobuf; - const char *groupName = NULL; - jvalue args[5]; - herr_t status = FAIL; - jobject ret_obj = NULL; + H5L_info2_t infobuf; + const char *groupName = NULL; + jvalue args[5]; + herr_t status = FAIL; + jobject ret_obj = NULL; UNUSED(clss); @@ -335,16 +357,38 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Lget_info_by_idx: group name not pinned"); - if ((status = H5Lget_info_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0) + if ((status = H5Lget_info_by_idx2((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - args[0].i = infobuf.type; - args[1].z = infobuf.corder_valid; - args[2].j = infobuf.corder; - args[3].i = infobuf.cset; - args[4].j = (infobuf.type == H5L_TYPE_HARD) ? (jlong) infobuf.u.address : (jlong) infobuf.u.val_size; + /* + * Set the last argument based upon whether this is a hard link (which returns object tokens) + * or a soft/user-defined link (which returns the link's value size). Then, call the appropriate + * constructor to instantiate an H5L_info_t object. + */ + if (infobuf.type == H5L_TYPE_HARD) { + jobject token; - CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args, ret_obj); + /* Create an H5O_token_t object */ + if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.u.token, FALSE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + args[0].i = infobuf.type; + args[1].z = infobuf.corder_valid; + args[2].j = infobuf.corder; + args[3].i = infobuf.cset; + args[4].l = token; + + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, ret_obj); + } + else { + args[0].i = infobuf.type; + args[1].z = infobuf.corder_valid; + args[2].j = infobuf.corder; + args[3].i = infobuf.cset; + args[4].j = (jlong)infobuf.u.val_size; + + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args, ret_obj); + } done: if (groupName) @@ -381,7 +425,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx /* add extra space for the null terminator */ if (NULL == (linkName = (char *) HDmalloc(sizeof(char) * (size_t)status_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_name_by_idx: failed to allocate buffer for link name"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_name_by_idx: failed to allocate buffer for link name"); if ((H5Lget_name_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char *)linkName, (size_t)status_size + 1, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -408,13 +452,13 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lget_1value (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jobjectArray link_value, jlong access_id) { - H5L_info_t infobuf; - const char *file_name = NULL; - const char *obj_name = NULL; - const char *linkName = NULL; - jstring str; - herr_t status; - char *linkValue = NULL; + H5L_info2_t infobuf; + const char *file_name = NULL; + const char *obj_name = NULL; + const char *linkName = NULL; + jstring str; + herr_t status; + char *linkValue = NULL; UNUSED(clss); @@ -426,14 +470,14 @@ Java_hdf_hdf5lib_H5_H5Lget_1value PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lget_value: link name not pinned"); /* Get the length of the link value */ - if ((status = H5Lget_info((hid_t)loc_id, linkName, &infobuf, H5P_DEFAULT)) < 0) + if ((status = H5Lget_info2((hid_t)loc_id, linkName, &infobuf, H5P_DEFAULT)) < 0) H5_LIBRARY_ERROR(ENVONLY); if (H5L_TYPE_HARD == infobuf.type) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val: hard links are unsupported"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Lget_val: hard links are unsupported"); if (NULL == (linkValue = (char *) HDmalloc(sizeof(char) * infobuf.u.val_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val: failed to allocate buffer for link value"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_val: failed to allocate buffer for link value"); if ((status = H5Lget_val((hid_t)loc_id, linkName, (void *)linkValue, infobuf.u.val_size + 1, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -475,7 +519,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1value case H5L_TYPE_MAX: case H5L_TYPE_HARD: default: - H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val: invalid link type"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Lget_val: invalid link type"); break; } @@ -498,13 +542,13 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_field, jint order, jlong link_n, jobjectArray link_value, jlong access_id) { - H5L_info_t infobuf; - const char *file_name = NULL; - const char *obj_name = NULL; - const char *grpName = NULL; - jstring str; - herr_t status; - void *linkValue = NULL; + H5L_info2_t infobuf; + const char *file_name = NULL; + const char *obj_name = NULL; + const char *grpName = NULL; + jstring str; + herr_t status; + void *linkValue = NULL; UNUSED(clss); @@ -516,17 +560,17 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lget_val_by_idx: group name not pinned"); /* Get the length of the link value */ - if ((status = H5Lget_info_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0) + if ((status = H5Lget_info_by_idx2((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); if (H5L_TYPE_HARD == infobuf.type) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val_by_idx: hard links are unsupported") + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Lget_val_by_idx: hard links are unsupported"); if (!infobuf.u.val_size) H5_LIBRARY_ERROR(ENVONLY); if (NULL == (linkValue = (void *) HDmalloc(infobuf.u.val_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val_by_idx: failed to allocate buffer for link value"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_val_by_idx: failed to allocate buffer for link value"); if ((status = H5Lget_val_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (void *)linkValue, infobuf.u.val_size + 1, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -568,7 +612,7 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx case H5L_TYPE_MAX: case H5L_TYPE_HARD: default: - H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val_by_idx: invalid link type"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Lget_val_by_idx: invalid link type"); break; } @@ -615,12 +659,15 @@ done: UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName); } /* end Java_hdf_hdf5lib_H5_H5Lmove */ +/* + * Shim function for link iteration and link visiting which + */ static herr_t H5L_iterate_cb - (hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data) + (hid_t g_id, const char *name, const H5L_info2_t *info, void *cb_data) { cb_wrapper *wrapper = (cb_wrapper *)cb_data; - jmethodID constructor, mid; + jmethodID mid; jobject cb_info_t = NULL; jobject visit_callback = wrapper->visit_callback; jstring str; @@ -635,32 +682,44 @@ H5L_iterate_cb H5_JNI_FATAL_ERROR(CBENVONLY, "H5L_iterate_cb: failed to attach current thread to JVM"); } + /* Get the Method ID for the "callback" function of the H5L_iterate_t class */ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_t;)I"))) + if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_opdata_t;)I"))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - args[0].i = info->type; - args[1].z = info->corder_valid; - args[2].j = info->corder; - args[3].i = info->cset; - args[4].j = (info->type == H5L_TYPE_HARD) ? (jlong)info->u.address : (jlong)info->u.val_size; - - /* Get a reference to your class if you don't have it already */ - if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5L_info_t"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - /* Get a reference to the constructor; the name is <init> */ - if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(IZJIJ)V"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - if (NULL == (cb_info_t = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) { - HDprintf("FATAL ERROR: hdf/hdf5lib/structs/H5L_info_t: Creation failed\n"); - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); + /* + * Set the last argument based upon whether this is a hard link (which returns object tokens) + * or a soft/user-defined link (which returns the link's value size). Then, call the appropriate + * constructor to instantiate an H5L_info_t object. + */ + if (info->type == H5L_TYPE_HARD) { + jobject token; + + /* Create an H5O_token_t object */ + if (NULL == (token = create_H5O_token_t(CBENVONLY, &info->u.token, FALSE))) + CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); + + args[0].i = info->type; + args[1].z = info->corder_valid; + args[2].j = info->corder; + args[3].i = info->cset; + args[4].l = token; + + CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, cb_info_t); + } + else { + args[0].i = info->type; + args[1].z = info->corder_valid; + args[2].j = info->corder; + args[3].i = info->cset; + args[4].j = (jlong)info->u.val_size; + + CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args, cb_info_t); } status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, g_id, str, cb_info_t, op_data); @@ -696,7 +755,8 @@ Java_hdf_hdf5lib_H5_H5Lvisit if (NULL == callback_op) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit: callback_op is NULL"); - if ((status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void *)&wrapper)) < 0) + if ((status = H5Lvisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, + H5L_iterate_cb, (void *)&wrapper)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -731,7 +791,8 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lvisit_by_name: group name not pinned"); - if ((status = H5Lvisit_by_name((hid_t)grp_id, grpName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void *)&wrapper, (hid_t)access_id)) < 0) + if ((status = H5Lvisit_by_name2((hid_t)grp_id, grpName, (H5_index_t)idx_type, (H5_iter_order_t)order, + H5L_iterate_cb, (void *)&wrapper, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -765,7 +826,8 @@ Java_hdf_hdf5lib_H5_H5Literate if (NULL == callback_op) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate: callback_op is NULL"); - if ((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)) < 0) + if ((status = H5Literate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, + &start_idx, H5L_iterate_cb, (void *)&wrapper)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -801,7 +863,8 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Literate_by_name: group name not pinned"); - if ((status = H5Literate_by_name((hid_t)grp_id, groupName, (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)) < 0) + if ((status = H5Literate_by_name2((hid_t)grp_id, groupName, (H5_index_t)idx_type, (H5_iter_order_t)order, + &start_idx, H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index b49a3e9..1d828a1 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -40,7 +40,58 @@ typedef struct _cb_wrapper { /* Local Prototypes */ /********************/ -static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data); +static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info2_t *info, void *cb_data); + +/* + * Create a java object of hdf.hdf5lib.structs.H5O_token_t. + */ +jobject +create_H5O_token_t + (JNIEnv *envptr, const H5O_token_t *token, hbool_t is_critical_pinning) +{ + jbyteArray tokenByteBuf; + jboolean token_buf_is_copy; + jvalue constructor_args[1]; + jbyte *token_buf = NULL; + jobject ret_token_obj = NULL; + + if (NULL == (tokenByteBuf = (*envptr)->NewByteArray(envptr, H5O_MAX_TOKEN_SIZE))) + CHECK_JNI_EXCEPTION(envptr, JNI_FALSE); + + if (is_critical_pinning) + PIN_BYTE_ARRAY_CRITICAL(envptr, tokenByteBuf, token_buf, &token_buf_is_copy, "create_H5O_token_t: object token buffer not pinned"); + else + PIN_BYTE_ARRAY(envptr, tokenByteBuf, token_buf, &token_buf_is_copy, "create_H5O_token_t: object token buffer not pinned"); + + HDmemcpy(token_buf, token, sizeof(H5O_token_t)); + + if (is_critical_pinning) + UNPIN_ARRAY_CRITICAL(envptr, tokenByteBuf, token_buf, 0); + else + UNPIN_BYTE_ARRAY(envptr, tokenByteBuf, token_buf, 0); + + token_buf = NULL; + + constructor_args[0].l = tokenByteBuf; + CALL_CONSTRUCTOR(envptr, "hdf/hdf5lib/structs/H5O_token_t", "([B)V", constructor_args, ret_token_obj); + + /* + * If critical pinning is being used, this routine is probably being + * called within a loop, so we'll clean up local references. + */ + if (is_critical_pinning) + (*envptr)->DeleteLocalRef(envptr, tokenByteBuf); + +done: + if (token_buf) { + if (is_critical_pinning) + UNPIN_ARRAY_CRITICAL(envptr, tokenByteBuf, token_buf, JNI_ABORT); + else + UNPIN_BYTE_ARRAY(envptr, tokenByteBuf, token_buf, JNI_ABORT); + } /* end if */ + + return ret_token_obj; +} /* end create_H5O_token_t */ /* * Class: hdf_hdf5lib_H5 @@ -134,17 +185,156 @@ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info (JNIEnv *env, jclass clss, jlong loc_id, jint fields) { - H5O_info_t infobuf; - jobject hdrinfobuf; - jobject ihinfobuf1; - jobject ihinfobuf2; - jvalue args[12]; - herr_t status = FAIL; - jobject ret_obj = NULL; + H5O_info2_t infobuf; + jobject token; + jvalue args[9]; + herr_t status = FAIL; + jobject ret_obj = NULL; + + UNUSED(clss); + + if ((status = H5Oget_info3((hid_t)loc_id, &infobuf, (unsigned)fields)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, FALSE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + args[0].j = (jlong)infobuf.fileno; + args[1].l = token; + args[2].i = infobuf.type; + args[3].i = (jint)infobuf.rc; + args[4].j = infobuf.atime; + args[5].j = infobuf.mtime; + args[6].j = infobuf.ctime; + args[7].j = infobuf.btime; + args[8].j = (jlong)infobuf.num_attrs; + + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj); + +done: + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info_by_name + * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name + (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint fields, jlong access_id) +{ + H5O_info2_t infobuf; + const char *objName = NULL; + jobject token; + jvalue args[9]; + herr_t status = FAIL; + jobject ret_obj = NULL; UNUSED(clss); - if ((status = H5Oget_info2((hid_t)loc_id, &infobuf, (unsigned)fields)) < 0) + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_info_by_name: object name is NULL"); + + PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_info_by_name: object name not pinned"); + + if ((status = H5Oget_info_by_name3((hid_t)loc_id, objName, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + /* Create an H5O_token_t object */ + if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, FALSE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + args[0].j = (jlong)infobuf.fileno; + args[1].l = token; + args[2].i = infobuf.type; + args[3].i = (jint)infobuf.rc; + args[4].j = infobuf.atime; + args[5].j = infobuf.mtime; + args[6].j = infobuf.ctime; + args[7].j = infobuf.btime; + args[8].j = (jlong)infobuf.num_attrs; + + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj); + +done: + if (objName) + UNPIN_JAVA_STRING(ENVONLY, name, objName); + + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info_by_idx + * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx + (JNIEnv *env, jclass clss, jlong loc_id, + jstring name, jint index_field, jint order, jlong link_n, jint fields, jlong access_id) +{ + H5O_info2_t infobuf; + const char *grpName = NULL; + jobject token; + jvalue args[9]; + herr_t status = FAIL; + jobject ret_obj = NULL; + + UNUSED(clss); + + if (NULL == name) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_info_by_idx: group name is NULL"); + + PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oget_info_by_idx: group name not pinned"); + + if ((status = H5Oget_info_by_idx3((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, + &infobuf, (unsigned)fields, (hid_t)access_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + /* Create an H5O_token_t object */ + if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, FALSE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + args[0].j = (jlong)infobuf.fileno; + args[1].l = token; + args[2].i = infobuf.type; + args[3].i = (jint)infobuf.rc; + args[4].j = infobuf.atime; + args[5].j = infobuf.mtime; + args[6].j = infobuf.ctime; + args[7].j = infobuf.btime; + args[8].j = (jlong)infobuf.num_attrs; + + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj); + +done: + if (grpName) + UNPIN_JAVA_STRING(ENVONLY, name, grpName); + + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_native_info + * Signature: (JI)Lhdf/hdf5lib/structs/H5O_native_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1native_1info + (JNIEnv *env, jclass clss, jlong loc_id, jint fields) +{ + H5O_native_info_t infobuf; + jobject hdrinfobuf; + jobject obj_ihinfobuf; + jobject attr_ihinfobuf; + jvalue args[10]; + herr_t status = FAIL; + jobject ret_obj = NULL; + + UNUSED(clss); + + if ((status = H5Oget_native_info((hid_t)loc_id, &infobuf, (unsigned)fields)) < 0) H5_LIBRARY_ERROR(ENVONLY); args[0].i = (jint)infobuf.hdr.version; @@ -165,59 +355,50 @@ Java_hdf_hdf5lib_H5_H5Oget_1info args[1].j = (jlong)infobuf.meta_size.obj.heap_size; CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj); - ihinfobuf1 = ret_obj; + obj_ihinfobuf = ret_obj; args[0].j = (jlong)infobuf.meta_size.attr.index_size; args[1].j = (jlong)infobuf.meta_size.attr.heap_size; CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj); - ihinfobuf2 = ret_obj; + attr_ihinfobuf = ret_obj; - args[0].j = (jlong)infobuf.fileno; - args[1].j = (jlong)infobuf.addr; - args[2].i = infobuf.type; - args[3].i = (jint)infobuf.rc; - args[4].j = (jlong)infobuf.num_attrs; - args[5].j = infobuf.atime; - args[6].j = infobuf.mtime; - args[7].j = infobuf.ctime; - args[8].j = infobuf.btime; - args[9].l = hdrinfobuf; - args[10].l = ihinfobuf1; - args[11].l = ihinfobuf2; + args[0].l = hdrinfobuf; + args[1].l = obj_ihinfobuf; + args[2].l = attr_ihinfobuf; - CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj); + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t", "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj); done: return ret_obj; -} /* end Java_hdf_hdf5lib_H5_H5Oget_1info */ +} /* end Java_hdf_hdf5lib_H5_H5Oget_1native_1info */ /* * Class: hdf_hdf5lib_H5 - * Method: H5Oget_info_by_name - * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_info_t; + * Method: H5Oget_native_info_by_name + * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_native_info_t; */ JNIEXPORT jobject JNICALL -Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name +Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint fields, jlong access_id) { - H5O_info_t infobuf; - const char *objName = NULL; - jobject hdrinfobuf; - jobject ihinfobuf1; - jobject ihinfobuf2; - jvalue args[12]; - herr_t status = FAIL; - jobject ret_obj = NULL; + H5O_native_info_t infobuf; + const char *objName = NULL; + jobject hdrinfobuf; + jobject obj_ihinfobuf; + jobject attr_ihinfobuf; + jvalue args[10]; + herr_t status = FAIL; + jobject ret_obj = NULL; UNUSED(clss); if (NULL == name) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_info_by_name: object name is NULL"); + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_native_info_by_name: object name is NULL"); - PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_info_by_name: object name not pinned"); + PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_native_info_by_name: object name not pinned"); - if ((status = H5Oget_info_by_name2((hid_t)loc_id, objName, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0) + if ((status = H5Oget_native_info_by_name((hid_t)loc_id, objName, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); args[0].i = (jint)infobuf.hdr.version; @@ -238,63 +419,55 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name args[1].j = (jlong)infobuf.meta_size.obj.heap_size; CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj); - ihinfobuf1 = ret_obj; + obj_ihinfobuf = ret_obj; args[0].j = (jlong)infobuf.meta_size.attr.index_size; args[1].j = (jlong)infobuf.meta_size.attr.heap_size; CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj); - ihinfobuf2 = ret_obj; + attr_ihinfobuf = ret_obj; - args[0].j = (jlong)infobuf.fileno; - args[1].j = (jlong)infobuf.addr; - args[2].i = infobuf.type; - args[3].i = (jint)infobuf.rc; - args[4].j = (jlong)infobuf.num_attrs; - args[5].j = infobuf.atime; - args[6].j = infobuf.mtime; - args[7].j = infobuf.ctime; - args[8].j = infobuf.btime; - args[9].l = hdrinfobuf; - args[10].l = ihinfobuf1; - args[11].l = ihinfobuf2; + args[0].l = hdrinfobuf; + args[1].l = obj_ihinfobuf; + args[2].l = attr_ihinfobuf; - CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj); + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t", "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj); done: if (objName) UNPIN_JAVA_STRING(ENVONLY, name, objName); return ret_obj; -} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name */ +} /* end Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name */ /* * Class: hdf_hdf5lib_H5 - * Method: H5Oget_info_by_idx - * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_info_t; + * Method: H5Oget_native_info_by_idx + * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_native_info_t; */ JNIEXPORT jobject JNICALL -Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx +Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_field, jint order, jlong link_n, jint fields, jlong access_id) { - H5O_info_t infobuf; - const char *grpName = NULL; - jobject hdrinfobuf; - jobject ihinfobuf1; - jobject ihinfobuf2; - jvalue args[12]; - herr_t status = FAIL; - jobject ret_obj = NULL; + H5O_native_info_t infobuf; + const char *grpName = NULL; + jobject hdrinfobuf; + jobject obj_ihinfobuf; + jobject attr_ihinfobuf; + jvalue args[10]; + herr_t status = FAIL; + jobject ret_obj = NULL; UNUSED(clss); if (NULL == name) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_info_by_idx: group name is NULL"); + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_native_info_by_idx: group name is NULL"); - PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oget_info_by_idx: group name not pinned"); + PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oget_native_info_by_idx: group name not pinned"); - if ((status = H5Oget_info_by_idx2((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0) + if ((status = H5Oget_native_info_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, + &infobuf, (unsigned)fields, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); args[0].i = (jint)infobuf.hdr.version; @@ -315,35 +488,26 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx args[1].j = (jlong)infobuf.meta_size.obj.heap_size; CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj); - ihinfobuf1 = ret_obj; + obj_ihinfobuf = ret_obj; args[0].j = (jlong)infobuf.meta_size.attr.index_size; args[1].j = (jlong)infobuf.meta_size.attr.heap_size; CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj); - ihinfobuf2 = ret_obj; + attr_ihinfobuf = ret_obj; - args[0].j = (jlong)infobuf.fileno; - args[1].j = (jlong)infobuf.addr; - args[2].i = infobuf.type; - args[3].i = (jint)infobuf.rc; - args[4].j = (jlong)infobuf.num_attrs; - args[5].j = infobuf.atime; - args[6].j = infobuf.mtime; - args[7].j = infobuf.ctime; - args[8].j = infobuf.btime; - args[9].l = hdrinfobuf; - args[10].l = ihinfobuf1; - args[11].l = ihinfobuf2; + args[0].l = hdrinfobuf; + args[1].l = obj_ihinfobuf; + args[2].l = attr_ihinfobuf; - CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj); + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t", "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj); done: if (grpName) UNPIN_JAVA_STRING(ENVONLY, name, grpName); return ret_obj; -} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx */ +} /* end Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx */ /* * Class: hdf_hdf5lib_H5 @@ -375,15 +539,13 @@ done: static herr_t H5O_iterate_cb - (hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data) + (hid_t g_id, const char *name, const H5O_info2_t *info, void *cb_data) { cb_wrapper *wrapper = (cb_wrapper *)cb_data; - jmethodID constructor, mid; + jmethodID mid; jobject cb_info_t = NULL; jobject visit_callback = wrapper->visit_callback; - jobject hdrinfobuf; - jobject ihinfobuf1; - jobject ihinfobuf2; + jobject token; jstring str; JNIEnv *cbenv = NULL; jclass cls; @@ -399,85 +561,28 @@ H5O_iterate_cb if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_t;)I"))) + if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_opdata_t;)I"))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - args[0].i = (jint)info->hdr.version; - args[1].i = (jint)info->hdr.nmesgs; - args[2].i = (jint)info->hdr.nchunks; - args[3].i = (jint)info->hdr.flags; - args[4].j = (jlong)info->hdr.space.total; - args[5].j = (jlong)info->hdr.space.meta; - args[6].j = (jlong)info->hdr.space.mesg; - args[7].j = (jlong)info->hdr.space.free; - args[8].j = (jlong)info->hdr.mesg.present; - args[9].j = (jlong)info->hdr.mesg.shared; - - /* Get a reference to the H5_hdr_info_t class */ - if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - /* Get a reference to the constructor; the name is <init> */ - if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(IIIIJJJJJJ)V"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - if (NULL == (hdrinfobuf = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) { - HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5O_hdr_info_t: Creation failed\n"); - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - } - - args[0].j = (jlong)info->meta_size.obj.index_size; - args[1].j = (jlong)info->meta_size.obj.heap_size; - - /* Get a reference to the H5_ih_info_t class */ - if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - /* Get a reference to the constructor; the name is <init> */ - if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(JJ)V"))) + /* Create an H5O_token_t object */ + if (NULL == (token = create_H5O_token_t(CBENVONLY, &info->token, FALSE))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - if (NULL == (ihinfobuf1 = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) { - HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n"); - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - } - - args[0].j = (jlong)info->meta_size.attr.index_size; - args[1].j = (jlong)info->meta_size.attr.heap_size; - - if (NULL == (ihinfobuf2 = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) { - HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n"); - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - } - args[0].j = (jlong)info->fileno; - args[1].j = (jlong)info->addr; + args[1].l = token; args[2].i = info->type; args[3].i = (jint)info->rc; - args[4].j = (jlong)info->num_attrs; - args[5].j = info->atime; - args[6].j = info->mtime; - args[7].j = info->ctime; - args[8].j = info->btime; - args[9].l = hdrinfobuf; - args[10].l = ihinfobuf1; - args[11].l = ihinfobuf2; + args[4].j = info->atime; + args[5].j = info->mtime; + args[6].j = info->ctime; + args[7].j = info->btime; + args[8].j = (jlong)info->num_attrs; /* Get a reference to the H5O_info_t class */ - if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5O_info_t"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - /* Get a reference to the constructor; the name is <init> */ - if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - if (NULL == (cb_info_t = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) { - HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5O_info_t: Creation failed\n"); - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - } + CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, cb_info_t); status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, g_id, str, cb_info_t, op_data); CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); @@ -512,7 +617,8 @@ Java_hdf_hdf5lib_H5_H5Ovisit if (NULL == callback_op) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit: callback_op is NULL"); - if ((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)) < 0) + if ((status = H5Ovisit3((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, + H5O_iterate_cb, (void *)&wrapper, (unsigned)fields)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -547,7 +653,8 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Ovisit_by_name: object name not pinned"); - if ((status = H5Ovisit_by_name2((hid_t)grp_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void *)&wrapper, (unsigned)fields, (hid_t)access_id)) < 0) + if ((status = H5Ovisit_by_name3((hid_t)grp_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, + H5O_iterate_cb, (void *)&wrapper, (unsigned)fields, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -639,7 +746,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment if (buf_size) { if (NULL == (oComment = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Oget_comment: failed to allocate object comment buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Oget_comment: failed to allocate object comment buffer"); if ((status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -684,7 +791,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name if (buf_size) { if (NULL == (objComment = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Oget_comment_by_name: failed to allocate buffer for object comment"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Oget_comment_by_name: failed to allocate buffer for object comment"); if ((status = H5Oget_comment_by_name((hid_t)loc_id, objName, objComment, (size_t)buf_size + 1, (hid_t)access_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -772,23 +879,46 @@ done: /* * Class: hdf_hdf5lib_H5 - * Method: _H5Oopen_by_addr - * Signature: (JJ)J; + * Method: _H5Oopen_by_token + * Signature: (JLhdf/hdf5lib/structs/H5O_token_t;)J; */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr - (JNIEnv *env, jclass clss, jlong loc_id, jlong addr) +Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token + (JNIEnv *env, jclass clss, jlong loc_id, jobject token) { - hid_t retVal = H5I_INVALID_HID; + H5O_token_t obj_token; + jboolean token_buf_is_copy; + jfieldID token_data_field_id; + jclass token_cls; + jbyte *token_buf = NULL; + jobject token_data; + hid_t retVal = H5I_INVALID_HID; UNUSED(clss); - if ((retVal = H5Oopen_by_addr((hid_t)loc_id, (haddr_t)addr)) < 0) + token_cls = ENVPTR->GetObjectClass(ENVONLY, token); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (token_data_field_id = ENVPTR->GetFieldID(ENVONLY, token_cls, "data", "[B"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + token_data = ENVPTR->GetObjectField(ENVONLY, token, token_data_field_id); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + PIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, &token_buf_is_copy, "H5Oopen_by_token: token buffer not pinned"); + HDmemcpy(&obj_token, token_buf, sizeof(H5O_token_t)); + UNPIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, JNI_ABORT); + token_buf = NULL; + + if ((retVal = H5Oopen_by_token((hid_t)loc_id, obj_token)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: + if (token_buf) + UNPIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, (retVal < 0) ? JNI_ABORT : 0); + return (jlong)retVal; -} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr */ +} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token */ /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h index 5241aba..2b53fd3 100644 --- a/java/src/jni/h5oImp.h +++ b/java/src/jni/h5oImp.h @@ -78,6 +78,33 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx /* * Class: hdf_hdf5lib_H5 + * Method: H5Oget_native_info + * Signature: (JI)Lhdf/hdf5lib/structs/H5O_native_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1native_1info +(JNIEnv*, jclass, jlong, jint fields); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_native_info_by_name + * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_native_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name +(JNIEnv*, jclass, jlong, jstring, jint fields, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_native_info_by_idx + * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_native_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx +(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jint fields, jlong); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5Olink * Signature: (JJLjava/lang/String;JJ)V */ @@ -168,12 +195,12 @@ Java_hdf_hdf5lib_H5_H5Oincr_1refcount /* * Class: hdf_hdf5lib_H5 - * Method: _H5Oopen_by_addr - * Signature: (JJ)J; + * Method: _H5Oopen_by_token + * Signature: (JLhdf/hdf5lib/structs/H5O_token_t;)J; */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr - (JNIEnv*, jclass, jlong, jlong); +Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token + (JNIEnv*, jclass, jlong, jobject); /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5pDAPLImp.c b/java/src/jni/h5pDAPLImp.c index fb39b84..2386df1 100644 --- a/java/src/jni/h5pDAPLImp.c +++ b/java/src/jni/h5pDAPLImp.c @@ -151,7 +151,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix H5_LIBRARY_ERROR(ENVONLY); if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t)prefix_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_efile_prefix: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_efile_prefix: memory allocation failed"); if (H5Pget_efile_prefix((hid_t)dapl_id, (char *)pre, (size_t)prefix_size + 1) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -159,7 +159,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_efile_prefix: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_efile_prefix: out of memory - unable to construct string from UTF characters"); } done: diff --git a/java/src/jni/h5pDCPLImp.c b/java/src/jni/h5pDCPLImp.c index 7559c3b..c43079f 100644 --- a/java/src/jni/h5pDCPLImp.c +++ b/java/src/jni/h5pDCPLImp.c @@ -109,7 +109,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1chunk PIN_BYTE_ARRAY(ENVONLY, dim, theArray, &isCopy, "H5Pset_chunk: dim array not pinned"); if (NULL == (da = lp = (hsize_t *) HDmalloc(rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pset_chunk: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_chunk: memory allocation failed"); jlp = (jlong *)theArray; for (i = 0; i < rank; i++) { @@ -161,7 +161,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1chunk PIN_LONG_ARRAY(ENVONLY, dims, theArray, &isCopy, "H5Pget_chunk: input dims not pinned"); if (NULL == (da = (hsize_t *) HDmalloc((size_t)max_ndims * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_chunk: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_chunk: memory allocation failed"); if ((status = H5Pget_chunk((hid_t)plist, (int)max_ndims, da)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -595,7 +595,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: cd_values is NULL"); if (NULL == (filter = (char *) HDmalloc(sizeof(char) * (size_t)namelen))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter: memory allocation failed"); PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter: flags array not pinned"); PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter: nelmts array not pinned"); @@ -620,7 +620,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, filter))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str); @@ -632,7 +632,7 @@ done: if (cd_nelmtsArray) UNPIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, (status < 0) ? JNI_ABORT : 0); if (flagsArray) - UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0) + UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0); if (filter) HDfree(filter); @@ -671,7 +671,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter2 H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: filter_config is NULL"); if (NULL == (filter = (char *) HDmalloc(sizeof(char) * (size_t)namelen))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter2: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter2: memory allocation failed"); PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter2: flags array not pinned"); PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter2: nelmts array not pinned"); @@ -715,7 +715,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter2 if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, filter))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter2: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter2: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str); @@ -772,7 +772,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: name is NULL"); if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)bs))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter_by_id: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id: memory allocation failed"); PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter_by_id: flags not pinned"); PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter_by_id: cd_nelms not pinned"); @@ -801,7 +801,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter_by_id: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str); @@ -858,7 +858,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: filter_config is NULL"); if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)bs))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter_by_id2: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id2: memory allocation failed"); PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter_by_id2: flags not pinned"); PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter_by_id2: cd_nelms not pinned"); @@ -882,7 +882,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter_by_id2: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id2: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str); @@ -1122,7 +1122,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1external if (name_size > 0) if (NULL == (file = (char *) HDmalloc(sizeof(char) * (size_t)name_size))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_external: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_external: memory allocation failed"); if ((status = H5Pget_external((hid_t) plist, (unsigned)idx, (size_t)name_size, file, (off_t *)&o, (hsize_t *)&s)) < 0) @@ -1140,7 +1140,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1external if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, file))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_external: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_external: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str); @@ -1250,7 +1250,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname H5_LIBRARY_ERROR(ENVONLY); if (NULL == (dname = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_dsetname: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_dsetname: memory allocation failed"); if (H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, dname, (size_t)buf_size + 1) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1258,7 +1258,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, dname))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_dsetname: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_dsetname: out of memory - unable to construct string from UTF characters"); } done: @@ -1288,7 +1288,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename H5_LIBRARY_ERROR(ENVONLY); if (NULL == (fname = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_filename: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_filename: memory allocation failed"); if (H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, fname, (size_t)buf_size + 1) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1296,7 +1296,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, fname))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_filename: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_filename: out of memory - unable to construct string from UTF characters"); } done: @@ -1392,7 +1392,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix H5_LIBRARY_ERROR(ENVONLY); if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t) prefix_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_prefix: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_prefix: memory allocation failed"); if (H5Pget_virtual_prefix((hid_t)dapl_id, (char *)pre, (size_t) prefix_size + 1) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1400,7 +1400,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_prefix: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_prefix: out of memory - unable to construct string from UTF characters"); } done: diff --git a/java/src/jni/h5pDXPLImp.c b/java/src/jni/h5pDXPLImp.c index 323fa8c..12e3367 100644 --- a/java/src/jni/h5pDXPLImp.c +++ b/java/src/jni/h5pDXPLImp.c @@ -310,7 +310,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1data_1transform H5_LIBRARY_ERROR(ENVONLY); if (NULL == (express = (char *) HDmalloc(sizeof(char) * (size_t)express_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_data_transform: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_data_transform: memory allocation failed"); if (H5Pget_data_transform((hid_t)plist_id, express, (size_t)express_size + 1) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -318,7 +318,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1data_1transform if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, express))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_data_transform: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_data_transform: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, expression, 0, str); diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index a627e65..c9844b7 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -308,7 +308,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family } if (NULL == (sa = (hsize_t *) HDmalloc((size_t) rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_family: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_family: memory allocation failed"); PIN_LONG_ARRAY(ENVONLY, memb_plist, plistArray, &isCopy, "H5Pget_family: plistArray not pinned"); @@ -398,7 +398,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs if (NULL != fa.namenode_name) { if (NULL == (j_namenode_name = ENVPTR->NewStringUTF(ENVONLY, fa.namenode_name))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create namenode_name string"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create namenode_name string"); } } args[0].l = j_namenode_name; @@ -408,7 +408,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs if (NULL != fa.user_name) { if (NULL == (j_user_name = ENVPTR->NewStringUTF(ENVONLY, fa.user_name))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create user_name string"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create user_name string"); } } args[2].l = j_user_name; @@ -416,7 +416,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs if (NULL != fa.kerberos_ticket_cache) { if (NULL == (j_kerb_cache_path = ENVPTR->NewStringUTF(ENVONLY, fa.kerberos_ticket_cache))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create kerberos_ticket_cache string"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create kerberos_ticket_cache string"); } } args[3].l = j_kerb_cache_path; @@ -651,7 +651,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi str_len = HDstrlen(utf8); if (NULL == (member_name[i] = (char *) HDmalloc(str_len + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pset_fapl_multi: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_fapl_multi: memory allocation failed"); HDstrncpy(member_name[i], utf8, str_len + 1); (member_name[i])[str_len] = '\0'; @@ -678,7 +678,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi if (NULL == (rstring = ENVPTR->NewStringUTF(ENVONLY, member_name[i]))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pset_fapl_multi: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_fapl_multi: out of memory - unable to construct string from UTF characters"); } if (NULL == (o = ENVPTR->GetObjectArrayElement(ENVONLY, memb_name, (jsize) i))) { @@ -750,7 +750,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi PIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, &isCopy, "H5Pget_fapl_multi: memb_addr not pinned"); if (memb_name) if (NULL == (mName = (char **) HDcalloc(H5FD_MEM_NTYPES, sizeof(*mName)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_multi: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_multi: memory allocation failed"); if ((status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t *)themapArray, (hid_t *)thefaplArray, mName, (haddr_t *)theaddrArray, (hbool_t *)&relax)) < 0) @@ -761,7 +761,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi if (mName[i]) { if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, mName[i]))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_multi: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_multi: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize) i, (jobject)str); @@ -823,7 +823,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 if (NULL != fa.aws_region) { if (NULL == (j_aws = ENVPTR->NewStringUTF(ENVONLY, fa.aws_region))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create aws_region string"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create aws_region string"); } } args[0].l = j_aws; @@ -831,7 +831,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 if (NULL != fa.secret_id) { if (NULL == (j_id = ENVPTR->NewStringUTF(ENVONLY, fa.secret_id))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create secret_id string"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create secret_id string"); } } args[1].l = j_id; @@ -839,7 +839,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 if (NULL != fa.secret_key) { if (NULL == (j_key = ENVPTR->NewStringUTF(ENVONLY, fa.secret_key))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create secret_key string"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create secret_key string"); } } args[2].l = j_key; @@ -1688,7 +1688,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config if (NULL != cacheinfo.trace_file_name) { if (NULL == (j_str = ENVPTR->NewStringUTF(ENVONLY, cacheinfo.trace_file_name))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_mdc_config: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_mdc_config: out of memory - unable to construct string from UTF characters"); } } @@ -1802,7 +1802,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options location_size++; /* add extra space for the null terminator */ if (NULL == (lname = (char *) HDmalloc(sizeof(char) * location_size))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_mdc_log_options: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_mdc_log_options: memory allocation failed"); if ((status = H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, lname, &location_size, &start_on_access)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1810,7 +1810,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, lname))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_mdc_log_options: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_mdc_log_options: out of memory - unable to construct string from UTF characters"); } mdc_log_options_ptr[0] = (jboolean)is_enabled; diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index 726e08c..9e5b004 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -503,7 +503,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1class_1name if (NULL == (j_str = ENVPTR->NewStringUTF(ENVONLY, c_str))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_class_name: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_class_name: out of memory - unable to construct string from UTF characters"); } done: diff --git a/java/src/jni/h5pLAPLImp.c b/java/src/jni/h5pLAPLImp.c index f2cb80a..754bece 100644 --- a/java/src/jni/h5pLAPLImp.c +++ b/java/src/jni/h5pLAPLImp.c @@ -134,7 +134,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix H5_LIBRARY_ERROR(ENVONLY); if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t) prefix_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_elink_prefix: memory allocation failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_elink_prefix: memory allocation failed"); if (H5Pget_elink_prefix((hid_t)lapl_id, (char *)pre, (size_t) prefix_size + 1) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -142,7 +142,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_elink_prefix: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_elink_prefix: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, prefix, 0, str); diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c index 90d78fe..b43b532 100644 --- a/java/src/jni/h5plImp.c +++ b/java/src/jni/h5plImp.c @@ -226,7 +226,7 @@ Java_hdf_hdf5lib_H5_H5PLget H5_LIBRARY_ERROR(ENVONLY); if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5PLget: failed to allocate plugin name buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5PLget: failed to allocate plugin name buffer"); if ((H5PLget((unsigned) index, aName, (size_t)buf_size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index 4ad5d5f..def27f4 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -51,7 +51,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1object PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_object: reference name not pinned"); if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_object: failed to allocate reference buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rcreate_object: failed to allocate reference buffer"); if ((status = H5Rcreate_object((hid_t)loc_id, refName, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -94,7 +94,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1region PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_region: reference name not pinned"); if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_region: failed to allocate reference buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rcreate_region: failed to allocate reference buffer"); if ((status = H5Rcreate_region((hid_t)loc_id, refName, space_id, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -141,7 +141,7 @@ Java_hdf_hdf5lib_H5_H5Rcreate_1attr PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_attr: reference name not pinned"); if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate reference buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate reference buffer"); if ((status = H5Rcreate_attr((hid_t)loc_id, refName, attrName, (hid_t)aid, (const H5R_ref_t *)refBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -315,7 +315,7 @@ Java_hdf_hdf5lib_H5_H5Rcopy PIN_BYTE_ARRAY(ENVONLY, src_ref, src_refBuf, &isCopy, "H5Rcopy: src reference buffer not pinned"); if (NULL == (dst_refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate dst reference buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate dst reference buffer"); if ((status = H5Rcopy((const H5R_ref_t *)src_refBuf, (const H5R_ref_t *)dst_refBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -452,7 +452,7 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3 (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id) { - H5O_type_t object_info; + H5O_type_t object_info = -1; jboolean isCopy; jbyte *refBuf = NULL; int retVal = -1; @@ -505,7 +505,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1file_1name H5_LIBRARY_ERROR(ENVONLY); if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_file_name: malloc failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_file_name: malloc failed"); if ((check_size = H5Rget_file_name((const H5R_ref_t *)refBuf, namePtr, (size_t)buf_size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -551,7 +551,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1obj_1name H5_LIBRARY_ERROR(ENVONLY); if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_obj_name: malloc failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_obj_name: malloc failed"); if ((check_size = H5Rget_obj_name((const H5R_ref_t *)refBuf, (hid_t)rapl_id, namePtr, (size_t)buf_size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -597,7 +597,7 @@ Java_hdf_hdf5lib_H5_H5Rget_1attr_1name H5_LIBRARY_ERROR(ENVONLY); if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_attr_name: malloc failed"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_attr_name: malloc failed"); if ((check_size = H5Rget_attr_name((const H5R_ref_t *)refBuf, namePtr, (size_t)buf_size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -645,9 +645,9 @@ Java_hdf_hdf5lib_H5_H5Rcreate } if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: reference input array length != H5R_OBJ_REF_BUF_SIZE") + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: reference input array length != H5R_OBJ_REF_BUF_SIZE"); else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE") + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE"); else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type)) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: unknown reference type"); @@ -692,9 +692,9 @@ Java_hdf_hdf5lib_H5__1H5Rdereference } if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: reference input array length != H5R_OBJ_REF_BUF_SIZE") + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: reference input array length != H5R_OBJ_REF_BUF_SIZE"); else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE") + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE"); else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type)) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: unknown reference type"); @@ -854,16 +854,16 @@ Java_hdf_hdf5lib_H5_H5Rget_1name } if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: reference input array length != H5R_OBJ_REF_BUF_SIZE") + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: reference input array length != H5R_OBJ_REF_BUF_SIZE"); else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE)) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE") + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE"); else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type)) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: unknown reference type"); PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_name: reference buffer not pinned"); if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_name: failed to allocate referenced object name buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_name: failed to allocate referenced object name buffer"); if ((ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, aName, (size_t)size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index c703e90..74866ed 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -98,7 +98,7 @@ Java_hdf_hdf5lib_H5__1H5Screate_1simple PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Screate_simple: dims not pinned"); if (NULL == (sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Screate_simple: failed to allocate dims buffer") + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Screate_simple: failed to allocate dims buffer"); jlp = (jlong *) dimsP; for (i = 0; i < rank; i++) { @@ -115,7 +115,7 @@ Java_hdf_hdf5lib_H5__1H5Screate_1simple PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Screate_simple: maxdims not pinned"); if (NULL == (msa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Screate_simple: failed to allocate maxdims buffer") + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Screate_simple: failed to allocate maxdims buffer"); jlp = (jlong *) maxdimsP; for (i = 0; i < mrank; i++) { @@ -194,7 +194,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements PIN_LONG_ARRAY(ENVONLY, coords, P, &isCopy, "H5Sselect_elements: coords not pinned"); if (NULL == (sa = (hssize_t *) HDmalloc( (size_t)num_elemn * 2 * sizeof(hssize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer"); for (i = 0; i < (num_elemn * 2); i++) { sa[i] = P[i]; @@ -247,7 +247,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements nlongs = (int)((size_t)size / sizeof(jlong)); if (NULL == (lp = (hsize_t *) HDmalloc((size_t)nlongs * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer"); jlp = (jlong *) P; llp = lp; @@ -444,7 +444,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims } if (NULL == (sa = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate dimension buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate dimension buffer"); } if (NULL == maxdims) { @@ -462,10 +462,10 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims if (rank < 0) rank = mrank; else if (mrank != rank) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims rank not same as dims"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims rank not same as dims"); if (NULL == (msa = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate maximum dimension buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate maximum dimension buffer"); } if ((status = H5Sget_simple_extent_dims(space_id, (hsize_t *)sa, (hsize_t *)msa)) < 0) @@ -564,7 +564,7 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Sset_extent_simple: dims not pinned"); if (NULL == (sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate dimension buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate dimension buffer"); jlp = (jlong *) dimsP; for (i = 0; i < rank; i++) { @@ -581,7 +581,7 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Sset_extent_simple: maxdims not pinned"); if (NULL == (msa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate maximum dimension buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate maximum dimension buffer"); jlp = (jlong *) maxdimsP; for (i = 0; i < rank; i++) { @@ -660,7 +660,7 @@ Java_hdf_hdf5lib_H5_H5Soffset_1simple rank = (size_t) i / sizeof(jlong); if (NULL == (sa = lp = (hssize_t *) HDmalloc((size_t)rank * sizeof(hssize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Soffset_simple: failed to allocate offset buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Soffset_simple: failed to allocate offset buffer"); jlp = (jlong *) P; for (i = 0; (size_t) i < rank; i++) { @@ -788,7 +788,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sselect_hyperslab: start not pinned"); if (NULL == (strt = lp = (hsize_t *) HDmalloc((size_t)start_rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate start buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate start buffer"); jlp = (jlong *) startP; for (i = 0; i < start_rank; i++) { @@ -800,7 +800,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sselect_hyperslab: count not pinned"); if (NULL == (cnt = lp = (hsize_t *) HDmalloc((size_t)count_rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate count buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate count buffer"); jlp = (jlong *) countP; for (i = 0; i < count_rank; i++) { @@ -825,7 +825,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sselect_hyperslab: stride not pinned"); if (NULL == (strd = lp = (hsize_t *) HDmalloc((size_t)stride_rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate stride buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate stride buffer"); jlp = (jlong *) strideP; for (i = 0; i < stride_rank; i++) { @@ -851,7 +851,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sselect_hyperslab: block not pinned"); if (NULL == (blk = lp = (hsize_t *) HDmalloc((size_t)block_rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate block buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate block buffer"); jlp = (jlong *) blockP; for (i = 0; i < block_rank; i++) { @@ -988,7 +988,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist buf_size = (size_t) numblocks * (size_t) 2 * (size_t) rank * sizeof(hsize_t); if (NULL == (ba = (hsize_t *) HDmalloc(buf_size))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: failed to allocate block list buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: failed to allocate block list buffer"); if ((status = H5Sget_select_hyper_blocklist((hid_t)spaceid, (hsize_t) startblock, (hsize_t) numblocks, (hsize_t *)ba)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1044,7 +1044,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_elem_pointlist: buffer not pinned"); if (NULL == (ba = (hsize_t *) HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: failed to allocate point list buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: failed to allocate point list buffer"); if ((status = H5Sget_select_elem_pointlist((hid_t)spaceid, (hsize_t)startpoint, (hsize_t)numpoints, (hsize_t *)ba)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1094,12 +1094,12 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds } if (NULL == (strt = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate start buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate start buffer"); PIN_LONG_ARRAY(ENVONLY, end, endP, &isCopy, "H5Sget_select_bounds: end not pinned"); if (NULL == (en = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate end buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate end buffer"); if ((status = H5Sget_select_bounds((hid_t) spaceid, (hsize_t *) strt, (hsize_t *) en)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1148,7 +1148,7 @@ Java_hdf_hdf5lib_H5_H5Sencode H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: buf_size = 0"); if (NULL == (bufPtr = (unsigned char *) HDcalloc((size_t) 1, buf_size))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sencode: failed to allocate encoding buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sencode: failed to allocate encoding buffer"); if ((status = H5Sencode2((hid_t) obj_id, bufPtr, &buf_size, H5P_DEFAULT)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1258,7 +1258,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sget_regular_hyperslab: start not pinned"); if (NULL == (strt = (hsize_t *) HDmalloc((size_t)start_rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate start buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate start buffer"); } if (NULL == stride) { @@ -1277,7 +1277,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sget_regular_hyperslab: stride not pinned"); if (NULL == (strd = (hsize_t *) HDmalloc((size_t)stride_rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate stride buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate stride buffer"); } if (NULL == count) { @@ -1296,7 +1296,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sget_regular_hyperslab: count not pinned"); if (NULL == (cnt = (hsize_t *) HDmalloc((size_t)count_rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate count buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate count buffer"); } if (NULL == block) { @@ -1315,7 +1315,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sget_regular_hyperslab: block not pinned"); if (NULL == (blk = (hsize_t *) HDmalloc((size_t)block_rank * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate block buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate block buffer"); } if ((status = H5Sget_regular_hyperslab(space_id, (hsize_t *) strt, (hsize_t *) strd, (hsize_t *) cnt, (hsize_t *) blk)) < 0) diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 1adff3c..1cbf1a5 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -1239,7 +1239,7 @@ Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof_int: name size < 0"); if (NULL == (nameP = (char *) HDmalloc(sizeof(char) * (size_t)size))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Tenum_nameof_int: failed to allocate name buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tenum_nameof_int: failed to allocate name buffer"); PIN_INT_ARRAY(ENVONLY, value, intP, &isCopy, "H5Tenum_nameof_int: value not pinned"); @@ -1285,7 +1285,7 @@ Java_hdf_hdf5lib_H5_H5Tenum_1nameof H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof: value is NULL"); if (NULL == (nameP = (char *) HDmalloc(sizeof(char) * (size_t)size))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Tenum_nameof: failed to allocate name buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tenum_nameof: failed to allocate name buffer"); PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Tenum_nameof: value not pinned"); @@ -1485,7 +1485,7 @@ Java_hdf_hdf5lib_H5_H5Tget_1array_1dims } if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Tget_array_dims: failed to allocate dimension buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tget_array_dims: failed to allocate dimension buffer"); if ((ndims = H5Tget_array_dims2((hid_t)type_id, cdims)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1626,10 +1626,10 @@ Java_hdf_hdf5lib_H5__1H5Tarray_1create2 } if (dlen != rank) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Tarray_create: dimension array length != array rank"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: dimension array length != array rank"); if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Tarray_create: failed to allocate dimension buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tarray_create: failed to allocate dimension buffer"); for (i = 0; i < (size_t) dlen; i++) { cdims[i] = (hsize_t)dimsP[i]; @@ -1676,7 +1676,7 @@ Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2 } if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Tarray_get_dims2: failed to allocate dimension buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tarray_get_dims2: failed to allocate dimension buffer"); if ((ndims = H5Tget_array_dims2((hid_t)type_id, (hsize_t*)cdims)) < 0) H5_LIBRARY_ERROR(ENVONLY); diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 5f1bccb..55f7571 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -515,7 +515,7 @@ h5str_convert total_elmts *= dims[i]; if (NULL == (cptr = (char *) HDcalloc((size_t)total_elmts, baseTypeSize))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: failed to allocate array buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to allocate array buffer"); for (i = 0; i < total_elmts; i++) { if (!(h5str_convert(ENVONLY, &this_str, container, mtid, out_buf, i * baseTypeSize))) { @@ -556,7 +556,7 @@ h5str_convert H5_LIBRARY_ERROR(ENVONLY); if (NULL == (vl_buf->p = HDmalloc(baseTypeSize))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: failed to allocate vlen buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to allocate vlen buffer"); vl_buf->len = 1; /* Skip whitespace and vlen indicators */ @@ -570,7 +570,7 @@ h5str_convert char *tmp_realloc; if (NULL == (tmp_realloc = (char *) HDrealloc(vl_buf->p, vl_buf->len * 2 * baseTypeSize))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: failed to reallocate vlen buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to reallocate vlen buffer"); vl_buf->len *= 2; vl_buf->p = tmp_realloc; } @@ -733,9 +733,9 @@ h5str_sprintf /* Build default formats for long long types */ if (!fmt_llong[0]) { if (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure"); + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); } /* end if */ switch (tclass) { @@ -749,7 +749,7 @@ h5str_sprintf HDmemcpy(&tmp_float, cptr, sizeof(float)); if (NULL == (this_str = (char *) HDmalloc(25))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%g", tmp_float) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -764,7 +764,7 @@ h5str_sprintf HDmemcpy(&tmp_double, cptr, sizeof(double)); if (NULL == (this_str = (char *) HDmalloc(25))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%g", tmp_double) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -779,7 +779,7 @@ h5str_sprintf HDmemcpy(&tmp_ldouble, cptr, sizeof(long double)); if (NULL == (this_str = (char *) HDmalloc(27))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%Lf", tmp_ldouble) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -819,13 +819,13 @@ h5str_sprintf /* Check for NULL pointer for string */ if (!tmp_str) { if (NULL == (this_str = (char *) HDmalloc(5))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); HDstrncpy(this_str, "NULL", 5); } else { if (typeSize > 0) { if (NULL == (this_str = (char *) HDmalloc(typeSize + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); HDstrncpy(this_str, tmp_str, typeSize); this_str[typeSize] = '\0'; @@ -851,7 +851,7 @@ h5str_sprintf HDmemcpy(&tmp_uchar, cptr, sizeof(unsigned char)); if (NULL == (this_str = (char *) HDmalloc(7))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%hhu", tmp_uchar) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -860,7 +860,7 @@ h5str_sprintf HDmemcpy(&tmp_char, cptr, sizeof(char)); if (NULL == (this_str = (char *) HDmalloc(7))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%hhd", tmp_char) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -878,7 +878,7 @@ h5str_sprintf HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short)); if (NULL == (this_str = (char *) HDmalloc(9))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%hu", tmp_ushort) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -887,7 +887,7 @@ h5str_sprintf HDmemcpy(&tmp_short, cptr, sizeof(short)); if (NULL == (this_str = (char *) HDmalloc(9))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%hd", tmp_short) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -905,7 +905,7 @@ h5str_sprintf HDmemcpy(&tmp_uint, cptr, sizeof(unsigned int)); if (NULL == (this_str = (char *) HDmalloc(14))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%u", tmp_uint) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -914,7 +914,7 @@ h5str_sprintf HDmemcpy(&tmp_int, cptr, sizeof(int)); if (NULL == (this_str = (char *) HDmalloc(14))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%d", tmp_int) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -932,7 +932,7 @@ h5str_sprintf HDmemcpy(&tmp_ulong, cptr, sizeof(unsigned long)); if (NULL == (this_str = (char *) HDmalloc(23))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%lu", tmp_ulong) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -941,7 +941,7 @@ h5str_sprintf HDmemcpy(&tmp_long, cptr, sizeof(long)); if (NULL == (this_str = (char *) HDmalloc(23))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%ld", tmp_long) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -960,7 +960,7 @@ h5str_sprintf HDmemcpy(&tmp_ullong, cptr, sizeof(unsigned long long)); if (NULL == (this_str = (char *) HDmalloc(25))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, fmt_ullong, tmp_ullong) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -969,7 +969,7 @@ h5str_sprintf HDmemcpy(&tmp_llong, cptr, sizeof(long long)); if (NULL == (this_str = (char *) HDmalloc(25))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, fmt_llong, tmp_llong) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); @@ -1034,7 +1034,7 @@ h5str_sprintf size_t i; if (NULL == (this_str = (char *) HDmalloc(4 * (typeSize + 1)))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (1 == typeSize) { if (HDsprintf(this_str, "%#02x", ucptr[0]) < 0) @@ -1059,7 +1059,7 @@ h5str_sprintf } if (H5Tequal(tid, H5T_STD_REF)) { - H5O_type_t obj_type; /* Object type */ + H5O_type_t obj_type = -1; /* Object type */ H5R_type_t ref_type; /* Reference type */ const H5R_ref_t *ref_vp = (H5R_ref_t *)cptr; @@ -1069,10 +1069,10 @@ h5str_sprintf case H5R_OBJECT1: { /* Object references -- show the type and OID of the referenced object. */ - H5O_info_t oi; + H5O_info2_t oi; if((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - H5Oget_info2(obj, &oi, H5O_INFO_BASIC); + H5Oget_info3(obj, &oi, H5O_INFO_BASIC); if(H5Oclose(obj) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } @@ -1080,7 +1080,7 @@ h5str_sprintf CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (this_str = (char *) HDmalloc(14))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (HDsprintf(this_str, "%u-", (unsigned) oi.type) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); if (!h5str_append(out_str, this_str)) @@ -1114,10 +1114,19 @@ h5str_sprintf h5str_sprint_reference(ENVONLY, out_str, container, ref_vp); /* Print OID */ - if (NULL == (this_str = (char *) HDmalloc(64))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsprintf(this_str, "%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr) < 0) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + { + char *token_str; + + H5Otoken_to_str(tid, &oi.token, &token_str); + + if (NULL == (this_str = (char *) HDmalloc(64 + strlen(token_str) + 1))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + if (HDsprintf(this_str, "%lu:%s", oi.fileno, token_str) < 0) + H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure"); + + H5free_memory(token_str); + } + } break; @@ -1273,7 +1282,7 @@ h5str_sprintf /* All other types get printed as hexadecimal */ if (NULL == (this_str = (char *) HDmalloc(4 * (typeSize + 1)))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); if (1 == typeSize) { if (HDsprintf(this_str, "%#02x", ucptr[0]) < 0) @@ -1346,7 +1355,7 @@ h5str_print_region_data_blocks /* Allocate space for the dimension array */ if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate dimension array buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate dimension array buffer"); /* Find the dimensions of each data space from the block coordinates */ for (jndx = 0, numelem = 1; jndx < (size_t) ndims; jndx++) { @@ -1362,15 +1371,15 @@ h5str_print_region_data_blocks H5_LIBRARY_ERROR(ENVONLY); if (NULL == (region_buf = HDmalloc(type_size * (size_t)numelem))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate region buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate region buffer"); /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ /* 1 2 n 1 2 n */ if (NULL == (start = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab start buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab start buffer"); if (NULL == (count = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab count buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab count buffer"); for (blkndx = 0; blkndx < (hsize_t) nblocks; blkndx++) { for (indx = 0; indx < (unsigned) ndims; indx++) { @@ -1445,7 +1454,7 @@ h5str_dump_region_blocks_data alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); if (alloc_size == (hsize_t)((size_t) alloc_size)) { if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks_data: failed to allocate region block buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_blocks_data: failed to allocate region block buffer"); if (H5Sget_select_hyper_blocklist(region, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1505,7 +1514,7 @@ h5str_dump_region_blocks int i; if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: failed to allocate region block buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_blocks: failed to allocate region block buffer"); if (H5Sget_select_hyper_blocklist(region, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1590,7 +1599,7 @@ h5str_print_region_data_points /* Allocate space for the dimension array */ if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate dimension array buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate dimension array buffer"); dims1[0] = (hsize_t)npoints; @@ -1602,7 +1611,7 @@ h5str_print_region_data_points H5_LIBRARY_ERROR(ENVONLY); if (NULL == (region_buf = HDmalloc(type_size * (size_t)npoints))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate region buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate region buffer"); if (H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1662,7 +1671,7 @@ h5str_dump_region_points_data alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); if (alloc_size == (hsize_t)((size_t) alloc_size)) { if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points_data: failed to allocate region point data buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_points_data: failed to allocate region point data buffer"); if (H5Sget_select_elem_pointlist(region, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1725,7 +1734,7 @@ h5str_dump_region_points alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); if (alloc_size == (hsize_t)((size_t) alloc_size)) { if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: failed to allocate region point buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_points: failed to allocate region point buffer"); if (H5Sget_select_elem_pointlist(region, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -2833,7 +2842,7 @@ h5str_dump_simple_dset if (sm_nbytes > 0) { if (NULL == (sm_buf = (unsigned char *) HDmalloc((size_t)sm_nbytes))) - H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_dset: failed to allocate sm_buf"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_dset: failed to allocate sm_buf"); sm_nelmts = sm_nbytes / p_type_nbytes; @@ -2964,7 +2973,7 @@ h5tools_dump_simple_data h5str_new(&buffer, 32 * size); if (!buffer.s) - H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: failed to allocate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5tools_dump_simple_data: failed to allocate buffer"); if (!(bytes_in = h5str_sprintf(ENVONLY, &buffer, container, type, memref, 0, 1))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -3035,7 +3044,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex } if (NULL == (readBuf = (char *) HDmalloc((size_t)n * size))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadComplex: failed to allocate read buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadComplex: failed to allocate read buffer"); if ((status = H5Aread(attr_id, mem_type_id, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -3043,7 +3052,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex h5str_new(&h5str, 4 * size); if (!h5str.s) - H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadComplex: failed to allocate string buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadComplex: failed to allocate string buffer"); for (i = 0; i < (size_t) n; i++) { h5str.s[0] = '\0'; @@ -3104,7 +3113,7 @@ Java_hdf_hdf5lib_H5_H5Acopy total_size = (hsize_t)npoints * (hsize_t)type_size; if (NULL == (buf = (jbyte *) HDmalloc((size_t)total_size * sizeof(jbyte)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Acopy: failed to allocate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Acopy: failed to allocate buffer"); if ((retVal = H5Aread((hid_t)src_id, tid, buf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -3151,7 +3160,7 @@ Java_hdf_hdf5lib_H5_H5Dcopy UNUSED(clss); if (!(total_allocated_size = H5Dget_storage_size((hid_t)src_id))) - return 0; // nothing to write + return 0; /* nothing to write */ if ((sid = H5Dget_space((hid_t)src_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -3166,7 +3175,7 @@ Java_hdf_hdf5lib_H5_H5Dcopy total_size = (hsize_t)npoints * (hsize_t)type_size; if (NULL == (buf = (jbyte *) HDmalloc((size_t)total_size * sizeof(jbyte)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Dcopy: failed to allocate buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dcopy: failed to allocate buffer"); if ((retVal = H5Dread((hid_t)src_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -3204,15 +3213,15 @@ done: */ #ifdef __cplusplus - herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); - herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); - int H5Gget_obj_info_max(hid_t, char **, int *, int *, unsigned long *, long); - int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder); + herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data); + herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data); + int H5Gget_obj_info_max(hid_t, char **, int *, int *, H5O_token_t *, long); + int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, H5O_token_t *obj_token, int indexType, int indexOrder); #else - static herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); - static herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); - static int H5Gget_obj_info_max(hid_t, char **, int *, int *, unsigned long *, long); - static int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder); + static herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data); + static herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data); + static int H5Gget_obj_info_max(hid_t, char **, int *, int *, H5O_token_t *, long); + static int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, H5O_token_t *obj_token, int indexType, int indexOrder); #endif typedef struct info_all @@ -3220,7 +3229,7 @@ typedef struct info_all char **objname; int *otype; int *ltype; - unsigned long *objno; + H5O_token_t *obj_token; unsigned long *fno; unsigned long idxnum; int count; @@ -3241,17 +3250,17 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full (JNIEnv *env, jclass clss, jlong loc_id, jstring group_name, jobjectArray objName, jintArray oType, jintArray lType, jlongArray fNo, - jlongArray oRef, jint n, jint indx_type, jint indx_order) + jobjectArray oToken, jint n, jint indx_type, jint indx_order) { - unsigned long *refs = NULL; unsigned long *fnos = NULL; + H5O_token_t *tokens = NULL; const char *gName = NULL; char **oName = NULL; jboolean isCopy; jstring str; + jobject token; jint *otarr = NULL; jint *ltarr = NULL; - jlong *refP = NULL; jlong *fnoP = NULL; hid_t gid = (hid_t)loc_id; int i; @@ -3265,24 +3274,23 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: oType is NULL"); if (NULL == lType) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: lType is NULL"); - if (NULL == oRef) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: oRef is NULL"); + if (NULL == oToken) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: oToken is NULL"); if (NULL == fNo) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: fNo is NULL"); PIN_INT_ARRAY(ENVONLY, oType, otarr, &isCopy, "H5Gget_obj_info_full: oType not pinned"); PIN_INT_ARRAY(ENVONLY, lType, ltarr, &isCopy, "H5Gget_obj_info_full: lType not pinned"); - PIN_LONG_ARRAY(ENVONLY, oRef, refP, &isCopy, "H5Gget_obj_info_full: oRef not pinned"); PIN_LONG_ARRAY(ENVONLY, fNo, fnoP, &isCopy, "H5Gget_obj_info_full: fNo not pinned"); if (NULL == (oName = (char **) HDcalloc((size_t)n, sizeof(*oName)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for object name"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for object name"); - if (NULL == (refs = (unsigned long *) HDcalloc((size_t)n, sizeof(unsigned long)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for ref. info"); + if (NULL == (tokens = (H5O_token_t *) HDcalloc((size_t)n, sizeof(H5O_token_t)))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for object tokens"); if (NULL == (fnos = (unsigned long *) HDcalloc((size_t)n, sizeof(unsigned long)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for file number info"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for file number info"); if (group_name) { PIN_JAVA_STRING(ENVONLY, group_name, gName, &isCopy, "H5Gget_obj_info_full: group_name not pinned"); @@ -3291,11 +3299,10 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full H5_LIBRARY_ERROR(ENVONLY); } - if ((ret_val = H5Gget_obj_info_full(gid, oName, (int *)otarr, (int *)ltarr, fnos, refs, indexType, indexOrder)) < 0) + if ((ret_val = H5Gget_obj_info_full(gid, oName, (int *)otarr, (int *)ltarr, fnos, tokens, indexType, indexOrder)) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_full: retrieval of object info failed"); for (i = 0; i < n; i++) { - refP[i] = (jlong)refs[i]; fnoP[i] = (jlong)fnos[i]; if (oName[i]) { @@ -3307,6 +3314,15 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full ENVPTR->DeleteLocalRef(ENVONLY, str); } /* end if */ + + /* Create an H5O_token_t object */ + if (NULL == (token = create_H5O_token_t(ENVONLY, &tokens[i], TRUE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + ENVPTR->SetObjectArrayElement(ENVONLY, oToken, i, token); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + ENVPTR->DeleteLocalRef(ENVONLY, token); } done: @@ -3316,14 +3332,12 @@ done: } if (fnos) HDfree(fnos); - if (refs) - HDfree(refs); + if (tokens) + HDfree(tokens); if (oName) h5str_array_free(oName, (size_t)n); if (fnoP) UNPIN_LONG_ARRAY(ENVONLY, fNo, fnoP, (ret_val < 0) ? JNI_ABORT : 0); - if (refP) - UNPIN_LONG_ARRAY(ENVONLY, oRef, refP, (ret_val < 0) ? JNI_ABORT : 0); if (ltarr) UNPIN_INT_ARRAY(ENVONLY, lType, ltarr, (ret_val < 0) ? JNI_ABORT : 0); if (otarr) @@ -3345,17 +3359,17 @@ done: JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max (JNIEnv *env, jclass clss, jlong loc_id, jobjectArray objName, - jintArray oType, jintArray lType, jlongArray oRef, jlong maxnum, jint n) + jintArray oType, jintArray lType, jobjectArray oToken, jlong maxnum, jint n) { - unsigned long *refs = NULL; - jboolean isCopy; - jstring str; - jlong *refP = NULL; - char **oName = NULL; - jint *otarr = NULL; - jint *ltarr = NULL; - int i; - herr_t ret_val = FAIL; + H5O_token_t *tokens = NULL; + jboolean isCopy; + jstring str; + jobject token; + char **oName = NULL; + jint *otarr = NULL; + jint *ltarr = NULL; + int i; + herr_t ret_val = FAIL; UNUSED(clss); @@ -3363,25 +3377,22 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_max: oType is NULL"); if (NULL == lType) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_max: lType is NULL"); - if (NULL == oRef) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_max: oRef is NULL"); + if (NULL == oToken) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_max: oToken is NULL"); PIN_INT_ARRAY(ENVONLY, oType, otarr, &isCopy, "H5Gget_obj_info_max: oType not pinned"); PIN_INT_ARRAY(ENVONLY, lType, ltarr, &isCopy, "H5Gget_obj_info_max: lType not pinned"); - PIN_LONG_ARRAY(ENVONLY, oRef, refP, &isCopy, "H5Gget_obj_info_max: oRef not pinned"); if (NULL == (oName = (char **) HDcalloc((size_t)n, sizeof(*oName)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for object name"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for object name"); - if (NULL == (refs = (unsigned long *) HDcalloc((size_t)n, sizeof(unsigned long)))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for ref. info"); + if (NULL == (tokens = (H5O_token_t *) HDcalloc((size_t)n, sizeof(H5O_token_t)))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for object tokens"); - if ((ret_val = H5Gget_obj_info_max((hid_t)loc_id, oName, (int *)otarr, (int *)ltarr, refs, maxnum)) < 0) + if ((ret_val = H5Gget_obj_info_max((hid_t)loc_id, oName, (int *)otarr, (int *)ltarr, tokens, maxnum)) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_max: retrieval of object info failed"); for (i = 0; i < n; i++) { - refP[i] = (jlong) refs[i]; - if (oName[i]) { if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, oName[i]))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); @@ -3391,15 +3402,22 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max ENVPTR->DeleteLocalRef(ENVONLY, str); } + + /* Create an H5O_token_t object */ + if (NULL == (token = create_H5O_token_t(ENVONLY, &tokens[i], TRUE))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + ENVPTR->SetObjectArrayElement(ENVONLY, oToken, i, token); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + ENVPTR->DeleteLocalRef(ENVONLY, token); } /* end for */ done: - if (refs) - HDfree(refs); + if (tokens) + HDfree(tokens); if (oName) h5str_array_free(oName, (size_t)n); - if (refP) - UNPIN_LONG_ARRAY(ENVONLY, oRef, refP, (ret_val < 0) ? JNI_ABORT : 0); if (ltarr) UNPIN_INT_ARRAY(ENVONLY, lType, ltarr, (ret_val < 0) ? JNI_ABORT : 0); if (otarr) @@ -3410,7 +3428,7 @@ done: int H5Gget_obj_info_full - (hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder) + (hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, H5O_token_t *obj_token, int indexType, int indexOrder) { info_all_t info; @@ -3419,10 +3437,10 @@ H5Gget_obj_info_full info.ltype = ltype; info.idxnum = 0; info.fno = fno; - info.objno = objno; + info.obj_token = obj_token; info.count = 0; - if (H5Literate(loc_id, (H5_index_t)indexType, (H5_iter_order_t)indexOrder, NULL, obj_info_all, (void *)&info) < 0) { + if (H5Literate2(loc_id, (H5_index_t)indexType, (H5_iter_order_t)indexOrder, NULL, obj_info_all, (void *)&info) < 0) { /* * Reset info stats; most importantly, reset the count. */ @@ -3431,11 +3449,11 @@ H5Gget_obj_info_full info.ltype = ltype; info.idxnum = 0; info.fno = fno; - info.objno = objno; + info.obj_token = obj_token; info.count = 0; /* Iteration failed, try normal alphabetical order */ - if (H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, obj_info_all, (void *)&info) < 0) + if (H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, obj_info_all, (void *)&info) < 0) return -1; } @@ -3444,7 +3462,7 @@ H5Gget_obj_info_full int H5Gget_obj_info_max - (hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *objno, long maxnum) + (hid_t loc_id, char **objname, int *otype, int *ltype, H5O_token_t *obj_token, long maxnum) { info_all_t info; @@ -3452,10 +3470,10 @@ H5Gget_obj_info_max info.otype = otype; info.ltype = ltype; info.idxnum = (unsigned long)maxnum; - info.objno = objno; + info.obj_token = obj_token; info.count = 0; - if (H5Lvisit(loc_id, H5_INDEX_NAME, H5_ITER_NATIVE, obj_info_max, (void *)&info) < 0) + if (H5Lvisit2(loc_id, H5_INDEX_NAME, H5_ITER_NATIVE, obj_info_max, (void *)&info) < 0) return -1; return info.count; @@ -3463,16 +3481,16 @@ H5Gget_obj_info_max herr_t obj_info_all - (hid_t loc_id, const char *name, const H5L_info_t *info, void *op_data) + (hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_data) { - info_all_t *datainfo = (info_all_t *)op_data; - H5O_info_t object_info; - htri_t object_exists; - size_t str_len; + info_all_t *datainfo = (info_all_t *)op_data; + H5O_info2_t object_info; + htri_t object_exists; + size_t str_len; datainfo->otype[datainfo->count] = -1; datainfo->ltype[datainfo->count] = -1; - datainfo->objno[datainfo->count] = (unsigned long)-1; + datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF; str_len = HDstrlen(name); if (NULL == (datainfo->objname[datainfo->count] = (char *) HDmalloc(str_len + 1))) @@ -3485,21 +3503,15 @@ obj_info_all goto done; if (object_exists) { - if (H5Oget_info_by_name2(loc_id, name, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0) + if (H5Oget_info_by_name3(loc_id, name, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0) goto done; datainfo->otype[datainfo->count] = object_info.type; datainfo->ltype[datainfo->count] = info->type; datainfo->fno[datainfo->count] = object_info.fileno; - datainfo->objno[datainfo->count] = (unsigned long)object_info.addr; - } - /* - if (info->type == H5L_TYPE_HARD) - datainfo->objno[datainfo->count] = (unsigned long)info->u.address; - else - datainfo->objno[datainfo->count] = info->u.val_size; - */ + HDmemcpy(&datainfo->obj_token[datainfo->count], &object_info.token, sizeof(object_info.token)); + } done: datainfo->count++; @@ -3509,16 +3521,16 @@ done: herr_t obj_info_max - (hid_t loc_id, const char *name, const H5L_info_t *info, void *op_data) + (hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_data) { - info_all_t *datainfo = (info_all_t *)op_data; - H5O_info_t object_info; - size_t str_len; + info_all_t *datainfo = (info_all_t *)op_data; + H5O_info2_t object_info; + size_t str_len; datainfo->otype[datainfo->count] = -1; datainfo->ltype[datainfo->count] = -1; datainfo->objname[datainfo->count] = NULL; - datainfo->objno[datainfo->count] = (unsigned long)-1; + datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF; /* This will be freed by h5str_array_free(oName, n) */ str_len = HDstrlen(name); @@ -3528,16 +3540,13 @@ obj_info_max HDstrncpy(datainfo->objname[datainfo->count], name, str_len); (datainfo->objname[datainfo->count])[str_len] = '\0'; - if (H5Oget_info2(loc_id, &object_info, H5O_INFO_ALL) < 0) + if (H5Oget_info3(loc_id, &object_info, H5O_INFO_ALL) < 0) goto done; datainfo->otype[datainfo->count] = object_info.type; datainfo->ltype[datainfo->count] = info->type; - if (info->type == H5L_TYPE_HARD) - datainfo->objno[datainfo->count] = (unsigned long)info->u.address; - else - datainfo->objno[datainfo->count] = info->u.val_size; + HDmemcpy(&datainfo->obj_token[datainfo->count], &object_info.token, sizeof(object_info.token)); done: datainfo->count++; diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h index c26cd5d..51b6594 100644 --- a/java/src/jni/h5util.h +++ b/java/src/jni/h5util.h @@ -96,7 +96,7 @@ Java_hdf_hdf5lib_H5_H5Dcopy */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full - (JNIEnv*, jclass, jlong, jstring, jobjectArray, jintArray, jintArray, jlongArray, jlongArray, jint, jint, jint); + (JNIEnv*, jclass, jlong, jstring, jobjectArray, jintArray, jintArray, jlongArray, jobjectArray, jint, jint, jint); /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c index 92e456e..0fee343 100644 --- a/java/src/jni/h5vlImp.c +++ b/java/src/jni/h5vlImp.c @@ -110,10 +110,30 @@ done: /* * Class: hdf_hdf5lib_H5 * Method: H5VLget_connector_id - * Signature: (Ljava/lang/String;)J + * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5VLget_1connector_1id + (JNIEnv *env, jclass clss, jlong obj_id) +{ + hid_t status = H5I_INVALID_HID; + + UNUSED(clss); + + if ((status = H5VLget_connector_id((hid_t)obj_id)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLget_connector_id_by_name + * Signature: (Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name (JNIEnv *env, jclass clss, jobject connector_name) { const char *volName = NULL; @@ -122,11 +142,11 @@ Java_hdf_hdf5lib_H5_H5VLget_1connector_1id UNUSED(clss); if (NULL == connector_name) - H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLget_connector_id: VOL connector name is NULL"); + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLget_connector_id_by_name: VOL connector name is NULL"); - PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLget_connector_id: VOL connector name not pinned"); + PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLget_connector_id_by_name: VOL connector name not pinned"); - if ((status = H5VLget_connector_id(volName)) < 0) + if ((status = H5VLget_connector_id_by_name(volName)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -134,7 +154,7 @@ done: UNPIN_JAVA_STRING(ENVONLY, connector_name, volName); return (jlong)status; -} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id */ +} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name */ /* * Class: hdf_hdf5lib_H5 @@ -158,7 +178,7 @@ Java_hdf_hdf5lib_H5_H5VLget_1connector_1name if (buf_size > 0) { if (NULL == (volName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1))) - H5_JNI_FATAL_ERROR(ENVONLY, "H5VLget_connector_name: failed to allocated VOL connector name buffer"); + H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5VLget_connector_name: failed to allocated VOL connector name buffer"); if ((status = H5VLget_connector_name((hid_t)object_id, volName, (size_t)buf_size + 1)) < 0) H5_LIBRARY_ERROR(ENVONLY); diff --git a/java/src/jni/h5vlImp.h b/java/src/jni/h5vlImp.h index 207efa5..6dd7529 100644 --- a/java/src/jni/h5vlImp.h +++ b/java/src/jni/h5vlImp.h @@ -50,10 +50,19 @@ Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered /* * Class: hdf_hdf5lib_H5 * Method: H5VLget_connector_id - * Signature: (Ljava/lang/String;)J + * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5VLget_1connector_1id + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLget_connector_id_by_name + * Signature: (Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name (JNIEnv *, jclass, jobject); /* diff --git a/java/src/jni/nativeData.c b/java/src/jni/nativeData.c index ad01b01..3c3d3d5 100644 --- a/java/src/jni/nativeData.c +++ b/java/src/jni/nativeData.c @@ -327,7 +327,7 @@ Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B } if ((start < 0) || ((int)(start + (len * (int)sizeof(jint))) > blen)) - H5_JNI_FATAL_ERROR(ENVONLY, "byteToInt: start < 0 or len exceeded buffer length"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToInt: start < 0 or len exceeded buffer length"); bp = (char *)barr + start; @@ -379,7 +379,7 @@ Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B } if ((start < 0) || ((int)(start + (len * (int)sizeof(jshort))) > blen)) - H5_JNI_FATAL_ERROR(ENVONLY, "byteToShort: start < 0 or len exceeded buffer length"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToShort: start < 0 or len exceeded buffer length"); bp = (char *)barr + start; @@ -431,7 +431,7 @@ Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B } if ((start < 0) || ((int)(start + (len * (int)sizeof(jfloat))) > blen)) - H5_JNI_FATAL_ERROR(ENVONLY, "byteToFloat: start < 0 or len exceeded buffer length"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: start < 0 or len exceeded buffer length"); bp = (char *)barr + start; @@ -483,7 +483,7 @@ Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B } if ((start < 0) || ((int)(start + (len * (int)sizeof(jlong))) > blen)) - H5_JNI_FATAL_ERROR(ENVONLY, "byteToLong: start < 0 or len exceeded buffer length"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: start < 0 or len exceeded buffer length"); bp = (char *)barr + start; @@ -535,7 +535,7 @@ Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B } if ((start < 0) || ((int)(start + (len * (int)sizeof(jdouble))) > blen)) - H5_JNI_FATAL_ERROR(ENVONLY, "byteToDouble: start < 0 or len exceeded buffer length"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToDouble: start < 0 or len exceeded buffer length"); bp = (char *)barr + start; @@ -593,7 +593,7 @@ Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I } if ((start < 0) || (((start + len)) > ilen)) - H5_JNI_FATAL_ERROR(ENVONLY, "intToByte: start < 0 or len exceeded buffer length"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "intToByte: start < 0 or len exceeded buffer length"); ip = iarr + start; @@ -655,7 +655,7 @@ Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S } if ((start < 0) || (((start + len)) > ilen)) - H5_JNI_FATAL_ERROR(ENVONLY, "shortToByte: start < 0 or len exceeded buffer length"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "shortToByte: start < 0 or len exceeded buffer length"); ip = sarr + start; @@ -717,7 +717,7 @@ Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F } if ((start < 0) || (((start + len)) > ilen)) - H5_JNI_FATAL_ERROR(ENVONLY, "floatToByte: start < 0 or len exceeded buffer length"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "floatToByte: start < 0 or len exceeded buffer length"); ip = farr + start; @@ -779,7 +779,7 @@ Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D } if ((start < 0) || (((start + len)) > ilen)) - H5_JNI_FATAL_ERROR(ENVONLY, "doubleToByte: start < 0 or len exceeded buffer length"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "doubleToByte: start < 0 or len exceeded buffer length"); ip = darr + start; @@ -841,7 +841,7 @@ Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J } if ((start < 0) || (((start + len)) > ilen)) - H5_JNI_FATAL_ERROR(ENVONLY, "longToByte: start < 0 or len exceeded buffer length"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, "longToByte: start < 0 or len exceeded buffer length"); ip = larr + start; diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index dfb6e72..de7dc62 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -105,39 +105,41 @@ endif () get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") -foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) - set (CMAKE_JAVA_CLASSPATH ".") - foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) - set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) + foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) + set (CMAKE_JAVA_CLASSPATH ".") + foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") + endforeach () + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_${test_file}_JAR_FILE}") + + add_test ( + NAME JUnit-${test_file}-clearall-objects + COMMAND ${CMAKE_COMMAND} -E remove + JUnit-${test_file}.out + JUnit-${test_file}.out.err + ) + add_test ( + NAME JUnit-${test_file} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -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_FOLDER=${HDF5_BINARY_DIR}/java/test" + -D "TEST_OUTPUT=JUnit-${test_file}.out" +# -D "TEST_LOG_LEVEL=trace" + -D "TEST_EXPECT=0" + -D "SKIP_APPEND=1" + -D "TEST_MASK_ERROR=TRUE" +# -D "TEST_FILTER:STRING=${testfilter}" + -D "TEST_REFERENCE=JUnit-${test_file}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + set_tests_properties (JUnit-${test_file} PROPERTIES + ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2" + DEPENDS "JUnit-${test_file}-clearall-objects" + ) endforeach () - set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_${test_file}_JAR_FILE}") - - add_test ( - NAME JUnit-${test_file}-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove - JUnit-${test_file}.out - JUnit-${test_file}.out.err - ) - add_test ( - NAME JUnit-${test_file} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" - -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_FOLDER=${HDF5_BINARY_DIR}/java/test" - -D "TEST_OUTPUT=JUnit-${test_file}.out" -# -D "TEST_LOG_LEVEL=trace" - -D "TEST_EXPECT=0" - -D "SKIP_APPEND=1" - -D "TEST_MASK_ERROR=TRUE" -# -D "TEST_FILTER:STRING=${testfilter}" - -D "TEST_REFERENCE=JUnit-${test_file}.txt" - -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" - ) - set_tests_properties (JUnit-${test_file} PROPERTIES - ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2" - DEPENDS "JUnit-${test_file}-clearall-objects" - ) -endforeach () +endif () diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index fd015c0..6f4f473 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -74,7 +74,6 @@ public class TestH5E { @Test public void testH5Eget_msg_major() { - try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } @@ -90,8 +89,17 @@ public class TestH5E { fail("H5.H5Eget_msg(Throwable): " + err); } assertNotNull("H5.H5Eget_msg: " + msg, msg); - assertEquals("H5.H5Eget_msg: ", "File accessibility", msg); assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, error_msg_type[0]); + + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error string might be different. + * Only check for the specific error message if the native + * connector is being used. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) + assertEquals("H5.H5Eget_msg: ", "File accessibility", msg); } catch (Throwable err) { err.printStackTrace(); @@ -116,8 +124,17 @@ public class TestH5E { fail("H5.H5Eget_msg: " + err); } assertNotNull("H5.H5Eget_msg: " + msg, msg); - assertEquals("H5.H5Eget_msg: ", "Unable to open file", msg); assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, error_msg_type[0]); + + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error string might be different. + * Only check for the specific error message if the native + * connector is being used. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) + assertEquals("H5.H5Eget_msg: ", "Unable to open file", msg); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 6f968b1..0e55bcc 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -24,6 +24,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.Ignore; import org.junit.rules.TestName; public class TestH5Edefault { @@ -55,20 +56,29 @@ public class TestH5Edefault { H5.H5Eprint2(-1, null); } - @Test + @Ignore public void testH5Eprint() { - try { - H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - } - try { - H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Eprint: " + err); - } + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error stack might be different. + * Only check for the specific error stack if the native + * connector is being used. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) { + try { + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + } + try { + H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eprint: " + err); + } + } } @Test @@ -427,20 +437,29 @@ public class TestH5Edefault { H5.H5Eprint2(-1, null); } - @Test + @Ignore public void testH5EprintInt() { - try { - H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - } - try { - H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5EprintInt: " + err); - } + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error stack might be different. + * Only check for the specific error stack if the native + * connector is being used. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) { + try { + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + } + try { + H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EprintInt: " + err); + } + } } @Test diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java index 6c30187..4b6d470 100644 --- a/java/test/TestH5G.java +++ b/java/test/TestH5G.java @@ -24,6 +24,7 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5G_info_t; +import hdf.hdf5lib.structs.H5O_token_t; import org.junit.After; import org.junit.Before; @@ -286,12 +287,12 @@ public class TestH5G { String objNames[] = new String[(int) info.nlinks]; int objTypes[] = new int[(int) info.nlinks]; int lnkTypes[] = new int[(int) info.nlinks]; - long objRefs[] = new long[(int) info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_all(H5fid, GROUPS[0], objNames, - objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); @@ -317,14 +318,14 @@ public class TestH5G { assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: ", info); assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number of links is empty", info.nlinks > 0); String objNames[] = new String[(int) info.nlinks]; - long objRefs[] = new long[(int) info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; int lnkTypes[] = new int[(int) info.nlinks]; int objTypes[] = new int[(int) info.nlinks]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, - objRefs, HDF5Constants.H5_INDEX_NAME); + objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); @@ -358,14 +359,14 @@ public class TestH5G { assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: ", info); assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number of links is empty", info.nlinks > 0); String objNames[] = new String[(int) info.nlinks]; - long objRefs[] = new long[(int) info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; int lnkTypes[] = new int[(int) info.nlinks]; int objTypes[] = new int[(int) info.nlinks]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, - objRefs, HDF5Constants.H5_INDEX_NAME); + objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); @@ -395,12 +396,12 @@ public class TestH5G { String objNames[] = new String[(int)groups_max_size]; int objTypes[] = new int[(int)groups_max_size]; int lnkTypes[] = new int[(int)groups_max_size]; - long objRefs[] = new long[(int)groups_max_size]; + H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, - objRefs, groups_max_size); + objTokens, groups_max_size); } catch (Throwable err) { err.printStackTrace(); @@ -426,12 +427,12 @@ public class TestH5G { String objNames[] = new String[(int)groups_max_size]; int objTypes[] = new int[(int)groups_max_size]; int lnkTypes[] = new int[(int)groups_max_size]; - long objRefs[] = new long[(int)groups_max_size]; + H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, - objRefs, groups_max_size); + objTokens, groups_max_size); } catch (Throwable err) { err.printStackTrace(); @@ -471,11 +472,11 @@ public class TestH5G { String objNames[] = new String[(int) info.nlinks]; int objTypes[] = new int[(int) info.nlinks]; int lnkTypes[] = new int[(int) info.nlinks]; - long objRefs[] = new long[(int) info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; try { H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, - objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_CRT_ORDER); + objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_CRT_ORDER); } catch (Throwable err) { err.printStackTrace(); @@ -488,7 +489,7 @@ public class TestH5G { try { H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, - objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java index 06c59e7..9514837 100644 --- a/java/test/TestH5Giterate.java +++ b/java/test/TestH5Giterate.java @@ -20,6 +20,7 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5G_info_t; +import hdf.hdf5lib.structs.H5O_token_t; import org.junit.After; import org.junit.Before; @@ -93,12 +94,12 @@ public class TestH5Giterate { String objNames[] = new String[(int) info.nlinks]; int objTypes[] = new int[(int) info.nlinks]; int lnkTypes[] = new int[(int) info.nlinks]; - long objRefs[] = new long[(int) info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames, - objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java index 0a836c1..3bea1ee 100644 --- a/java/test/TestH5Lbasic.java +++ b/java/test/TestH5Lbasic.java @@ -21,8 +21,8 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5L_iterate_cb; import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5L_info_t; @@ -119,9 +119,8 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info ",link_info==null); + assertFalse("H5Lget_info",link_info==null); assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); - assertTrue("Link Address ",link_info.address_val_size>0); } @Test(expected = HDF5LibraryException.class) @@ -155,7 +154,7 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("H5Lget_info_by_idx ",link_info==null); + assertFalse("H5Lget_info_by_idx",link_info==null); assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); try { link_info2 = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -164,7 +163,7 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size); + assertTrue("Link Value Size", link_info.val_size == link_info2.val_size); } @Test @@ -178,7 +177,7 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("H5Lget_info_by_idx ",link_info==null); + assertFalse("H5Lget_info_by_idx",link_info==null); assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); try { link_info2 = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); @@ -187,7 +186,7 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size); + assertTrue("Link Value Size", link_info.val_size == link_info2.val_size); } @Test(expected = HDF5LibraryException.class) @@ -233,18 +232,18 @@ public class TestH5Lbasic { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); } @@ -271,18 +270,18 @@ public class TestH5Lbasic { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Lvisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); } @@ -305,18 +304,18 @@ public class TestH5Lbasic { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data); } @@ -342,18 +341,18 @@ public class TestH5Lbasic { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Literate_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); } diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java index 06c4ac1..c8f2348 100644 --- a/java/test/TestH5Lcreate.java +++ b/java/test/TestH5Lcreate.java @@ -22,8 +22,8 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5L_iterate_cb; import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5L_info_t; @@ -320,9 +320,9 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info ", link_info==null); + assertFalse("H5Lget_info", link_info==null); assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); - assertTrue("Link Address ", link_info.address_val_size>0); + assertTrue("Link Value Size", link_info.val_size > 0); } @Test @@ -383,9 +383,9 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info ", link_info==null); + assertFalse("H5Lget_info", link_info==null); assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); - assertTrue("Link Address ", link_info.address_val_size>0); + assertTrue("Link Value Size", link_info.val_size > 0); } @Test @@ -431,9 +431,9 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info ", link_info==null); + assertFalse("H5Lget_info", link_info==null); assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); - assertTrue("Link Address ", link_info.address_val_size>0); + assertTrue("Link Value Size", link_info.val_size > 0); } @Test @@ -740,18 +740,18 @@ public class TestH5Lcreate { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); } @@ -792,18 +792,18 @@ public class TestH5Lcreate { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, iter_cb, iter_data); } diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java index 8c6689f..20ffc41 100644 --- a/java/test/TestH5Obasic.java +++ b/java/test/TestH5Obasic.java @@ -21,10 +21,14 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5O_iterate_cb; import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5O_info_t; +import hdf.hdf5lib.structs.H5O_native_info_t; +import hdf.hdf5lib.structs.H5O_token_t; +import hdf.hdf5lib.structs.H5O_hdr_info_t; +import hdf.hdf5lib.structs.H5_ih_info_t; import org.junit.After; import org.junit.Before; @@ -35,10 +39,8 @@ import org.junit.rules.TestName; public class TestH5Obasic { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "h5ex_g_iterateO1.hdf"; - private static long H5la_ds1 = -1; - private static long H5la_l1 = -1; - private static long H5la_dt1 = -1; - private static long H5la_g1 = -1; + private static H5O_token_t H5la_ds1 = null; + private static H5O_token_t H5la_l1 = null; long H5fid = -1; @Before @@ -242,7 +244,7 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info: " + err); } - H5la_ds1 = obj_info.addr; + H5la_ds1 = obj_info.token; try {H5.H5Oclose(oid);} catch (Exception ex) {} try { obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); @@ -253,7 +255,7 @@ public class TestH5Obasic { } assertFalse("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx ",obj_info==null); assertTrue("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("testH5Oget_info_by_idx_n0:Link Address ",obj_info.addr==H5la_ds1); + assertTrue("testH5Oget_info_by_idx_n0:Link Object token", obj_info.token.equals(H5la_ds1)); } @Test @@ -268,7 +270,7 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info: " + err); } - H5la_l1 = obj_info.addr; + H5la_l1 = obj_info.token; try {H5.H5Oclose(oid);} catch (Exception ex) {} try { obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); @@ -279,7 +281,263 @@ public class TestH5Obasic { } assertFalse("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx ",obj_info==null); assertTrue("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("testH5Oget_info_by_idx_n3:Link Address ",obj_info.addr==H5la_l1); + assertTrue("testH5Oget_info_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1)); + } + + @Test + public void testH5Oget_native_info_dataset() { + long oid = -1; + H5O_native_info_t native_info = null; + + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info: " + err); + } + assertFalse("H5Oget_native_info ", native_info == null); + assertFalse("H5Oget_native_info ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info ", native_info.obj_info == null); + assertFalse("H5Oget_native_info ", native_info.attr_info == null); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_native_info_hardlink() { + long oid = -1; + H5O_native_info_t native_info = null; + + try { + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info: " + err); + } + assertFalse("H5Oget_native_info ", native_info == null); + assertFalse("H5Oget_native_info ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info ", native_info.obj_info == null); + assertFalse("H5Oget_native_info ", native_info.attr_info == null); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_native_info_group() { + long oid = -1; + H5O_native_info_t native_info = null; + + try { + oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info: " + err); + } + assertFalse("H5Oget_native_info ", native_info == null); + assertFalse("H5Oget_native_info ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info ", native_info.obj_info == null); + assertFalse("H5Oget_native_info ", native_info.attr_info == null); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_native_info_datatype() { + long oid = -1; + H5O_native_info_t native_info = null; + + try { + oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info: " + err); + } + assertFalse("H5Oget_native_info ", native_info == null); + assertFalse("H5Oget_native_info ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info ", native_info.obj_info == null); + assertFalse("H5Oget_native_info ", native_info.attr_info == null); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_name_not_exist_name() throws Throwable { + H5.H5Oget_native_info_by_name(H5fid, "None", HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_name_not_exists() throws Throwable { + H5.H5Oget_native_info_by_name(H5fid, "Bogus", HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_native_info_by_name_dataset() { + H5O_native_info_t native_info = null; + + try { + native_info = H5.H5Oget_native_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info_by_name: " + err); + } + assertFalse("H5Oget_native_info_by_name ", native_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null); + } + + @Test + public void testH5Oget_native_info_by_name_hardlink() { + H5O_native_info_t native_info = null; + + try { + native_info = H5.H5Oget_native_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info_by_name: " + err); + } + assertFalse("H5Oget_native_info_by_name ", native_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null); + } + + @Test + public void testH5Oget_native_info_by_name_group() { + H5O_native_info_t native_info = null; + + try { + native_info = H5.H5Oget_native_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info_by_name: " + err); + } + assertFalse("H5Oget_native_info_by_name ", native_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null); + } + + @Test + public void testH5Oget_native_info_by_name_datatype() { + H5O_native_info_t native_info = null; + + try { + native_info = H5.H5Oget_native_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info_by_name: " + err); + } + assertFalse("H5Oget_native_info_by_name ", native_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_idx_name_not_exist_name() throws Throwable { + H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_idx_name_not_exist_create() throws Throwable { + H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_idx_not_exist_name() throws Throwable { + H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_idx_not_exist_create() throws Throwable { + H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_native_info_by_idx_n0() { + long oid = -1; + H5O_native_info_t native_info = null; + H5O_hdr_info_t ohdr; + H5_ih_info_t oinfo; + H5_ih_info_t ainfo; + + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_native_info_by_idx_n0:H5.H5Oget_native_info: " + err); + } + + ohdr = native_info.hdr_info; + oinfo = native_info.obj_info; + ainfo = native_info.attr_info; + + try {H5.H5Oclose(oid);} catch (Exception ex) {} + + try { + native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_native_info_by_idx_n0:H5.H5Oget_native_info_by_idx: " + err); + } + assertFalse("H5Oget_native_info_by_idx ", native_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.attr_info == null); + assertTrue("testH5Oget_native_info_by_idx_n0:Object Header Info", native_info.hdr_info.equals(ohdr)); + assertTrue("testH5Oget_native_info_by_idx_n0:Object Info", native_info.obj_info.equals(oinfo)); + assertTrue("testH5Oget_native_info_by_idx_n0:Attribute Info", native_info.attr_info.equals(ainfo)); + } + + @Test + public void testH5Oget_native_info_by_idx_n3() { + long oid = -1; + H5O_native_info_t native_info = null; + H5O_hdr_info_t ohdr; + H5_ih_info_t oinfo; + H5_ih_info_t ainfo; + + try { + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_native_info_by_idx_n3:H5.H5Oget_native_info: " + err); + } + + ohdr = native_info.hdr_info; + oinfo = native_info.obj_info; + ainfo = native_info.attr_info; + + try {H5.H5Oclose(oid);} catch (Exception ex) {} + + try { + native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_native_info_by_idx_n3:H5.H5Oget_native_info_by_idx: " + err); + } + assertFalse("H5Oget_native_info_by_idx ", native_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.attr_info == null); + assertTrue("testH5Oget_native_info_by_idx_n3:Object Header Info", native_info.hdr_info.equals(ohdr)); + assertTrue("testH5Oget_native_info_by_idx_n3:Object Info", native_info.obj_info.equals(oinfo)); + assertTrue("testH5Oget_native_info_by_idx_n3:Attribute Info", native_info.attr_info.equals(ainfo)); } @Test @@ -292,18 +550,18 @@ public class TestH5Obasic { this.link_type = type; } } - class H5O_iter_data implements H5O_iterate_t { + class H5O_iter_data implements H5O_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5O_iterate_t iter_data = new H5O_iter_data(); - class H5O_iter_callback implements H5O_iterate_cb { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + H5O_iterate_opdata_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_t { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5O_iter_data)op_data).iterdata.add(id); return 0; } } - H5O_iterate_cb iter_cb = new H5O_iter_callback(); + H5O_iterate_t iter_cb = new H5O_iter_callback(); try { H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); } @@ -331,18 +589,18 @@ public class TestH5Obasic { this.link_type = type; } } - class H5O_iter_data implements H5O_iterate_t { + class H5O_iter_data implements H5O_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5O_iterate_t iter_data = new H5O_iter_data(); - class H5O_iter_callback implements H5O_iterate_cb { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + H5O_iterate_opdata_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_t { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5O_iter_data)op_data).iterdata.add(id); return 0; } } - H5O_iterate_cb iter_cb = new H5O_iter_callback(); + H5O_iterate_t iter_cb = new H5O_iter_callback(); try { H5.H5Ovisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); } @@ -371,7 +629,7 @@ public class TestH5Obasic { } @Test - public void testH5Oopen_by_addr() { + public void testH5Oopen_by_token() { long oid = -1; H5O_info_t obj_info = null; try { @@ -381,32 +639,32 @@ public class TestH5Obasic { } catch (Throwable err) { err.printStackTrace(); - fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err); + fail("testH5Oopen_by_token: H5.H5Oget_info: " + err); } - H5la_ds1 = obj_info.addr; + H5la_ds1 = obj_info.token; try {H5.H5Oclose(oid);} catch (Exception ex) {} try { - oid = H5.H5Oopen_by_addr(H5fid, H5la_ds1); + oid = H5.H5Oopen_by_token(H5fid, H5la_ds1); } catch (Throwable err) { err.printStackTrace(); - fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + fail("testH5Oopen_by_token: H5.H5Oopen_by_token: " + err); } try { obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { err.printStackTrace(); - fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err); + fail("testH5Oopen_by_token: H5.H5Oget_info: " + err); } - assertFalse("testH5Oopen_by_addr: H5Oget_info ",obj_info==null); - assertTrue("testH5Oopen_by_addr: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("testH5Oopen_by_addr: Link Address ",obj_info.addr==H5la_ds1); + assertFalse("testH5Oopen_by_token: H5Oget_info ",obj_info==null); + assertTrue("testH5Oopen_by_token: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oopen_by_token: Link Object Token", obj_info.token.equals(H5la_ds1)); } finally { try{H5.H5Oclose(oid);} catch (Exception ex) {} } - } + } @Test public void testH5Oopen_by_idx_n0() { @@ -421,14 +679,14 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oopen_by_idx_n0: H5.H5Oget_info: " + err); } - H5la_ds1 = obj_info.addr; + H5la_ds1 = obj_info.token; try {H5.H5Oclose(oid);} catch (Exception ex) {} try { oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); - fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + fail("testH5Oopen_by_idx_n0: H5.H5Oopen_by_idx: " + err); } try { obj_info = H5.H5Oget_info(oid); @@ -439,7 +697,7 @@ public class TestH5Obasic { } assertFalse("testH5Oopen_by_idx_n0: H5Oget_info_by_idx ",obj_info==null); assertTrue("testH5Oopen_by_idx_n0: H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("testH5Oopen_by_idx_n0: Link Address ",obj_info.addr==H5la_ds1); + assertTrue("testH5Oopen_by_idx_n0: Link Object Token", obj_info.token.equals(H5la_ds1)); } finally { try{H5.H5Oclose(oid);} catch (Exception ex) {} @@ -459,14 +717,14 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oopen_by_idx_n3:H5.H5Oget_info: " + err); } - H5la_l1 = obj_info.addr; + H5la_l1 = obj_info.token; try {H5.H5Oclose(oid);} catch (Exception ex) {} try { oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); - fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + fail("testH5Oopen_by_idx_n3: H5.H5Oopen_by_idx: " + err); } try { obj_info = H5.H5Oget_info(oid); @@ -477,7 +735,7 @@ public class TestH5Obasic { } assertFalse("testH5Oopen_by_idx_n3:H5Oget_info_by_idx ",obj_info==null); assertTrue("testH5Oopen_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("testH5Oopen_by_idx_n3:Link Address ",obj_info.addr==H5la_l1); + assertTrue("testH5Oopen_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1)); } finally { try{H5.H5Oclose(oid);} catch (Exception ex) {} diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java index de17d8b..5e9fdf2 100644 --- a/java/test/TestH5Ocreate.java +++ b/java/test/TestH5Ocreate.java @@ -22,8 +22,8 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5O_iterate_cb; import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5O_info_t; @@ -264,9 +264,9 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ", obj_info==null); + assertFalse("H5Oget_info", obj_info==null); assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("Link Address ", obj_info.addr>0); + assertTrue("Link Object Token", obj_info.token != null); } @Test(expected = HDF5LibraryException.class) @@ -286,9 +286,9 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ", obj_info==null); + assertFalse("H5Oget_info", obj_info==null); assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); - assertTrue("Link Address ", obj_info.addr>0); + assertTrue("Link Object Token", obj_info.token != null); } @Test @@ -351,18 +351,18 @@ public class TestH5Ocreate { this.link_type = type; } } - class H5O_iter_data implements H5O_iterate_t { + class H5O_iter_data implements H5O_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5O_iterate_t iter_data = new H5O_iter_data(); - class H5O_iter_callback implements H5O_iterate_cb { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + H5O_iterate_opdata_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_t { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5O_iter_data)op_data).iterdata.add(id); return 0; } } - H5O_iterate_cb iter_cb = new H5O_iter_callback(); + H5O_iterate_t iter_cb = new H5O_iter_callback(); try { H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); } diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java index cac3dcd..1f379d3 100644 --- a/java/test/TestH5Oparams.java +++ b/java/test/TestH5Oparams.java @@ -95,6 +95,31 @@ public class TestH5Oparams { } @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_invalid() throws Throwable { + H5.H5Oget_native_info(-1, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Oget_native_info_by_name_null() throws Throwable { + H5.H5Oget_native_info_by_name(-1, null, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_name_invalid() throws Throwable { + H5.H5Oget_native_info_by_name(-1, "/testH5Gcreate", 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_idx_invalid() throws Throwable { + H5.H5Oget_native_info_by_idx(-1, "Bogus", -1, -1, -1L, 0, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Oget_native_info_by_idx_null() throws Throwable { + H5.H5Oget_native_info_by_idx(-1, null, 0, 0, 0L, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) public void testH5Olink_invalid() throws Throwable { H5.H5Olink(-1, -1, "Bogus", -1, -1); } diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java index 0397be1..d774dbb 100644 --- a/java/test/TestH5VL.java +++ b/java/test/TestH5VL.java @@ -69,14 +69,46 @@ public class TestH5VL { @Test public void testH5VLget_connector_id() { + String H5_FILE = "testFvl.h5"; + + long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + try { + long native_id = H5.H5VLget_connector_id(H5fid); + assertTrue("H5.H5VLget_connector_id", native_id >= 0); + + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector. Only check for the native connector + * if this isn't set. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) + assertEquals(HDF5Constants.H5VL_NATIVE, native_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5VLget_connector_id " + err); + } + finally { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + _deleteFile(H5_FILE); + } + } + + @Test + public void testH5VLget_connector_id_by_name() { try { - long native_id = H5.H5VLget_connector_id(HDF5Constants.H5VL_NATIVE_NAME); - assertTrue("H5.H5VLget_connector_id H5VL_NATIVE_NAME", native_id >= 0); + long native_id = H5.H5VLget_connector_id_by_name(HDF5Constants.H5VL_NATIVE_NAME); + assertTrue("H5.H5VLget_connector_id_by_name H5VL_NATIVE_NAME", native_id >= 0); assertEquals(HDF5Constants.H5VL_NATIVE, native_id); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5VLget_connector_id " + err); + fail("H5.H5VLget_connector_id_by_name " + err); } } @@ -90,7 +122,15 @@ public class TestH5VL { try { String native_name = H5.H5VLget_connector_name(H5fid); - assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0); + + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector. Only check for the native connector + * if this isn't set. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) + assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index ac09db7..598b3d2 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -330,7 +330,7 @@ TESTING JUnit-TestH5 # 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/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-TestH5.ext > JUnit-TestH5.out @@ -351,7 +351,7 @@ TESTING JUnit-TestH5Eparams # 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/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-TestH5Eparams.ext > JUnit-TestH5Eparams.out @@ -372,7 +372,7 @@ TESTING JUnit-TestH5Eregister # 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/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-TestH5Eregister.ext > JUnit-TestH5Eregister.out @@ -393,7 +393,7 @@ TESTING JUnit-TestH5Fparams # 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/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-TestH5Fparams.ext > JUnit-TestH5Fparams.out @@ -414,7 +414,7 @@ TESTING JUnit-TestH5Fbasic # 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/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-TestH5Fbasic.ext > JUnit-TestH5Fbasic.out @@ -435,7 +435,7 @@ TESTING JUnit-TestH5F # 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/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-TestH5F.ext > JUnit-TestH5F.out @@ -456,7 +456,7 @@ TESTING JUnit-TestH5Fswmr # 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/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-TestH5Fswmr.ext > JUnit-TestH5Fswmr.out @@ -477,7 +477,7 @@ TESTING JUnit-TestH5Gbasic # 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/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-TestH5Gbasic.ext > JUnit-TestH5Gbasic.out @@ -498,7 +498,7 @@ TESTING JUnit-TestH5G # 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/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-TestH5G.ext > JUnit-TestH5G.out @@ -519,7 +519,7 @@ TESTING JUnit-TestH5Sbasic # 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/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-TestH5Sbasic.ext > JUnit-TestH5Sbasic.out @@ -540,7 +540,7 @@ TESTING JUnit-TestH5S # 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/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-TestH5S.ext > JUnit-TestH5S.out @@ -561,7 +561,7 @@ TESTING JUnit-TestH5Tparams # 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/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-TestH5Tparams.ext > JUnit-TestH5Tparams.out @@ -582,7 +582,7 @@ TESTING JUnit-TestH5Tbasic # 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/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-TestH5Tbasic.ext > JUnit-TestH5Tbasic.out @@ -603,7 +603,7 @@ TESTING JUnit-TestH5T # 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/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-TestH5T.ext > JUnit-TestH5T.out @@ -624,7 +624,7 @@ TESTING JUnit-TestH5Dparams # 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/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-TestH5Dparams.ext > JUnit-TestH5Dparams.out @@ -645,7 +645,7 @@ TESTING JUnit-TestH5D # 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/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-TestH5D.ext > JUnit-TestH5D.out @@ -666,7 +666,7 @@ TESTING JUnit-TestH5Dplist # 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/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-TestH5Dplist.ext > JUnit-TestH5Dplist.out @@ -687,7 +687,7 @@ TESTING JUnit-TestH5Lparams # 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/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-TestH5Lparams.ext > JUnit-TestH5Lparams.out @@ -708,7 +708,7 @@ TESTING JUnit-TestH5Lbasic # 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/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-TestH5Lbasic.ext > JUnit-TestH5Lbasic.out @@ -729,7 +729,7 @@ TESTING JUnit-TestH5Lcreate # 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/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-TestH5Lcreate.ext > JUnit-TestH5Lcreate.out @@ -750,7 +750,7 @@ TESTING JUnit-TestH5R # 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/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-TestH5R.ext > JUnit-TestH5R.out @@ -771,7 +771,7 @@ TESTING JUnit-TestH5P # 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/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-TestH5P.ext > JUnit-TestH5P.out @@ -792,7 +792,7 @@ TESTING JUnit-TestH5PData # 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/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-TestH5PData.ext > JUnit-TestH5PData.out @@ -813,7 +813,7 @@ TESTING JUnit-TestH5Pfapl # 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/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-TestH5Pfapl.ext > JUnit-TestH5Pfapl.out @@ -834,7 +834,7 @@ TESTING JUnit-TestH5Pvirtual # 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/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-TestH5Pvirtual.ext > JUnit-TestH5Pvirtual.out @@ -855,7 +855,7 @@ TESTING JUnit-TestH5Plist # 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/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-TestH5Plist.ext > JUnit-TestH5Plist.out @@ -876,7 +876,7 @@ TESTING JUnit-TestH5A # 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/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-TestH5A.ext > JUnit-TestH5A.out @@ -897,7 +897,7 @@ TESTING JUnit-TestH5Oparams # 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/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-TestH5Oparams.ext > JUnit-TestH5Oparams.out @@ -918,7 +918,7 @@ TESTING JUnit-TestH5Obasic # 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/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-TestH5Obasic.ext > JUnit-TestH5Obasic.out @@ -939,7 +939,7 @@ TESTING JUnit-TestH5Ocreate # 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/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-TestH5Ocreate.ext > JUnit-TestH5Ocreate.out @@ -960,7 +960,7 @@ TESTING JUnit-TestH5Ocopy # 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/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-TestH5Ocopy.ext > JUnit-TestH5Ocopy.out @@ -981,7 +981,7 @@ TESTING JUnit-TestH5PL # 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/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-TestH5PL.ext > JUnit-TestH5PL.out @@ -1002,7 +1002,7 @@ TESTING JUnit-TestH5VL # 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/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-TestH5VL.ext > JUnit-TestH5VL.out @@ -1023,7 +1023,7 @@ TESTING JUnit-TestH5Z # 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/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-TestH5Z.ext > JUnit-TestH5Z.out @@ -1044,7 +1044,7 @@ TESTING JUnit-TestH5E # 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/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 @@ -1065,7 +1065,7 @@ TESTING JUnit-TestH5Edefault # 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/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 @@ -1087,7 +1087,7 @@ if test $USE_FILTER_SZIP = "yes"; then # 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/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-TestH5Giterate.ext > JUnit-TestH5Giterate.out @@ -1109,7 +1109,7 @@ if test "X$ROS3_VFD" = "Xyes"; then # 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/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-TestH5Pfapls3.ext > JUnit-TestH5Pfapls3.out @@ -1131,7 +1131,7 @@ if test "X$HAVE_LIBHDFS" = "Xyes"; then # 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/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-TestH5Pfaplhdfs.ext > JUnit-TestH5Pfaplhdfs.out diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index 48c6254..bb43c64 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -1,10 +1,8 @@ JUnit version 4.11 -.testH5EprintInt .testH5Eset_current_stack_invalid_stkid .testH5Eset_current_stack .testH5Eget_num .testH5Eclear -.testH5Eprint .testH5Epush_null_name .testH5Eget_num_with_msg .testH5Eclear2_with_msg @@ -30,49 +28,5 @@ JUnit version 4.11 Time: XXXX -OK (28 tests) +OK (26 tests) -HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Fopen(): unable to open file - major: File accessibility - minor: Unable to open file - #001: (file name) line (number) in H5VL_file_open(): open failed - major: Virtual Object Layer - minor: Can't open object - #002: (file name) line (number) in H5VL__file_open(): open failed - major: Virtual Object Layer - minor: Can't open object - #003: (file name) line (number) in H5VL__native_file_open(): unable to open file - major: File accessibility - minor: Unable to open file - #004: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 - major: File accessibility - minor: Unable to open file - #005: (file name) line (number) in H5FD_open(): open failed - major: Virtual File Layer - minor: Unable to initialize object - #006: (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 accessibility - minor: Unable to open file - #001: (file name) line (number) in H5VL_file_open(): open failed - major: Virtual Object Layer - minor: Can't open object - #002: (file name) line (number) in H5VL__file_open(): open failed - major: Virtual Object Layer - minor: Can't open object - #003: (file name) line (number) in H5VL__native_file_open(): unable to open file - major: File accessibility - minor: Unable to open file - #004: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 - major: File accessibility - minor: Unable to open file - #005: (file name) line (number) in H5FD_open(): open failed - major: Virtual File Layer - minor: Unable to initialize object - #006: (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/java/test/testfiles/JUnit-TestH5Obasic.txt b/java/test/testfiles/JUnit-TestH5Obasic.txt index d015bdd..c39c01d 100644 --- a/java/test/testfiles/JUnit-TestH5Obasic.txt +++ b/java/test/testfiles/JUnit-TestH5Obasic.txt @@ -1,29 +1,45 @@ JUnit version 4.11 .testH5Oexists_by_name +.testH5Oget_native_info_dataset +.testH5Oopen_by_token .testH5Oget_info_by_idx_n0 .testH5Oget_info_by_idx_n3 +.testH5Oget_native_info_datatype .testH5Oget_info_by_name_not_exist_name .testH5Ovisit_by_name +.testH5Oget_native_info_by_name_datatype .testH5Oget_info_by_idx_name_not_exist_name .testH5Oget_info_datatype .testH5Oget_info_by_idx_not_exist_name .testH5Oopen_by_idx_n0 .testH5Oopen_by_idx_n3 +.testH5Oget_native_info_by_name_not_exist_name .testH5Oopen_not_exists .testH5Ovisit .testH5Oget_info_by_idx_not_exist_create +.testH5Oget_native_info_by_idx_not_exist_name .testH5Oget_info_by_name_hardlink .testH5Oget_info_by_name_group -.testH5Oopen_by_addr .testH5Oget_info_by_name_not_exists +.testH5Oget_native_info_by_idx_not_exist_create .testH5Oget_info_by_name_dataset .testH5Oget_info_group +.testH5Oget_native_info_hardlink +.testH5Oget_native_info_by_name_hardlink +.testH5Oget_native_info_by_idx_name_not_exist_name .testH5Oget_info_by_name_datatype .testH5Oget_info_hardlink +.testH5Oget_native_info_group +.testH5Oget_native_info_by_name_not_exists +.testH5Oget_native_info_by_name_dataset .testH5Oget_info_by_idx_name_not_exist_create +.testH5Oget_native_info_by_idx_n0 +.testH5Oget_native_info_by_idx_n3 .testH5Oget_info_dataset +.testH5Oget_native_info_by_name_group +.testH5Oget_native_info_by_idx_name_not_exist_create Time: XXXX -OK (23 tests) +OK (39 tests) diff --git a/java/test/testfiles/JUnit-TestH5Oparams.txt b/java/test/testfiles/JUnit-TestH5Oparams.txt index bc23695..b756bcf 100644 --- a/java/test/testfiles/JUnit-TestH5Oparams.txt +++ b/java/test/testfiles/JUnit-TestH5Oparams.txt @@ -1,22 +1,27 @@ JUnit version 4.11 .testH5Oget_comment_by_name_null +.testH5Oget_native_info_by_name_invalid .testH5Ovisit_by_name_nullname .testH5Oget_info_invalid .testH5Ovisit_by_name_null .testH5Odisable_mdc_flushes .testH5Oget_comment_invalid +.testH5Oget_native_info_invalid .testH5Oset_comment_by_name_invalid .testH5Oare_mdc_flushes_disabled .testH5Oopen_null .testH5Oclose_invalid .testH5Oflush_invalid +.testH5Oget_native_info_by_name_null .testH5Oget_comment_by_name_invalid .testH5Orefresh_invalid .testH5Ocopy_null_dest +.testH5Oget_native_info_by_idx_null .testH5Olink_invalid .testH5Oget_info_by_idx_invalid .testH5Oget_info_by_idx_null .testH5Olink_null_dest +.testH5Oget_native_info_by_idx_invalid .testH5Oget_info_by_name_invalid .testH5Oget_info_by_name_null .testH5Ocopy_invalid @@ -29,5 +34,5 @@ JUnit version 4.11 Time: XXXX -OK (27 tests) +OK (32 tests) diff --git a/java/test/testfiles/JUnit-TestH5VL.txt b/java/test/testfiles/JUnit-TestH5VL.txt index caadf26..f646009 100644 --- a/java/test/testfiles/JUnit-TestH5VL.txt +++ b/java/test/testfiles/JUnit-TestH5VL.txt @@ -1,4 +1,5 @@ JUnit version 4.11 +.testH5VLget_connector_id_by_name .testH5VLget_connector_id .testH5VLnative_init .testH5VLget_connector_name @@ -7,5 +8,5 @@ JUnit version 4.11 Time: XXXX -OK (5 tests) +OK (6 tests) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 1bd9517..3cc0dea 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,26 @@ New Features Configuration: ------------- + - Added new options to CMake for control of testing + + Added CMake options (default ON); + HDF5_TEST_SERIAL AND/OR HDF5_TEST_PARALLEL + combined with: + HDF5_TEST_TOOLS + HDF5_TEST_EXAMPLES + HDF5_TEST_SWMR + HDF5_TEST_FORTRAN + HDF5_TEST_CPP + HDF5_TEST_JAVA + + (ADB - 2020/01/15, HDFFV-11001) + + - Added Clang sanitizers to CMake for analyzer support + + Added CMake code and files to execute the Clang sanitizers. + + (ADB - 2019/12/12, TRILAB-135) + - Update CMake for VS2019 support CMake added support for VS2019 in version 3.15. Changes to the CMake @@ -56,6 +76,18 @@ New Features (ADB - 2019/11/18, HDFFV-10962) + - Update CMake options to match new autotools options + + Add configure options (autotools - CMake): + enable-asserts HDF5_ENABLE_ASSERTS + enable-symbols HDF5_ENABLE_SYMBOLS + enable-profiling HDF5_ENABLE_PROFILING + enable-optimization HDF5_ENABLE_OPTIMIZATION + In addition NDEBUG is no longer forced defined and relies on the CMake + process. + + (ADB - 2019/10/07, HDFFV-100901, HDFFV-10637, TRILAB-97) + - Update CMake tests to use FIXTURES CMake test fixtures allow setup/cleanup tests and other dependency @@ -350,6 +382,14 @@ New Features Java Library: ---------------- + - Tests fail for non-English locale. + + In the JUnit tests with a non-English locale, only the part before + the decimal comma is replaced by XXXX and this leads to a comparison + error. Changed the regex for the Time substitution. + + (ADB - 2020/01/09, HDFFV-10995) + - Fix a failure in JUnit-TestH5P on 32-bit architectures (JTH - 2019/04/30) @@ -373,6 +413,13 @@ New Features Tools: ------ + - h5diff was updated to use the new reference APIs. + + h5diff uses the new reference APIs to compare references. + Attribute references can also be compared. + + (ADB - 2019/12/19, HDFFV-10980) + - h5dump and h5ls were updated to use the new reference APIs. The tools library now use the new reference APIs to inspect a @@ -655,6 +702,21 @@ Bug Fixes since HDF5-1.10.3 release (DER - 2019/08/27, HDFFV-10892) + - Torn pread/pwrite I/O would result in read and write corruption. + + In the sec2, log, and core (with backing store) virtual file drivers + (VFDs), the read and write calls incorrectly reset the offset parameter + on torn pread and pwrite operations (i.e., I/O operations which fail to + be written atomically by the OS). For this bug to occur, pread/pwrite + have to be configured (this is the default if they are present on the + system) and the pread/pwrite operation has to fail to transfer all + the bytes, resulting in a multiple pread/pwrite calls. + + This feature was initially enabled in HDF5 1.10.5 so the bug is + limited to that version. + + (DER - 2019/12/09, HDFFV-10945) + Java Library: ---------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c794c1a..070cf62 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -386,6 +386,7 @@ IDE_GENERATED_PROPERTIES ("H5I" "${H5I_HDRS}" "${H5I_SOURCES}" ) set (H5L_SOURCES ${HDF5_SRC_DIR}/H5L.c + ${HDF5_SRC_DIR}/H5Ldeprec.c ${HDF5_SRC_DIR}/H5Lexternal.c ) set (H5L_HDRS @@ -657,7 +658,9 @@ set (H5VL_SOURCES ${HDF5_SRC_DIR}/H5VLnative_file.c ${HDF5_SRC_DIR}/H5VLnative_group.c ${HDF5_SRC_DIR}/H5VLnative_link.c + ${HDF5_SRC_DIR}/H5VLnative_introspect.c ${HDF5_SRC_DIR}/H5VLnative_object.c + ${HDF5_SRC_DIR}/H5VLnative_token.c ${HDF5_SRC_DIR}/H5VLpassthru.c ) set (H5VL_HDRS @@ -100,6 +100,29 @@ static hbool_t H5A_top_package_initialize_s = FALSE; +/*------------------------------------------------------------------------- + * Function: H5A_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + *------------------------------------------------------------------------- + */ +herr_t +H5A_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 H5A_init() */ + + /*-------------------------------------------------------------------------- NAME H5A__init_package -- Initialize interface-specific information @@ -253,7 +276,7 @@ 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) { void *attr = NULL; /* Attribute created */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -337,8 +360,8 @@ 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 connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -360,13 +383,9 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* 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") - - if(H5P_DEFAULT != lapl_id) { - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not link access property list ID") - H5CX_set_lapl(lapl_id); - } + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info") + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info") /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -418,8 +437,8 @@ done: hid_t H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { - void *attr = NULL; /* attr token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -489,8 +508,8 @@ 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 connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -507,16 +526,9 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_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, 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, H5I_INVALID_HID, "not link access property list ID") - H5CX_set_lapl(lapl_id); - } - else - lapl_id = H5P_LINK_ACCESS_DEFAULT; + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info") + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info") /* Fill in location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -575,7 +587,7 @@ 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) { void *attr = NULL; /* Attribute opened */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -595,16 +607,9 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* 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, 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, H5I_INVALID_HID, "not link access property list ID") - H5CX_set_lapl(lapl_id); - } - else - lapl_id = H5P_LINK_ACCESS_DEFAULT; + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info") + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set link access property list info") /* Fill in location struct parameters */ loc_params.type = H5VL_OBJECT_BY_IDX; @@ -1323,7 +1328,7 @@ 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_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ @@ -1402,7 +1407,7 @@ 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) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index e4b81fa..fadde28 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -498,7 +498,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t *aux_ptr, +H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUSED *aux_ptr, int sync_point_op) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 8d0e33c..e0a0f55 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -116,8 +116,8 @@ 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 connector */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -147,7 +147,8 @@ 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, type_id, space_id, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id, + H5P_ATTRIBUTE_ACCESS_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 */ @@ -189,8 +190,8 @@ done: 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 */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -212,7 +213,8 @@ 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_ATTRIBUTE_ACCESS_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 */ @@ -254,8 +256,8 @@ done: 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 */ + void *attr = NULL; /* attr object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -280,7 +282,8 @@ 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_ATTRIBUTE_ACCESS_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 */ @@ -318,9 +321,9 @@ done: int H5Aget_num_attrs(hid_t loc_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; - H5O_info_t oinfo; + H5O_info2_t oinfo; int ret_value = -1; FUNC_ENTER_API((-1)) @@ -334,7 +337,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_NATIVE_OBJECT_GET_INFO, &loc_params, &oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &oinfo, H5O_INFO_NUM_ATTRS) < 0) 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); @@ -384,7 +387,7 @@ done: herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(H5_ITER_ERROR) @@ -399,7 +402,7 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") /* Call attribute iteration routine */ - if((ret_value = H5VL_attr_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_ATTR_ITERATE_OLD, loc_id, attr_num, op, op_data)) < 0) + if((ret_value = H5VL_attr_optional(vol_obj, H5VL_NATIVE_ATTR_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_id, attr_num, op, op_data)) < 0) HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes"); done: diff --git a/src/H5Aint.c b/src/H5Aint.c index 436fced..fc5ea34 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -181,8 +181,9 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, if(NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t))) HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "can't allocate shared attr structure") - /* If the creation property list is H5P_DEFAULT, use the default character encoding */ - if(acpl_id == H5P_DEFAULT) + /* If the creation property list is H5P_ATTRIBUTE_CREATE_DEFAULT, use the default character encoding */ + HDassert(acpl_id != H5P_DEFAULT); + if(acpl_id == H5P_ATTRIBUTE_CREATE_DEFAULT) attr->shared->encoding = H5F_DEFAULT_CSET; else { H5P_genplist_t *ac_plist; /* ACPL Property list */ @@ -2026,7 +2027,7 @@ H5A__set_version(const H5F_t *f, H5A_t *attr) version = H5O_ATTR_VERSION_1; /* Write out basic version */ /* Upgrade to the version indicated by the file's low bound if higher */ - version = MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]); + version = (uint8_t)MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]); /* Version bounds check */ if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)]) @@ -2062,7 +2063,7 @@ done: */ H5A_t * H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_size, - H5O_copy_t *cpy_info) + H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info) { H5A_t *attr_dst = NULL; /* Destination attribute */ hid_t tid_src = -1; /* Datatype ID for source datatype */ diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h index 342ffc8..b288228 100644 --- a/src/H5Aprivate.h +++ b/src/H5Aprivate.h @@ -73,6 +73,7 @@ typedef struct H5A_attr_iter_op_t { /***************************************/ /* General attribute routines */ +H5_DLL herr_t H5A_init(void); H5_DLL struct H5O_loc_t *H5A_oloc(H5A_t *attr); H5_DLL H5G_name_t *H5A_nameof(H5A_t *attr); H5_DLL H5T_t *H5A_type(const H5A_t *attr); @@ -2020,7 +2020,6 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) { H5B_t *bt = NULL; /* The B-tree */ H5UC_t *rc_shared; /* Ref-counted shared info */ - H5B_shared_t *shared; /* Pointer to shared B-tree info */ H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ htri_t ret_value = SUCCEED; /* Return value */ @@ -2038,8 +2037,7 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, NULL))) 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); + HDassert((H5B_shared_t *)H5UC_GET_OBJ(rc_shared)); /* * Load the tree node. diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 2a77bd5..65286e6 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -398,7 +398,8 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ - *image++ = hdr->cls->id; + HDassert(hdr->cls->id <= 255); + *image++ = (uint8_t)hdr->cls->id; /* Node size (in bytes) */ UINT32ENCODE(image, hdr->node_size); @@ -818,7 +819,8 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ - *image++ = internal->hdr->cls->id; + HDassert(internal->hdr->cls->id <= 255); + *image++ = (uint8_t)internal->hdr->cls->id; HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for internal node */ @@ -1219,7 +1221,8 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ - *image++ = leaf->hdr->cls->id; + HDassert(leaf->hdr->cls->id <= 255); + *image++ = (uint8_t)leaf->hdr->cls->id; HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_LEAF_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for leaf node */ diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 0e3ebd5..b5b1c03 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -87,7 +87,7 @@ */ herr_t H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5B2_class_t *type, haddr_t obj_addr) + const H5B2_class_t H5_ATTR_NDEBUG_UNUSED *type, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header info */ unsigned u; /* Local index variable */ @@ -182,7 +182,7 @@ done: */ herr_t H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth, haddr_t obj_addr) + const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, unsigned depth, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_internal_t *internal = NULL; /* B-tree internal node */ @@ -294,7 +294,7 @@ done: */ herr_t H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, - const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t obj_addr) + const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec, haddr_t H5_ATTR_NDEBUG_UNUSED obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */ diff --git a/src/H5B2int.c b/src/H5B2int.c index 2d77276..ea03ed6 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -239,7 +239,7 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, old_node_nrec = internal->node_ptrs[idx].node_nrec; /* Determine "middle" record to promote to internal node */ - mid_record = old_node_nrec / 2; + mid_record = (uint16_t)(old_node_nrec / 2); /* Copy "upper half" of records to new child */ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), @@ -507,8 +507,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, if(*left_nrec < *right_nrec) { /* Moving record from right node to left */ - uint16_t new_right_nrec = (uint16_t)(*left_nrec + *right_nrec) / 2; /* New number of records for right child */ - uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */ + uint16_t new_right_nrec = (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for right child */ + uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */ /* Copy record from parent node down into left child */ H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); @@ -558,8 +558,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, else { /* Moving record from left node to right */ - uint16_t new_left_nrec = (uint16_t)(*left_nrec + *right_nrec) / 2; /* New number of records for left child */ - uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */ + uint16_t new_left_nrec = (uint16_t)((*left_nrec + *right_nrec) / 2); /* New number of records for left child */ + uint16_t move_nrec = (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */ /* Sanity check */ HDassert(*left_nrec > *right_nrec); @@ -762,8 +762,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, { /* Compute new # of records in each node */ unsigned total_nrec = (unsigned)(*left_nrec + *middle_nrec + *right_nrec + 2); - uint16_t new_middle_nrec = (uint16_t)(total_nrec - 2) / 3; - uint16_t new_left_nrec = (uint16_t)((total_nrec - 2) - new_middle_nrec) / 2; + uint16_t new_middle_nrec = (uint16_t)((total_nrec - 2) / 3); + uint16_t new_left_nrec = (uint16_t)(((total_nrec - 2) - new_middle_nrec) / 2); uint16_t new_right_nrec = (uint16_t)((total_nrec - 2) - (unsigned)(new_left_nrec + new_middle_nrec)); uint16_t curr_middle_nrec = *middle_nrec; diff --git a/src/H5B2internal.c b/src/H5B2internal.c index 7f6b80a..92c802e 100644 --- a/src/H5B2internal.c +++ b/src/H5B2internal.c @@ -1355,7 +1355,7 @@ done: *------------------------------------------------------------------------- */ H5_ATTR_PURE herr_t -H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal) +H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_internal_t *internal) { hsize_t tot_all_nrec; /* Total number of records at or below this node */ uint16_t u, v; /* Local index variables */ @@ -1396,7 +1396,7 @@ H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2 *------------------------------------------------------------------------- */ H5_ATTR_PURE herr_t -H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2) +H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_internal_t *internal, const H5B2_internal_t *internal2) { hsize_t tot_all_nrec; /* Total number of records at or below this node */ uint16_t u, v; /* Local index variables */ diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c index beca40c..7ed0468 100644 --- a/src/H5B2leaf.c +++ b/src/H5B2leaf.c @@ -1027,7 +1027,8 @@ done: *------------------------------------------------------------------------- */ H5_ATTR_PURE herr_t -H5B2__assert_leaf(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf) +H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, + const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf) { /* General sanity checking on node */ HDassert(leaf->nrec <= hdr->node_info->split_nrec); @@ -1056,7 +1056,6 @@ H5C_flush_cache(H5F_t *f, unsigned flags) H5C_ring_t ring; H5C_t * cache_ptr; hbool_t destroy; - hbool_t ignore_protected; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -1101,9 +1100,8 @@ H5C_flush_cache(H5F_t *f, unsigned flags) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ); - HDassert( ! ( destroy && ignore_protected ) ); + HDassert( ! ( destroy && ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 )) ); HDassert( ! ( cache_ptr->flush_in_progress ) ); cache_ptr->flush_in_progress = TRUE; @@ -3856,7 +3854,11 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, { herr_t ret_value = SUCCEED; /* Return value */ +#if H5C_DO_SANITY_CHECKS FUNC_ENTER_STATIC +#else + FUNC_ENTER_STATIC_NOERR +#endif /* Sanity checking */ HDassert(cache_ptr); @@ -3873,7 +3875,9 @@ H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, /* Update the stats for an unpin operation */ H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) +#if H5C_DO_SANITY_CHECKS done: +#endif FUNC_LEAVE_NOAPI(ret_value) } /* H5C__unpin_entry_real() */ @@ -105,7 +105,7 @@ } /* end if */ #endif /* H5_HAVE_PARALLEL */ -#ifdef H5_HAVE_PARALLEL +#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY) /* Macro for the duplicated code to test and set properties for a property list */ #define H5CX_TEST_SET_PROP(PROP_NAME, PROP_FIELD) \ { \ @@ -127,7 +127,9 @@ (*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \ } /* end if */ \ } +#endif /* defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY) */ +#ifdef 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) \ if((*head)->ctx.H5_GLUE(PROP_FIELD,_set)) { \ diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c index dd9e9b2..5ac354d 100644 --- a/src/H5Clog_json.c +++ b/src/H5Clog_json.c @@ -1281,7 +1281,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, +H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t H5_ATTR_NDEBUG_UNUSED *config, herr_t fxn_ret_value) { H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 9156c0d..cafc6d5 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -4923,7 +4923,7 @@ H5_DLL herr_t H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry); /* Testing functions */ #ifdef H5C_TESTING -H5_DLL herr_t H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status); +H5_DLL herr_t H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status); #endif /* H5C_TESTING */ #endif /* _H5Cpkg_H */ diff --git a/src/H5Ctest.c b/src/H5Ctest.c index 340071a..7f24302 100644 --- a/src/H5Ctest.c +++ b/src/H5Ctest.c @@ -35,12 +35,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Cpkg.h" /* Cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* Files */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5Cpkg.h" /* Cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5Iprivate.h" /* IDs */ #include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ @@ -132,11 +133,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status) +H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status) { H5F_t * f; /* File Pointer */ H5C_t * cache; /* Cache Pointer */ H5C_tag_iter_vct_ctx_t ctx; /* Context for iterator callback */ + haddr_t tag; /* Tagged address */ herr_t ret_value = SUCCEED; /* Return value */ /* Function enter macro */ @@ -146,6 +148,11 @@ H5C__verify_cork_tag_test(hid_t fid, haddr_t tag, hbool_t status) if(NULL == (f = (H5F_t *)H5VL_object_verify(fid, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + /* Convert token to address */ + tag = HADDR_UNDEF; + if(H5VL_native_token_to_addr(f, H5I_FILE, tag_token, &tag) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get address for token") + /* Get cache pointer */ cache = f->shared->cache; @@ -54,12 +54,6 @@ /* Package initialization variable */ hbool_t H5_PKG_INIT_VAR = FALSE; -/* Declare extern the free list to manage blocks of VL data */ -H5FL_BLK_EXTERN(vlen_vl_buf); - -/* Declare extern the free list to manage other blocks of VL data */ -H5FL_BLK_EXTERN(vlen_fl_buf); - /*****************************/ /* Library Private Variables */ @@ -106,7 +100,7 @@ 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) { void *dset = NULL; /* New dataset's info */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -205,8 +199,8 @@ 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 connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *dset = NULL; /* dset object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -271,8 +265,8 @@ done: hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { - void *dset = NULL; /* dset token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *dset = NULL; /* dset object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -717,14 +711,6 @@ done: * VL data, in memory. The *size value is modified according to how many * bytes are required to store the VL data in memory. * - * Implementation: This routine actually performs the read with a custom - * memory manager which basically just counts the bytes requested and - * uses a temporary memory buffer (through the H5FL API) to make certain - * enough space is available to perform the read. Then the temporary - * buffer is released and the number of bytes allocated is returned. - * Kinda kludgy, but easier than the other method of trying to figure out - * the sizes without actually reading the data in... - QAK - * * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol @@ -734,105 +720,43 @@ done: */ herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, - hsize_t *size) + hsize_t *size) { - H5D_vlen_bufsize_t vlen_bufsize = {NULL, H5I_INVALID_HID, H5I_INVALID_HID, NULL, NULL, 0, H5P_DATASET_XFER_DEFAULT}; - 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 */ - H5T_t *type; /* Datatype */ - H5S_sel_iter_op_t dset_op; /* Operator for iteration */ - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Dataset for this operation */ + hbool_t supported; /* Whether 'get vlen buf size' operation is supported by VOL connector */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "iii*h", dataset_id, type_id, space_id, size); /* Check args */ - 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 == (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") - 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))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") - - /* Save the dataset */ - vlen_bufsize.dset_vol_obj = vol_obj; - - /* Get a copy of the dataset's dataspace */ - if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy 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 dataspace atom") - - /* Grab the temporary buffers required */ - if(NULL == (vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") - if(NULL == (vlen_bufsize.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") - - /* Set the memory manager to the special allocation routine */ - if(H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine") - - /* If we are not using the native VOL connector we must also set this - * property on the DXPL since the context is not visible to the connector - * and will be ignored if the connector re-enters the library */ - if(vol_obj->connector->cls->value != H5VL_NATIVE_VALUE) { - H5P_genplist_t *dxpl; - - if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL") - if((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property list"); - if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL") - if(H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL") + if(H5I_DATATYPE != H5I_get_type(type_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype identifier") + if(H5I_DATASPACE != H5I_get_type(space_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace identifier") + if(size == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid 'size' pointer") + + /* Check if the 'get_vlen_buf_size' callback is supported */ + supported = FALSE; + if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, &supported) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'get vlen buf size' operation") + if(supported) { + /* Make the 'get_vlen_buf_size' callback */ + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id, space_id, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size") } /* end if */ - - /* Set the initial number of bytes required */ - 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; - - ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize); - - /* Get the size if we succeeded */ - if(ret_value >= 0) - *size = vlen_bufsize.size; + else { + /* Perform a generic operation that will work with all VOL connectors */ + if(H5D__vlen_get_buf_size_gen(vol_obj, type_id, space_id, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size") + } /* end else */ done: - if(ret_value < 0) - if(mspace && H5S_close(mspace) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - - if(vlen_bufsize.fspace_id >= 0 && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") - if(vlen_bufsize.mspace_id >= 0 && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) - HDONE_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) - vlen_bufsize.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf); - if(vlen_bufsize.dxpl_id != H5P_DATASET_XFER_DEFAULT) - if(H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list") - FUNC_LEAVE_API(ret_value) -} /* end H5Dvlen_get_buf_size() */ +} /* end H5Dvlen_get_buf_size() */ /*------------------------------------------------------------------------- @@ -981,7 +905,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_FORMAT_CONVERT) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") done: @@ -1017,7 +941,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") done: @@ -1058,7 +982,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") done: @@ -1103,13 +1027,13 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") /* Get the number of written chunks */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, fspace_id, nchunks) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, nchunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks") done: FUNC_LEAVE_API(ret_value); } /* H5Dget_num_chunks() */ - + /*------------------------------------------------------------------------- * Function: H5Dget_chunk_info @@ -1151,7 +1075,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Get the number of written chunks to check range */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, fspace_id, &nchunks) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, &nchunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks") /* Check range for chunk index */ @@ -1159,7 +1083,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk index is out of range") /* Call private function to get the chunk info given the chunk's index */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, fspace_id, chk_index, offset, filter_mask, addr, size) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fspace_id, chk_index, offset, filter_mask, addr, size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by index") done: @@ -1206,7 +1130,7 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") /* Call private function to get the chunk info given the chunk's index */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, offset, filter_mask, addr, size) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, offset, filter_mask, addr, size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by its logical coordinates") done: diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index c13c36a..098e01b 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -253,7 +253,7 @@ H5D__btree_get_shared(const H5F_t H5_ATTR_UNUSED *f, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5D__btree_new_node(H5F_t *f, H5B_ins_t op, void *_lt_key, void *_udata, +H5D__btree_new_node(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p/*out*/) { H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key; @@ -536,7 +536,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5D__btree_insert(H5F_t *f, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, +H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t H5_ATTR_UNUSED *rt_key_changed, haddr_t *new_node_p/*out*/) { diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 35773b6..43cfd02 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -1100,14 +1100,10 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf H5D_chunk_map_t *fm) { const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */ - H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */ hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */ htri_t file_space_normalized = FALSE; /* File dataspace was normalized */ - H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */ - hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ unsigned f_ndims; /* The number of dimensions of the file's dataspace */ int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */ - char bogus; /* "bogus" buffer to pass to selection iterator */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1268,22 +1264,22 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ else sel_hyper_flag = TRUE; - /* Check if file selection is a not a hyperslab selection */ - if(sel_hyper_flag) { - /* Build the file selection for each chunk */ - if(H5S_SEL_ALL == fm->fsel_type) { - if(H5D__create_chunk_file_map_all(fm, io_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") - } /* end if */ - else { - /* Sanity check */ - HDassert(fm->fsel_type == H5S_SEL_HYPERSLABS); - - if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") - } /* end else */ + /* Check if file selection is a not a hyperslab selection */ + if(sel_hyper_flag) { + /* Build the file selection for each chunk */ + if(H5S_SEL_ALL == fm->fsel_type) { + if(H5D__create_chunk_file_map_all(fm, io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") } /* end if */ else { + /* Sanity check */ + HDassert(fm->fsel_type == H5S_SEL_HYPERSLABS); + + if(H5D__create_chunk_file_map_hyper(fm, io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") + } /* end else */ + } /* end if */ + else { H5S_sel_iter_op_t iter_op; /* Operator for iteration */ H5D_chunk_file_iter_ud_t udata; /* User data for iteration */ @@ -1320,14 +1316,12 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ if(H5D__create_chunk_mem_map_hyper(fm) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections") } /* end if */ - else if(sel_hyper_flag && - fm->f_ndims == 1 && fm->m_ndims == 1 && + else if(sel_hyper_flag && fm->f_ndims == 1 && fm->m_ndims == 1 && H5S_SELECT_IS_REGULAR(fm->mem_space) && H5S_SELECT_IS_SINGLE(fm->mem_space)) { - if(H5D__create_chunk_mem_map_1d(fm) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") - - } else { + } /* end else-if */ + else { H5S_sel_iter_op_t iter_op; /* Operator for iteration */ size_t elmt_size; /* Memory datatype size */ @@ -1343,8 +1337,8 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ fm->mchunk_tmpl = tmp_mspace; /* Create temporary datatypes for selection iteration */ - if(!file_type) - if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL))) + if(!file_type) + if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype") /* Create selection iterator for memory selection */ @@ -1366,11 +1360,9 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ done: /* Release the [potentially partially built] chunk mapping information if an error occurs */ if(ret_value < 0) { - if(tmp_mspace && !fm->mchunk_tmpl) { + if(tmp_mspace && !fm->mchunk_tmpl) if(H5S_close(tmp_mspace) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template") - } /* end if */ - if(H5D__chunk_io_term(fm) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping") } /* end if */ @@ -2139,13 +2131,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) { H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */ H5SL_node_t *curr_node; /* Current node in skip list */ - hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ - hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ - hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ - hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ - hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2171,6 +2157,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) else { hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ + HDassert(fm->m_ndims == 1); if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0) @@ -2179,7 +2166,7 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) /* Iterate over each chunk in the chunk list */ curr_node = H5SL_first(fm->sel_chunks); while(curr_node) { - hssize_t schunk_points; /* Number of elements in chunk selection */ + hsize_t chunk_points; /* Number of elements in chunk selection */ hsize_t tmp_count = 1; /* Get pointer to chunk's information */ @@ -2190,12 +2177,12 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) if((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") - schunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); + chunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); - if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &schunk_points) < 0) + if(H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &chunk_points) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") - mem_sel_start[0] += schunk_points; + mem_sel_start[0] += chunk_points; /* Get the next chunk node in the skip list */ curr_node = H5SL_next(curr_node); @@ -5037,8 +5024,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, blocks++; } - /* MSC - * should use this if MPI_type_create_hindexed block is working + /* MSC - should use this if MPI_type_create_hindexed block is working: * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type); */ mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type); @@ -5512,7 +5498,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) } /* end if */ else dims_outside_fill[u] = FALSE; - } /* end if */ + } /* end else */ carry = FALSE; while(!carry) { @@ -5665,9 +5651,8 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5D_chunk_it_ud2_t *udata = (H5D_chunk_it_ud2_t *)_udata; /* User data for callback */ unsigned rank = udata->common.layout->ndims - 1; /* # of dimensions of dataset */ hsize_t chunk_index; - int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Compute the index for this chunk */ chunk_index = H5VM_array_offset_pre(rank, udata->common.layout->down_chunks, chunk_rec->scaled); @@ -5675,8 +5660,7 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Set it in the userdata to return */ udata->chunk_addr[chunk_index] = chunk_rec->chunk_addr; -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(H5_ITER_CONT) } /* H5D__chunk_addrmap_cb() */ @@ -5969,11 +5953,10 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Check for an edge chunk that is not filtered */ if(pline && pline->nused) { must_filter = TRUE; - if( (udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && - (H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, - chunk_rec->scaled, udata->dset_dims)) ) + if((udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && + H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims)) must_filter = FALSE; - } + } /* end if */ /* Check parameter for type conversion */ if(udata->do_convert) { @@ -6011,7 +5994,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HDassert(!H5F_addr_defined(chunk_rec->chunk_addr)); H5MM_memcpy(buf, udata->chunk, nbytes); udata->chunk = NULL; - } + } /* end if */ else { H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ unsigned idx; /* Index of chunk in cache, if present */ @@ -6044,13 +6027,13 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t); H5MM_memcpy(buf, ent->chunk, nbytes); - } + } /* end if */ else { /* read chunk data from the source file */ if(H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk") - } - } + } /* end else */ + } /* end else */ /* Need to uncompress filtered variable-length & reference data elements that are not found in chunk cache */ if(must_filter && (is_vlen || fix_ref) && !udata->chunk_in_cache) { @@ -7088,7 +7071,7 @@ H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info, H5D_chk_idx udata.dset_ndims = dset->shared->ndims; udata.dset_dims = dset->shared->curr_dims; - /* terate over the chunks in the current index and insert the chunk addresses into version 1 B-tree index */ + /* Iterate over the chunks in the current index and insert the chunk addresses into version 1 B-tree index */ if((idx_info->storage->ops->iterate)(idx_info, H5D__chunk_format_convert_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to chunk info") @@ -7152,7 +7135,6 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ hsize_t num_chunks = 0; /* Number of written chunks */ H5D_rdcc_ent_t *ent; /* Cache entry */ const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */ - const H5O_layout_t *layout; /* Dataset layout */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) @@ -7162,7 +7144,6 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ HDassert(space); HDassert(nchunks); - layout = &(dset->shared->layout); /* Dataset layout */ rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */ HDassert(rdcc); @@ -7179,15 +7160,14 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ idx_info.storage = &dset->shared->layout.storage.u.chunk; /* If the dataset is not written, number of chunks will be 0 */ - if(!H5F_addr_defined(idx_info.storage->idx_addr)) { + if(!H5F_addr_defined(idx_info.storage->idx_addr)) *nchunks = 0; - } else { /* Iterate over the allocated chunks */ if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_num_chunks_cb, &num_chunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index") *nchunks = num_chunks; - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -7212,7 +7192,6 @@ static int H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) { H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata; - hsize_t ii = 0; /* Dimension index */ int ret_value = H5_ITER_CONT; /* Callback return value */ FUNC_ENTER_STATIC_NOERR @@ -7222,17 +7201,20 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HDassert(chunk_info); /* If this is the queried chunk, retrieve its info and stop iterating */ - if (chunk_info->curr_idx == chunk_info->chunk_idx) { + if(chunk_info->curr_idx == chunk_info->chunk_idx) { + hsize_t ii = 0; /* Dimension index */ + + /* Copy info */ chunk_info->filter_mask = chunk_rec->filter_mask; chunk_info->chunk_addr = chunk_rec->chunk_addr; chunk_info->nbytes = chunk_rec->nbytes; - for (ii = 0; ii < chunk_info->ndims; ii++) + for(ii = 0; ii < chunk_info->ndims; ii++) chunk_info->scaled[ii] = chunk_rec->scaled[ii]; chunk_info->found = TRUE; /* Stop iterating */ ret_value = H5_ITER_STOP; - } + } /* end if */ /* Go to the next chunk */ else chunk_info->curr_idx++; @@ -7291,9 +7273,9 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Set addr & size for when dset is not written or queried chunk is not found */ - if (addr) + if(addr) *addr = HADDR_UNDEF; - if (size) + if(size) *size = 0; /* If the chunk is written, get its info, otherwise, return without error */ @@ -7322,7 +7304,7 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ if(offset) for(ii = 0; ii < udata.ndims; ii++) offset[ii] = udata.scaled[ii] * dset->shared->layout.u.chunk.dim[ii]; - } + } /* end if */ } /* end if H5F_addr_defined */ done: @@ -7347,9 +7329,9 @@ done: static int H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) { - hsize_t ii; H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata; hbool_t different = FALSE; /* TRUE when a scaled value pair mismatch */ + hsize_t ii; /* Local index value */ int ret_value = H5_ITER_CONT; /* Callback return value */ FUNC_ENTER_STATIC_NOERR @@ -7359,12 +7341,12 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HDassert(chunk_info); /* Going through the scaled, stop when a mismatch is found */ - for (ii = 0; ii < chunk_info->ndims && !different; ii++) - if (chunk_info->scaled[ii] != chunk_rec->scaled[ii]) + for(ii = 0; ii < chunk_info->ndims && !different; ii++) + if(chunk_info->scaled[ii] != chunk_rec->scaled[ii]) different = TRUE; /* Same scaled coords means the chunk is found, copy the chunk info */ - if (!different) { + if(!different) { chunk_info->nbytes = chunk_rec->nbytes; chunk_info->filter_mask = chunk_rec->filter_mask; chunk_info->chunk_addr = chunk_rec->chunk_addr; @@ -7372,7 +7354,7 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Stop iterating */ ret_value = H5_ITER_STOP; - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* H5D__get_chunk_info_by_coord_cb() */ @@ -7423,9 +7405,9 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned* HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") /* Set addr & size for when dset is not written or queried chunk is not found */ - if (addr) + if(addr) *addr = HADDR_UNDEF; - if (size) + if(size) *size = 0; /* Compose chunked index info struct */ @@ -7452,14 +7434,14 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned* HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve information of the chunk by its scaled coordinates") /* Obtain requested info if the chunk is found */ - if (udata.found) { + if(udata.found) { if(filter_mask) *filter_mask = udata.filter_mask; if(addr) *addr = udata.chunk_addr; if(size) *size = udata.nbytes; - } + } /* end if */ } /* end if H5F_addr_defined */ done: diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index f321c82..f4f4223 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -113,11 +113,9 @@ 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 connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *dset = NULL; /* dset object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; - 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 */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -129,6 +127,10 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(!*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read") + if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else @@ -138,10 +140,6 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, /* Set the DCPL for the API context */ H5CX_set_dcpl(dcpl_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") - /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); @@ -151,7 +149,8 @@ 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, lcpl_id, type_id, space_id, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, type_id, space_id, 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 */ @@ -187,8 +186,8 @@ done: hid_t H5Dopen1(hid_t loc_id, const char *name) { - void *dset = NULL; /* dset token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *dset = NULL; /* dset object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ diff --git a/src/H5Dint.c b/src/H5Dint.c index c3d4398..436a507 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -43,6 +43,35 @@ /* Local Typedefs */ /******************/ +/* Shared data structure for computing variable-length dataset's total size */ +/* (Used for both native and generic 'get vlen buf size' operation) */ +typedef struct { + 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 */ + size_t vl_tbuf_size; /* Current size of the temp. buffer for VL data */ + hsize_t size; /* Accumulated number of bytes for the selection */ +} H5D_vlen_bufsize_common_t; + +/* Internal data structure for computing variable-length dataset's total size */ +/* (Used for native 'get vlen buf size' operation) */ +typedef struct { + H5D_t *dset; /* Dataset for operation */ + H5S_t *fspace; /* Dataset's dataspace for operation */ + H5S_t *mspace; /* Memory dataspace for operation */ + H5D_vlen_bufsize_common_t common; /* VL data buffers & accumulatd size */ +} H5D_vlen_bufsize_native_t; + +/* Internal data structure for computing variable-length dataset's total size */ +/* (Used for generic 'get vlen buf size' operation) */ +typedef struct { + H5VL_object_t *dset_vol_obj; /* VOL object for the dataset */ + hid_t fspace_id; /* Dataset dataspace ID of the dataset we are working on */ + H5S_t *fspace; /* Dataset's dataspace for operation */ + hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */ + hid_t dxpl_id; /* Dataset transfer property list to pass to dataset read */ + H5D_vlen_bufsize_common_t common; /* VL data buffers & accumulatd size */ +} H5D_vlen_bufsize_generic_t; + /********************/ /* Local Prototypes */ @@ -60,9 +89,14 @@ static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overw hsize_t old_dim[]); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); static herr_t H5D__close_cb(H5VL_object_t *dset_vol_obj); -static herr_t H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize); +static herr_t H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize); static herr_t H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc); static size_t H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr); +static void *H5D__vlen_get_buf_size_alloc(size_t size, void *info); +static herr_t H5D__vlen_get_buf_size_cb(void *elem, hid_t type_id, unsigned ndim, + const hsize_t *point, void *op_data); +static herr_t H5D__vlen_get_buf_size_gen_cb(void *elem, hid_t type_id, unsigned ndim, + const hsize_t *point, void *op_data); /*********************/ @@ -98,8 +132,12 @@ H5FL_EXTERN(H5D_chunk_info_t); /* Declare extern the free list to manage blocks of type conversion data */ H5FL_BLK_EXTERN(type_conv); +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlarger-than=" /* Define a static "default" dataset structure to use to initialize new datasets */ static H5D_shared_t H5D_def_dset; +#pragma GCC diagnostic pop /* Dataset ID class */ static const H5I_class_t H5I_DATASET_CLS[1] = {{ @@ -113,7 +151,7 @@ static const H5I_class_t H5I_DATASET_CLS[1] = {{ static hbool_t H5D_top_package_initialize_s = FALSE; /* Prefixes of VDS and external file from the environment variables - * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */ + * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */ static const char *H5D_prefix_ext_env = NULL; static const char *H5D_prefix_vds_env = NULL; @@ -699,14 +737,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize) +H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT; HDassert(file); - HDassert(dset); HDassert(minimize); /* Get the dataset object header minimize flag for this call */ @@ -977,7 +1014,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value info") } /* end if */ - if(H5D__use_minimized_dset_headers(file, dset, &minimize_header) == FAIL) + if(H5D__use_minimized_dset_headers(file, &minimize_header) == FAIL) HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get minimize settings") if(TRUE == minimize_header) { @@ -2567,29 +2604,172 @@ done: * this data is not actually usable. * * Return: Non-negative on success, negative on failure + * *------------------------------------------------------------------------- */ -void * +static void * H5D__vlen_get_buf_size_alloc(size_t size, void *info) { - H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)info; + H5D_vlen_bufsize_common_t *vlen_bufsize_com = (H5D_vlen_bufsize_common_t *)info; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC + + /* Check for increasing the size of the temporary space for VL data */ + if(size > vlen_bufsize_com->vl_tbuf_size) { + if(NULL == (vlen_bufsize_com->vl_tbuf = H5FL_BLK_REALLOC(vlen_vl_buf, vlen_bufsize_com->vl_tbuf, size))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't reallocate temporary VL data buffer") + vlen_bufsize_com->vl_tbuf_size = size; + } /* end if */ - /* Get a temporary pointer to space for the VL data */ - if((vlen_bufsize->vl_tbuf = H5FL_BLK_REALLOC(vlen_vl_buf, vlen_bufsize->vl_tbuf, size)) != NULL) - vlen_bufsize->size += size; + /* Increment size of VL data buffer needed */ + vlen_bufsize_com->size += size; /* Set return value */ - ret_value = vlen_bufsize->vl_tbuf; + ret_value = vlen_bufsize_com->vl_tbuf; +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__vlen_get_buf_size_alloc() */ /*------------------------------------------------------------------------- - * Function: H5D__vlen_get_buf_size + * Function: H5D__vlen_get_buf_size_cb + * + * Purpose: Dataspace selection iteration callback for H5Dvlen_get_buf_size. + * + * Return: Non-negative on success, negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__vlen_get_buf_size_cb(void H5_ATTR_UNUSED *elem, hid_t type_id, + unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data) +{ + H5D_vlen_bufsize_native_t *vlen_bufsize = (H5D_vlen_bufsize_native_t *)op_data; + herr_t ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(H5I_DATATYPE == H5I_get_type(type_id)); + HDassert(point); + HDassert(op_data); + + /* Select point to read in */ + if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5_ITER_ERROR, "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->common.fl_tbuf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, H5_ITER_ERROR, "can't read point") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__vlen_get_buf_size_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__vlen_get_buf_size + * + * Purpose: This routine checks the number of bytes required to store the VL + * data from the dataset, using the space_id for the selection in the + * dataset on disk and the type_id for the memory representation of the + * VL data, in memory. The *size value is modified according to how many + * bytes are required to store the VL data in memory. + * + * Implementation: This routine actually performs the read with a custom + * memory manager which basically just counts the bytes requested and + * uses a temporary memory buffer (through the H5FL API) to make certain + * enough space is available to perform the read. Then the temporary + * buffer is released and the number of bytes allocated is returned. + * Kinda kludgy, but easier than the other method of trying to figure out + * the sizes without actually reading the data in... - QAK + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Quincey Koziol + * Wednesday, August 11, 1999 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, + hsize_t *size) +{ + H5D_vlen_bufsize_native_t vlen_bufsize = {NULL, NULL, NULL, {NULL, NULL, 0, 0}}; + H5S_t *fspace = NULL; /* Dataset's dataspace */ + H5S_t *mspace = NULL; /* Memory dataspace */ + char bogus; /* bogus value to pass to H5Diterate() */ + H5S_t *space; /* Dataspace for iteration */ + H5T_t *type; /* Datatype */ + H5S_sel_iter_op_t dset_op; /* Operator for iteration */ + herr_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + if(NULL == (type = (H5T_t *)H5I_object(type_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") + if(NULL == (space = (H5S_t *)H5I_object(space_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") + if(!(H5S_has_extent(space))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") + + /* Save the dataset */ + vlen_bufsize.dset = dset; + + /* 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; + + /* 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; + + /* Grab the temporary buffers required */ + if(NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") + if(NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") + vlen_bufsize.common.vl_tbuf_size = 1; + + /* Set the memory manager to the special allocation routine */ + if(H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine") + + /* Set the initial number of bytes required */ + vlen_bufsize.common.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_cb; + dset_op.u.app_op.type_id = type_id; + + ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize); + + /* Get the size if we succeeded */ + if(ret_value >= 0) + *size = vlen_bufsize.common.size; + +done: + if(fspace && H5S_close(fspace) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + if(mspace && H5S_close(mspace) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + if(vlen_bufsize.common.fl_tbuf != NULL) + vlen_bufsize.common.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.common.fl_tbuf); + if(vlen_bufsize.common.vl_tbuf != NULL) + vlen_bufsize.common.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.common.vl_tbuf); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__vlen_get_buf_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__vlen_get_buf_size_gen_cb * * Purpose: This routine checks the number of bytes required to store a single * element from a dataset in memory, creating a selection with just the @@ -2609,42 +2789,152 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info) * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ -herr_t -H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, +static herr_t +H5D__vlen_get_buf_size_gen_cb(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; + H5D_vlen_bufsize_generic_t *vlen_bufsize = (H5D_vlen_bufsize_generic_t *)op_data; H5T_t *dt; /* Datatype for operation */ - H5S_t *fspace; /* File dataspace for operation */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC + /* Sanity check */ + HDassert(point); HDassert(op_data); - HDassert(H5I_DATATYPE == H5I_get_type(type_id)); /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a datatype") /* Make certain there is enough fixed-length buffer available */ - if(NULL == (vlen_bufsize->fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt)))) + if(NULL == (vlen_bufsize->common.fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->common.fl_tbuf, H5T_get_size(dt)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf") /* 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") - if(H5S_select_elements(fspace, H5S_SELECT_SET, (size_t)1, point) < 0) + if(H5S_select_elements(vlen_bufsize->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(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_read(vlen_bufsize->dset_vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->common.fl_tbuf, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__vlen_get_buf_size() */ +} /* end H5D__vlen_get_buf_size_gen_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__vlen_get_buf_size_gen + * + * Purpose: Generic routine to checks the number of bytes required to store the + * VL data from the dataset. + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Quincey Koziol + * Friday, December 20, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id, + hsize_t *size) +{ + H5D_vlen_bufsize_generic_t vlen_bufsize = {NULL, H5I_INVALID_HID, NULL, H5I_INVALID_HID, H5I_INVALID_HID, {NULL, NULL, 0, 0}}; + H5P_genplist_t *dxpl = NULL; /* DXPL for operation */ + H5S_t *mspace = NULL; /* Memory dataspace */ + char bogus; /* Bogus value to pass to H5Diterate() */ + H5S_t *space; /* Dataspace for iteration */ + H5T_t *type; /* Datatype */ + H5S_sel_iter_op_t dset_op; /* Operator for iteration */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + if(NULL == (type = (H5T_t *)H5I_object(type_id))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not an valid datatype") + if(NULL == (space = (H5S_t *)H5I_object(space_id))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "invalid dataspace") + if(!(H5S_has_extent(space))) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dataspace does not have extent set") + + /* Save the dataset */ + vlen_bufsize.dset_vol_obj = vol_obj; + + /* Get a copy of the dataset's dataspace */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace") + if(NULL == (vlen_bufsize.fspace = (H5S_t *)H5I_object(vlen_bufsize.fspace_id))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Create a scalar for the memory dataspace */ + if(NULL == (mspace = H5S_create(H5S_SCALAR))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create dataspace") + if((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + + /* Grab the temporary buffers required */ + if(NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available") + if(NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available") + vlen_bufsize.common.vl_tbuf_size = 1; + + /* Set the VL allocation callbacks on a DXPL */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL") + if((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy property list"); + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL") + if(H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL") + + /* Set the initial number of bytes required */ + vlen_bufsize.common.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_gen_cb; + dset_op.u.app_op.type_id = type_id; + + ret_value = H5S_select_iterate(&bogus, type, space, &dset_op, &vlen_bufsize); + + /* Get the size if we succeeded */ + if(ret_value >= 0) + *size = vlen_bufsize.common.size; + +done: + if(vlen_bufsize.fspace_id >= 0) { + if(H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id") + vlen_bufsize.fspace = NULL; + } /* end if */ + if(vlen_bufsize.fspace && H5S_close(vlen_bufsize.fspace) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + if(vlen_bufsize.mspace_id >= 0) { + if(H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id") + mspace = NULL; + } /* end if */ + if(mspace && H5S_close(mspace) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + if(vlen_bufsize.common.fl_tbuf != NULL) + vlen_bufsize.common.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.common.fl_tbuf); + if(vlen_bufsize.common.vl_tbuf != NULL) + vlen_bufsize.common.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.common.vl_tbuf); + if(vlen_bufsize.dxpl_id != H5I_INVALID_HID) { + if(H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list") + dxpl = NULL; + } /* end if */ + if(dxpl && H5P_close(dxpl) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release DXPL") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__vlen_get_buf_size_gen() */ /*------------------------------------------------------------------------- diff --git a/src/H5Dio.c b/src/H5Dio.c index 1237063..6b02b68 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -239,7 +239,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_NATIVE_DATASET_CHUNK_READ, offset, filters, buf) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_READ, dxpl_id, H5_REQUEST_NULL, offset, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") done: @@ -367,7 +367,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_NATIVE_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) + if(H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_WRITE, dxpl_id, H5_REQUEST_NULL, 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/H5Dnone.c b/src/H5Dnone.c index 9346220..2093512 100644 --- a/src/H5Dnone.c +++ b/src/H5Dnone.c @@ -378,7 +378,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, +H5D__none_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 02121e6..c46e38b6 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -516,17 +516,6 @@ typedef struct H5D_fill_buf_info_t { hbool_t has_vlen_fill_type; /* Whether the datatype for the fill value has a variable-length component */ } H5D_fill_buf_info_t; -/* Internal data structure for computing variable-length dataset's total size */ -typedef struct { - 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 */ - void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ - hsize_t size; /* Accumulated number of bytes for the selection */ - hid_t dxpl_id; /* Dataset transfer property list to pass to dataset read */ -} H5D_vlen_bufsize_t; - /*****************************/ /* Package Private Variables */ @@ -575,8 +564,8 @@ H5_DLL herr_t H5D__get_num_chunks(const H5D_t *dset, const H5S_t *space, hsize_t H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *offset, hsize_t *size); H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size); H5_DLL 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(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size); +H5_DLL herr_t H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id, hsize_t *size); 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); diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c index 4510a03..8efa771 100644 --- a/src/H5Dsingle.c +++ b/src/H5Dsingle.c @@ -437,7 +437,7 @@ H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info) *------------------------------------------------------------------------- */ static herr_t -H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, +H5D__single_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index da67e6b..1d182a4 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -487,7 +487,8 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ - *image++ = hdr->cparam.cls->id; + HDassert(hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ @@ -875,7 +876,8 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_IBLOCK_VERSION; /* Extensible array type */ - *image++ = iblock->hdr->cparam.cls->id; + HDassert(iblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)iblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, iblock->hdr->addr); @@ -1284,7 +1286,8 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_SBLOCK_VERSION; /* Extensible array type */ - *image++ = sblock->hdr->cparam.cls->id; + HDassert(sblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)sblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, sblock->hdr->addr); @@ -1540,7 +1543,7 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ */ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, -H5EA__cache_dblock_deserialize(const void *_image, size_t len, +H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) /* Local variables */ @@ -1698,7 +1701,8 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_DBLOCK_VERSION; /* Extensible array type */ - *image++ = dblock->hdr->cparam.cls->id; + HDassert(dblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)dblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, dblock->hdr->addr); @@ -2076,7 +2080,7 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, -H5EA__cache_dblk_page_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, +H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) /* Local variables */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 814e64f..58e255a 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -279,7 +279,7 @@ END_FUNC(STATIC) /* end H5EA__test_encode() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)) +H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDEBUG_UNUSED *_ctx)) /* Local variables */ #ifndef NDEBUG diff --git a/src/H5Epkg.h b/src/H5Epkg.h index ac98496..86b5b73 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -77,7 +77,7 @@ typedef struct { } H5E_auto_op_t; #else /* H5_NO_DEPRECATED_SYMBOLS */ typedef struct { - H5E_auto_t func2; /* Only the new style callback function is available. */ + H5E_auto2_t func2; /* Only the new style callback function is available. */ } H5E_auto_op_t; #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 3eae2da..ed14217 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -100,14 +100,14 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; } #else /* H5_NO_DEPRECATED_SYMBOLS */ #define H5E_BEGIN_TRY { \ - H5E_auto_t saved_efunc; \ + H5E_auto2_t saved_efunc; \ void *H5E_saved_edata; \ \ - (void)H5Eget_auto(H5E_DEFAULT, &saved_efunc, &H5E_saved_edata); \ - (void)H5Eset_auto(H5E_DEFAULT, NULL, NULL); + (void)H5Eget_auto2(H5E_DEFAULT, &saved_efunc, &H5E_saved_edata); \ + (void)H5Eset_auto2(H5E_DEFAULT, NULL, NULL); #define H5E_END_TRY \ - (void)H5Eset_auto(H5E_DEFAULT, saved_efunc, H5E_saved_edata); \ + (void)H5Eset_auto2(H5E_DEFAULT, saved_efunc, H5E_saved_edata); \ } #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -113,6 +113,30 @@ static const H5I_class_t H5I_FILE_CLS[1] = {{ (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ }}; + + +/*------------------------------------------------------------------------- + * Function: H5F_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + *------------------------------------------------------------------------- + */ +herr_t +H5F_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 H5F_init() */ + /*-------------------------------------------------------------------------- NAME @@ -547,7 +571,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_VFD_HANDLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, file_handle, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: @@ -623,8 +647,9 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { 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 */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ H5VL_object_t *vol_obj = NULL; /* VOL object for file */ + hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -687,9 +712,13 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(NULL == (vol_obj = H5VL_vol_object(ret_value))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - /* Make the post open callback */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback") + /* Make the 'post open' callback */ + supported = FALSE; + if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") + if(supported) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") done: FUNC_LEAVE_API(ret_value) @@ -718,11 +747,12 @@ done: hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - 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 */ - H5VL_object_t *vol_obj = NULL; /* VOL object for file */ - 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 */ + H5VL_object_t *vol_obj = NULL; /* VOL object for file */ + hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -770,9 +800,13 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(NULL == (vol_obj = H5VL_vol_object(ret_value))) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") - /* Make the post open callback */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback") + /* Make the 'post open' callback */ + supported = FALSE; + if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") + if(supported) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") done: FUNC_LEAVE_API(ret_value) @@ -880,13 +914,6 @@ H5Fdelete(const char *filename, hid_t fapl_id) if(!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") - /* 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 a file access property list") - /* Verify access property list and set up collective metadata if appropriate */ 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") @@ -936,8 +963,9 @@ done: hid_t H5Freopen(hid_t file_id) { - H5VL_object_t *vol_obj = NULL; void *file = NULL; /* File struct for new file */ + H5VL_object_t *vol_obj = NULL; /* VOL object for file */ + hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -963,9 +991,13 @@ H5Freopen(hid_t file_id) if(NULL == (vol_obj = H5VL_vol_object(ret_value))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - /* Make the post open callback */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback") + /* Make the 'post open' callback */ + supported = FALSE; + if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") + if(supported) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") done: /* XXX (VOL MERGE): If registration fails, file will not be closed */ @@ -1070,7 +1102,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FREE_SPACE, &ret_value) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FREE_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") done: @@ -1105,7 +1137,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_SIZE, size) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") done: @@ -1166,7 +1198,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FILE_IMAGE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: @@ -1206,7 +1238,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_CONF, config_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_CONF, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: @@ -1239,7 +1271,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MDC_CONFIG, config_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MDC_CONFIG, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") done: @@ -1275,7 +1307,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_HR, hit_rate_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_HR, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: @@ -1312,7 +1344,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_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, H5VL_NATIVE_FILE_GET_MDC_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 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: @@ -1350,7 +1382,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") done: @@ -1444,7 +1476,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_INFO, (int)type, finfo) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)type, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") done: @@ -1480,7 +1512,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") done: @@ -1519,7 +1551,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, (int)type, nsects) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FREE_SECTIONS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, sect_info, &ret_value, (int)type, nsects) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: @@ -1552,7 +1584,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") done: @@ -1612,7 +1644,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_START_SWMR_WRITE) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_START_SWMR_WRITE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: @@ -1644,7 +1676,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_START_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_START_MDC_LOGGING, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging") done: @@ -1677,7 +1709,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_STOP_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_STOP_MDC_LOGGING, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging") done: @@ -1711,7 +1743,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status") done: @@ -1723,7 +1755,7 @@ done: * Function: H5Fset_libver_bounds * * Purpose: Set to a different low and high bounds while a file is open. - * This public routine is introduced in place of + * This public routine is introduced in place of * H5Fset_latest_format() starting release 1.10.2. * See explanation for H5Fset_latest_format() in H5Fdeprec.c. * @@ -1749,7 +1781,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, low, high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: @@ -1786,7 +1818,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_FORMAT_CONVERT) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") done: @@ -1817,7 +1849,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") done: @@ -1852,7 +1884,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, accesses, hits, misses, evictions, bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") done: @@ -1887,7 +1919,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, image_addr, image_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") done: @@ -1921,7 +1953,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_EOA, eoa) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_EOA, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") } /* end if */ @@ -1952,7 +1984,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_INCR_FILESIZE, increment) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_INCR_FILESIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, increment) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size") done: @@ -1997,7 +2029,7 @@ H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize) if(NULL == vol_obj) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG, minimize) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, minimize) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag") done: @@ -2038,7 +2070,7 @@ H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize) if(NULL == vol_obj) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG, minimize) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, minimize) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag") done: diff --git a/src/H5FAcache.c b/src/H5FAcache.c index f440efe..922153c 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -253,7 +253,7 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */ */ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, -H5FA__cache_hdr_deserialize(const void *_image, size_t len, +H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) /* Local variables */ @@ -417,7 +417,8 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5FA_HDR_VERSION; /* Fixed array type */ - *image++ = hdr->cparam.cls->id; + HDassert(hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ @@ -650,7 +651,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */ */ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, -H5FA__cache_dblock_deserialize(const void *_image, size_t len, +H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) /* Local variables */ @@ -805,7 +806,8 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5FA_DBLOCK_VERSION; /* Fixed array type */ - *image++ = dblock->hdr->cparam.cls->id; + HDassert(dblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)dblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ H5F_addr_encode(f, &image, dblock->hdr->addr); @@ -1176,7 +1178,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, -H5FA__cache_dblk_page_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, +H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) /* Local variables */ diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 6db8af6..552b7ca 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -342,6 +342,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) unsigned char *ptr = file->mem + addr; /* mutable pointer into the * buffer (can't change mem) */ + HDoff_t offset = (HDoff_t)addr; /* Offset to write at */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -358,7 +359,6 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ - HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -371,7 +371,8 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) do { #ifdef H5_HAVE_PREADWRITE bytes_wrote = HDpwrite(file->fd, ptr, bytes_in, offset); - offset += bytes_wrote; + if(bytes_wrote > 0) + offset += bytes_wrote; #else bytes_wrote = HDwrite(file->fd, ptr, bytes_in); #endif /* H5_HAVE_PREADWRITE */ @@ -856,12 +857,12 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr * partial results, and the end of the file. */ - uint8_t *mem = file->mem; /* memory pointer for writes */ + uint8_t *mem = file->mem; /* memory pointer for writes */ + HDoff_t offset = (HDoff_t)0; /* offset for reading */ while(size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ - HDoff_t offset = (HDoff_t)0; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -874,7 +875,8 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr do { #ifdef H5_HAVE_PREADWRITE bytes_read = HDpread(file->fd, mem, bytes_in, offset); - offset += bytes_read; + if(bytes_read > 0) + offset += bytes_read; #else bytes_read = HDread(file->fd, mem, bytes_in); #endif /* H5_HAVE_PREADWRITE */ diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 819d200..3d086ea 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -569,11 +569,7 @@ done: * Return: Success: The driver ID for the hdfs driver. * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * - * Changes: Rename as appropriate for hdfs vfd. - * Jacob Smith 2018 + * Programmer: Jacob Smith, 2018 * *------------------------------------------------------------------------- */ @@ -581,7 +577,9 @@ hid_t H5FD_hdfs_init(void) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ +#if HDFS_STATS unsigned int bin_i; +#endif FUNC_ENTER_NOAPI(FAIL) @@ -589,28 +587,24 @@ H5FD_hdfs_init(void) HDfprintf(stdout, "H5FD_hdfs_init() called.\n"); #endif - if (H5I_VFL != H5I_get_type(H5FD_HDFS_g)) { - H5FD_HDFS_g = H5FD_register( - &H5FD_hdfs_g, - sizeof(H5FD_class_t), - FALSE); - } + if(H5I_VFL != H5I_get_type(H5FD_HDFS_g)) + H5FD_HDFS_g = H5FD_register( &H5FD_hdfs_g, sizeof(H5FD_class_t), FALSE); #if HDFS_STATS /* pre-compute statsbin boundaries */ - for (bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) { + for(bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) { unsigned long long value = 0; + HDFS_STATS_POW(bin_i, &value) hdfs_stats_boundaries[bin_i] = value; - } + } /* end for */ #endif ret_value = H5FD_HDFS_g; done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_hdfs_init() */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index ac5667f..60255e5 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -1171,6 +1171,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd #ifdef H5_HAVE_GETTIMEOFDAY struct timeval timeval_start, timeval_stop; #endif /* H5_HAVE_GETTIMEOFDAY */ + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1255,7 +1256,6 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ - HDoff_t offset = (HDoff_t)addr; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -1268,7 +1268,8 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd do { #ifdef H5_HAVE_PREADWRITE bytes_read = HDpread(file->fd, buf, bytes_in, offset); - offset += bytes_read; + if(bytes_read > 0) + offset += bytes_read; #else bytes_read = HDread(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ @@ -1382,6 +1383,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had #ifdef H5_HAVE_GETTIMEOFDAY struct timeval timeval_start, timeval_stop; #endif /* H5_HAVE_GETTIMEOFDAY */ + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1471,7 +1473,6 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ - HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -1484,7 +1485,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had do { #ifdef H5_HAVE_PREADWRITE bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset); - offset += bytes_wrote; + if(bytes_wrote > 0) + offset += bytes_wrote; #else bytes_wrote = HDwrite(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 0054a86..a393490 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -669,6 +669,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS haddr_t addr, size_t size, void *buf /*out*/) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -687,7 +688,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS if(addr != file->pos || OP_READ != file->op) { if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } /* end if */ + } #endif /* H5_HAVE_PREADWRITE */ /* Read data, being careful of interrupted system calls, partial results, @@ -697,7 +698,6 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ - HDoff_t offset = (HDoff_t)addr; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -710,7 +710,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS do { #ifdef H5_HAVE_PREADWRITE bytes_read = HDpread(file->fd, buf, bytes_in, offset); - offset += bytes_read; + if(bytes_read > 0) + offset += bytes_read; #else bytes_read = HDread(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ @@ -773,6 +774,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU haddr_t addr, size_t size, const void *buf) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -791,7 +793,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if(addr != file->pos || OP_WRITE != file->op) { if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } /* end if */ + } #endif /* H5_HAVE_PREADWRITE */ /* Write the data, being careful of interrupted system calls and partial @@ -801,7 +803,6 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ - HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -814,7 +815,8 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU do { #ifdef H5_HAVE_PREADWRITE bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset); - offset += bytes_wrote; + if(bytes_wrote > 0) + offset += bytes_wrote; #else bytes_wrote = HDwrite(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ @@ -665,14 +665,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) +H5FS_size(const H5FS_t *fspace, hsize_t *meta_size) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* * Check arguments. */ - HDassert(f); HDassert(fspace); HDassert(meta_size); diff --git a/src/H5FScache.c b/src/H5FScache.c index b520458..d5f2817 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -241,7 +241,7 @@ H5FS__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static void * -H5FS__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, +H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5FS_t *fspace = NULL; /* Free space header info */ @@ -404,8 +404,8 @@ H5FS__cache_hdr_image_len(const void *_thing, size_t *image_len) */ static herr_t H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, - haddr_t addr, size_t H5_ATTR_UNUSED len, haddr_t *new_addr, size_t *new_len, - unsigned *flags) + haddr_t addr, size_t H5_ATTR_UNUSED len, haddr_t H5_ATTR_NDEBUG_UNUSED *new_addr, + size_t H5_ATTR_NDEBUG_UNUSED *new_len, unsigned *flags) { H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ @@ -694,7 +694,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len, +H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */ @@ -735,7 +735,7 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len, *image++ = H5FS_HDR_VERSION; /* Client ID */ - *image++ = fspace->client; + H5_CHECKED_ASSIGN(*image++, uint8_t, fspace->client, int); /* Total space tracked */ H5F_ENCODE_LENGTH(f, image, fspace->tot_space); @@ -979,8 +979,8 @@ H5FS__cache_sinfo_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU *------------------------------------------------------------------------- */ static void * -H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, - hbool_t *dirty) +H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, + hbool_t H5_ATTR_NDEBUG_UNUSED *dirty) { H5FS_sinfo_cache_ud_t *udata = (H5FS_sinfo_cache_ud_t *)_udata; /* User data for callback */ H5FS_t *fspace; /* free space manager */ @@ -1025,11 +1025,11 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, /* Check for any serialized sections */ if(fspace->serial_sect_count > 0) { - hsize_t old_tot_sect_count; /* Total section count from header */ - hsize_t old_serial_sect_count; /* Total serializable section count from header */ - hsize_t old_ghost_sect_count; /* Total ghost section count from header */ - hsize_t old_tot_space; /* Total space managed from header */ - unsigned sect_cnt_size; /* The size of the section size counts */ + hsize_t old_tot_sect_count; /* Total section count from header */ + hsize_t H5_ATTR_NDEBUG_UNUSED old_serial_sect_count; /* Total serializable section count from header */ + hsize_t H5_ATTR_NDEBUG_UNUSED old_ghost_sect_count; /* Total ghost section count from header */ + hsize_t H5_ATTR_NDEBUG_UNUSED old_tot_space; /* Total space managed from header */ + unsigned sect_cnt_size; /* The size of the section size counts */ /* Compute the size of the section counts */ sect_cnt_size = H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); @@ -1046,8 +1046,8 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, /* Walk through the image, deserializing sections */ do { - hsize_t sect_size; /* Current section size */ - size_t node_count; /* # of sections of this size */ + hsize_t sect_size = 0; /* Current section size */ + size_t node_count = 0; /* # of sections of this size */ size_t u; /* Local index variable */ /* The number of sections of this node's size */ @@ -1061,7 +1061,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, /* Loop over nodes of this size */ for(u = 0; u < node_count; u++) { H5FS_section_info_t *new_sect; /* Section that was deserialized */ - haddr_t sect_addr; /* Address of free space section in the address space */ + haddr_t sect_addr = 0; /* Address of free space section in the address space */ unsigned sect_type; /* Type of free space section */ unsigned des_flags; /* Flags from deserialize callback */ @@ -1141,7 +1141,6 @@ static herr_t H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) { const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)_thing; /* Pointer to the object */ - const H5FS_t *fspace; /* Free space header */ FUNC_ENTER_STATIC_NOERR @@ -1149,10 +1148,9 @@ H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) HDassert(sinfo); HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - fspace = sinfo->fspace; - HDassert(fspace); - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); + HDassert(sinfo->fspace); + HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); HDassert(image_len); /* Set the image length size */ @@ -1180,7 +1178,8 @@ H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) */ static herr_t H5FS__cache_sinfo_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, - size_t len, haddr_t *new_addr, size_t *new_len, unsigned *flags) + size_t H5_ATTR_NDEBUG_UNUSED len, haddr_t *new_addr, size_t H5_ATTR_NDEBUG_UNUSED *new_len, + unsigned *flags) { H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */ H5FS_t *fspace; /* Free space header */ @@ -1267,7 +1266,6 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, void *_thing) { H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */ - H5FS_t *fspace; /* Free space header */ H5FS_iter_ud_t udata; /* User data for callbacks */ uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint8_t *chksum_image = NULL; /* Points to chksum location */ @@ -1283,12 +1281,11 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, HDassert(sinfo); HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - fspace = sinfo->fspace; - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(fspace->cache_info.is_pinned); - HDassert(fspace->sect_size == len); - HDassert(fspace->sect_cls); + HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); + HDassert(sinfo->fspace->cache_info.is_pinned); + HDassert(sinfo->fspace->sect_size == len); + HDassert(sinfo->fspace->sect_cls); /* Magic number */ H5MM_memcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -1418,7 +1415,6 @@ static herr_t H5FS__cache_sinfo_free_icr(void *_thing) { H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */ - H5FS_t *fspace; /* Free space header */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1427,10 +1423,9 @@ H5FS__cache_sinfo_free_icr(void *_thing) HDassert(sinfo); HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - fspace = sinfo->fspace; - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(fspace->cache_info.is_pinned); + HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); + HDassert(sinfo->fspace->cache_info.is_pinned); /* Destroy free space info */ if(H5FS__sinfo_dest(sinfo) < 0) diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index 31fc63c..d2e1f90 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -182,7 +182,7 @@ H5_DLL H5FS_t *H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_c H5_DLL H5FS_t *H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold); -H5_DLL herr_t H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size); +H5_DLL herr_t H5FS_size(const H5FS_t *fspace, hsize_t *meta_size); H5_DLL herr_t H5FS_delete(H5F_t *f, haddr_t fs_addr); H5_DLL herr_t H5FS_close(H5F_t *f, H5FS_t *fspace); H5_DLL herr_t H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr); diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 18e915f..a047161 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -120,7 +120,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_INFO, type, &finfo2) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, &finfo2) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") /* Copy the compatible fields into the older struct */ @@ -177,10 +177,10 @@ done: * bounds. * * Before release 1.10.2, the library supports only two - * combinations of low/high bounds: + * combinations of low/high bounds: * (earliest, latest) * (latest, latest) - * Thus, this public routine does the job in switching + * Thus, this public routine does the job in switching * between the two combinations listed above. * * Starting release 1.10.2, we add v18 to the enumerated @@ -198,7 +198,7 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Vailin Choi; December 2017 - * + * *------------------------------------------------------------------------- */ herr_t @@ -227,7 +227,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, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, (int)low, (int)high) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)low, (int)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 3a8dc3b..74189c1 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3581,78 +3581,6 @@ 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_MAP: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "maps not supported in native VOL connector") - - case H5I_UNINIT: - case H5I_BADID: - case H5I_DATASPACE: - 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_SPACE_SEL_ITER: - 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 * @@ -3669,8 +3597,9 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) { void *vol_obj_file = NULL; /* File object pointer */ H5VL_loc_params_t loc_params; /* Location parameters */ - hid_t file_id = H5I_INVALID_HID; /* File ID for object */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t file_id = H5I_INVALID_HID; /* File ID for object */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) @@ -3680,7 +3609,7 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) /* Retrieve VOL file from object */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vol_obj_file) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object") /* Check if the file's ID already exists */ if(H5I_find_id(vol_obj_file, H5I_FILE, &file_id) < 0) @@ -3688,7 +3617,12 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) /* If the ID does not exist, register it with the VOL connector */ if(H5I_INVALID_HID == file_id) { - if((file_id = H5VL_register(H5I_FILE, vol_obj_file, vol_obj->connector, app_ref)) < 0) + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + if((file_id = H5VL_wrap_register(H5I_FILE, vol_obj_file, app_ref)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") } /* end if */ else { @@ -3701,6 +3635,10 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) 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_CANTRESET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_file_id() */ diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 1630d6b..0c46f59 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -291,11 +291,11 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag) H5TRACE2("e", "ib", file_id, flag); /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_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, "invalid file identifier"); /* Set atomicity value */ - if (H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, va_flag) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, va_flag) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set MPI atomicity"); done: @@ -359,11 +359,11 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) H5TRACE2("e", "i*b", file_id, flag); /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_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, "invalid file identifier"); /* Get atomicity value */ - if (H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, flag) < 0) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, flag) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MPI atomicity"); done: @@ -374,8 +374,8 @@ done: /*------------------------------------------------------------------------- * Function: H5F_mpi_retrieve_comm * - * Purpose: Retrieves an MPI communicator from the file the location ID - * is in. If the loc_id is invalid, the fapl_id is used to + * Purpose: Retrieves an MPI communicator from the file the location ID + * is in. If the loc_id is invalid, the fapl_id is used to * retrieve the communicator. * * Return: Success: Non-negative diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 6e2c994..b85305e 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -411,7 +411,6 @@ 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 herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info); /* File mount related routines */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index cfb796c..f0c28ca 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -93,7 +93,7 @@ typedef struct H5F_t H5F_t; for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ *_p++ = (uint8_t)(_n & 0xff); \ for (/*void*/; _i < 8; _i++) \ - *_p++ = (n) < 0 ? 0xff : 0; \ + *_p++ = (uint8_t)((n) < 0 ? 0xff : 0); \ (p) = (uint8_t*)(p)+8; \ } @@ -247,29 +247,29 @@ typedef struct H5F_t H5F_t; } /* Address-related macros */ -#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ - HADDR_UNDEF==(X)+(haddr_t)(Z) || \ +#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ + HADDR_UNDEF==(X)+(haddr_t)(Z) || \ (X)+(haddr_t)(Z)<(X)) #define H5F_addr_defined(X) ((X)!=HADDR_UNDEF) /* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making * certain that X is not HADDR_UNDEF and then checking that X equals Y */ -#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ +#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ (X)==(Y)) #define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) -#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ +#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)<(Y)) -#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ +#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)<=(Y)) -#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ +#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)>(Y)) -#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ +#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ + (Y)!=HADDR_UNDEF && \ (X)>=(Y)) -#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ +#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ (H5F_addr_lt((X), (Y)) ? -1 : 1)) #define H5F_addr_pow2(N) ((haddr_t)1<<(N)) #define H5F_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \ @@ -730,6 +730,7 @@ typedef enum H5F_prefix_open_t { /***************************************/ /* Private functions */ +H5_DLL herr_t H5F_init(void); H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref); diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 125d6cf..f95f13d 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -344,7 +344,7 @@ H5F__cache_superblock_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *------------------------------------------------------------------------- */ static herr_t -H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len, +H5F__cache_superblock_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, size_t *actual_len) { const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ @@ -434,7 +434,7 @@ H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata *------------------------------------------------------------------------- */ static void * -H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata, +H5F__cache_superblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5F_super_t *sblock = NULL; /* File's superblock */ @@ -867,7 +867,7 @@ H5F__cache_drvrinfo_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *i *------------------------------------------------------------------------- */ static herr_t -H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len, +H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, size_t *actual_len) { const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ @@ -911,7 +911,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata, +H5F__cache_drvrinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5O_drvinfo_t *drvinfo = NULL; /* Driver info */ @@ -1006,7 +1006,7 @@ H5F__cache_drvrinfo_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t len, +H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5O_drvinfo_t *drvinfo = (H5O_drvinfo_t *)_thing; /* Pointer to the object */ @@ -144,6 +144,29 @@ static hbool_t H5G_top_package_initialize_s = FALSE; /*------------------------------------------------------------------------- + * Function: H5G_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + *------------------------------------------------------------------------- + */ +herr_t +H5G_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 H5G_init() */ + + +/*------------------------------------------------------------------------- * Function: H5G__init_package * * Purpose: Initializes the H5G interface. @@ -318,9 +341,9 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id) { void *grp = NULL; /* Structure for new group */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + 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); @@ -413,7 +436,7 @@ hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) { void *grp = NULL; /* Structure for new group */ - H5VL_object_t *vol_obj = NULL; /* Object token for loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object for loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -475,10 +498,10 @@ done: 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 */ + void *grp = NULL; /* Group opened */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, gapl_id); @@ -534,7 +557,7 @@ hid_t H5Gget_create_plist(hid_t group_id) { H5VL_object_t *vol_obj = NULL; - hid_t ret_value = H5I_INVALID_HID; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", group_id); diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index fcb16d3..126456b 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -173,10 +173,9 @@ 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; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; 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) @@ -228,7 +227,8 @@ 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, lcpl_id, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, 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 */ @@ -269,7 +269,7 @@ 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 */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -289,7 +289,8 @@ 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_GROUP_ACCESS_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 */ @@ -316,7 +317,6 @@ 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; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -334,19 +334,19 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Create link */ if(type == H5L_TYPE_HARD) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object 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 */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ loc_params1.type = H5VL_OBJECT_BY_NAME; loc_params1.obj_type = H5I_get_type(cur_loc_id); loc_params1.loc_data.loc_by_name.name = cur_name; - loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params2.type = H5VL_OBJECT_BY_NAME; loc_params2.loc_data.loc_by_name.name = new_name; - loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; /* get the location object */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) @@ -357,16 +357,17 @@ 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, vol_obj->data, &loc_params1) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj->data, &loc_params1) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object 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.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params.obj_type = H5I_get_type(cur_loc_id); /* get the location object */ @@ -374,7 +375,8 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* 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, cur_name) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else-if */ else @@ -397,7 +399,6 @@ 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; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -415,20 +416,20 @@ 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; /* Object token of loc_id */ - H5VL_object_t *vol_obj2; /* Object token of loc_id */ + H5VL_object_t *vol_obj1; /* Object of loc_id */ + H5VL_object_t *vol_obj2; /* Object of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; 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_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params2.type = H5VL_OBJECT_BY_NAME; loc_params2.obj_type = H5I_get_type(new_loc_id); loc_params2.loc_data.loc_by_name.name = new_name; - loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; /* get the location object */ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id))) @@ -437,11 +438,12 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* 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, vol_obj1->data, &loc_params1) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, &loc_params1) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Soft links only need one location, the new_loc_id, but it's possible that @@ -451,7 +453,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, 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.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params.obj_type = H5I_get_type(new_loc_id); /* get the location object */ @@ -459,7 +461,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* 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, cur_name) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cur_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else-if */ else @@ -480,7 +483,7 @@ done: herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -495,18 +498,19 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) 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_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params2.type = H5VL_OBJECT_BY_NAME; loc_params2.loc_data.loc_by_name.name = dst_name; - loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; + loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_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(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_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: @@ -525,9 +529,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 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 of dst_id */ H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -541,13 +545,13 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* 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.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_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.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params2.obj_type = H5I_get_type(dst_loc_id); if(H5L_SAME_LOC != src_loc_id) @@ -560,7 +564,8 @@ 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_LINK_CREATE_DEFAULT, + H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -578,7 +583,7 @@ done: herr_t H5Gunlink(hid_t loc_id, const char *name) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -622,7 +627,7 @@ done: herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -675,7 +680,7 @@ done: herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -700,7 +705,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_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: @@ -734,7 +739,7 @@ done: int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; ssize_t op_ret; /* Return value from operation */ int ret_value; /* Return value */ @@ -762,7 +767,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier") /* Get the comment */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_GET_COMMENT, &loc_params, buf, bufsize, &op_ret) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, buf, bufsize, &op_ret) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, -1, "unable to get comment value") /* Set return value */ @@ -801,7 +806,7 @@ herr_t H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_obj; /* Index of last object looked at */ @@ -838,7 +843,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_NATIVE_GROUP_ITERATE_OLD, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) + if((ret_value = H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links"); /* Set the index we stopped at */ @@ -869,7 +874,7 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5I_type_t id_type; /* Type of ID */ H5VL_loc_params_t loc_params; H5G_info_t grp_info; /* Group information */ @@ -926,7 +931,7 @@ herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -934,11 +939,11 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf); /* Check arguments */ - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ - if (H5CX_set_loc(loc_id) < 0) + if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Retrieve object info */ @@ -949,11 +954,11 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, 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, FAIL, "invalid location identifier"); /* Retrieve the object's information */ - if (H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_GROUP_GET_OBJINFO, &loc_params, (unsigned)follow_link, statbuf) < 0) + if(H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_GET_OBJINFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, (unsigned)follow_link, statbuf) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name); done: @@ -984,52 +989,59 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c FUNC_ENTER_STATIC; /* Check if the name in this group resolved to a valid link */ - if (lnk == NULL && obj_loc == NULL) + 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) { + /* 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) + 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 */ + if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { + H5O_info2_t dm_info; /* Data model information */ + H5O_native_info_t nat_info; /* Native information */ + haddr_t obj_addr; /* Address of object */ - /* Go retrieve the object information */ + /* Go retrieve the data model & native 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"); + if(H5O_get_info(obj_loc->oloc, &dm_info, H5O_INFO_BASIC | H5O_INFO_TIME) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get data model object info") + if(H5O_get_native_info(obj_loc->oloc, &nat_info, H5O_INFO_HDR) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get native object info") /* Get mapped object type */ - statbuf->type = H5G_map_obj_type(oinfo.type); + statbuf->type = H5G_map_obj_type(dm_info.type); /* Get object number (i.e. address) for object */ - statbuf->objno[0] = (unsigned long)(oinfo.addr); + if(H5VL_native_token_to_addr(obj_loc->oloc->file, H5I_FILE, dm_info.token, &obj_addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + + statbuf->objno[0] = (unsigned long)(obj_addr); #if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long)); + statbuf->objno[1] = (unsigned long)(obj_addr >> 8 * sizeof(long)); #else statbuf->objno[1] = 0; #endif /* Get # of hard links pointing to object */ - statbuf->nlink = oinfo.rc; + statbuf->nlink = dm_info.rc; /* Get modification time for object */ - statbuf->mtime = oinfo.ctime; + statbuf->mtime = dm_info.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; - } - } + statbuf->ohdr.size = nat_info.hdr.space.total; + statbuf->ohdr.free = nat_info.hdr.space.free; + statbuf->ohdr.nmesgs = nat_info.hdr.nmesgs; + statbuf->ohdr.nchunks = nat_info.hdr.nchunks; + } /* end if */ + } /* end if */ done: /* Indicate that this callback didn't take ownership of the group * @@ -1084,7 +1096,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, /* If we're pointing at a soft or UD link, get the real link length and type */ if (statbuf && follow_link == 0) { - H5L_info_t linfo; /* Link information buffer */ + H5L_info2_t linfo; /* Link information buffer */ herr_t ret; /* Get information about link to the object. If this fails, e.g. @@ -1137,7 +1149,7 @@ done: ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; ssize_t ret_value; /* Return value */ @@ -1188,10 +1200,9 @@ done: H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object 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 */ + H5O_info2_t oinfo; /* Object info (contains object type) */ H5G_obj_t ret_value; /* Return value */ FUNC_ENTER_API(H5G_UNKNOWN) @@ -1211,8 +1222,7 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") /* 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_NATIVE_OBJECT_GET_INFO, &loc_params, &oinfo, fields) < 0) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &oinfo, H5O_INFO_BASIC) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info") /* Map to group object type */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 049c696..e0b8bd7 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -58,6 +58,7 @@ typedef struct { /* User data for application-style iteration over links in a group */ typedef struct { hid_t gid; /* The group ID for the application callback */ + H5O_loc_t *link_loc; /* The object location for the link */ H5G_link_iterate_t lnk_op; /* Application callback */ void *op_data; /* Application's op data */ } H5G_iter_appcall_ud_t; @@ -72,7 +73,7 @@ typedef struct { char *path; /* Path name of the link */ size_t curr_path_len; /* Current length of the path in the buffer */ size_t path_buf_size; /* Size of path buffer */ - H5L_iterate_t op; /* Application callback */ + H5L_iterate2_t op; /* Application callback */ void *op_data; /* Application's op data */ } H5G_iter_visit_ud_t; @@ -752,10 +753,10 @@ H5G_iterate_cb(const H5O_link_t *lnk, void *_udata) case H5G_LINK_OP_NEW: { - H5L_info_t info; /* Link info */ + H5L_info2_t info; /* Link info */ /* Retrieve the info for the link */ - if(H5G_link_to_info(lnk, &info) < 0) + if(H5G_link_to_info(udata->link_loc, lnk, &info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link") /* Make the application callback */ @@ -812,6 +813,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, /* Set up user data for callback */ udata.gid = gid; + udata.link_loc = &grp->oloc; udata.lnk_op = *lnk_op; udata.op_data = op_data; @@ -872,7 +874,7 @@ static herr_t H5G_visit_cb(const H5O_link_t *lnk, void *_udata) { H5G_iter_visit_ud_t *udata = (H5G_iter_visit_ud_t *)_udata; /* User data for callback */ - H5L_info_t info; /* Link info */ + H5L_info2_t info; /* Link info */ H5G_loc_t obj_loc; /* Location of object */ H5G_name_t obj_path; /* Object's group hier. path */ H5O_loc_t obj_oloc; /* Object's object location */ @@ -908,7 +910,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) udata->curr_path_len += link_name_len; /* Construct the link info from the link message */ - if(H5G_link_to_info(lnk, &info) < 0) + if(H5G_link_to_info(udata->curr_loc->oloc, lnk, &info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link") /* Make the application callback */ @@ -1044,7 +1046,7 @@ done: */ 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) + H5_iter_order_t order, H5L_iterate2_t op, void *op_data) { H5G_iter_visit_ud_t udata; /* User data for callback */ H5O_linfo_t linfo; /* Link info message */ diff --git a/src/H5Glink.c b/src/H5Glink.c index 04ccbc5..6c42f1d 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -41,6 +41,8 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppublic.h" /* Property Lists */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ @@ -290,13 +292,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *info) +H5G_link_to_info(const H5O_loc_t *link_loc, const H5O_link_t *lnk, H5L_info2_t *info) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ + HDassert(link_loc); HDassert(lnk); /* Get information from the link */ @@ -308,7 +311,9 @@ H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *info) switch(lnk->type) { case H5L_TYPE_HARD: - info->u.address = lnk->u.hard.addr; + /* Serialize the address into a VOL token */ + if(H5VL_native_addr_to_token(link_loc->file, H5I_FILE, lnk->u.hard.addr, &info->u.token) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") break; case H5L_TYPE_SOFT: diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 40d56c6..4d89abb 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -73,15 +73,24 @@ typedef struct { H5G_loc_t *loc; /* Group location to set */ } H5G_loc_fbi_t; -/* User data for getting an object's info in a group */ +/* User data for getting an object's data model info in a group */ typedef struct { /* downward */ - unsigned fields; /* which fields in H5O_info_t struct to fill in */ + unsigned fields; /* which fields in H5O_info2_t struct to fill in */ /* upward */ - H5O_info_t *oinfo; /* Object information to retrieve */ + H5O_info2_t *oinfo; /* Object information to retrieve */ } H5G_loc_info_t; +/* User data for getting an object's native info in a group */ +typedef struct { + /* downward */ + unsigned fields; /* which fields in H5O_native_info_t struct to fill in */ + + /* upward */ + H5O_native_info_t *oinfo; /* Object information to retrieve */ +} H5G_loc_native_info_t; + /* User data for setting an object's comment in a group */ typedef struct { /* downward */ @@ -112,6 +121,12 @@ static herr_t H5G__loc_find_cb(H5G_loc_t *grp_loc, const char *name, static herr_t H5G__loc_find_by_idx_cb(H5G_loc_t *grp_loc, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc); +static herr_t H5G__loc_addr_cb(H5G_loc_t *grp_loc, const char *name, + const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc); +static herr_t H5G__loc_info_cb(H5G_loc_t *grp_loc, const char *name, + const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc); +static herr_t H5G__loc_native_info_cb(H5G_loc_t *grp_loc, const char *name, + const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc); static herr_t H5G__loc_set_comment_cb(H5G_loc_t *grp_loc, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata, H5G_own_loc_t *own_loc); @@ -684,9 +699,81 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_loc_info_cb + * Function: H5G__loc_addr_cb * - * Purpose: Callback for retrieving object info for an object in a group + * Purpose: Callback for retrieving the address for an object in a group + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Saturday, December 21, 2019 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G__loc_addr_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, + void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) +{ + haddr_t *udata = (haddr_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name in this group resolved to a valid link */ + if(obj_loc == NULL) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") + + /* Set address of object */ + *udata = obj_loc->oloc->addr; + +done: + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__loc_addr_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5G__loc_addr + * + * Purpose: Retrieve the information for an object from a group location + * and path to that object + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, November 23, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G__loc_addr(const H5G_loc_t *loc, const char *name, haddr_t *addr/*out*/) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args. */ + HDassert(loc); + HDassert(name && *name); + HDassert(addr); + + /* Traverse group hierarchy to locate object */ + if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_addr_cb, addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__loc_addr() */ + + +/*------------------------------------------------------------------------- + * Function: H5G__loc_info_cb + * + * Purpose: Callback for retrieving data model info for an object in a group * * Return: Non-negative on success/Negative on failure * @@ -696,13 +783,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_loc_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t H5_ATTR_UNUSED *lnk, +H5G__loc_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { H5G_loc_info_t *udata = (H5G_loc_info_t *)_udata; /* User data passed in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check if the name in this group resolved to a valid link */ if(obj_loc == NULL) @@ -718,13 +805,13 @@ done: *own_loc = H5G_OWN_NONE; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_loc_info_cb() */ +} /* end H5G__loc_info_cb() */ /*------------------------------------------------------------------------- * Function: H5G_loc_info * - * Purpose: Retrieve the information for an object from a group location + * Purpose: Retrieve the data model information for an object from a group location * and path to that object * * Return: Non-negative on success/Negative on failure @@ -735,7 +822,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/, unsigned fields) +H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info2_t *oinfo/*out*/, unsigned fields) { H5G_loc_info_t udata; /* User data for traversal callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -752,7 +839,7 @@ H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/, u udata.oinfo = oinfo; /* Traverse group hierarchy to locate object */ - if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G_loc_info_cb, &udata) < 0) + if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_info_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") done: @@ -761,6 +848,84 @@ done: /*------------------------------------------------------------------------- + * Function: H5G__loc_native_info_cb + * + * Purpose: Callback for retrieving native info for an object in a group + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, November 23, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5G__loc_native_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t H5_ATTR_UNUSED *lnk, + H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) +{ + H5G_loc_native_info_t *udata = (H5G_loc_native_info_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name in this group resolved to a valid link */ + if(obj_loc == NULL) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") + + /* Query object information */ + if(H5O_get_native_info(obj_loc->oloc, udata->oinfo, udata->fields) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object info") + +done: + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G__loc_native_info_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_loc_native_info + * + * Purpose: Retrieve the native information for an object from a group location + * and path to that object + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, November 23, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_loc_native_info(const H5G_loc_t *loc, const char *name, H5O_native_info_t *oinfo/*out*/, + unsigned fields) +{ + H5G_loc_native_info_t udata; /* User data for traversal callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check args. */ + HDassert(loc); + HDassert(name && *name); + HDassert(oinfo); + + /* Set up user data for locating object */ + udata.fields = fields; + udata.oinfo = oinfo; + + /* Traverse group hierarchy to locate object */ + if(H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_native_info_cb, &udata) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_loc_native_info() */ + + +/*------------------------------------------------------------------------- * Function: H5G__loc_set_comment_cb * * Purpose: Callback for (re)setting object comment for an object in a group diff --git a/src/H5Gname.c b/src/H5Gname.c index 86a0c2f..4b0f04c 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -42,6 +42,8 @@ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory wrappers */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ @@ -1195,16 +1197,16 @@ done: * Purpose: Callback for retrieving object's name by address * * Return: Positive if path is for object desired - * 0 if not correct object - * negative on failure. + * 0 if not correct object + * negative on failure. * * Programmer: Quincey Koziol - * November 4 2007 + * November 4 2007 * *------------------------------------------------------------------------- */ static herr_t -H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo, +H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, void *_udata) { H5G_gnba_iter_t *udata = (H5G_gnba_iter_t *)_udata; /* User data for iteration */ @@ -1212,7 +1214,7 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo, H5G_name_t obj_path; /* Object's group hier. path */ H5O_loc_t obj_oloc; /* Object's object location */ hbool_t obj_found = FALSE; /* Object at 'path' found */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1223,31 +1225,39 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info_t *linfo, HDassert(udata->path == NULL); /* Check for hard link with correct address */ - if(linfo->type == H5L_TYPE_HARD && udata->loc->addr == linfo->u.address) { - H5G_loc_t grp_loc; /* Location of group */ - - /* Get group's location */ - if(H5G_loc(gid, &grp_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "bad group location") - - /* Set up opened object location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); - - /* Find the object */ - if(H5G_loc_find(&grp_loc, path, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found") - obj_found = TRUE; - - /* Check for object in same file (handles mounted files) */ - /* (re-verify address, in case we traversed a file mount) */ - if(udata->loc->addr == obj_loc.oloc->addr && udata->loc->file == obj_loc.oloc->file) { - if(NULL == (udata->path = H5MM_strdup(path))) - HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, H5_ITER_ERROR, "can't duplicate path string") - - /* We found a match so we return immediately */ - HGOTO_DONE(H5_ITER_STOP) + if(linfo->type == H5L_TYPE_HARD) { + haddr_t link_addr; + + /* Retrieve hard link address from VOL token */ + if(H5VL_native_token_to_addr(udata->loc->file, H5I_FILE, linfo->u.token, &link_addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + + if(udata->loc->addr == link_addr) { + H5G_loc_t grp_loc; /* Location of group */ + + /* Get group's location */ + if(H5G_loc(gid, &grp_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "bad group location") + + /* Set up opened object location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object */ + if(H5G_loc_find(&grp_loc, path, &obj_loc/*out*/) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found") + obj_found = TRUE; + + /* Check for object in same file (handles mounted files) */ + /* (re-verify address, in case we traversed a file mount) */ + if(udata->loc->addr == obj_loc.oloc->addr && udata->loc->file == obj_loc.oloc->file) { + if(NULL == (udata->path = H5MM_strdup(path))) + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, H5_ITER_ERROR, "can't duplicate path string") + + /* We found a match so we return immediately */ + HGOTO_DONE(H5_ITER_STOP) + } /* end if */ } /* end if */ } /* end if */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index b79b7d2..35b90f3 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -762,12 +762,11 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, +H5G_node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key/*in,out*/, hbool_t H5_ATTR_UNUSED *lt_key_changed/*out*/, void *_udata/*in,out*/, void *_rt_key/*in,out*/, hbool_t *rt_key_changed/*out*/) { - H5G_node_key_t *lt_key = (H5G_node_key_t *)_lt_key; H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key; H5G_bt_rm_t *udata = (H5G_bt_rm_t *)_udata; H5G_node_t *sn = NULL; @@ -781,7 +780,7 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/, /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); - HDassert(lt_key); + HDassert((H5G_node_key_t *)_lt_key); HDassert(rt_key); HDassert(udata && udata->common.heap); @@ -1256,7 +1255,7 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, /* expand soft link */ if(H5G_CACHED_SLINK == src_ent->type && cpy_info->expand_soft_link) { - H5O_info_t oinfo; /* Information about object pointed to by soft link */ + haddr_t obj_addr; /* Address of object pointed to by soft link */ H5G_loc_t grp_loc; /* Group location holding soft link */ H5G_name_t grp_path; /* Path for group holding soft link */ char *link_name; /* Pointer to value of soft link */ @@ -1274,9 +1273,8 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name") /* Check if the object pointed by the soft link exists in the source file */ - /* Only basic information is needed */ - if(H5G_loc_info(&grp_loc, link_name, &oinfo, H5O_INFO_BASIC) >= 0) { - tmp_src_ent.header = oinfo.addr; + if(H5G__loc_addr(&grp_loc, link_name, &obj_addr) >= 0) { + tmp_src_ent.header = obj_addr; src_ent = &tmp_src_ent; } /* end if */ else diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index f475bde..6dc025c 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -498,6 +498,8 @@ H5_DLL herr_t H5G__name_init(H5G_name_t *name, const char *path); */ H5_DLL herr_t H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info); +H5_DLL herr_t H5G__loc_addr(const H5G_loc_t *loc, const char *name, + haddr_t *addr/*out*/); /* Testing functions */ #ifdef H5G_TESTING diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index f149f29..19b120c 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -174,7 +174,7 @@ typedef struct { #ifndef H5_NO_DEPRECATED_SYMBOLS H5G_iterate_t op_old; /* "Old" application callback for each link */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - H5L_iterate_t op_new; /* "New" application callback for each link */ + H5L_iterate2_t op_new; /* "New" application callback for each link */ } op_func; } H5G_link_iterate_t; @@ -186,6 +186,7 @@ typedef struct H5G_entry_t H5G_entry_t; * Library prototypes... These are the ones that other packages routinely * call. */ +H5_DLL herr_t H5G_init(void); H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp); H5_DLL H5G_name_t * H5G_nameof(const H5G_t *grp); H5_DLL H5F_t *H5G_fileof(H5G_t *grp); @@ -213,12 +214,12 @@ 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(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); + H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, void *op_data); /* * Functions that understand links in groups */ -H5_DLL herr_t H5G_link_to_info(const struct H5O_link_t *lnk, H5L_info_t *linfo); +H5_DLL herr_t H5G_link_to_info(const struct H5O_loc_t *link_loc, const struct H5O_link_t *lnk, H5L_info2_t *linfo); /* * Functions that understand group objects @@ -278,7 +279,9 @@ H5_DLL herr_t H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name, H5G_loc_t *obj_loc/*out*/); H5_DLL htri_t H5G_loc_exists(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5G_loc_info(const H5G_loc_t *loc, const char *name, - H5O_info_t *oinfo/*out*/, unsigned fields); + H5O_info2_t *oinfo/*out*/, unsigned fields); +H5_DLL herr_t H5G_loc_native_info(const H5G_loc_t *loc, const char *name, + H5O_native_info_t *oinfo/*out*/, unsigned fields); H5_DLL herr_t H5G_loc_set_comment(const H5G_loc_t *loc, const char *name, const char *comment); H5_DLL ssize_t H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 492b5b9..7482e27 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -201,11 +201,15 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") /* User-defined callback function */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /* (Backwardly compatible with v0 H5L_class_t traverssal callback) */ if(link_class->version == H5L_LINK_CLASS_T_VERS_0) cb_return = (((const H5L_class_0_t *)link_class)->trav_func)(lnk->name, cur_grp, lnk->u.ud.udata, lnk->u.ud.size, H5CX_get_lapl()); else cb_return = (link_class->trav_func)(lnk->name, cur_grp, lnk->u.ud.udata, lnk->u.ud.size, H5CX_get_lapl(), H5CX_get_dxpl()); +#else /* H5_NO_DEPRECATED_SYMBOLS */ + cb_return = (link_class->trav_func)(lnk->name, cur_grp, lnk->u.ud.udata, lnk->u.ud.size, H5CX_get_lapl(), H5CX_get_dxpl()); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Check for failing to locate the object */ if(cb_return < 0) { diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 2d1c1f2..4a2ff91 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -403,7 +403,7 @@ H5HF__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_hdr_get_final_load_size(const void *_image, size_t image_len, +H5HF__cache_hdr_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, size_t *actual_len) { H5HF_hdr_t hdr; /* Temporary fractal heap header */ @@ -749,7 +749,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len, +H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5HF_hdr_t *hdr = (H5HF_hdr_t *)_thing; /* Fractal heap info */ @@ -979,8 +979,8 @@ H5HF__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN *------------------------------------------------------------------------- */ static void * -H5HF__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, + void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5HF_hdr_t *hdr; /* Shared fractal heap information */ H5HF_iblock_cache_ud_t *udata = (H5HF_iblock_cache_ud_t *)_udata; /* User data for callback */ @@ -1326,7 +1326,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t len, +H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5HF_hdr_t *hdr; /* Shared fractal heap information */ @@ -1471,8 +1471,8 @@ H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) else { /* if this is a child iblock, verify that the pointers are */ /* either uninitialized or set up correctly. */ - H5HF_indirect_t *par_iblock = iblock->parent; - unsigned indir_idx; /* Index in parent's child iblock pointer array */ + H5HF_indirect_t H5_ATTR_NDEBUG_UNUSED *par_iblock = iblock->parent; + unsigned H5_ATTR_NDEBUG_UNUSED indir_idx; /* Index in parent's child iblock pointer array */ /* Sanity check */ HDassert(par_iblock->child_iblocks); @@ -2438,8 +2438,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_dblock_serialize(const H5F_t *f, void *image, size_t len, - void *_thing) +H5HF__cache_dblock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, + size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5HF_direct_t *dblock = (H5HF_direct_t *)_thing; /* Direct block info */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index f5ac8e5..c11bc34 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -1185,9 +1185,9 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 H5HF_indirect_t *iblock; /* Indirect block that section's direct block resides in */ haddr_t dblock_addr; /* Direct block address */ size_t dblock_size; /* Direct block size */ - size_t dblock_overhead; /* Direct block's overhead */ unsigned dblock_status = 0; /* Direct block's status in the metadata cache */ - herr_t status; /* Generic status value */ + size_t H5_ATTR_NDEBUG_UNUSED dblock_overhead; /* Direct block's overhead */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Generic status value */ /* Sanity check settings for section's direct block's parent */ iblock = sect->u.single.parent; @@ -2038,7 +2038,7 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t const H5HF_hdr_t *hdr; /* Fractal heap header */ const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Pointer to section to check */ const H5HF_free_section_t *indir_sect; /* Pointer to underlying indirect section */ - unsigned indir_idx; /* Index of row in underlying indirect section's row array */ + unsigned H5_ATTR_NDEBUG_UNUSED indir_idx; /* Index of row in underlying indirect section's row array */ FUNC_ENTER_STATIC_NOERR @@ -4125,7 +4125,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) dir_nrows = (max_dir_row - start_row) + 1; HDassert(dir_nrows == sect->u.indirect.dir_nrows); for(u = 0; u < dir_nrows; u++) { - const H5HF_free_section_t *tmp_row_sect; /* Pointer to row section */ + const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_row_sect; /* Pointer to row section */ tmp_row_sect = sect->u.indirect.dir_rows[u]; HDassert(tmp_row_sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW @@ -4133,7 +4133,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) HDassert(tmp_row_sect->u.row.under == sect); HDassert(tmp_row_sect->u.row.row == (start_row + u)); if(u > 0) { - const H5HF_free_section_t *tmp_row_sect2; /* Pointer to row section */ + const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_row_sect2; /* Pointer to row section */ tmp_row_sect2 = sect->u.indirect.dir_rows[u - 1]; HDassert(tmp_row_sect2->u.row.row < tmp_row_sect->u.row.row); @@ -4160,7 +4160,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) HDassert(tmp_child_sect->sect_info.type == H5HF_FSPACE_SECT_INDIRECT); HDassert(tmp_child_sect->u.indirect.parent == sect); if(u > 0) { - const H5HF_free_section_t *tmp_child_sect2; /* Pointer to child indirect section */ + const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_child_sect2; /* Pointer to child indirect section */ tmp_child_sect2 = sect->u.indirect.indir_ents[u - 1]; HDassert(H5F_addr_lt(tmp_child_sect2->sect_info.addr, tmp_child_sect->sect_info.addr)); diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 37a0502..ad5ff0f 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -447,7 +447,7 @@ H5HF__space_size(H5HF_hdr_t *hdr, hsize_t *fs_size) /* Get free space metadata size */ if(hdr->fspace) { - if(H5FS_size(hdr->f, hdr->fspace, fs_size) < 0) + if(H5FS_size(hdr->fspace, fs_size) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info") } /* end if */ else diff --git a/src/H5HFtest.c b/src/H5HFtest.c index 6f174bb..d6eecd7 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -481,7 +481,7 @@ H5HF_get_id_type_test(const void *_id, unsigned char *obj_type) HDassert(obj_type); /* Get the type for a heap ID */ - *obj_type = *id & H5HF_ID_TYPE_MASK; + *obj_type = (uint8_t)(*id & H5HF_ID_TYPE_MASK); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_get_id_type_test() */ @@ -505,7 +505,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) +H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj/*out*/) { size_t need; /*total space needed for object */ size_t idx; diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 29e88df..18625cc 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -202,7 +202,7 @@ H5HG__cache_heap_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *imag *------------------------------------------------------------------------- */ static herr_t -H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len, +H5HG__cache_heap_get_final_load_size(const void *image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *udata, size_t *actual_len) { H5HG_heap_t heap; /* Global heap */ @@ -432,7 +432,7 @@ H5HG__cache_heap_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5HG__cache_heap_serialize(const H5F_t *f, void *image, size_t len, +H5HG__cache_heap_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, size_t len, void *_thing) { H5HG_heap_t *heap = (H5HG_heap_t *)_thing; diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 4841847..573ef39 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -55,7 +55,7 @@ typedef struct H5HG_heap_t H5HG_heap_t; /* Main global heap routines */ -H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/); +H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj/*out*/); H5_DLL void *H5HG_read(H5F_t *f, H5HG_t *hobj, void *object, size_t *buf_size/*out*/); H5_DLL int H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust); H5_DLL herr_t H5HG_get_obj_size(H5F_t *f, H5HG_t *hobj, size_t *obj_size); diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 8b04b47..b0ac05f 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -364,7 +364,7 @@ H5HL__cache_prefix_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *im *------------------------------------------------------------------------- */ static herr_t -H5HL__cache_prefix_get_final_load_size(const void *_image, size_t image_len, +H5HL__cache_prefix_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, size_t *actual_len) { const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ @@ -415,8 +415,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5HL__cache_prefix_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, + void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5HL_t *heap = NULL; /* Local heap */ H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */ @@ -555,7 +555,7 @@ H5HL__cache_prefix_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len, +H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5HL_prfx_t *prfx = (H5HL_prfx_t *)_thing; /* Pointer to local heap prefix to query */ @@ -826,8 +826,8 @@ H5HL__cache_datablock_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5HL__cache_datablock_serialize(const H5F_t *f, void *image, size_t len, - void *_thing) +H5HL__cache_datablock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, + size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5HL_t *heap; /* Pointer to the local heap */ H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */ @@ -1235,8 +1235,7 @@ H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) if(NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id))) HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node from skip list") - /* (Casting away const OK -QAK) */ - ret_value = (void *)curr_id->obj_ptr; + ret_value = (void *)curr_id->obj_ptr; /* (Casting away const OK -QAK) */ curr_id = H5FL_FREE(H5I_id_info_t, curr_id); /* Decrement the number of IDs in the type */ @@ -2220,7 +2219,7 @@ done: ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; ssize_t ret_value; /* Return value */ @@ -2259,8 +2258,8 @@ done: hid_t H5Iget_file_id(hid_t obj_id) { - H5I_type_t type; /* ID type */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5I_type_t type; /* ID type */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", obj_id); @@ -2269,15 +2268,15 @@ H5Iget_file_id(hid_t obj_id) type = H5I_TYPE(obj_id); /* Call internal function */ - if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - H5VL_object_t *vol_obj = NULL; /* Object token of obj_id */ + if(H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + H5VL_object_t *vol_obj; /* Object of obj_id */ /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get the file ID */ - if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) + if((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") } /* end if */ else diff --git a/src/H5Itest.c b/src/H5Itest.c index 79bc482..07c1965 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -78,7 +78,7 @@ 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 */ + H5VL_object_t *vol_obj; /* Object 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 */ @@ -96,7 +96,7 @@ H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) 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) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -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 */ /****************/ /* Local Macros */ @@ -49,7 +49,7 @@ /* User data for path traversal routine for getting link info by name */ typedef struct { - H5L_info_t *linfo; /* Buffer to return to user */ + H5L_info2_t *linfo; /* Buffer to return to user */ } H5L_trav_gi_t; /* User data for path traversal callback to creating a link */ @@ -93,6 +93,7 @@ typedef struct { void *buf; /* User buffer */ } H5L_trav_gv_t; + /********************/ /* Local Prototypes */ /********************/ @@ -274,11 +275,11 @@ 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) { - H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ + H5VL_object_t *vol_obj1 = NULL; /* Object 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 of dst_id */ H5VL_loc_params_t loc_params2; - H5VL_object_t tmp_vol_obj; /* Temporary object token */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -364,11 +365,11 @@ 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) { - H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ + H5VL_object_t *vol_obj1 = NULL; /* Object 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 of dst_id */ H5VL_loc_params_t loc_params2; - H5VL_object_t tmp_vol_obj; /* Temporary object token */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -458,7 +459,7 @@ 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) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -486,6 +487,10 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name /* Set the LCPL for the API context */ H5CX_set_lcpl(lcpl_id); + /* 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") + /* Set location fields */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = link_name; @@ -496,10 +501,6 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - /* 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(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, link_target) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") @@ -529,9 +530,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 tmp_vol_obj; /* Temporary object token of */ + H5VL_object_t *vol_obj1 = NULL; /* Object of cur_loc_id */ + H5VL_object_t *vol_obj2 = NULL; /* Object of new_loc_id */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -631,7 +632,7 @@ 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 of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -696,7 +697,7 @@ done: herr_t H5Ldelete(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 = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -753,7 +754,7 @@ 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) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -816,7 +817,7 @@ herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -872,7 +873,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -928,7 +929,7 @@ done: htri_t H5Lexists(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 = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; htri_t ret_value = FAIL; /* Return value */ @@ -965,13 +966,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lget_info + * Function: H5Lget_info2 * - * Purpose: Gets metadata for a link. + * Purpose: Gets metadata for a link. * - * Return: Success: Non-negative with information in LINFO - * - * Failure: Negative + * Return: Success: Non-negative with information in LINFO + * Failure: Negative * * Programmer: James Laird * Wednesday, June 21, 2006 @@ -979,12 +979,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, +H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ - H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ + H5VL_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); @@ -1012,17 +1012,17 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, done: FUNC_LEAVE_API(ret_value) -} /* end H5Lget_info() */ +} /* end H5Lget_info2() */ /*------------------------------------------------------------------------- - * Function: H5Lget_info_by_idx + * Function: H5Lget_info_by_idx2 * - * Purpose: Gets metadata for a link, according to the order within an + * Purpose: Gets metadata for a link, according to the order within an * index. * - * Return: Success: Non-negative with information in LINFO - * Failure: Negative + * Return: Success: Non-negative with information in LINFO + * Failure: Negative * * Programmer: Quincey Koziol * Monday, November 6, 2006 @@ -1030,13 +1030,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lget_info_by_idx(hid_t loc_id, const char *group_name, +H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linfo /*out*/, hid_t lapl_id) + H5L_info2_t *linfo /*out*/, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ - H5VL_loc_params_t loc_params; - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, @@ -1072,7 +1072,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, done: FUNC_LEAVE_API(ret_value) -} /* end H5Lget_info_by_idx() */ +} /* end H5Lget_info_by_idx2() */ /*------------------------------------------------------------------------- @@ -1115,6 +1115,10 @@ H5Lregister(const H5L_class_t *cls) */ if(cls->version > H5L_LINK_CLASS_T_VERS) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number") +#ifdef H5_NO_DEPRECATED_SYMBOLS + if(cls->version < H5L_LINK_CLASS_T_VERS) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "deprecated H5L_class_t version number (%d) and library built without deprecated symbol support", cls->version) +#endif /* H5_NO_DEPRECATED_SYMBOLS */ if(cls->id < H5L_TYPE_UD_MIN || cls->id > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number") @@ -1229,7 +1233,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; ssize_t ret_value = -1; /* Return value */ @@ -1272,7 +1276,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Literate + * Function: H5Literate2 * * Purpose: Iterates over links in a group, with user callback routine, * according to the order within an index. @@ -1290,10 +1294,10 @@ done: *------------------------------------------------------------------------- */ 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) +H5Literate2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + hsize_t *idx_p, H5L_iterate2_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ herr_t ret_value; /* Return value */ @@ -1321,16 +1325,17 @@ 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, (unsigned)FALSE, (int)idx_type, (int)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, (unsigned)FALSE, (int)idx_type, (int)order, idx_p, + op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: FUNC_LEAVE_API(ret_value) -} /* end H5Literate() */ +} /* end H5Literate2() */ /*------------------------------------------------------------------------- - * Function: H5Literate_by_name + * Function: H5Literate_by_name2 * * Purpose: Iterates over links in a group, with user callback routine, * according to the order within an index. @@ -1346,17 +1351,17 @@ done: * of the operators. * * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 16, 2006 * *------------------------------------------------------------------------- */ herr_t -H5Literate_by_name(hid_t loc_id, const char *group_name, +H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, - H5L_iterate_t op, void *op_data, hid_t lapl_id) + H5L_iterate2_t op, void *op_data, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ @@ -1391,7 +1396,8 @@ 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: @@ -1400,7 +1406,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Lvisit + * Function: H5Lvisit2 * * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within @@ -1423,15 +1429,15 @@ done: * of the operators. * * Programmer: Quincey Koziol - * November 24 2007 + * November 24 2007 * *------------------------------------------------------------------------- */ herr_t -H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, - H5L_iterate_t op, void *op_data) +H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + H5L_iterate2_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ herr_t ret_value; /* Return value */ @@ -1459,16 +1465,17 @@ 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: FUNC_LEAVE_API(ret_value) -} /* end H5Lvisit() */ +} /* end H5Lvisit2() */ /*------------------------------------------------------------------------- - * Function: H5Lvisit_by_name + * Function: H5Lvisit_by_name2 * * Purpose: Recursively visit all the links in a group and all * the groups that are linked to from that group. Links within @@ -1490,16 +1497,16 @@ done: * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 3 2007 + * Programmer: Quincey Koziol + * November 3 2007 * *------------------------------------------------------------------------- */ 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) +H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ @@ -1534,12 +1541,13 @@ 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: FUNC_LEAVE_API(ret_value) -} /* end H5Lvisit_by_name() */ +} /* end H5Lvisit_by_name2() */ /* *------------------------------------------------------------------------- @@ -3143,7 +3151,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L__get_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, +H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { @@ -3157,7 +3165,7 @@ H5L__get_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNU HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") /* Get information from the link */ - if(H5G_link_to_info(lnk, udata->linfo) < 0) + if(H5G_link_to_info(grp_loc->oloc, lnk, udata->linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") done: @@ -3172,9 +3180,9 @@ done: /*------------------------------------------------------------------------- * Function: H5L_get_info * - * Purpose: Returns metadata about a link. + * Purpose: Returns metadata about a link. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: James Laird * Monday, April 17 2006 @@ -3182,7 +3190,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linfo/*out*/) +H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linfo/*out*/) { H5L_trav_gi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3235,7 +3243,7 @@ H5L__get_info_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_A lnk_copied = TRUE; /* Get information from the link */ - if(H5G_link_to_info(&fnd_lnk, udata->linfo) < 0) + if(H5G_link_to_info(obj_loc->oloc, &fnd_lnk, udata->linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") done: @@ -3263,7 +3271,7 @@ done: */ 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_iter_order_t order, hsize_t n, H5L_info2_t *linfo /*out*/) { H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3516,7 +3524,7 @@ done: */ 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) + H5_iter_order_t order, hsize_t *idx_p, H5L_iterate2_t op, void *op_data) { H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_lnk; /* Index of last object looked at */ diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c new file mode 100644 index 0000000..8b83230 --- /dev/null +++ b/src/H5Ldeprec.c @@ -0,0 +1,628 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: Deprecated functions from the H5L interface. These + * functions are here for compatibility purposes and may be + * removed in the future. Applications should switch to the + * newer APIs. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Lmodule.h" /* This source code file is part of the H5L module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lpkg.h" /* Links */ + +#include "H5VLnative_private.h" + +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Shim data for using native H5Literate/visit callbacks with the VOL */ +typedef struct H5L_shim_data_t { + H5L_iterate1_t real_op; + void *real_op_data; +} H5L_shim_data_t; + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5L__iterate2_shim + * + * Purpose: Shim function for translating between H5L_info2_t and + * H5L_info1_t structures, as used by H5Literate2/H5Lvisit2 + * and H5Literate1/H5Lvisit1, respectively. + * + * Return: Success: H5_ITER_CONT or H5_ITER_STOP + * Failure: H5_ITER_ERROR + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__iterate2_shim(hid_t group_id, const char *name, const H5L_info2_t *linfo2, void *op_data) +{ + H5L_shim_data_t *shim_data = (H5L_shim_data_t *)op_data; + H5L_info1_t linfo; + herr_t ret_value = H5_ITER_CONT; + + FUNC_ENTER_STATIC + + /* Copy the new-style members into the old-style struct */ + if (linfo2) { + linfo.type = linfo2->type; + linfo.corder_valid = linfo2->corder_valid; + linfo.corder = linfo2->corder; + linfo.cset = linfo2->cset; + if (H5L_TYPE_HARD == linfo2->type) { + if(H5VLnative_token_to_addr(group_id, linfo2->u.token, &linfo.u.address) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, H5_ITER_ERROR, "can't deserialize object token into address") + } + else + linfo.u.val_size = linfo2->u.val_size; + } + + /* Invoke the real callback */ + ret_value = shim_data->real_op(group_id, name, &linfo, shim_data->real_op_data); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__iterate2_shim() */ + + +/*------------------------------------------------------------------------- + * Function: H5Literate1 + * + * Purpose: Iterates over links in a group, with user callback routine, + * according to the order within an index. + * + * Same pattern of behavior as H5Giterate. + * + * Note: Deprecated in favor of H5Literate2 + * + * 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. + * + *------------------------------------------------------------------------- + */ +herr_t +H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + hsize_t *idx_p, H5L_iterate1_t op, void *op_data) +{ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5I_type_t id_type; /* Type of ID */ + H5L_shim_data_t shim_data; + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "iIiIo*hx*x", group_id, idx_type, order, idx_p, op, op_data); + + /* Check arguments */ + 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") + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + 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") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Literate1 is only meant to be used with the native VOL connector") + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(group_id); + + /* Set up shim */ + shim_data.real_op = op; + shim_data.real_op_data = op_data; + + /* Iterate over the links */ + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (unsigned)FALSE, (int)idx_type, (int)order, idx_p, + H5L__iterate2_shim, (void *)&shim_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Literate1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Literate_by_name1 + * + * Purpose: Iterates over links in a group, with user callback routine, + * according to the order within an index. + * + * Same pattern of behavior as H5Giterate. + * + * Note: Deprecated in favor of H5Literate_by_name2 + * + * 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. + * + * + * Programmer: Quincey Koziol + * Thursday, November 16, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Literate_by_name1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, + H5L_iterate1_t op, void *op_data, hid_t lapl_id) +{ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5L_shim_data_t shim_data; + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + 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) + 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") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + 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") + + /* 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 if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Literate_by_name1 is only meant to be used with the native VOL connector") + + /* 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; + + /* Set up shim */ + shim_data.real_op = op; + shim_data.real_op_data = op_data; + + /* Iterate over the links */ + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, + H5L__iterate2_shim, (void *)&shim_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Literate_by_name1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Lget_info1 + * + * Purpose: Gets metadata for a link. + * + * Note: Deprecated in favor of H5Lget_info2 + * + * Return: Success: Non-negative with information in LINFO + * Failure: Negative + * + * Programmer: James Laird + * Wednesday, June 21, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, + hid_t lapl_id) +{ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ + H5VL_loc_params_t loc_params; + H5L_info2_t linfo2; /* New-style link info */ + hbool_t is_native_vol_obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id); + + /* Check arguments */ + if(!name || !*name) + 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) + 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") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lget_info1 is only meant to be used with the native VOL connector") + + /* Get the link information */ + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &linfo2) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + + /* Copy the new-style members into the old-style struct */ + if(linfo) { + linfo->type = linfo2.type; + linfo->corder_valid = linfo2.corder_valid; + linfo->corder = linfo2.corder; + linfo->cset = linfo2.cset; + if(H5L_TYPE_HARD == linfo2.type) { + void *vol_obj_data; + + if(NULL == (vol_obj_data = H5VL_object_data(vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + + if(H5VL_native_token_to_addr(vol_obj_data, loc_params.obj_type, linfo2.u.token, &linfo->u.address) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + } /* end if */ + else + linfo->u.val_size = linfo2.u.val_size; + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Lget_info1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Lget_info_by_idx1 + * + * Purpose: Gets metadata for a link, according to the order within an + * index. + * + * Note: Deprecated in favor of H5Lget_info_by_idx2 + * + * Return: Success: Non-negative with information in LINFO + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, November 6, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + H5L_info1_t *linfo /*out*/, hid_t lapl_id) +{ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ + H5VL_loc_params_t loc_params; + H5L_info2_t linfo2; /* New-style link info */ + hbool_t is_native_vol_obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, + lapl_id); + + /* Check arguments */ + 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) + 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") + + /* 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") + + 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") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lget_info_by_idx1 is only meant to be used with the native VOL connector") + + /* Get the link information */ + if(H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &linfo2) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + + /* Copy the new-style members into the old-style struct */ + if(linfo) { + linfo->type = linfo2.type; + linfo->corder_valid = linfo2.corder_valid; + linfo->corder = linfo2.corder; + linfo->cset = linfo2.cset; + if(H5L_TYPE_HARD == linfo2.type) { + void *vol_obj_data; + + if(NULL == (vol_obj_data = H5VL_object_data(vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + + if(H5VL_native_token_to_addr(vol_obj_data, loc_params.obj_type, linfo2.u.token, &linfo->u.address) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + } /* end if */ + else + linfo->u.val_size = linfo2.u.val_size; + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Lget_info_by_idx1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Lvisit1 + * + * 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 + * a particular group, then the "name" index is used). + * + * NOTE: Each _link_ reachable from the initial group will only be + * visited once. However, because an object may be reached from + * more than one link, the visitation may call the application's + * callback with more than one link that points to a particular + * _object_. + * + * Note: Deprecated in favor of H5Lvisit2 + * + * 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. + * + * Programmer: Quincey Koziol + * November 24 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + H5L_iterate1_t op, void *op_data) +{ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5I_type_t id_type; /* Type of ID */ + H5L_shim_data_t shim_data; + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "iIiIox*x", group_id, idx_type, order, op, op_data); + + /* Check args */ + 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") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + 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") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lvisit1 is only meant to be used with the native VOL connector") + + /* Set up shim */ + shim_data.real_op = op; + shim_data.real_op_data = op_data; + + /* Iterate over the links */ + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, TRUE, idx_type, order, NULL, H5L__iterate2_shim, (void *)&shim_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Lvisit1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Lvisit_by_name1 + * + * 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 + * a particular group, then the "name" index is used). + * + * NOTE: Each _link_ reachable from the initial group will only be + * visited once. However, because an object may be reached from + * more than one link, the visitation may call the application's + * callback with more than one link that points to a particular + * _object_. + * + * Note: Deprecated in favor of H5Lvisit_by_name2 + * + * 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. + * + * Programmer: Quincey Koziol + * November 3 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, H5L_iterate1_t op, void *op_data, hid_t lapl_id) +{ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5L_shim_data_t shim_data; + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + 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) + 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") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback 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") + + /* 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 if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "H5Lvisit_by_name1 is only meant to be used with the native VOL connector") + + /* 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; + + /* Set up shim */ + shim_data.real_op = op; + shim_data.real_op_data = op_data; + + /* Visit the links */ + if((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, TRUE, idx_type, order, NULL, H5L__iterate2_shim, (void *)&shim_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Lvisit_by_name1() */ + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index e075ed7..1b007b6 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -341,7 +341,7 @@ herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; char *norm_obj_name = NULL; /* Pointer to normalized current name */ void *ext_link_buf = NULL; /* Buffer to contain external link */ @@ -371,6 +371,10 @@ H5Lcreate_external(const char *file_name, const char *obj_name, /* Set the LCPL for the API context */ H5CX_set_lcpl(lcpl_id); + /* 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") + /* 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") @@ -389,10 +393,6 @@ H5Lcreate_external(const char *file_name, const char *obj_name, p += file_name_len; HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ - /* 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; diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index fa3c097..ab68b84 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -63,12 +63,12 @@ typedef struct { /* User data for path traversal routine for getting link info by index */ typedef struct { /* In */ - H5_index_t idx_type; /* Index to use */ + H5_index_t idx_type; /* Index to use */ H5_iter_order_t order; /* Order to iterate in index */ hsize_t n; /* Offset of link within index */ /* Out */ - H5L_info_t *linfo; /* Buffer to return to user */ + H5L_info2_t *linfo; /* Buffer to return to user */ } H5L_trav_gibi_t; /* User data for path traversal routine for getting name by index */ @@ -98,7 +98,6 @@ typedef struct H5L_elink_cb_t { void *user_data; } H5L_elink_cb_t; - /*****************************/ /* Library Private Variables */ /*****************************/ @@ -124,13 +123,13 @@ H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name, 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*/); + H5L_info2_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*/); + H5L_info2_t *linfo /*out*/); H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size); @@ -142,7 +141,7 @@ H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, 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); + H5L_iterate2_t op, void *op_data); /* User-defined link functions */ H5_DLL herr_t H5L_register(const H5L_class_t *cls); diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index 7bdb001..3bac5ac 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -27,6 +27,7 @@ /* Public headers needed by this file */ #include "H5public.h" /* Generic Functions */ #include "H5Ipublic.h" /* IDs */ +#include "H5Opublic.h" /* Object Headers */ #include "H5Tpublic.h" /* Datatypes */ /*****************/ @@ -43,9 +44,6 @@ /* Current version of the H5L_class_t struct */ #define H5L_LINK_CLASS_T_VERS 1 -/* Previous versions of the H5L_class_t struct */ -#define H5L_LINK_CLASS_T_VERS_0 0 - #ifdef __cplusplus extern "C" { #endif @@ -72,17 +70,19 @@ typedef enum { #define H5L_TYPE_BUILTIN_MAX H5L_TYPE_SOFT /* Maximum value link value for "built-in" link types */ #define H5L_TYPE_UD_MIN H5L_TYPE_EXTERNAL /* Link ids at or above this value are "user-defined" link types. */ -/* Information struct for link (for H5Lget_info/H5Lget_info_by_idx) */ +/* Information struct for link (for H5Lget_info2/H5Lget_info_by_idx2) + * H5O_token_t version used in VOL layer and future public API calls + */ typedef struct { H5L_type_t type; /* Type of link */ hbool_t corder_valid; /* Indicate if creation order is valid */ int64_t corder; /* Creation order */ H5T_cset_t cset; /* Character set of link name */ union { - haddr_t address; /* Address hard link points to */ + H5O_token_t token; /* Token of location that hard link points to */ size_t val_size; /* Size of a soft link or UD link value */ } u; -} H5L_info_t; +} H5L_info2_t; /* The H5L_class_t struct can be used to override the behavior of a * "user-defined" link class. Users should populate the struct with callback @@ -102,8 +102,6 @@ typedef herr_t (*H5L_copy_func_t)(const char *new_name, hid_t new_loc, const void *lnkdata, size_t lnkdata_size); /* Callback during link traversal */ -typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, - const void *lnkdata, size_t lnkdata_size, hid_t lapl_id); typedef hid_t (*H5L_traverse_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata, size_t lnkdata_size, hid_t lapl_id, hid_t dxpl_id); @@ -116,19 +114,6 @@ typedef herr_t (*H5L_delete_func_t)(const char *link_name, hid_t file, typedef ssize_t (*H5L_query_func_t)(const char *link_name, const void *lnkdata, size_t lnkdata_size, void *buf /*out*/, size_t buf_size); -/* User-defined link types */ -typedef struct { - int version; /* Version number of this struct */ - H5L_type_t id; /* Link type ID */ - const char *comment; /* Comment for debugging */ - H5L_create_func_t create_func; /* Callback during link creation */ - H5L_move_func_t move_func; /* Callback after moving link */ - H5L_copy_func_t copy_func; /* Callback after copying link */ - H5L_traverse_0_func_t trav_func; /* Callback during link traversal */ - H5L_delete_func_t del_func; /* Callback for link deletion */ - H5L_query_func_t query_func; /* Callback for queries */ -} H5L_class_0_t; - typedef struct { int version; /* Version number of this struct */ H5L_type_t id; /* Link type ID */ @@ -141,8 +126,10 @@ typedef struct { H5L_query_func_t query_func; /* Callback for queries */ } H5L_class_t; -/* Prototype for H5Literate/H5Literate_by_name() operator */ -typedef herr_t (*H5L_iterate_t)(hid_t group, const char *name, const H5L_info_t *info, +/* Prototype for H5Literate2/H5Literate_by_name2() operator + * H5O_token_t version used in VOL layer and future public API calls + */ +typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); /* Callback for external link traversal */ @@ -177,23 +164,23 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size, hid_t lapl_id); H5_DLL htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id); -H5_DLL herr_t H5Lget_info(hid_t loc_id, const char *name, - H5L_info_t *linfo /*out*/, hid_t lapl_id); -H5_DLL herr_t H5Lget_info_by_idx(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name, + H5L_info2_t *linfo /*out*/, hid_t lapl_id); +H5_DLL herr_t H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linfo /*out*/, hid_t lapl_id); + H5L_info2_t *linfo /*out*/, hid_t lapl_id); H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id); -H5_DLL herr_t H5Literate(hid_t grp_id, H5_index_t idx_type, - H5_iter_order_t order, hsize_t *idx, H5L_iterate_t op, void *op_data); -H5_DLL herr_t H5Literate_by_name(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data); +H5_DLL herr_t H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, - H5L_iterate_t op, void *op_data, hid_t lapl_id); -H5_DLL herr_t H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, - H5L_iterate_t op, void *op_data); -H5_DLL 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, + H5L_iterate2_t op, void *op_data, hid_t lapl_id); +H5_DLL herr_t H5Lvisit2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, + H5L_iterate2_t op, void *op_data); +H5_DLL herr_t H5Lvisit_by_name2(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id); /* UD link functions */ @@ -210,6 +197,73 @@ H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval/*in*/, size_t link_siz H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id); +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/* Macros */ + +/* Previous versions of the H5L_class_t struct */ +#define H5L_LINK_CLASS_T_VERS_0 0 + + +/* Typedefs */ + +/* Information struct for link (for H5Lget_info1/H5Lget_info_by_idx1) */ +typedef struct { + H5L_type_t type; /* Type of link */ + hbool_t corder_valid; /* Indicate if creation order is valid */ + int64_t corder; /* Creation order */ + H5T_cset_t cset; /* Character set of link name */ + union { + haddr_t address; /* Address hard link points to */ + size_t val_size; /* Size of a soft link or UD link value */ + } u; +} H5L_info1_t; + +/* Callback during link traversal */ +typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, + const void *lnkdata, size_t lnkdata_size, hid_t lapl_id); + +/* User-defined link types */ +typedef struct { + int version; /* Version number of this struct */ + H5L_type_t id; /* Link type ID */ + const char *comment; /* Comment for debugging */ + H5L_create_func_t create_func; /* Callback during link creation */ + H5L_move_func_t move_func; /* Callback after moving link */ + H5L_copy_func_t copy_func; /* Callback after copying link */ + H5L_traverse_0_func_t trav_func; /* Callback during link traversal */ + H5L_delete_func_t del_func; /* Callback for link deletion */ + H5L_query_func_t query_func; /* Callback for queries */ +} H5L_class_0_t; + +/* Prototype for H5Literate1/H5Literate_by_name1() operator */ +typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info, + void *op_data); + + +/* Function prototypes */ +H5_DLL herr_t H5Lget_info1(hid_t loc_id, const char *name, + H5L_info1_t *linfo /*out*/, hid_t lapl_id); +H5_DLL herr_t H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + H5L_info1_t *linfo /*out*/, hid_t lapl_id); +H5_DLL herr_t H5Literate1(hid_t grp_id, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx, H5L_iterate1_t op, void *op_data); +H5_DLL herr_t H5Literate_by_name1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, + H5L_iterate1_t op, void *op_data, hid_t lapl_id); +H5_DLL herr_t H5Lvisit1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, + H5L_iterate1_t op, void *op_data); +H5_DLL herr_t H5Lvisit_by_name1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, H5L_iterate1_t op, + void *op_data, hid_t lapl_id); + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + #ifdef __cplusplus } #endif @@ -78,6 +78,29 @@ static hbool_t H5M_top_package_initialize_s = FALSE; /*------------------------------------------------------------------------- + * Function: H5M_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + *------------------------------------------------------------------------- + */ +herr_t +H5M_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 H5M_init() */ + + +/*------------------------------------------------------------------------- NAME H5M__init_package -- Initialize interface-specific information USAGE @@ -197,7 +220,7 @@ H5M__close_cb(H5VL_object_t *map_vol_obj) HDassert(map_vol_obj); /* Close the map */ - if(H5VL_optional(map_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + if(H5VL_optional(map_vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_MAP, H5E_CLOSEERROR, FAIL, "unable to close map"); /* Free the VOL object */ @@ -233,7 +256,7 @@ H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id) { void *map = NULL; /* New map's info */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -274,8 +297,8 @@ H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the map */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CREATE, &loc_params, name, lcpl_id, - key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + &loc_params, name, lcpl_id, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map") /* Get an atom for the map */ @@ -285,7 +308,7 @@ H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + if(map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") FUNC_LEAVE_API(ret_value) @@ -320,8 +343,8 @@ hid_t H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id, hid_t mapl_id) { - void *map = NULL; /* map token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *map = NULL; /* map object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -348,8 +371,8 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the map */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CREATE, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, - key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map") /* Get an atom for the map */ @@ -359,7 +382,7 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + if(map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") FUNC_LEAVE_API(ret_value) @@ -384,8 +407,8 @@ done: hid_t H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id) { - void *map = NULL; /* map token from VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *map = NULL; /* map object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -411,7 +434,7 @@ H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Open the map */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_OPEN, &loc_params, name, mapl_id, &map) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, name, mapl_id, &map) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map") /* Register an atom for the map */ @@ -421,7 +444,7 @@ H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id) done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + if(map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") FUNC_LEAVE_API(ret_value) @@ -489,7 +512,7 @@ H5Mget_key_type(hid_t map_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") /* get the datatype */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_KEY_TYPE, &ret_value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_KEY_TYPE, &ret_value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: @@ -524,7 +547,7 @@ H5Mget_val_type(hid_t map_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") /* get the datatype */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_VAL_TYPE, &ret_value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_VAL_TYPE, &ret_value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: @@ -559,7 +582,7 @@ H5Mget_create_plist(hid_t map_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") /* Get the map creation property list */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_MCPL, &ret_value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_MCPL, &ret_value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map creation properties") done: @@ -597,7 +620,7 @@ H5Mget_access_plist(hid_t map_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") /* Get the map access property list */ - if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_MAPL, &ret_value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_MAPL, &ret_value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties") done: @@ -641,7 +664,7 @@ H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id) H5CX_set_dxpl(dxpl_id); /* Get the number of key-value pairs stored in the map */ - if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_COUNT, count) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET_COUNT, count) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties") done: @@ -697,7 +720,7 @@ H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, H5CX_set_dxpl(dxpl_id); /* Set the key/value pair */ - if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_PUT, key_mem_type_id, key, val_mem_type_id, value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_PUT, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key, val_mem_type_id, value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to put key/value pair") done: @@ -756,7 +779,7 @@ H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, H5CX_set_dxpl(dxpl_id); /* Get the value for the key */ - if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET_VAL, key_mem_type_id, key, val_mem_type_id, value) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_GET_VAL, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key, val_mem_type_id, value) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map") done: @@ -806,7 +829,7 @@ H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, H5CX_set_dxpl(dxpl_id); /* Check if key exists */ - if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_EXISTS, key_mem_type_id, key, exists)) < 0) + if((ret_value = H5VL_optional(vol_obj, H5VL_MAP_EXISTS, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key, exists)) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTGET, ret_value, "unable to check if key exists") done: @@ -881,7 +904,7 @@ H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, loc_params.obj_type = H5I_get_type(map_id); /* Iterate over keys */ - if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0) + if((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0) HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys") done: @@ -964,7 +987,7 @@ H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Iterate over keys */ - if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0) + if((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0) HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys") done: @@ -1021,7 +1044,7 @@ H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, loc_params.obj_type = H5I_get_type(map_id); /* Delete the key/value pair */ - if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_DELETE, key_mem_type_id, key) < 0) + if(H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_DELETE, key_mem_type_id, key) < 0) HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to delete key/value pair") done: @@ -2290,7 +2290,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) /* Retrieve free space size from free space manager */ if(H5FS_sect_stats(f->shared->fs_man[type], &type_fs_size, NULL) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats") - if(H5FS_size(f, f->shared->fs_man[type], &type_meta_size) < 0) + if(H5FS_size(f->shared->fs_man[type], &type_meta_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space metadata stats") /* Increment total free space for types */ diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h index c841e75..3d0e8cc 100644 --- a/src/H5Mprivate.h +++ b/src/H5Mprivate.h @@ -65,6 +65,7 @@ /****************************/ /* Library Private Typedefs */ /****************************/ +H5_DLL herr_t H5M_init(void); /*****************************/ @@ -102,7 +102,7 @@ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; @@ -171,7 +171,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; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; @@ -217,57 +217,34 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oopen_by_addr + * Function: H5Oopen_by_token * - * Purpose: Warning! This function is EXTREMELY DANGEROUS! - * Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA, - * and other VERY BAD THINGS! + * Purpose: Same as H5Oopen_by_addr, but uses VOL-independent tokens. * - * This function opens an object using its address within the - * HDF5 file, similar to an HDF5 hard link. The open object - * is identical to an object opened with H5Oopen() and should - * be closed with H5Oclose() or a type-specific closing - * function (such as H5Gclose() ). - * - * This function is very dangerous if called on an invalid - * address. For this reason, H5Oincr_refcount() should be - * used to prevent HDF5 from deleting any object that is - * referenced by address (e.g. by a user-defined link). - * H5Odecr_refcount() should be used when the object is - * no longer being referenced by address (e.g. when the UD link - * is deleted). - * - * The address of the HDF5 file on disk has no effect on - * H5Oopen_by_addr(), nor does the use of any unusual file - * drivers. The "address" is really the offset within the - * HDF5 file, and HDF5's file drivers will transparently - * map this to an address on disk for the filesystem. + * Return: Success: An open object identifier + * Failure: H5I_INVALID_HID * - * Return: Success: An open object identifier - * Failure: H5I_INVALID_HID - * - * Programmer: James Laird - * July 14 2006 + * Programmer: Dana Robinson + * Winter 2019 * *------------------------------------------------------------------------- */ hid_t -H5Oopen_by_addr(hid_t loc_id, haddr_t addr) +H5Oopen_by_token(hid_t loc_id, H5O_token_t token) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ - hid_t file_id = H5I_INVALID_HID; /* File ID */ - void *vol_obj_file = NULL; /* Object token of file_id */ - H5F_t *f = NULL; - uint8_t *p = NULL; hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) - H5TRACE2("i", "ia", loc_id, addr); + H5TRACE2("i", "ik", loc_id, token); + + /* Check args */ + if(H5O_IS_TOKEN_UNDEF(token)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "can't open H5O_TOKEN_UNDEF") /* Get the location object */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) @@ -277,39 +254,21 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) if((vol_obj_type = H5I_get_type(loc_id)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - /* Get the file for the object */ - if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object") - - /* Retrieve VOL object */ - if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - - /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data(vol_obj_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL object") - - /* This is a native specific routine that requires serialization of the token */ - p = (uint8_t *)&obj_token; - H5F_addr_encode(f, &p, addr); - loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = &obj_token; + loc_params.loc_data.loc_by_token.token = &token; loc_params.obj_type = vol_obj_type; /* Open the object */ 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 */ + /* Register the object's ID */ 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: - if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on file") FUNC_LEAVE_API(ret_value) -} /* end H5Oopen_by_addr() */ +} /* end H5Oopen_by_token() */ /*------------------------------------------------------------------------- @@ -337,9 +296,9 @@ herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj1 = NULL; /* object 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_object_t *vol_obj1 = NULL; /* object of obj_id */ + H5VL_object_t *vol_obj2 = NULL; /* object of new_loc_id */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -429,7 +388,7 @@ done: herr_t H5Oincr_refcount(hid_t object_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; @@ -479,7 +438,7 @@ done: herr_t H5Odecr_refcount(hid_t object_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -522,7 +481,7 @@ done: htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; htri_t ret_value = FAIL; /* Return value */ @@ -559,23 +518,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oget_info2 + * Function: H5Oget_info3 * * 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 + * Programmer: Dana Robinson + * Fall 2019 * *------------------------------------------------------------------------- */ herr_t -H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) +H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -597,33 +554,31 @@ 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_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") done: FUNC_LEAVE_API(ret_value) -} /* end H5Oget_info2() */ +} /* end H5Oget_info3() */ /*------------------------------------------------------------------------- - * Function: H5Oget_info_by_name2 + * Function: H5Oget_info_by_name3 * * 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 + * Programmer: Dana Robinson + * Fall 2019 * *------------------------------------------------------------------------- */ herr_t -H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, - unsigned fields, hid_t lapl_id) +H5Oget_info_by_name3(hid_t loc_id, const char *name, + H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -655,35 +610,33 @@ 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_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) + if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") done: FUNC_LEAVE_API(ret_value) -} /* end H5Oget_info_by_name2() */ +} /* end H5Oget_info_by_name3() */ /*------------------------------------------------------------------------- - * Function: H5Oget_info_by_idx2 - * - * Purpose: Retrieve information about an object, according to the order - * of an index. + * Function: H5Oget_info_by_idx3 * - * NOTE: Add a parameter "fields" to indicate selection of object info. + * Purpose: Retrieve information about an object, according to + * the order of an index. * * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * November 26 2006 + * Programmer: Dana Robinson + * Fall 2019 * *------------------------------------------------------------------------- */ 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) +H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -720,12 +673,176 @@ 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_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info_by_idx3() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_native_info + * + * Purpose: Retrieve native file format information about an object. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigned fields) +{ + H5VL_object_t *vol_obj; /* Object 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(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + if(fields & ~H5O_NATIVE_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_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve the object's information */ + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object") done: FUNC_LEAVE_API(ret_value) -} /* end H5Oget_info_by_idx2() */ +} /* end H5Oget_native_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_native_info_by_name + * + * Purpose: Retrieve native file format information about an object + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo, + unsigned fields, hid_t lapl_id) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "i*s*xIui", loc_id, name, oinfo, fields, lapl_id); + + /* Check args */ + 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, "oinfo parameter cannot be NULL") + if(fields & ~H5O_NATIVE_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* 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") + + /* 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_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve the object's information */ + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object: '%s'", name) + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_native_info_by_name() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_native_info_by_idx + * + * Purpose: Retrieve native file format information about an object, + * according to the order of an index. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Dana Robinson + * Fall 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5O_native_info_t *oinfo, unsigned fields, hid_t lapl_id) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE8("e", "i*sIiIoh*xIui", loc_id, group_name, idx_type, order, n, oinfo, + fields, lapl_id); + + /* Check args */ + 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) + 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(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + if(fields & ~H5O_NATIVE_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* 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") + + 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_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve the object's information */ + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_native_info_by_idx() */ /*------------------------------------------------------------------------- @@ -748,7 +865,7 @@ done: herr_t H5Oset_comment(hid_t obj_id, const char *comment) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -768,7 +885,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_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: @@ -797,7 +914,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; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -823,7 +940,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_NATIVE_OBJECT_SET_COMMENT, &loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: @@ -850,9 +967,9 @@ done: ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - ssize_t ret_value = -1; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); @@ -866,7 +983,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_NATIVE_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: @@ -894,9 +1011,9 @@ 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; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - ssize_t ret_value = -1; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE5("Zs", "i*s*szi", loc_id, name, comment, bufsize, lapl_id); @@ -920,7 +1037,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_NATIVE_OBJECT_GET_COMMENT, &loc_params, comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: @@ -929,7 +1046,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ovisit2 + * Function: H5Ovisit3 * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -964,12 +1081,12 @@ done: *------------------------------------------------------------------------- */ 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) +H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate2_t op, void *op_data, unsigned fields) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - herr_t ret_value; /* Return value */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields); @@ -998,11 +1115,11 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, done: FUNC_LEAVE_API(ret_value) -} /* end H5Ovisit2() */ +} /* end H5Ovisit3() */ /*------------------------------------------------------------------------- - * Function: H5Ovisit_by_name2 + * Function: H5Ovisit_by_name3 * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -1037,12 +1154,12 @@ done: *------------------------------------------------------------------------- */ 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) +H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ - H5VL_loc_params_t loc_params; - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + 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, @@ -1082,7 +1199,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, done: FUNC_LEAVE_API(ret_value) -} /* end H5Ovisit_by_name2() */ +} /* end H5Ovisit_by_name3() */ /*------------------------------------------------------------------------- @@ -1187,7 +1304,7 @@ done: herr_t H5Odisable_mdc_flushes(hid_t object_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1207,7 +1324,7 @@ H5Odisable_mdc_flushes(hid_t object_id) loc_params.obj_type = H5I_get_type(object_id); /* Cork the object */ - if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES, &loc_params) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object"); done: @@ -1256,7 +1373,7 @@ done: herr_t H5Oenable_mdc_flushes(hid_t object_id) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1264,11 +1381,11 @@ H5Oenable_mdc_flushes(hid_t object_id) H5TRACE1("e", "i", object_id); /* Make sure the ID is a file object */ - if (H5I_is_file_object(object_id) != TRUE) + if(H5I_is_file_object(object_id) != TRUE) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object"); /* Get the VOL object */ - if (NULL == (vol_obj = H5VL_vol_object(object_id))) + if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID"); /* Fill in location struct fields */ @@ -1276,7 +1393,7 @@ H5Oenable_mdc_flushes(hid_t object_id) loc_params.obj_type = H5I_get_type(object_id); /* Uncork the object */ - if (H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES, &loc_params) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object"); done: @@ -1330,7 +1447,7 @@ done: herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled) { - H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1338,15 +1455,15 @@ H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled) H5TRACE2("e", "i*b", object_id, are_disabled); /* Sanity check */ - if (!are_disabled) + if(!are_disabled) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID"); /* Make sure the ID is a file object */ - if (H5I_is_file_object(object_id) != TRUE) + if(H5I_is_file_object(object_id) != TRUE) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object"); /* Get the VOL object */ - if (NULL == (vol_obj = H5VL_vol_object(object_id))) + if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID"); /* Fill in location struct fields */ @@ -1354,10 +1471,132 @@ H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled) loc_params.obj_type = H5I_get_type(object_id); /* Get the cork status */ - if (H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED, &loc_params, are_disabled) < 0) + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, are_disabled) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve object's cork status"); done: FUNC_LEAVE_API(ret_value) } /* H5Oare_mdc_flushes_disabled() */ + +/*--------------------------------------------------------------------------- + * Function: H5Otoken_cmp + * + * Purpose: Compares two VOL connector object tokens + * + * Note: Both object tokens must be from the same VOL connector class + * + * Return: Success: Non-negative, with *cmp_value set to positive if + * token1 is greater than token2, negative if token2 + * is greater than token1 and zero if token1 and + * token2 are equal. + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, + int *cmp_value) +{ + H5VL_object_t *vol_obj; /* VOL object for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "i*k*k*Is", loc_id, token1, token2, cmp_value); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(NULL == cmp_value) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid cmp_value pointer") + + /* Compare the two tokens */ + if(H5VL_token_cmp(vol_obj, token1, token2, cmp_value) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "object token comparison failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Otoken_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5Otoken_to_str + * + * Purpose: Serialize a connector's object token into a string + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str) +{ + H5VL_object_t *vol_obj; /* VOL object for ID */ + H5I_type_t vol_obj_type; /* VOL object's type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*k**s", loc_id, token, token_str); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(NULL == token) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + if(NULL == token_str) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token string pointer") + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object type") + + /* Serialize the token */ + if(H5VL_token_to_str(vol_obj, vol_obj_type, token, token_str) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "object token serialization failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Otoken_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5Otoken_from_str + * + * Purpose: Deserialize a string into a connector object token + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token) +{ + H5VL_object_t *vol_obj; /* VOL object for ID */ + H5I_type_t vol_obj_type; /* VOL object's type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*s*k", loc_id, token_str, token); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + if(NULL == token) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + if(NULL == token_str) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token string pointer") + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object type") + + /* Deserialize the token */ + if(H5VL_token_from_str(vol_obj, vol_obj_type, token_str, token) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "object token deserialization failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Otoken_from_str() */ + diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 7f4f17f..2d95ee9 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -194,7 +194,7 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co *p++ = H5O_AINFO_VERSION; /* The flags for the attribute indices */ - flags = ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0; + flags = (unsigned char)(ainfo->track_corder ? H5O_AINFO_TRACK_CORDER : 0); flags = (unsigned char)(flags | (ainfo->index_corder ? H5O_AINFO_INDEX_CORDER : 0)); *p++ = flags; @@ -334,7 +334,7 @@ H5O__ainfo_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O__ainfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg) +H5O__ainfo_delete(H5F_t *f, H5O_t H5_ATTR_NDEBUG_UNUSED *open_oh, void *_mesg) { H5O_ainfo_t *ainfo = (H5O_ainfo_t *)_mesg; herr_t ret_value = SUCCEED; /* Return value */ @@ -405,9 +405,9 @@ H5O_ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static void * -H5O__ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, +H5O__ainfo_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, void *mesg_src, H5F_t *file_dst, hbool_t H5_ATTR_UNUSED *recompute_size, unsigned H5_ATTR_UNUSED *mesg_flags, - H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) + H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata) { H5O_ainfo_t *ainfo_src = (H5O_ainfo_t *)mesg_src; H5O_ainfo_t *ainfo_dst = NULL; diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index c1f90cb..8850ef6 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -111,7 +111,7 @@ 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 H5_ATTR_NDEBUG_UNUSED *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 */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 878cb8a..573bb7a 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -329,7 +329,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) /* The character encoding for the attribute's name, in later versions */ if(attr->shared->version >= H5O_ATTR_VERSION_3) - *p++ = attr->shared->encoding; + *p++ = (uint8_t)attr->shared->encoding; /* Write the name including null terminator */ H5MM_memcpy(p, attr->shared->name, name_len); diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 71cbc1d..a4a746e 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -86,19 +86,6 @@ typedef struct { hbool_t found; /* Whether the attribute was found */ } H5O_iter_ren_t; -/* User data for iteration when iterating over attributes */ -typedef struct { - /* down */ - H5F_t *f; /* Pointer to file attribute is in */ - hid_t loc_id; /* ID of object being iterated over */ - unsigned skip; /* # of attributes to skip over */ - H5A_operator_t op; /* Callback routine for each attribute */ - void *op_data; /* User data for callback */ - - /* up */ - unsigned count; /* Count of attributes examined */ -} H5O_iter_itr_t; - /* User data for iteration when removing an attribute */ typedef struct { /* down */ @@ -109,15 +96,6 @@ typedef struct { hbool_t found; /* Found attribute to delete */ } H5O_iter_rm_t; -/* User data for iteration when checking if an attribute exists */ -typedef struct { - /* down */ - const char *name; /* Name of attribute to open */ - - /* up */ - hbool_t found; /* Found attribute */ -} H5O_iter_xst_t; - /********************/ /* Package Typedefs */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 683d155..8bad181 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -201,7 +201,7 @@ H5O__cache_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5O__cache_get_final_load_size(const void *image, size_t image_len, +H5O__cache_get_final_load_size(const void *image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, size_t *actual_len) { H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */ @@ -306,7 +306,7 @@ H5O__cache_verify_chksum(const void *_image, size_t len, void *_udata) *------------------------------------------------------------------------- */ static void * -H5O__cache_deserialize(const void *image, size_t len, void *_udata, +H5O__cache_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t *dirty) { H5O_t *oh = NULL; /* Object header read in */ @@ -763,7 +763,7 @@ H5O__cache_chk_verify_chksum(const void *_image, size_t len, void *_udata) *------------------------------------------------------------------------- */ static void * -H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata, +H5O__cache_chk_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t *dirty) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk proxy object */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 55013c9..469a9e0 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -88,7 +88,7 @@ static herr_t H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, static herr_t H5O__copy_free_comm_dt_cb(void *item, void *key, void *op_data); static int H5O__copy_comm_dt_cmp(const void *dt1, const void *dt2); static herr_t H5O__copy_search_comm_dt_cb(hid_t group, const char *name, - const H5L_info_t *linfo, void *udata); + const H5L_info2_t *linfo, void *udata); static htri_t H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst/*in, out*/, H5O_copy_t *cpy_info); static herr_t H5O__copy_insert_comm_dt(H5F_t *file_src, H5O_t *oh_src, @@ -197,9 +197,9 @@ 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) { - H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */ + H5VL_object_t *vol_obj1 = NULL; /* object 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 of dst_id */ H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -1523,7 +1523,7 @@ done: */ static herr_t H5O__copy_search_comm_dt_cb(hid_t H5_ATTR_UNUSED group, const char *name, - const H5L_info_t *linfo, void *_udata) + const H5L_info2_t *linfo, void *_udata) { H5O_copy_search_comm_dt_ud_t *udata = (H5O_copy_search_comm_dt_ud_t *)_udata; /* Skip list of dtypes in dest file */ H5G_loc_t obj_loc; /* Location of object */ diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c index b835f8e..0de661f 100644 --- a/src/H5Ocopy_ref.c +++ b/src/H5Ocopy_ref.c @@ -38,6 +38,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5Rpkg.h" /* References */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ @@ -165,7 +167,7 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, size_t buf_size = H5R_OBJ_REF_BUF_SIZE; size_t i; /* Local index variable */ size_t token_size = H5F_SIZEOF_ADDR(src_oloc->file); - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -173,8 +175,7 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, for(i = 0; i < ref_count; i++) { const unsigned char *src_buf = (const unsigned char *)&src_ref[i]; unsigned char *dst_buf = (unsigned char *)&dst_ref[i]; - H5VL_token_t tmp_token = { 0 }; - uint8_t *p; + H5O_token_t tmp_token = { 0 }; /* If data is not initialized, copy zeros and skip */ if(0 == HDmemcmp(src_buf, zeros, buf_size)) { @@ -185,8 +186,9 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, /* Set up for the object copy for the reference */ if(H5R__decode_token_obj_compat(src_buf, &buf_size, &tmp_token, token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode src object address") - p = (uint8_t *)&tmp_token; - H5F_addr_decode(src_oloc->file, (const uint8_t **)&p, &src_oloc->addr); + if(H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer") dst_oloc->addr = HADDR_UNDEF; @@ -196,9 +198,9 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") /* Set the object reference info for the destination file */ - p = (uint8_t *)&tmp_token; - H5F_addr_encode(dst_oloc->file, &p, dst_oloc->addr); - if(H5R__encode_token_obj_compat((const H5VL_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0) + if(H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") + if(H5R__encode_token_obj_compat((const H5O_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to encode dst object address") } /* end for */ @@ -365,25 +367,25 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src, for(i = 0; i < ref_count; i++) { H5R_ref_t *ref_ptr = (H5R_ref_t *)conv_buf; H5R_ref_priv_t *ref = (H5R_ref_priv_t *)&ref_ptr[i]; - H5VL_token_t tmp_token = { 0 }; - uint8_t *p; + H5O_token_t tmp_token = { 0 }; /* Get src object address */ if(H5R__get_obj_token(ref, &tmp_token, &token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object token") - p = (uint8_t *)&tmp_token; - H5F_addr_decode(src_oloc->file, (const uint8_t **)&p, &src_oloc->addr); + if(H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") /* Attempt to copy object from source to destination file */ if(H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") /* Set dst object address */ - p = (uint8_t *)&tmp_token; - H5F_addr_encode(dst_oloc->file, &p, dst_oloc->addr); - if(H5R__set_obj_token(ref, (const H5VL_token_t *)&tmp_token, token_size) < 0) + if(H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") + if(H5R__set_obj_token(ref, (const H5O_token_t *)&tmp_token, token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set object token") - if(H5R__set_loc_id(ref, dst_loc_id, TRUE) < 0) + /* Do not set app_ref since references are released once the copy is done */ + if(H5R__set_loc_id(ref, dst_loc_id, TRUE, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set destination loc id") } /* end for */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 7aefc67..e43213d 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -39,6 +39,7 @@ #include "H5VLnative_private.h" /* Native VOL connector */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /****************/ /* Local Macros */ @@ -49,6 +50,13 @@ /* Local Typedefs */ /******************/ +/* Adapter for using deprecated H5Ovisit1 callbacks with the VOL */ +typedef struct H5O_visit1_adapter_t { + H5O_iterate1_t real_op; /* Application callback to invoke */ + unsigned fields; /* Original fields passed to H5Ovisit */ + void *real_op_data; /* Application op_data */ +} H5O_visit1_adapter_t; + /********************/ /* Package Typedefs */ @@ -58,7 +66,10 @@ /********************/ /* Local Prototypes */ /********************/ - +static herr_t H5O__reset_info1(H5O_info1_t *oinfo); +static herr_t H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, void *op_data); +static herr_t H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, + H5O_info1_t *oinfo, unsigned fields); /*********************/ /* Package Variables */ @@ -75,7 +86,295 @@ /*******************/ -#ifndef H5_NO_DEPRECATED_SYMBOLS +/*------------------------------------------------------------------------- + * Function: H5O__reset_info1 + * + * Purpose: Resets/initializes an H5O_info1_t struct. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O__reset_info1(H5O_info1_t *oinfo) +{ + FUNC_ENTER_STATIC_NOERR; + + /* Reset the passed-in info struct */ + HDmemset(oinfo, 0, sizeof(H5O_info1_t)); + oinfo->type = H5O_TYPE_UNKNOWN; + oinfo->addr = HADDR_UNDEF; + + FUNC_LEAVE_NOAPI(SUCCEED); +} /* end H5O__reset_info1() */ + + +/*------------------------------------------------------------------------- + * Function: H5O__iterate1_adapter + * + * Purpose: Retrieve information about an object, according to the order + * of an index. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * November 26 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, + void *op_data) +{ + H5O_visit1_adapter_t *shim_data = (H5O_visit1_adapter_t *)op_data; + H5O_info1_t oinfo; /* Deprecated object info struct */ + unsigned dm_fields; /* Fields for data model query */ + unsigned nat_fields; /* Fields for native query */ + H5VL_object_t *vol_obj; /* Object of obj_id */ + H5VL_loc_params_t loc_params; /* Location parameters for VOL callback */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(oinfo2); + HDassert(op_data); + + /* Reset the legacy info struct */ + if(H5O__reset_info1(&oinfo) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct") + + /* Check for retrieving data model information */ + dm_fields = shim_data->fields & (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS); + if(dm_fields) { + /* Set the data model fields */ + if(shim_data->fields & H5O_INFO_BASIC) { + oinfo.fileno = oinfo2->fileno; + oinfo.type = oinfo2->type; + oinfo.rc = oinfo2->rc; + + /* Deserialize VOL object token into object address */ + if(H5VLnative_token_to_addr(obj_id, oinfo2->token, &oinfo.addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + } + if(shim_data->fields & H5O_INFO_TIME) { + oinfo.atime = oinfo2->atime; + oinfo.mtime = oinfo2->mtime; + oinfo.ctime = oinfo2->ctime; + oinfo.btime = oinfo2->btime; + } + if(shim_data->fields & H5O_INFO_NUM_ATTRS) + oinfo.num_attrs = oinfo2->num_attrs; + } + + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(obj_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") + + /* Check for retrieving native information */ + nat_fields = shim_data->fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE); + if(nat_fields) { + H5O_native_info_t nat_info; /* Native object info */ + + /* Retrieve the object's native information */ + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, &nat_info, nat_fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object") + + /* Set the native fields */ + if(shim_data->fields & H5O_INFO_HDR) + HDmemcpy(&(oinfo.hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t)); + if(shim_data->fields & H5O_INFO_META_SIZE) { + HDmemcpy(&(oinfo.meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t)); + HDmemcpy(&(oinfo.meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t)); + } + } + + /* Invoke the application callback */ + ret_value = (shim_data->real_op)(obj_id, name, &oinfo, shim_data->real_op_data); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O__iterate1_adapter() */ + + +/*------------------------------------------------------------------------- + * Function: H5O__get_info_old + * + * Purpose: Retrieve deprecated info about an object. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * December 21 2019 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, + H5O_info1_t *oinfo, unsigned fields) +{ + unsigned dm_fields; /* Fields for data model query */ + unsigned nat_fields; /* Fields for native query */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(vol_obj); + HDassert(loc_params); + + /* Reset the passed-in info struct */ + if(H5O__reset_info1(oinfo) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct") + + /* Check for retrieving data model information */ + dm_fields = fields & (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS); + if(dm_fields) { + H5O_info2_t dm_info; /* Data model object info */ + + /* Retrieve the object's data model information */ + if(H5VL_object_get(vol_obj, loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &dm_info, dm_fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") + + /* Set the data model fields */ + if(fields & H5O_INFO_BASIC) { + void *vol_obj_data; + + if(NULL == (vol_obj_data = H5VL_object_data(vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + + oinfo->fileno = dm_info.fileno; + oinfo->type = dm_info.type; + oinfo->rc = dm_info.rc; + + /* Deserialize VOL object token into object address */ + if(H5VL_native_token_to_addr(vol_obj_data, loc_params->obj_type, dm_info.token, &oinfo->addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + } /* end if */ + if(fields & H5O_INFO_TIME) { + oinfo->atime = dm_info.atime; + oinfo->mtime = dm_info.mtime; + oinfo->ctime = dm_info.ctime; + oinfo->btime = dm_info.btime; + } /* end if */ + if(fields & H5O_INFO_NUM_ATTRS) + oinfo->num_attrs = dm_info.num_attrs; + } /* end if */ + + /* Check for retrieving native information */ + nat_fields = fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE); + if(nat_fields) { + H5O_native_info_t nat_info; /* Native object info */ + + /* Retrieve the object's native information */ + if(H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, &nat_info, nat_fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object") + + /* Set the native fields */ + if(fields & H5O_INFO_HDR) + HDmemcpy(&(oinfo->hdr), &(nat_info.hdr), sizeof(H5O_hdr_info_t)); + if(fields & H5O_INFO_META_SIZE) { + HDmemcpy(&(oinfo->meta_size.obj), &(nat_info.meta_size.obj), sizeof(H5_ih_info_t)); + HDmemcpy(&(oinfo->meta_size.attr), &(nat_info.meta_size.attr), sizeof(H5_ih_info_t)); + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O__get_info_old() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oopen_by_addr + * + * Purpose: Warning! This function is EXTREMELY DANGEROUS! + * Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA, + * and other VERY BAD THINGS! + * + * This function opens an object using its address within the + * HDF5 file, similar to an HDF5 hard link. The open object + * is identical to an object opened with H5Oopen() and should + * be closed with H5Oclose() or a type-specific closing + * function (such as H5Gclose() ). + * + * This function is very dangerous if called on an invalid + * address. For this reason, H5Oincr_refcount() should be + * used to prevent HDF5 from deleting any object that is + * referenced by address (e.g. by a user-defined link). + * H5Odecr_refcount() should be used when the object is + * no longer being referenced by address (e.g. when the UD link + * is deleted). + * + * The address of the HDF5 file on disk has no effect on + * H5Oopen_by_addr(), nor does the use of any unusual file + * drivers. The "address" is really the offset within the + * HDF5 file, and HDF5's file drivers will transparently + * map this to an address on disk for the filesystem. + * + * Return: Success: An open object identifier + * Failure: H5I_INVALID_HID + * + * Programmer: James Laird + * July 14 2006 + * + *------------------------------------------------------------------------- + */ +hid_t +H5Oopen_by_addr(hid_t loc_id, haddr_t addr) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ + H5I_type_t opened_type; /* Opened object type */ + void *opened_obj = NULL; /* Opened object */ + H5VL_loc_params_t loc_params; /* Location parameters */ + H5O_token_t obj_token = {0}; /* Object token */ + hbool_t is_native_vol_obj; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE2("i", "ia", loc_id, addr); + + /* 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 object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(is_native_vol_obj) { + /* This is a native-specific routine that requires serialization of the token */ + if(H5VLnative_addr_to_token(loc_id, addr, &obj_token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, H5I_INVALID_HID, "can't serialize address into object token") + } /* end if */ + else + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oopen_by_addr is only meant to be used with the native VOL connector") + + loc_params.type = H5VL_OBJECT_BY_TOKEN; + loc_params.loc_data.loc_by_token.token = &obj_token; + loc_params.obj_type = vol_obj_type; + + /* Open the object */ + 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 object's ID */ + 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: + FUNC_LEAVE_API(ret_value) +} /* end H5Oopen_by_addr() */ /*------------------------------------------------------------------------- @@ -89,9 +388,9 @@ *------------------------------------------------------------------------- */ herr_t -H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) +H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -111,8 +410,8 @@ 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_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") done: FUNC_LEAVE_API(ret_value) @@ -130,9 +429,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) +H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -162,8 +461,8 @@ 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_NATIVE_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) + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") done: FUNC_LEAVE_API(ret_value) @@ -186,9 +485,9 @@ done: */ 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) + H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -223,8 +522,8 @@ 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_NATIVE_OBJECT_GET_INFO, &loc_params, oinfo, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") done: FUNC_LEAVE_API(ret_value) @@ -232,6 +531,197 @@ done: /*------------------------------------------------------------------------- + * Function: H5Oget_info2 + * + * 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_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + hbool_t is_native_vol_obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*xIu", loc_id, oinfo, fields); + + /* Check args */ + 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_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oget_info2 is only meant to be used with the native VOL connector") + + /* Retrieve deprecated info struct */ + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* 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: SUCCEED/FAIL + * + * Programmer: Neil Fortner + * July 7 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo, + unsigned fields, hid_t lapl_id) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + hbool_t is_native_vol_obj; + 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(!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, "oinfo parameter cannot be NULL") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* 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") + + /* 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_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oget_info_by_name2 is only meant to be used with the native VOL connector") + + /* Retrieve deprecated info struct */ + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info_by_name2() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_info_by_idx2 + * + * Purpose: Retrieve information about an object, according to the order + * of an index. + * + * NOTE: Add a parameter "fields" to indicate selection of object info. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * November 26 2006 + * + *------------------------------------------------------------------------- + */ +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_info1_t *oinfo, unsigned fields, hid_t lapl_id) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + hbool_t is_native_vol_obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE8("e", "i*sIiIoh*xIui", loc_id, group_name, idx_type, order, n, oinfo, + fields, lapl_id); + + /* Check args */ + 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) + 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(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* 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") + + 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_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Oget_info_by_idx2 is only meant to be used with the native VOL connector") + + /* Retrieve deprecated info struct */ + if(H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info_by_idx2() */ + + +/*------------------------------------------------------------------------- * Function: H5Ovisit1 * * Purpose: Recursively visit an object and all the objects reachable @@ -265,10 +755,11 @@ done: */ herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, - H5O_iterate_t op, void *op_data) + H5O_iterate1_t op, void *op_data) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; + H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -290,8 +781,13 @@ 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 up adapter */ + shim_data.real_op = op; + shim_data.fields = H5O_INFO_ALL; + shim_data.real_op_data = op_data; + /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: @@ -333,10 +829,11 @@ done: */ 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) + H5_iter_order_t order, H5O_iterate1_t op, void *op_data, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ - H5VL_loc_params_t loc_params; + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -369,13 +866,203 @@ H5Ovisit_by_name1(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 up adapter */ + shim_data.real_op = op; + shim_data.fields = H5O_INFO_ALL; + shim_data.real_op_data = op_data; + /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: FUNC_LEAVE_API(ret_value) } /* end H5Ovisit_by_name1() */ + +/*------------------------------------------------------------------------- + * Function: H5Ovisit2 + * + * 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 + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Soft links and user-defined links are ignored during + * this operation. + * + * NOTE: Each _object_ reachable from the initial group will only + * be visited once. If multiple hard links point to the same + * object, the first link to the object's path (according to the + * iteration index and iteration order given) will be used to in + * the callback about the object. + * + * NOTE: Add a a parameter "fields" to indicate selection of + * 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. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * Programmer: Quincey Koziol + * November 25 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate1_t op, void *op_data, unsigned fields) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */ + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields); + + /* Check args */ + 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) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Ovisit2 is only meant to be used with the native VOL connector") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(obj_id); + + /* Set up adapter */ + shim_data.real_op = op; + shim_data.fields = fields; + shim_data.real_op_data = op_data; + + /* Visit the objects */ + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Ovisit2() */ + + +/*------------------------------------------------------------------------- + * 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 + * linked to from that group will be visited. Links within + * each group are visited according to the order within the + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Soft links and user-defined links are ignored during + * this operation. + * + * NOTE: Each _object_ reachable from the initial group will only + * be visited once. If multiple hard links point to the same + * object, the first link to the object's path (according to the + * iteration index and iteration order given) will be used to in + * the callback about the object. + * + * NOTE: Add a a parameter "fields" to indicate selection of + * 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. + * + * 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 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, H5O_iterate1_t op, void *op_data, unsigned fields, hid_t lapl_id) +{ + H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_loc_params_t loc_params; + H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */ + hbool_t is_native_vol_obj; + herr_t ret_value; /* Return value */ + + 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) + 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) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + + /* 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") + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Check if the VOL object is a native VOL connector object */ + if(H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") + if(!is_native_vol_obj) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, "H5Ovisit_by_name2 is only meant to be used with the native VOL connector") + + /* 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); + + /* Set up adapter */ + shim_data.real_op = op; + shim_data.fields = fields; + shim_data.real_op_data = op_data; + + /* Visit the objects */ + if((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter, (void *)&shim_data, fields)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Ovisit_by_name2() */ + #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 0cc58a6..cb75bc3 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -408,10 +408,10 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) if(fill->version < H5O_FILL_VERSION_3) { /* Space allocation time */ - *p++ = fill->alloc_time; + *p++ = (uint8_t)fill->alloc_time; /* Fill value writing time */ - *p++ = fill->fill_time; + *p++ = (uint8_t)fill->fill_time; /* Whether fill value is defined */ *p++ = (uint8_t)fill->fill_defined; diff --git a/src/H5Oflush.c b/src/H5Oflush.c index a03cfa1..b441840 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -72,7 +72,7 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, herr_t H5Oflush(hid_t obj_id) { - H5VL_object_t *vol_obj = NULL; /* Object token */ + H5VL_object_t *vol_obj = NULL; /* Object of obj_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -236,7 +236,7 @@ done: herr_t H5Orefresh(hid_t oid) { - H5VL_object_t *vol_obj = NULL; /* Object token */ + H5VL_object_t *vol_obj = NULL; /* Object of oid */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 7e48b9e..78e8e19 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -223,8 +223,8 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(p); HDassert(fsinfo); - *p++ = (uint8_t)fsinfo->version; /* message version */ - *p++ = fsinfo->strategy; /* File space strategy */ + *p++ = (uint8_t)fsinfo->version; /* message version */ + *p++ = (uint8_t)fsinfo->strategy; /* File space strategy */ *p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */ H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */ diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 4b34a52..d6190c6 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -171,7 +171,7 @@ static herr_t H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg; - unsigned char flags; /* Flags for encoding group info */ + unsigned char flags = 0; /* Flags for encoding group info */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -183,7 +183,7 @@ H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, *p++ = H5O_GINFO_VERSION; /* The flags for the group info */ - flags = ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0; + flags = (unsigned char)(ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0); flags = (unsigned char)(flags | (ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0)); *p++ = flags; diff --git a/src/H5Oint.c b/src/H5Oint.c index b97ff30..d5a3a71 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -31,6 +31,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free lists */ @@ -42,6 +43,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ @@ -55,9 +58,9 @@ /* User data for recursive traversal over objects from a group */ typedef struct { hid_t obj_id; /* The ID for the starting group */ - H5G_loc_t *start_loc; /* Location of starting group */ + H5G_loc_t *start_loc; /* Location of starting group */ H5SL_t *visited; /* Skip list for tracking visited nodes */ - H5O_iterate_t op; /* Application callback */ + H5O_iterate2_t op; /* Application callback */ void *op_data; /* Application's op data */ unsigned fields; /* Selection of object info */ } H5O_iter_visit_ud_t; @@ -77,9 +80,11 @@ static herr_t H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type); static herr_t H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr); static herr_t H5O__free_visit_visited(void *item, void *key, void *operator_data/*in,out*/); -static herr_t H5O__visit_cb(hid_t group, const char *name, const H5L_info_t *linfo, +static herr_t H5O__visit_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void *_udata); static const H5O_obj_class_t *H5O__obj_class_real(const H5O_t *oh); +static herr_t H5O__reset_info2(H5O_info2_t *oinfo); + /*********************/ /* Package Variables */ @@ -150,6 +155,13 @@ H5FL_BLK_DEFINE(chunk_image); /* Declare external the free list for H5O_cont_t sequences */ H5FL_SEQ_EXTERN(H5O_cont_t); +/* The canonical 'undefined' token */ +const H5O_token_t H5O_TOKEN_UNDEF_g = {{ + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255, + 255, 255, 255, 255}}; + /*****************************/ /* Library Private Variables */ @@ -239,7 +251,7 @@ H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx version = H5O_VERSION_1; /* Upgrade to the version indicated by the file's low bound if higher */ - version = MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]); + version = (uint8_t)MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]); /* Version bounds check */ if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)]) @@ -2154,9 +2166,7 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) /*------------------------------------------------------------------------- * Function: H5O_get_info * - * Purpose: Retrieve the information for an object - * - * Note: Add a parameter "fields" to indicate selection of object info. + * Purpose: Retrieve the data model information for an object * * Return: Success: Non-negative * Failure: Negative @@ -2167,7 +2177,7 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) *------------------------------------------------------------------------- */ herr_t -H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) +H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields) { const H5O_obj_class_t *obj_class; /* Class of object for header */ H5O_t *oh = NULL; /* Object header */ @@ -2188,15 +2198,17 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class") /* Reset the object info structure */ - HDmemset(oinfo, 0, sizeof(*oinfo)); + if(H5O__reset_info2(oinfo) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct") /* Get basic information, if requested */ if(fields & H5O_INFO_BASIC) { /* Retrieve the file's fileno */ H5F_GET_FILENO(loc->file, oinfo->fileno); - /* Set the object's address */ - oinfo->addr = loc->addr; + /* Set the object's address into the token */ + if(H5VL_native_addr_to_token(loc->file, H5I_FILE, loc->addr, &oinfo->token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") /* Retrieve the type of the object */ oinfo->type = obj_class->type; @@ -2248,31 +2260,11 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) } /* end else */ } /* end if */ - /* Get the information for the object header, if requested */ - if(fields & H5O_INFO_HDR) - if(H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info") - /* Retrieve # of attributes */ if(fields & H5O_INFO_NUM_ATTRS) 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 */ - if(fields & H5O_INFO_META_SIZE) { - /* Check for 'bh_info' callback for this type of object */ - if(obj_class->bh_info) - /* Call the object's class 'bh_info' routine */ - if((obj_class->bh_info)(loc, oh, &oinfo->meta_size.obj) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info") - - /* Get B-tree & heap info for any attributes */ - if(!(fields & H5O_INFO_NUM_ATTRS) || oinfo->num_attrs > 0) { - if(H5O__attr_bh_info(loc->file, oh, &oinfo->meta_size.attr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info") - } /* end if */ - } /* end if */ - done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") @@ -2282,60 +2274,66 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__get_info_by_idx + * Function: H5O_get_native_info * - * Purpose: Internal routine to retrieve an object's info according to - * an index within a group. - * - * - * Note: Add a parameter "fields" to indicate selection of object info. + * Purpose: Retrieve the native file-format information for an object * * Return: Success: Non-negative * Failure: Negative * * Programmer: Quincey Koziol - * December 28, 2017 + * November 21 2006 * *------------------------------------------------------------------------- */ 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) +H5O_get_native_info(const H5O_loc_t *loc, H5O_native_info_t *oinfo, unsigned fields) { - 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 */ + const H5O_obj_class_t *obj_class; /* Class of object for header */ + H5O_t *oh = NULL; /* Object header */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL) - /* Check arguments */ + /* Check args */ HDassert(loc); - HDassert(group_name && *group_name); HDassert(oinfo); - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); + /* 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") - /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(loc, group_name, idx_type, order, n, &obj_loc/*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - loc_found = TRUE; + /* Get class for object */ + if(NULL == (obj_class = H5O__obj_class_real(oh))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class") + + /* Reset the object info structure */ + HDmemset(oinfo, 0, sizeof(*oinfo)); - /* Retrieve the object's information */ - if(H5O_get_info(obj_loc.oloc, oinfo, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") + /* Get the information for the object header, if requested */ + if(fields & H5O_NATIVE_INFO_HDR) + if(H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info") + + /* Get B-tree & heap metadata storage size, if requested */ + if(fields & H5O_NATIVE_INFO_META_SIZE) { + /* Check for 'bh_info' callback for this type of object */ + if(obj_class->bh_info) + /* Call the object's class 'bh_info' routine */ + if((obj_class->bh_info)(loc, oh, &oinfo->meta_size.obj) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info") + + /* Get B-tree & heap info for any attributes */ + if(H5O__attr_bh_info(loc->file, oh, &oinfo->meta_size.attr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info") + } /* end if */ 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") + if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O__get_info_by_idx() */ + FUNC_LEAVE_NOAPI_TAG(ret_value) +} /* end H5O_get_native_info() */ /*------------------------------------------------------------------------- @@ -2378,7 +2376,7 @@ H5O_get_create_plist(const H5O_loc_t *loc, H5P_genplist_t *oc_plist) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list") /* Mask off non-"user visible" flags */ - ohdr_flags = oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES); + H5_CHECKED_ASSIGN(ohdr_flags, uint8_t, oh->flags & (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES), int); /* Set object header flags */ if(H5P_set(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) @@ -2649,7 +2647,7 @@ H5O__free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static herr_t -H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *linfo, +H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t *linfo, void *_udata) { H5O_iter_visit_ud_t *udata = (H5O_iter_visit_ud_t *)_udata; /* User data for callback */ @@ -2687,7 +2685,7 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *li /* Check if we've seen the object the link references before */ if(NULL == H5SL_search(udata->visited, &obj_pos)) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ /* Get the object's info */ if(H5O_get_info(&obj_oloc, &oinfo, udata->fields) < 0) @@ -2763,14 +2761,14 @@ done: */ 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_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields) { H5O_iter_visit_ud_t udata; /* User data for callback */ 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 */ + H5O_info2_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 */ @@ -2846,7 +2844,10 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, /* Construct unique "position" for this object */ obj_pos->fileno = oinfo.fileno; - obj_pos->addr = oinfo.addr; + + /* De-serialize object token into an object address */ + if(H5VL_native_token_to_addr(loc->oloc->file, H5I_FILE, oinfo.token, &(obj_pos->addr)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") /* Add to list of visited objects */ if(H5SL_insert(udata.visited, obj_pos, obj_pos) < 0) @@ -3083,3 +3084,25 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__free() */ +/*------------------------------------------------------------------------- + * Function: H5O__reset_info2 + * + * Purpose: Resets/initializes an H5O_info2_t struct. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O__reset_info2(H5O_info2_t *oinfo) +{ + FUNC_ENTER_STATIC_NOERR; + + /* Reset the passed-in info struct */ + HDmemset(oinfo, 0, sizeof(H5O_info2_t)); + oinfo->type = H5O_TYPE_UNKNOWN; + oinfo->token = H5O_TOKEN_UNDEF; + + FUNC_LEAVE_NOAPI(SUCCEED); +} /* end H5O__reset_info2() */ + diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 138f219..2a2a07b 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -570,7 +570,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, H5O_LAYOUT_VERSION_3 : mesg->version); /* Layout class */ - *p++ = mesg->type; + *p++ = (uint8_t)mesg->type; /* Write out layout class specific information */ switch(mesg->type) { diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 9827b6a..a2f88d9 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -203,7 +203,7 @@ H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co *p++ = H5O_LINFO_VERSION; /* The flags for the link indices */ - index_flags = linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0; + index_flags = (uint8_t)(linfo->track_corder ? H5O_LINFO_TRACK_CORDER : 0); index_flags = (uint8_t)(index_flags | (linfo->index_corder ? H5O_LINFO_INDEX_CORDER : 0)); *p++ = index_flags; diff --git a/src/H5Olink.c b/src/H5Olink.c index 4bd952b..1f0c6c7 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -316,7 +316,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con /* Store the type of a non-default link */ if(link_flags & H5O_LINK_STORE_LINK_TYPE) - *p++ = lnk->type; + *p++ = (uint8_t)lnk->type; /* Store the link creation order in the file, if its valid */ if(lnk->corder_valid) diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 18f3706..d66ea69 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1686,17 +1686,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_msg_reset_share(unsigned type_id, void *mesg) +H5O_msg_reset_share(unsigned H5_ATTR_NDEBUG_UNUSED type_id, void *mesg) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(type->share_flags & H5O_SHARE_IS_SHARABLE); + HDassert(H5O_msg_class_g[type_id]); /* map the type ID to the actual type object */ + HDassert(H5O_msg_class_g[type_id]->share_flags & H5O_SHARE_IS_SHARABLE); HDassert(mesg); /* Reset the shared component in the message to zero. */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 4afa452..fb08f7d 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -556,10 +556,8 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; /* Package-local function prototypes */ 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(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_iter_order_t order, H5O_iterate2_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); H5_DLL herr_t H5O__free(H5O_t *oh); diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 54e8ec8..52a72b2 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -877,6 +877,7 @@ typedef struct { void *new_obj; /* Pointer to new object created */ } H5O_obj_create_t; + /* Forward declarations for prototype arguments */ struct H5P_genplist_t; @@ -906,7 +907,8 @@ H5_DLL herr_t H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned mesg_id, unsigned mesg_ #endif /* H5O_ENABLE_BOGUS */ H5_DLL herr_t H5O_delete(H5F_t *f, haddr_t addr); 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_get_info(const H5O_loc_t *oloc, H5O_info2_t *oinfo, unsigned fields); +H5_DLL herr_t H5O_get_native_info(const H5O_loc_t *oloc, H5O_native_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 void *H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type/*out*/); diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 234f4f0..d0f8ab3 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -75,14 +75,24 @@ /* Flags for H5Oget_info. * Theses flags determine which fields will be filled in in the H5O_info_t - * struct. + * struct. */ #define H5O_INFO_BASIC 0x0001u /* Fill in the fileno, addr, type, and rc fields */ #define H5O_INFO_TIME 0x0002u /* Fill in the atime, mtime, ctime, and btime fields */ #define H5O_INFO_NUM_ATTRS 0x0004u /* Fill in the num_attrs field */ -#define H5O_INFO_HDR 0x0008u /* Fill in the hdr field */ -#define H5O_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */ -#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE) +#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS) + +/* Flags for H5Oget_native_info. + * Theses flags determine which fields will be filled in in the H5O_native_info_t + * struct. + */ +#define H5O_NATIVE_INFO_HDR 0x0008u /* Fill in the hdr field */ +#define H5O_NATIVE_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */ +#define H5O_NATIVE_INFO_ALL (H5O_NATIVE_INFO_HDR | H5O_NATIVE_INFO_META_SIZE) + +/* Convenience macro to check if the token is the 'undefined' token value */ +#define H5O_IS_TOKEN_UNDEF(token) (!HDmemcmp(&(token), &(H5O_TOKEN_UNDEF), sizeof(H5O_token_t))) + /*******************/ /* Public Typedefs */ @@ -116,30 +126,36 @@ typedef struct H5O_hdr_info_t { } mesg; } H5O_hdr_info_t; -/* Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */ -typedef struct H5O_info_t { - unsigned long fileno; /* File number that object is located in */ - haddr_t addr; /* Object address in file */ - H5O_type_t type; /* Basic object type (group, dataset, etc.) */ - unsigned rc; /* Reference count of object */ - time_t atime; /* Access time */ - time_t mtime; /* Modification time */ - time_t ctime; /* Change time */ - time_t btime; /* Birth time */ - hsize_t num_attrs; /* # of attributes attached to object */ +/* Data model information struct for objects */ +/* (For H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx version 3) */ +typedef struct H5O_info2_t { + unsigned long fileno; /* File number that object is located in */ + H5O_token_t token; /* Token representing the object */ + H5O_type_t type; /* Basic object type (group, dataset, etc.) */ + unsigned rc; /* Reference count of object */ + time_t atime; /* Access time */ + time_t mtime; /* Modification time */ + time_t ctime; /* Change time */ + time_t btime; /* Birth time */ + hsize_t num_attrs; /* # of attributes attached to object */ +} H5O_info2_t; + +/* Native file format information struct for objects */ +/* (For H5Oget_native_info / H5Oget_native_info_by_name / H5Oget_native_info_by_idx) */ +typedef struct H5O_native_info_t { H5O_hdr_info_t hdr; /* Object header information */ /* Extra metadata storage for obj & attributes */ struct { H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ H5_ih_info_t attr; /* v2 B-tree & heap for attributes */ } meta_size; -} H5O_info_t; +} H5O_native_info_t; /* Typedef for message creation indexes */ typedef uint32_t H5O_msg_crt_idx_t; -/* Prototype for H5Ovisit/H5Ovisit_by_name() operator */ -typedef herr_t (*H5O_iterate_t)(hid_t obj, const char *name, const H5O_info_t *info, +/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (version 3) */ +typedef herr_t (*H5O_iterate2_t)(hid_t obj, const char *name, const H5O_info2_t *info, void *op_data); typedef enum H5O_mcdt_search_ret_t { @@ -165,15 +181,21 @@ extern "C" { #endif H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id); -H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr); +H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token); H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id); H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id); -H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields); -H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, +H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields); +H5_DLL herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id); -H5_DLL 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, +H5_DLL herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo, + unsigned fields, hid_t lapl_id); +H5_DLL herr_t H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigned fields); +H5_DLL herr_t H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo, + unsigned fields, hid_t lapl_id); +H5_DLL herr_t H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_native_info_t *oinfo, unsigned fields, hid_t lapl_id); H5_DLL herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id); @@ -187,10 +209,10 @@ H5_DLL herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize); H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id); -H5_DLL 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); -H5_DLL 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, +H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate2_t op, void *op_data, unsigned fields); +H5_DLL herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, + H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields, hid_t lapl_id); H5_DLL herr_t H5Oclose(hid_t object_id); H5_DLL herr_t H5Oflush(hid_t obj_id); @@ -198,6 +220,14 @@ H5_DLL herr_t H5Orefresh(hid_t oid); H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id); H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id); H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled); +H5_DLL herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, + int *cmp_value); +H5_DLL herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str); +H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token); + +/* The canonical 'undefined' token value */ +#define H5O_TOKEN_UNDEF (H5OPEN H5O_TOKEN_UNDEF_g) +H5_DLLVAR const H5O_token_t H5O_TOKEN_UNDEF_g; /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -207,6 +237,12 @@ H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled /* Macros */ +/* Deprecated flags for earlier versions of H5Oget_info* */ +#define H5O_INFO_HDR 0x0008u /* Fill in the hdr field */ +#define H5O_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */ +#undef H5O_INFO_ALL +#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE) + /* Typedefs */ /* A struct that's part of the H5G_stat_t structure (deprecated) */ @@ -217,19 +253,56 @@ typedef struct H5O_stat_t { unsigned nchunks; /* Number of object header chunks */ } H5O_stat_t; +/* Information struct for object */ +/* (For H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx versions 1 & 2) */ +typedef struct H5O_info1_t { + unsigned long fileno; /* File number that object is located in */ + haddr_t addr; /* Object address in file */ + H5O_type_t type; /* Basic object type (group, dataset, etc.) */ + unsigned rc; /* Reference count of object */ + time_t atime; /* Access time */ + time_t mtime; /* Modification time */ + time_t ctime; /* Change time */ + time_t btime; /* Birth time */ + hsize_t num_attrs; /* # of attributes attached to object */ + H5O_hdr_info_t hdr; /* Object header information */ + /* Extra metadata storage for obj & attributes */ + struct { + H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ + H5_ih_info_t attr; /* v2 B-tree & heap for attributes */ + } meta_size; +} H5O_info1_t; + +/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (versions 1 & 2) */ +typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t *info, + void *op_data); + + /* Function prototypes */ -H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo); -H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, +H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr); +H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo); +H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo, hid_t lapl_id); H5_DLL 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, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, hid_t lapl_id); - +H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields); +H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo, + unsigned fields, hid_t lapl_id); +H5_DLL 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_info1_t *oinfo, + unsigned fields, hid_t lapl_id); H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, - H5O_iterate_t op, void *op_data); + H5O_iterate1_t op, void *op_data); H5_DLL 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, + H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data, hid_t lapl_id); +H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate1_t op, void *op_data, unsigned fields); +H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, + H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, + void *op_data, unsigned fields, hid_t lapl_id); + #endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifdef __cplusplus diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index b4f00ea..33310dc 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -257,7 +257,7 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) /* Dataspace type */ if(sdim->version > H5O_SDSPACE_VERSION_1) - *p++ = sdim->type; + *p++ = (uint8_t)sdim->type; else { *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 67ca76f..b49e501 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -589,9 +589,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O__shared_copy_file(H5F_t *file_src, H5F_t *file_dst, +H5O__shared_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, H5F_t *file_dst, const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst, - hbool_t H5_ATTR_UNUSED *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, + hbool_t H5_ATTR_UNUSED *recompute_size, unsigned *mesg_flags, H5O_copy_t H5_ATTR_NDEBUG_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata) { const H5O_shared_t *shared_src = (const H5O_shared_t *)_native_src; /* Alias to shared info in native source */ diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 8040a6a..e4ad980 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -381,7 +381,7 @@ done: *------------------------------------------------------------------------- */ static H5_INLINE herr_t -H5O_SHARED_POST_COPY_FILE(const H5O_loc_t *oloc_src, const void *mesg_src, +H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const void *mesg_src, H5O_loc_t *oloc_dst, void *mesg_dst, unsigned *mesg_flags, H5O_copy_t *cpy_info) { diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 22252d3..3668229 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -5753,10 +5753,10 @@ 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 = 0; /* Value from comparison */ - herr_t status; /* Status from info comparison */ - int ret_value = 0; /* Return value */ + H5VL_class_t *cls1, *cls2; /* connector class for each property */ + int cmp_value = 0; /* Value from comparison */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Status from info comparison */ + int ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Pint.c b/src/H5Pint.c index 2911eef..0810427 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -2780,8 +2780,8 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P__poke_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, - void *_udata) +H5P__poke_plist_cb(H5P_genplist_t H5_ATTR_NDEBUG_UNUSED *plist, const char H5_ATTR_NDEBUG_UNUSED *name, + H5P_genprop_t *prop, void *_udata) { H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2827,7 +2827,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, +H5P__poke_pclass_cb(H5P_genplist_t *plist, const char H5_ATTR_NDEBUG_UNUSED *name, H5P_genprop_t *prop, void *_udata) { H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ @@ -4260,10 +4260,9 @@ property list class. REVISION LOG --------------------------------------------------------------------------*/ static int -H5P__iterate_pclass_cb(void *_item, void *_key, void *_udata) +H5P__iterate_pclass_cb(void *_item, void H5_ATTR_NDEBUG_UNUSED *_key, void *_udata) { H5P_genprop_t *item = (H5P_genprop_t *)_item; /* Pointer to the property */ - char *key = (char *)_key; /* Pointer to the property's name */ H5P_iter_pclass_ud_t *udata = (H5P_iter_pclass_ud_t *)_udata; /* Pointer to user data */ int ret_value = 0; /* Return value */ @@ -4271,7 +4270,7 @@ H5P__iterate_pclass_cb(void *_item, void *_key, void *_udata) /* Sanity check */ HDassert(item); - HDassert(key); + HDassert((char *)_key); /* Check if we've found the correctly indexed property */ if(*udata->curr_idx_ptr >= udata->prev_idx) { @@ -4397,8 +4396,8 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5P__peek_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, - void *_udata) +H5P__peek_cb(H5P_genplist_t H5_ATTR_NDEBUG_UNUSED *plist, const char H5_ATTR_NDEBUG_UNUSED *name, + H5P_genprop_t *prop, void *_udata) { H5P_prop_get_ud_t *udata = (H5P_prop_get_ud_t *)_udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 7a7cc23..6e582fb 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -270,8 +270,8 @@ H5P__lacc_elink_fapl_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") - if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") } /* end if */ done: @@ -313,8 +313,8 @@ H5P__lacc_elink_fapl_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") - if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") } /* end if */ done: @@ -329,8 +329,8 @@ done: * property in the dataset access property list is * encoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -401,8 +401,8 @@ done: * property in the dataset access property list is * decoded. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Wednesday, August 15, 2012 @@ -454,15 +454,15 @@ done: /*-------------------------------------------------------------------------- - * Function: H5P__lacc_elink_fapl_del + * Function: H5P__lacc_elink_fapl_del * - * Purpose: Close the FAPL for link access + * Purpose: Close the FAPL for link access * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 + * Programmer: Vailin Choi + * Tuesday, Sept 23, 2008 * *-------------------------------------------------------------------------- */ @@ -482,7 +482,7 @@ H5P__lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED /* Close the FAPL */ if(l_fapl_id != H5P_DEFAULT && H5I_dec_ref(l_fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") done: FUNC_LEAVE_NOAPI(ret_value) @@ -490,15 +490,15 @@ done: /*-------------------------------------------------------------------------- - * Function: H5P__lacc_elink_fapl_copy + * Function: H5P__lacc_elink_fapl_copy * - * Purpose: Copy the FAPL for link access + * Purpose: Copy the FAPL for link access * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 + * Programmer: Vailin Choi + * Tuesday, Sept 23, 2008 * *-------------------------------------------------------------------------- */ @@ -522,8 +522,8 @@ H5P__lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") - if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") } /* end if */ done: @@ -567,7 +567,7 @@ H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_ if(obj1 == NULL && obj2 != NULL) HGOTO_DONE(1); if(obj1 != NULL && obj2 == NULL) HGOTO_DONE(-1); if(obj1 && obj2) { - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; status = H5P__cmp_plist(obj1, obj2, &ret_value); HDassert(status >= 0); @@ -579,23 +579,23 @@ done: /*-------------------------------------------------------------------------- - * Function: H5P__lacc_elink_fapl_close + * Function: H5P__lacc_elink_fapl_close * - * Purpose: Close the FAPL for link access + * Purpose: Close the FAPL for link access * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 + * Programmer: Vailin Choi + * Tuesday, Sept 23, 2008 * *--------------------------------------------------------------------------- */ static herr_t H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - hid_t l_fapl_id; - herr_t ret_value = SUCCEED; + hid_t l_fapl_id; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -607,7 +607,7 @@ H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE /* Close the FAPL */ if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c index fe5be0f..3a3f619 100644 --- a/src/H5Pmapl.c +++ b/src/H5Pmapl.c @@ -137,6 +137,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__macc_reg_prop() */ +#ifdef H5_HAVE_MAP_API /*------------------------------------------------------------------------- * Function: H5Pset_map_iterate_hints @@ -214,4 +215,4 @@ H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_a done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_map_iterate_hints() */ - +#endif @@ -66,22 +66,22 @@ /*------------------------------------------------------------------------- * Function: H5Rcreate_object * - * Purpose: Creates an object reference. The LOC_ID and NAME are used to locate - * the object pointed to. + * Purpose: Creates an object reference. The LOC_ID and NAME are used + * to locate the object pointed to. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ hid_t file_id = H5I_INVALID_HID;/* File ID */ - H5VL_object_t *vol_obj_file = NULL; /* Object token of file_id */ + H5VL_object_t *vol_obj_file = NULL; /* Object of file_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; herr_t ret_value = SUCCEED; /* Return value */ @@ -135,11 +135,11 @@ H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_p /* Create the reference (do not pass filename, since file_id is attached) */ HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE); - if(H5R__create_object((const H5VL_token_t *)&obj_token, cont_info.token_size, (H5R_ref_priv_t *)ref_ptr) < 0) + if(H5R__create_object((const H5O_token_t *)&obj_token, cont_info.token_size, (H5R_ref_priv_t *)ref_ptr) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference") /* Attach loc_id to reference and hold reference to it */ - if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE) < 0) + if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") done: @@ -152,11 +152,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Rcreate_region * - * Purpose: Creates a region reference. The LOC_ID and NAME are used to locate - * the object pointed to and the SPACE_ID is used to choose the region pointed - * to. + * Purpose: Creates a region reference. The LOC_ID and NAME are used to + * locate the object pointed to and the SPACE_ID is used to + * choose the region pointed to. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ @@ -164,12 +164,12 @@ herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, H5R_ref_t *ref_ptr) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ hid_t file_id = H5I_INVALID_HID;/* File ID */ - H5VL_object_t *vol_obj_file = NULL; /* Object token of file_id */ + H5VL_object_t *vol_obj_file = NULL; /* Object of file_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; struct H5S_t *space = NULL; /* Pointer to dataspace containing region */ herr_t ret_value = SUCCEED; /* Return value */ @@ -228,16 +228,16 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, /* Create the reference (do not pass filename, since file_id is attached) */ HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE); - if(H5R__create_region((const H5VL_token_t *)&obj_token, cont_info.token_size, space, (H5R_ref_priv_t *)ref_ptr) < 0) + if(H5R__create_region((const H5O_token_t *)&obj_token, cont_info.token_size, space, (H5R_ref_priv_t *)ref_ptr) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference") /* Attach loc_id to reference and hold reference to it */ - if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE) < 0) + if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") done: if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on file") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") FUNC_LEAVE_API(ret_value) } /* end H5Rcreate_region() */ @@ -245,10 +245,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Rcreate_attr * - * Purpose: Creates an attribute reference. The LOC_ID, NAME and ATTR_NAME are - * used to locate the attribute pointed to. + * Purpose: Creates an attribute reference. The LOC_ID, NAME and + * ATTR_NAME are used to locate the attribute pointed to. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ @@ -256,12 +256,12 @@ herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id, H5R_ref_t *ref_ptr) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ hid_t file_id = H5I_INVALID_HID;/* File ID */ - H5VL_object_t *vol_obj_file = NULL; /* Object token of file_id */ + H5VL_object_t *vol_obj_file = NULL; /* Object of file_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; herr_t ret_value = SUCCEED; /* Return value */ @@ -317,16 +317,16 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, /* Create the reference (do not pass filename, since file_id is attached) */ HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE); - if(H5R__create_attr((const H5VL_token_t *)&obj_token, cont_info.token_size, attr_name, (H5R_ref_priv_t *)ref_ptr) < 0) + if(H5R__create_attr((const H5O_token_t *)&obj_token, cont_info.token_size, attr_name, (H5R_ref_priv_t *)ref_ptr) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create attribute reference") /* Attach loc_id to reference and hold reference to it */ - if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE) < 0) + if(H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") done: if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on file") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") FUNC_LEAVE_API(ret_value) } /* end H5Rcreate_attr() */ @@ -334,9 +334,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Rdestroy * - * Purpose: Destroy reference and free resources allocated during H5Rcreate. + * Purpose: Destroy reference and free resources allocated during + * H5Rcreate. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ @@ -367,9 +368,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_type * - * Purpose: Given a reference to some object, return the type of that reference. + * Purpose: Given a reference to some object, return the type of that + * reference. * - * Return: Reference type/H5R_BADTYPE on failure + * Return: Reference type / H5R_BADTYPE on failure * *------------------------------------------------------------------------- */ @@ -398,9 +400,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Requal * - * Purpose: Compare two references + * Purpose: Compare two references * - * Return: TRUE if equal, FALSE if unequal, FAIL if error + * Return: TRUE if equal, FALSE if unequal, FAIL if error * *------------------------------------------------------------------------- */ @@ -428,9 +430,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Rcopy * - * Purpose: Copy a reference + * Purpose: Copy a reference * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ @@ -458,20 +460,20 @@ done: /*------------------------------------------------------------------------- * Function: H5Ropen_object * - * Purpose: Given a reference to some object, open that object and return an - * ID for that object. + * Purpose: Given a reference to some object, open that object and + * return an ID for that object. * - * Return: Valid ID on success/Negative on failure + * Return: Valid ID on success / H5I_INVALID_HID on failure * *------------------------------------------------------------------------- */ hid_t -H5Ropen_object(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) +H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) { hid_t loc_id; /* Reference location ID */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -530,21 +532,21 @@ done: /*------------------------------------------------------------------------- * Function: H5Ropen_region * - * Purpose: Given a reference to some object, creates a copy of the dataset - * pointed to's dataspace and defines a selection in the copy which is the - * region pointed to. + * Purpose: Given a reference to some object, creates a copy of the dataset + * pointed to's dataspace and defines a selection in the copy + * which is the region pointed to. * - * Return: Valid ID on success/Negative on failure + * Return: Valid ID on success / H5I_INVALID_HID on failure * *------------------------------------------------------------------------- */ hid_t -H5Ropen_region(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) +H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) { hid_t loc_id; /* Reference location ID */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ hid_t opened_obj_id = H5I_INVALID_HID; /* Opened object ID */ @@ -616,7 +618,7 @@ done: HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close object") if(H5I_INVALID_HID == ret_value) /* Cleanup on failure */ if((space_id != H5I_INVALID_HID) && (H5I_dec_ref(space_id) < 0)) - HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close dataspace") + HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close dataspace") FUNC_LEAVE_API(ret_value) } /* end H5Ropen_region() */ @@ -625,20 +627,20 @@ done: /*------------------------------------------------------------------------- * Function: H5Ropen_attr * - * Purpose: Given a reference to some attribute, open that attribute and - * return an ID for that attribute. + * Purpose: Given a reference to some attribute, open that attribute and + * return an ID for that attribute. * - * Return: Valid ID on success/Negative on failure + * Return: Valid ID on success / H5I_INVALID_HID on failure * *------------------------------------------------------------------------- */ hid_t -H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) +H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) { hid_t loc_id; /* Reference location ID */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ hid_t opened_obj_id = H5I_INVALID_HID; /* Opened object ID */ @@ -688,7 +690,7 @@ H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) /* 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, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -700,18 +702,18 @@ H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) /* Open the attribute */ if(NULL == (opened_attr = H5VL_attr_open(opened_obj, &loc_params, H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr), aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr)) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr)) /* Register the attribute and get an ID for it */ if((ret_value = H5VL_register(H5I_ATTR, opened_attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: if((opened_obj_id != H5I_INVALID_HID) && (H5I_dec_ref(opened_obj_id) < 0)) HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close object") if(H5I_INVALID_HID == ret_value) /* Cleanup on failure */ if(opened_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") + HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) } /* end H5Ropen_attr() */ @@ -720,20 +722,20 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_obj_type3 * - * Purpose: Given a reference to some object, this function returns the type - * of object pointed to. + * Purpose: Given a reference to some object, this function returns the + * type of object pointed to. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / Negative on failure * *------------------------------------------------------------------------- */ herr_t -H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type) +H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type) { hid_t loc_id; /* Reference location ID */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -746,7 +748,7 @@ H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type) || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") if(rapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Retrieve loc_id from reference */ if(H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) { @@ -770,7 +772,7 @@ H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type) /* Retrieve object's type */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type") done: FUNC_LEAVE_API(ret_value) @@ -780,10 +782,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_file_name * - * Purpose: Given a reference to some object, determine a file name of the - * object located into. + * Purpose: Given a reference to some object, determine a file name of the + * object located into. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Non-negative length of the path on success / -1 on failure * *------------------------------------------------------------------------- */ @@ -809,8 +811,9 @@ H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf, size_t size) * copy of the filename */ if((ret_value = H5R__get_file_name((const H5R_ref_priv_t *)ref_ptr, buf, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to retrieve file name") - } else { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + } + else { + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ /* Retrieve VOL file object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -828,21 +831,21 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_obj_name * - * Purpose: Given a reference to some object, determine a path to the object - * referenced in the file. + * Purpose: Given a reference to some object, determine a path to the + * object referenced in the file. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Non-negative length of the path on success / -1 on failure * *------------------------------------------------------------------------- */ ssize_t -H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) +H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) { hid_t loc_id; /* Reference location ID */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ - ssize_t ret_value; /* Return value */ + H5O_token_t obj_token = {0}; /* Object token */ + ssize_t ret_value = 0; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE4("Zs", "*Rri*sz", ref_ptr, rapl_id, buf, size); @@ -854,7 +857,7 @@ H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") if(rapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a property list") /* Retrieve loc_id from reference */ if(H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) { @@ -864,7 +867,7 @@ H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) } /* Get object token */ - if((ret_value = H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL)) < 0) + if(H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to get object token") /* Get the VOL object */ @@ -878,7 +881,7 @@ H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) /* Retrieve object's name */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, buf, size) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) @@ -888,9 +891,9 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_attr_name * - * Purpose: Given a reference to some attribute, determine its name. + * Purpose: Given a reference to some attribute, determine its name. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Non-negative length of the path on success / -1 on failure * *------------------------------------------------------------------------- */ @@ -915,3 +918,4 @@ H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf, size_t size) done: FUNC_LEAVE_API(ret_value) } /* end H5Rget_attr_name() */ + diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index ad3c219..4e44683 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -87,20 +87,20 @@ /*------------------------------------------------------------------------- * Function: H5Rget_obj_type1 * - * Purpose: Retrieves the type of the object that a reference points to. + * Purpose: Retrieves the type of the object that a reference points to. * - * Return: Object type (as defined in H5Gpublic.h) on success - * H5G_UNKNOWN on failure + * Return: Success: Object type (as defined in H5Gpublic.h) + * Failure: H5G_UNKNOWN * *------------------------------------------------------------------------- */ H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5O_type_t obj_type; /* Object type */ const unsigned char *buf = (const unsigned char *)ref; /* Reference buffer */ H5G_obj_t ret_value; /* Return value */ @@ -133,7 +133,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) /* Retrieve object's type */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5G_UNKNOWN, "can't retrieve object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "can't retrieve object type") /* Set return value */ ret_value = H5G_map_obj_type(obj_type); @@ -146,20 +146,21 @@ done: /*------------------------------------------------------------------------- * Function: H5Rdereference1 * - * Purpose: Given a reference to some object, open that object and return an - * ID for that object. + * Purpose: Given a reference to some object, open that object and return + * an ID for that object. * - * Return: Valid ID on success/Negative on failure + * Return: Success: Valid ID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ const unsigned char *buf = (const unsigned char *)ref; /* Reference buffer */ @@ -209,12 +210,12 @@ done: /*------------------------------------------------------------------------- * Function: H5Rcreate * - * Purpose: Creates a particular type of reference specified with REF_TYPE, - * in the space pointed to by REF. The LOC_ID and NAME are used to locate the - * object pointed to and the SPACE_ID is used to choose the region pointed to - * (for Dataset Region references). + * Purpose: Creates a particular type of reference specified with REF_TYPE, + * in the space pointed to by REF. The LOC_ID and NAME are used to + * locate the object pointed to and the SPACE_ID is used to choose + * the region pointed to (for Dataset Region references). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / negative on failure * *------------------------------------------------------------------------- */ @@ -222,10 +223,10 @@ herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */ void *vol_obj_file = NULL; @@ -251,6 +252,19 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(vol_obj, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ + /* Get object type */ if((vol_obj_type = H5I_get_type(loc_id)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") @@ -274,16 +288,17 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get container info */ - if(H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) + if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") /* Create reference */ if(ref_type == H5R_OBJECT1) { size_t buf_size = H5R_OBJ_REF_BUF_SIZE; - if((ret_value = H5R__encode_token_obj_compat((const H5VL_token_t *)&obj_token, cont_info.token_size, buf, &buf_size)) < 0) + if((ret_value = H5R__encode_token_obj_compat((const H5O_token_t *)&obj_token, cont_info.token_size, buf, &buf_size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to encode object reference") - } else { + } /* end if */ + else { H5F_t *f = NULL; H5S_t *space = NULL; /* Pointer to dataspace containing region */ size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; @@ -294,17 +309,14 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, if(NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - /* Currently restrict API usage to native VOL - * TODO check for terminal connector or use capability flag */ - /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data(vol_obj_file))) + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Encode dataset region */ - if((ret_value = H5R__encode_token_region_compat(f, (const H5VL_token_t *)&obj_token, cont_info.token_size, space, buf, &buf_size)) < 0) + if((ret_value = H5R__encode_token_region_compat(f, (const H5O_token_t *)&obj_token, cont_info.token_size, space, buf, &buf_size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to encode region reference") - } + } /* end else */ done: if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) @@ -316,10 +328,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_obj_type2 * - * Purpose: Given a reference to some object, this function returns the type - * of object pointed to. + * Purpose: Given a reference to some object, this function returns the + * type of object pointed to. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success / negative on failure * *------------------------------------------------------------------------- */ @@ -327,10 +339,10 @@ herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */ herr_t ret_value = SUCCEED; /* Return value */ @@ -362,7 +374,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, /* Retrieve object's type */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type") done: FUNC_LEAVE_API(ret_value) @@ -372,10 +384,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Rdereference2 * - * Purpose: Given a reference to some object, open that object and return an - * ID for that object. + * Purpose: Given a reference to some object, open that object and return + * an ID for that object. * - * Return: Valid ID on success/Negative on failure + * Return: Success: Valid ID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -383,10 +396,10 @@ hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ H5I_type_t opened_type; /* Opened object type */ void *opened_obj = NULL; /* Opened object */ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */ @@ -440,18 +453,19 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_region * - * Purpose: Given a reference to some object, creates a copy of the dataset - * pointed to's dataspace and defines a selection in the copy which is the - * region pointed to. + * Purpose: Given a reference to some object, creates a copy of the dataset + * pointed to's dataspace and defines a selection in the copy + * which is the region pointed to. * - * Return: Valid ID on success/Negative on failure + * Return: Success: Valid ID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ void *vol_obj_file = NULL; /* VOL file */ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; @@ -475,6 +489,19 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) if(NULL == (vol_obj = H5VL_vol_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(vol_obj, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ + /* Get object type */ if((vol_obj_type = H5I_get_type(id)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") @@ -488,11 +515,11 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get container info */ - if(H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) + if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get container info") /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data(vol_obj_file))) + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL object") /* Get the dataspace with the correct region selected */ @@ -501,7 +528,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) /* 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") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) @@ -513,10 +540,11 @@ done: /*------------------------------------------------------------------------- * Function: H5Rget_name * - * Purpose: Given a reference to some object, determine a path to the object - * referenced in the file. + * Purpose: Given a reference to some object, determine a path to the + * object referenced in the file. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Success: Non-negative length of the path + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -524,10 +552,10 @@ ssize_t H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name, size_t size) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5I_type_t vol_obj_type = H5I_BADID;/* Object type of loc_id */ H5VL_loc_params_t loc_params; /* Location parameters */ - H5VL_token_t obj_token = {0}; /* Object token */ + H5O_token_t obj_token = {0}; /* Object token */ const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */ ssize_t ret_value = -1; /* Return value */ @@ -559,8 +587,9 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name, /* Retrieve object's name */ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) } /* end H5Rget_name() */ + diff --git a/src/H5Rint.c b/src/H5Rint.c index 2a21179..33ebe53 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -35,6 +35,8 @@ #include "H5Sprivate.h" /* Dataspaces */ #include "H5Tprivate.h" /* Datatypes */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ /****************/ @@ -93,9 +95,29 @@ HDfflush(stdout); \ } while (0) static const char * -H5R__print_token(const H5VL_token_t token) { +H5R__print_token(const H5O_token_t token) { static char string[64]; - HDsnprintf(string, 64, "%zu", *(haddr_t *)token); + + /* Print the raw token. */ + HDsnprintf(string, 64, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", + (unsigned char)token.__data[15], + (unsigned char)token.__data[14], + (unsigned char)token.__data[13], + (unsigned char)token.__data[12], + (unsigned char)token.__data[11], + (unsigned char)token.__data[10], + (unsigned char)token.__data[9], + (unsigned char)token.__data[8], + (unsigned char)token.__data[7], + (unsigned char)token.__data[6], + (unsigned char)token.__data[5], + (unsigned char)token.__data[4], + (unsigned char)token.__data[3], + (unsigned char)token.__data[2], + (unsigned char)token.__data[1], + (unsigned char)token.__data[0] + ); + return string; } #else @@ -110,8 +132,8 @@ H5R__print_token(const H5VL_token_t token) { /* Local Prototypes */ /********************/ -static herr_t H5R__encode_obj_token(const H5VL_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); -static herr_t H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, H5VL_token_t *obj_token, uint8_t *token_size); +static herr_t H5R__encode_obj_token(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); +static herr_t H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, uint8_t *token_size); static herr_t H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc); static herr_t H5R__decode_region(const unsigned char *buf, size_t *nbytes, H5S_t **space_ptr); static herr_t H5R__encode_string(const char *string, unsigned char *buf, size_t *nalloc); @@ -240,14 +262,14 @@ H5R_term_package(void) /*------------------------------------------------------------------------- * Function: H5R__create_object * - * Purpose: Creates an object reference. + * Purpose: Creates an object reference * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, +H5R__create_object(const H5O_token_t *obj_token, size_t token_size, H5R_ref_priv_t *ref) { size_t encode_size; @@ -258,11 +280,11 @@ H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, HDassert(ref); /* Create new reference */ - H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); - ref->ref.obj.filename = NULL; + ref->info.obj.filename = NULL; ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_OBJECT2; - ref->token_size = (uint8_t)token_size; + if(H5R__set_obj_token(ref, obj_token, token_size) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token") /* Cache encoding size (assume no external reference) */ if(H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0) @@ -270,7 +292,7 @@ H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, ref->encode_size = (uint32_t)encode_size; H5R_LOG_DEBUG("Created object reference, %d, filename=%s, obj_addr=%s, encode size=%u", - (int)sizeof(H5R_ref_priv_t), ref->ref.obj.filename, H5R__print_token(ref->ref.obj.token), + (int)sizeof(H5R_ref_priv_t), ref->info.obj.filename, H5R__print_token(ref->info.obj.token), ref->encode_size); done: @@ -281,14 +303,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__create_region * - * Purpose: Creates a region reference. + * Purpose: Creates a region reference * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, +H5R__create_region(const H5O_token_t *obj_token, size_t token_size, H5S_t *space, H5R_ref_priv_t *ref) { size_t encode_size; @@ -300,14 +322,14 @@ H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, HDassert(ref); /* Create new reference */ - H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); - ref->ref.obj.filename = NULL; - if(NULL == (ref->ref.reg.space = H5S_copy(space, FALSE, TRUE))) + ref->info.obj.filename = NULL; + if(NULL == (ref->info.reg.space = H5S_copy(space, FALSE, TRUE))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace") ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_DATASET_REGION2; - ref->token_size = (uint8_t)token_size; + if(H5R__set_obj_token(ref, obj_token, token_size) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token") /* Cache encoding size (assume no external reference) */ if(H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0) @@ -315,16 +337,16 @@ H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, ref->encode_size = (uint32_t)encode_size; H5R_LOG_DEBUG("Created region reference, %d, filename=%s, obj_addr=%s, encode size=%u", - (int)sizeof(H5R_ref_priv_t), ref->ref.obj.filename, H5R__print_token(ref->ref.obj.token), + (int)sizeof(H5R_ref_priv_t), ref->info.obj.filename, H5R__print_token(ref->info.obj.token), ref->encode_size); done: - if(ret_value < 0) { - if(ref->ref.reg.space) { - H5S_close(ref->ref.reg.space); - ref->ref.reg.space = NULL; - } - } + if(ret_value < 0) + if(ref->info.reg.space) { + H5S_close(ref->info.reg.space); + ref->info.reg.space = NULL; + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5R__create_region */ @@ -332,14 +354,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__create_attr * - * Purpose: Creates an attribute reference. + * Purpose: Creates an attribute reference * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, +H5R__create_attr(const H5O_token_t *obj_token, size_t token_size, const char *attr_name, H5R_ref_priv_t *ref) { size_t encode_size; @@ -355,14 +377,14 @@ H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "attribute name too long (%d > %d)", (int)HDstrlen(attr_name), H5R_MAX_STRING_LEN) /* Create new reference */ - H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); - ref->ref.obj.filename = NULL; - if(NULL == (ref->ref.attr.name = HDstrdup(attr_name))) + ref->info.obj.filename = NULL; + if(NULL == (ref->info.attr.name = HDstrdup(attr_name))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name") ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_ATTR; - ref->token_size = (uint8_t)token_size; + if(H5R__set_obj_token(ref, obj_token, token_size) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token") /* Cache encoding size (assume no external reference) */ if(H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0) @@ -370,12 +392,15 @@ H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, ref->encode_size = (uint32_t)encode_size; H5R_LOG_DEBUG("Created attribute reference, %d, filename=%s, obj_addr=%s, attr name=%s, encode size=%u", - (int)sizeof(H5R_ref_priv_t), ref->ref.obj.filename, H5R__print_token(ref->ref.obj.token), - ref->ref.attr.name, ref->encode_size); + (int)sizeof(H5R_ref_priv_t), ref->info.obj.filename, H5R__print_token(ref->info.obj.token), + ref->info.attr.name, ref->encode_size); done: - if(ret_value < 0) - ref->ref.attr.name = H5MM_xfree(ref->ref.attr.name); + if(ret_value < 0) { + H5MM_xfree(ref->info.attr.name); + ref->info.attr.name = NULL; + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5R__create_attr */ @@ -383,9 +408,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__destroy * - * Purpose: Destroy reference. + * Purpose: Destroy a reference * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -398,19 +423,24 @@ H5R__destroy(H5R_ref_priv_t *ref) HDassert(ref != NULL); - ref->ref.obj.filename = H5MM_xfree(ref->ref.obj.filename); + H5MM_xfree(ref->info.obj.filename); + ref->info.obj.filename = NULL; switch(ref->type) { case H5R_OBJECT2: break; + case H5R_DATASET_REGION2: - if(H5S_close(ref->ref.reg.space) < 0) + if(H5S_close(ref->info.reg.space) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace") - ref->ref.reg.space = NULL; + ref->info.reg.space = NULL; break; + case H5R_ATTR: - ref->ref.attr.name = H5MM_xfree(ref->ref.attr.name); + H5MM_xfree(ref->info.attr.name); + ref->info.attr.name = NULL; break; + case H5R_OBJECT1: case H5R_DATASET_REGION1: break; @@ -418,14 +448,22 @@ H5R__destroy(H5R_ref_priv_t *ref) case H5R_MAXTYPE: HDassert("invalid reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)") + default: HDassert("unknown reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") } /* end switch */ /* Decrement refcount of attached loc_id */ - if(ref->type && (ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0)) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + if(ref->type && (ref->loc_id != H5I_INVALID_HID)) { + if(ref->app_ref) { + if(H5I_dec_app_ref(ref->loc_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + } else { + if(H5I_dec_ref(ref->loc_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + } + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -435,14 +473,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__set_loc_id * - * Purpose: Attach location ID to reference and increment location refcount. + * Purpose: Attach location ID to reference and increment location refcount. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref) +H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref, hbool_t app_ref) { herr_t ret_value = SUCCEED; /* Return value */ @@ -451,14 +489,26 @@ H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref) HDassert(ref != NULL); HDassert(id != H5I_INVALID_HID); - /* If a location ID was previously assigned, decrement refcount and assign new one */ - if((ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0)) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + /* If a location ID was previously assigned, decrement refcount and + * assign new one */ + if((ref->loc_id != H5I_INVALID_HID)) { + if(ref->app_ref) { + if(H5I_dec_app_ref(ref->loc_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + } else { + if(H5I_dec_ref(ref->loc_id) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + } + } ref->loc_id = id; - /* Prevent location ID from being freed until reference is destroyed */ - if(inc_ref && H5I_inc_ref(ref->loc_id, FALSE) < 0) + /* Prevent location ID from being freed until reference is destroyed, + * set app_ref if necessary as references are exposed to users and are + * expected to be destroyed, this allows the loc_id to be cleanly released + * on shutdown if users fail to call H5Rdestroy(). */ + if(inc_ref && H5I_inc_ref(ref->loc_id, app_ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINC, FAIL, "incrementing location ID failed") + ref->app_ref = app_ref; done: FUNC_LEAVE_NOAPI(ret_value) @@ -468,9 +518,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__get_loc_id * - * Purpose: Retrieve location ID attached to existing reference. + * Purpose: Retrieve location ID attached to existing reference. * - * Return: Valid ID on success/Negative on failure + * Return: Valid ID on success / H5I_INVALID_HID on failure * *------------------------------------------------------------------------- */ @@ -492,20 +542,20 @@ H5R__get_loc_id(const H5R_ref_priv_t *ref) /*------------------------------------------------------------------------- * Function: H5R__reopen_file * - * Purpose: Re-open referenced file using file access property list. + * Purpose: Re-open referenced file using file access property list. * - * Return: Valid ID on success/Negative on failure + * Return: Valid ID on success / H5I_INVALID_HID on failure * *------------------------------------------------------------------------- */ hid_t H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) { - void *new_file = NULL; - H5VL_connector_prop_t connector_prop; - unsigned flags = H5F_ACC_RDWR; /* Must open file read-write to allow for object modifications */ - H5P_genplist_t *plist; - H5VL_object_t *vol_obj = NULL; /* VOL object for file */ + H5P_genplist_t *plist; /* Property list for FAPL */ + void *new_file = NULL; /* File object opened */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_object_t *vol_obj = NULL; /* VOL object for file */ + hbool_t supported; /* Whether 'post open' operation is supported by VOL connector */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_PACKAGE @@ -520,32 +570,37 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) 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_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") /* Stash a copy of the "top-level" connector property, before any pass-through * connectors modify or unwrap it. */ if(H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") /* Open the file */ - if(NULL == (new_file = H5VL_file_open(&connector_prop, H5R_REF_FILENAME(ref), flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") + /* (Must open file read-write to allow for object modifications) */ + if(NULL == (new_file = H5VL_file_open(&connector_prop, H5R_REF_FILENAME(ref), H5F_ACC_RDWR, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_REFERENCE, 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, connector_prop.connector_id, TRUE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") /* Get the file object */ if(NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") - /* Make the post open callback */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file post open callback") + /* Make the 'post open' callback */ + supported = FALSE; + if(H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") + if(supported) + if(H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, "unable to make file 'post open' callback") /* Attach loc_id to reference */ - if(H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE) < 0) + if(H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "unable to attach location id to reference") done: @@ -556,9 +611,10 @@ done: /*------------------------------------------------------------------------- * Function: H5R__get_type * - * Purpose: Given a reference to some object, return the type of that reference. + * Purpose: Given a reference to some object, return the type of that + * reference. * - * Return: Type of the reference + * Return: Type of the reference * *------------------------------------------------------------------------- */ @@ -570,7 +626,7 @@ H5R__get_type(const H5R_ref_priv_t *ref) FUNC_ENTER_PACKAGE_NOERR HDassert(ref != NULL); - ret_value = ref->type; + ret_value = (H5R_type_t)ref->type; FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_type() */ @@ -579,9 +635,9 @@ H5R__get_type(const H5R_ref_priv_t *ref) /*------------------------------------------------------------------------- * Function: H5R__equal * - * Purpose: Compare two references + * Purpose: Compare two references * - * Return: TRUE if equal, FALSE if unequal, FAIL if error + * Return: TRUE if equal, FALSE if unequal, FAIL if error * *------------------------------------------------------------------------- */ @@ -602,27 +658,27 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2) /* Compare object addresses */ if(ref1->token_size != ref2->token_size) HGOTO_DONE(FALSE); - if(0 != HDmemcmp(&ref1->ref.obj.token, &ref2->ref.obj.token, ref1->token_size)) + if(0 != HDmemcmp(&ref1->info.obj.token, &ref2->info.obj.token, ref1->token_size)) HGOTO_DONE(FALSE); /* Compare filenames */ - if((ref1->ref.obj.filename && (NULL == ref2->ref.obj.filename)) - || ((NULL == ref1->ref.obj.filename) && ref2->ref.obj.filename)) + if((ref1->info.obj.filename && (NULL == ref2->info.obj.filename)) + || ((NULL == ref1->info.obj.filename) && ref2->info.obj.filename)) HGOTO_DONE(FALSE); - if(ref1->ref.obj.filename && ref1->ref.obj.filename - && (0 != HDstrcmp(ref1->ref.obj.filename, ref2->ref.obj.filename))) + if(ref1->info.obj.filename && ref1->info.obj.filename + && (0 != HDstrcmp(ref1->info.obj.filename, ref2->info.obj.filename))) HGOTO_DONE(FALSE); switch(ref1->type) { case H5R_OBJECT2: break; case H5R_DATASET_REGION2: - if((ret_value = H5S_extent_equal(ref1->ref.reg.space, ref2->ref.reg.space)) < 0) + if((ret_value = H5S_extent_equal(ref1->info.reg.space, ref2->info.reg.space)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "cannot compare dataspace extents") break; case H5R_ATTR: - HDassert(ref1->ref.attr.name && ref2->ref.attr.name); - if(0 != HDstrcmp(ref1->ref.attr.name, ref2->ref.attr.name)) + HDassert(ref1->info.attr.name && ref2->info.attr.name); + if(0 != HDstrcmp(ref1->info.attr.name, ref2->info.attr.name)) HGOTO_DONE(FALSE); break; case H5R_OBJECT1: @@ -644,9 +700,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__copy * - * Purpose: Copy a reference + * Purpose: Copy a reference * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -659,7 +715,7 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) HDassert((src_ref != NULL) && (dst_ref != NULL)); - H5MM_memcpy(&dst_ref->ref.obj.token, &src_ref->ref.obj.token, src_ref->token_size); + H5MM_memcpy(&dst_ref->info.obj.token, &src_ref->info.obj.token, sizeof(H5O_token_t)); dst_ref->encode_size = src_ref->encode_size; dst_ref->type = src_ref->type; dst_ref->token_size = src_ref->token_size; @@ -668,11 +724,11 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) case H5R_OBJECT2: break; case H5R_DATASET_REGION2: - if(NULL == (dst_ref->ref.reg.space = H5S_copy(src_ref->ref.reg.space, FALSE, TRUE))) + if(NULL == (dst_ref->info.reg.space = H5S_copy(src_ref->info.reg.space, FALSE, TRUE))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace") break; case H5R_ATTR: - if(NULL == (dst_ref->ref.attr.name = HDstrdup(src_ref->ref.attr.name))) + if(NULL == (dst_ref->info.attr.name = HDstrdup(src_ref->info.attr.name))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name") break; case H5R_OBJECT1: @@ -688,16 +744,17 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) /* We only need to keep a copy of the filename if we don't have the loc_id */ if(src_ref->loc_id == H5I_INVALID_HID) { - HDassert(src_ref->ref.obj.filename); + HDassert(src_ref->info.obj.filename); - if(NULL == (dst_ref->ref.obj.filename = HDstrdup(src_ref->ref.obj.filename))) + if(NULL == (dst_ref->info.obj.filename = HDstrdup(src_ref->info.obj.filename))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy filename") dst_ref->loc_id = H5I_INVALID_HID; - } else { - dst_ref->ref.obj.filename = NULL; + } + else { + dst_ref->info.obj.filename = NULL; /* Set location ID and hold reference to it */ - if(H5R__set_loc_id(dst_ref, src_ref->loc_id, TRUE) < 0) + if(H5R__set_loc_id(dst_ref, src_ref->loc_id, TRUE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "cannot set reference location ID") } @@ -709,14 +766,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__get_obj_token * - * Purpose: Given a reference to some object, get the encoded object addr. + * Purpose: Given a reference to some object, get the encoded token. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__get_obj_token(const H5R_ref_priv_t *ref, H5VL_token_t *obj_token, +H5R__get_obj_token(const H5R_ref_priv_t *ref, H5O_token_t *obj_token, size_t *token_size) { herr_t ret_value = SUCCEED; /* Return value */ @@ -724,12 +781,12 @@ H5R__get_obj_token(const H5R_ref_priv_t *ref, H5VL_token_t *obj_token, FUNC_ENTER_PACKAGE HDassert(ref != NULL); - HDassert(ref->token_size <= H5VL_MAX_TOKEN_SIZE); + HDassert(ref->token_size <= H5O_MAX_TOKEN_SIZE); if(obj_token) { if(0 == ref->token_size) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "NULL token size") - H5MM_memcpy(obj_token, &ref->ref.obj.token, ref->token_size); + H5MM_memcpy(obj_token, &ref->info.obj.token, sizeof(H5O_token_t)); } if(token_size) *token_size = ref->token_size; @@ -742,14 +799,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__set_obj_token * - * Purpose: Given a reference to some object, set the encoded object addr. + * Purpose: Given a reference to some object, set the encoded token. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, +H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, size_t token_size) { herr_t ret_value = SUCCEED; /* Return value */ @@ -759,10 +816,10 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, HDassert(ref != NULL); HDassert(obj_token); HDassert(token_size); - HDassert(token_size <= H5VL_MAX_TOKEN_SIZE); + HDassert(token_size <= H5O_MAX_TOKEN_SIZE); - H5MM_memcpy(&ref->ref.obj.token, obj_token, ref->token_size); - ref->token_size = token_size; + H5MM_memcpy(&ref->info.obj.token, obj_token, sizeof(H5O_token_t)); + ref->token_size = (uint8_t)token_size; FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__set_obj_token() */ @@ -771,11 +828,11 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, /*------------------------------------------------------------------------- * Function: H5R__get_region * - * Purpose: Given a reference to some object, creates a copy of the dataset - * pointed to's dataspace and defines a selection in the copy which is the - * region pointed to. + * Purpose: Given a reference to some object, creates a copy of the + * dataset pointed to's dataspace and defines a selection in + * the copy which is the region pointed to. * - * Return: Pointer to the dataspace on success/NULL on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -791,7 +848,7 @@ H5R__get_region(const H5R_ref_priv_t *ref, H5S_t *space) HDassert(space); /* Copy reference selection to destination */ - if(H5S_select_copy(space, ref->ref.reg.space, FALSE) < 0) + if(H5S_select_copy(space, ref->info.reg.space, FALSE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy selection") done: @@ -802,10 +859,10 @@ done: /*------------------------------------------------------------------------- * Function: H5R__get_file_name * - * Purpose: Given a reference to some object, determine a file name of the - * object located into. + * Purpose: Given a reference to some object, determine a file name of + * the object located into. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Non-negative length of the path on success / -1 on failure * *------------------------------------------------------------------------- */ @@ -821,17 +878,17 @@ H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size) HDassert(ref != NULL); /* Return if that reference has no filename set */ - if(!ref->ref.obj.filename) + if(!ref->info.obj.filename) HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, (-1), "no filename available for that reference") /* Get the file name length */ - copy_len = HDstrlen(ref->ref.obj.filename); + copy_len = HDstrlen(ref->info.obj.filename); HDassert(copy_len <= H5R_MAX_STRING_LEN); /* Copy the file name */ if(buf) { copy_len = MIN(copy_len, size - 1); - H5MM_memcpy(buf, ref->ref.obj.filename, copy_len); + H5MM_memcpy(buf, ref->info.obj.filename, copy_len); buf[copy_len] = '\0'; } ret_value = (ssize_t)(copy_len + 1); @@ -844,9 +901,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__get_attr_name * - * Purpose: Given a reference to some attribute, determine its name. + * Purpose: Given a reference to some attribute, determine its name. * - * Return: Non-negative length of the path on success/Negative on failure + * Return: Non-negative length of the path on success / -1 on failure * *------------------------------------------------------------------------- */ @@ -863,13 +920,13 @@ H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size) HDassert(ref->type == H5R_ATTR); /* Get the attribute name length */ - attr_name_len = HDstrlen(ref->ref.attr.name); + attr_name_len = HDstrlen(ref->info.attr.name); HDassert(attr_name_len <= H5R_MAX_STRING_LEN); /* Get the attribute name */ if(buf) { size_t copy_len = MIN(attr_name_len, size - 1); - H5MM_memcpy(buf, ref->ref.attr.name, copy_len); + H5MM_memcpy(buf, ref->info.attr.name, copy_len); buf[copy_len] = '\0'; } @@ -882,9 +939,9 @@ H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size) /*------------------------------------------------------------------------- * Function: H5R__encode * - * Purpose: Private function for H5Rencode. + * Purpose: Private function for H5Rencode * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -922,11 +979,11 @@ H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, *p++ = (uint8_t)flags; buf_size = *nalloc - H5R_ENCODE_HEADER_SIZE; - } + } /* end if */ encode_size += H5R_ENCODE_HEADER_SIZE; /* Encode object token */ - H5R_ENCODE_VAR(H5R__encode_obj_token, &ref->ref.obj.token, ref->token_size, + H5R_ENCODE_VAR(H5R__encode_obj_token, &ref->info.obj.token, ref->token_size, p, buf_size, encode_size, "Cannot encode object address"); /** @@ -937,31 +994,34 @@ H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, * - avoid duplicating VOL info on each reference * - must query terminal VOL connector to avoid passthrough confusion */ - if(flags & H5R_IS_EXTERNAL) { + if(flags & H5R_IS_EXTERNAL) /* Encode file name */ H5R_ENCODE(H5R__encode_string, filename, p, buf_size, encode_size, "Cannot encode filename"); - } switch(ref->type) { case H5R_OBJECT2: break; + case H5R_DATASET_REGION2: /* Encode dataspace */ - H5R_ENCODE(H5R__encode_region, ref->ref.reg.space, p, buf_size, + H5R_ENCODE(H5R__encode_region, ref->info.reg.space, p, buf_size, encode_size, "Cannot encode region"); break; + case H5R_ATTR: /* Encode attribute name */ - H5R_ENCODE(H5R__encode_string, ref->ref.attr.name, p, buf_size, + H5R_ENCODE(H5R__encode_string, ref->info.attr.name, p, buf_size, encode_size, "Cannot encode attribute name"); break; + case H5R_OBJECT1: case H5R_DATASET_REGION1: case H5R_BADTYPE: case H5R_MAXTYPE: HDassert("invalid reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)") + default: HDassert("unknown reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") @@ -977,9 +1037,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode * - * Purpose: Private function for H5Rdecode. + * Purpose: Private function for H5Rdecode * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1003,7 +1063,7 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") /* Set new reference */ - ref->type = (H5R_type_t)*p++; + ref->type = (int8_t)*p++; if(ref->type <= H5R_BADTYPE || ref->type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") @@ -1014,28 +1074,29 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref) decode_size += H5R_ENCODE_HEADER_SIZE; /* Decode object token */ - H5R_DECODE_VAR(H5R__decode_obj_token, &ref->ref.obj.token, &ref->token_size, + H5R_DECODE_VAR(H5R__decode_obj_token, &ref->info.obj.token, &ref->token_size, p, buf_size, decode_size, "Cannot decode object address"); /* We do not need to store the filename if the reference is internal */ if(flags & H5R_IS_EXTERNAL) { /* Decode file name */ - H5R_DECODE(H5R__decode_string, &ref->ref.obj.filename, p, buf_size, + H5R_DECODE(H5R__decode_string, &ref->info.obj.filename, p, buf_size, decode_size, "Cannot decode filename"); - } else - ref->ref.obj.filename = NULL; + } + else + ref->info.obj.filename = NULL; switch(ref->type) { case H5R_OBJECT2: break; case H5R_DATASET_REGION2: /* Decode dataspace */ - H5R_DECODE(H5R__decode_region, &ref->ref.reg.space, p, buf_size, + H5R_DECODE(H5R__decode_region, &ref->info.reg.space, p, buf_size, decode_size, "Cannot decode region"); break; case H5R_ATTR: /* Decode attribute name */ - H5R_DECODE(H5R__decode_string, &ref->ref.attr.name, p, buf_size, + H5R_DECODE(H5R__decode_string, &ref->info.attr.name, p, buf_size, decode_size, "Cannot decode attribute name"); break; case H5R_OBJECT1: @@ -1053,10 +1114,10 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref) ref->loc_id = H5I_INVALID_HID; /* Set encoding size */ - ref->encode_size = decode_size; + ref->encode_size = (uint32_t)decode_size; H5R_LOG_DEBUG("Decoded reference, filename=%s, obj_addr=%s, encode size=%u", - ref->ref.obj.filename, H5R__print_token(ref->ref.obj.token), + ref->info.obj.filename, H5R__print_token(ref->info.obj.token), ref->encode_size); *nbytes = decode_size; @@ -1069,14 +1130,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_obj_token * - * Purpose: Encode an object address. + * Purpose: Encode an object address. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5R__encode_obj_token(const H5VL_token_t *obj_token, size_t token_size, +H5R__encode_obj_token(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc) { herr_t ret_value = SUCCEED; @@ -1104,15 +1165,15 @@ H5R__encode_obj_token(const H5VL_token_t *obj_token, size_t token_size, /*------------------------------------------------------------------------- * Function: H5R__decode_obj_token * - * Purpose: Decode an object address. + * Purpose: Decode an object address. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, - H5VL_token_t *obj_token, uint8_t *token_size) + H5O_token_t *obj_token, uint8_t *token_size) { const uint8_t *p = (const uint8_t *)buf; herr_t ret_value = SUCCEED; @@ -1130,13 +1191,16 @@ H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, /* Get token size */ *token_size = *p++; - if(*token_size > sizeof(H5VL_token_t)) + if(*token_size > sizeof(H5O_token_t)) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Invalid token size (%u)", *token_size) + /* Make sure that token is initialized */ + HDmemset(obj_token, 0, sizeof(H5O_token_t)); + /* Decode token */ H5MM_memcpy(obj_token, p, *token_size); - *nbytes = *token_size + H5_SIZEOF_UINT8_T; + *nbytes = (size_t)*token_size + H5_SIZEOF_UINT8_T; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1146,9 +1210,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_region * - * Purpose: Encode a selection. + * Purpose: Encode a selection. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1184,7 +1248,7 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc) /* Serialize the selection */ if(H5S_SELECT_SERIALIZE(space, (unsigned char **)&p) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "can't serialize selection") - } + } /* end if */ *nalloc = (size_t)buf_size + 2 * H5_SIZEOF_UINT32_T; done: @@ -1195,9 +1259,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode_region * - * Purpose: Decode a selection. + * Purpose: Decode a selection. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1251,9 +1315,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_string * - * Purpose: Encode a string. + * Purpose: Encode a string. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1293,9 +1357,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode_string * - * Purpose: Decode a string. + * Purpose: Decode a string. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1322,7 +1386,7 @@ H5R__decode_string(const unsigned char *buf, size_t *nbytes, char **string_ptr) HDassert(string_len <= H5R_MAX_STRING_LEN); /* Allocate the string */ - if(NULL == (string = H5MM_malloc(string_len + 1))) + if(NULL == (string = (char *)H5MM_malloc(string_len + 1))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, FAIL, "Cannot allocate string") /* Copy the string */ @@ -1340,9 +1404,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_heap * - * Purpose: Encode data and insert into heap (native only). + * Purpose: Encode data and insert into heap (native only). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1364,13 +1428,13 @@ H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, uint8_t *p = (uint8_t *)buf; /* Write the reference information to disk (allocates space also) */ - if(H5HG_insert(f, data_size, (void *)data, &hobjid) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to write reference information") + if(H5HG_insert(f, data_size, data, &hobjid) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to write reference information") /* Encode the heap information */ H5F_addr_encode(f, &p, hobjid.addr); UINT32ENCODE(p, hobjid.idx); - } + } /* end if */ *nalloc = buf_size; done: @@ -1381,9 +1445,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode_heap * - * Purpose: Decode data inserted into heap (native only). + * Purpose: Decode data inserted into heap (native only). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1416,7 +1480,7 @@ H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, /* Read the information from disk */ if(NULL == (*data_ptr = (unsigned char *)H5HG_read(f, &hobjid, (void *)*data_ptr, data_size))) - HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "Unable to read reference data") + HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read reference data") *nbytes = buf_size; @@ -1428,9 +1492,9 @@ done: /*------------------------------------------------------------------------- * Function: H5R__free_heap * - * Purpose: Remove data previously inserted into heap (native only). + * Purpose: Remove data previously inserted into heap (native only). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1462,7 +1526,7 @@ H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes) if(hobjid.addr > 0) { /* Free heap object */ if(H5HG_remove(f, &hobjid) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") + HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to remove heap object") } /* end if */ done: @@ -1473,15 +1537,15 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode_token_compat * - * Purpose: Decode an object token. (native only) + * Purpose: Decode an object token. (native only) * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, - const unsigned char *buf, H5VL_token_t *obj_token) + const unsigned char *buf, H5O_token_t *obj_token) { hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */ H5VL_object_t *vol_obj_file = NULL; @@ -1490,6 +1554,19 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref FUNC_ENTER_PACKAGE +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(vol_obj, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ + /* Get the file for the object */ if((file_id = H5F_get_file_id(vol_obj, type, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -1499,7 +1576,7 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get container info */ - if(H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) + if(H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &cont_info) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") if(ref_type == H5R_OBJECT1) { @@ -1508,18 +1585,19 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref /* Get object address */ if(H5R__decode_token_obj_compat(buf, &buf_size, obj_token, cont_info.token_size) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token") - } else { + } /* end if */ + else { size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; H5F_t *f = NULL; /* Retrieve file from VOL object */ - if(NULL == (f = (H5F_t *)H5VL_object_data(vol_obj_file))) + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Get object address */ if(H5R__decode_token_region_compat(f, buf, &buf_size, obj_token, cont_info.token_size, NULL) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") - } + } /* end else */ done: if(file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) @@ -1531,14 +1609,14 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_token_obj_compat * - * Purpose: Encode an object token. (native only) + * Purpose: Encode an object token. (native only) * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__encode_token_obj_compat(const H5VL_token_t *obj_token, size_t token_size, +H5R__encode_token_obj_compat(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc) { herr_t ret_value = SUCCEED; @@ -1562,15 +1640,15 @@ H5R__encode_token_obj_compat(const H5VL_token_t *obj_token, size_t token_size, /*------------------------------------------------------------------------- * Function: H5R__decode_token_obj_compat * - * Purpose: Decode an object token. (native only) + * Purpose: Decode an object token. (native only) * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, - H5VL_token_t *obj_token, size_t token_size) + H5O_token_t *obj_token, size_t token_size) { herr_t ret_value = SUCCEED; @@ -1597,14 +1675,15 @@ done: /*------------------------------------------------------------------------- * Function: H5R__encode_token_region_compat * - * Purpose: Encode dataset selection and insert data into heap (native only). + * Purpose: Encode dataset selection and insert data into heap + * (native only). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5R__encode_token_region_compat(H5F_t *f, const H5VL_token_t *obj_token, +H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc) { size_t buf_size; @@ -1646,7 +1725,7 @@ H5R__encode_token_region_compat(H5F_t *f, const H5VL_token_t *obj_token, /* Allocate the space to store the serialized information */ H5_CHECK_OVERFLOW(data_size, hssize_t, size_t); if(NULL == (data = (uint8_t *)H5MM_malloc((size_t)data_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_REFERENCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Serialize information for dataset OID into heap buffer */ p = (uint8_t *)data; @@ -1672,19 +1751,20 @@ done: /*------------------------------------------------------------------------- * Function: H5R__decode_token_region_compat * - * Purpose: Decode dataset selection from data inserted into heap (native only). + * Purpose: Decode dataset selection from data inserted into heap + * (native only). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, - size_t *nbytes, H5VL_token_t *obj_token, size_t token_size, + size_t *nbytes, H5O_token_t *obj_token, size_t token_size, H5S_t **space_ptr) { unsigned char *data = NULL; - H5VL_token_t token = { 0 }; + H5O_token_t token = { 0 }; size_t data_size; const uint8_t *p; herr_t ret_value = SUCCEED; @@ -1708,16 +1788,17 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, if(space_ptr) { H5O_loc_t oloc; /* Object location */ H5S_t *space = NULL; - const uint8_t *q = (const uint8_t *)&token; /* Initialize the object location */ H5O_loc_reset(&oloc); oloc.file = f; - H5F_addr_decode(f, &q, &oloc.addr); + + if(H5VL_native_token_to_addr(f, H5I_FILE, token, &oloc.addr) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") /* Open and copy the dataset's dataspace */ if(NULL == (space = H5S_read(&oloc))) - HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "not found") + HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "not found") /* Unserialize the selection */ if(H5S_SELECT_DESERIALIZE(&space, &p) < 0) @@ -1726,9 +1807,10 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, *space_ptr = space; } if(obj_token) - H5MM_memcpy(obj_token, &token, token_size); + H5MM_memcpy(obj_token, &token, sizeof(H5O_token_t)); done: H5MM_free(data); FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__decode_token_region_compat() */ + diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 7471487..36cf805 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -40,8 +40,8 @@ #define H5R_IS_EXTERNAL 0x1 /* Set when encoding reference to external file */ /* Macros for convenience */ -#define H5R_REF_FILENAME(x) ((x)->ref.obj.filename) -#define H5R_REF_ATTRNAME(x) ((x)->ref.attr.name) +#define H5R_REF_FILENAME(x) ((x)->info.obj.filename) +#define H5R_REF_ATTRNAME(x) ((x)->info.attr.name) /* Header size */ #define H5R_ENCODE_HEADER_SIZE (2 * H5_SIZEOF_UINT8_T) @@ -52,7 +52,7 @@ /* Object reference */ typedef struct H5R_ref_priv_obj_t { - H5VL_token_t token; /* Object token */ + H5O_token_t token; /* Object token */ char *filename; /* File name */ } H5R_ref_priv_obj_t; @@ -74,12 +74,12 @@ typedef struct H5R_ref_priv_t { H5R_ref_priv_obj_t obj;/* Object reference */ H5R_ref_priv_reg_t reg;/* Region reference */ H5R_ref_priv_attr_t attr;/* Attribute Reference */ - } ref; + } info; hid_t loc_id; /* Cached location identifier */ uint32_t encode_size; /* Cached encoding size */ int8_t type; /* Reference type */ uint8_t token_size; /* Cached token size */ - char unused[18]; /* Unused */ + hbool_t app_ref; /* App ref on loc_id */ } H5R_ref_priv_t; /*****************************/ @@ -90,12 +90,12 @@ typedef struct H5R_ref_priv_t { /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, H5R_ref_priv_t *ref); -H5_DLL herr_t H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, H5S_t *space, H5R_ref_priv_t *ref); -H5_DLL herr_t H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, const char *attr_name, H5R_ref_priv_t *ref); +H5_DLL herr_t H5R__create_object(const H5O_token_t *obj_token, size_t token_size, H5R_ref_priv_t *ref); +H5_DLL herr_t H5R__create_region(const H5O_token_t *obj_token, size_t token_size, H5S_t *space, H5R_ref_priv_t *ref); +H5_DLL herr_t H5R__create_attr(const H5O_token_t *obj_token, size_t token_size, const char *attr_name, H5R_ref_priv_t *ref); H5_DLL herr_t H5R__destroy(H5R_ref_priv_t *ref); -H5_DLL herr_t H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref); +H5_DLL herr_t H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref, hbool_t app_ref); H5_DLL hid_t H5R__get_loc_id(const H5R_ref_priv_t *ref); H5_DLL hid_t H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id); @@ -103,8 +103,8 @@ H5_DLL H5R_type_t H5R__get_type(const H5R_ref_priv_t *ref); H5_DLL htri_t H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2); H5_DLL herr_t H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref); -H5_DLL herr_t H5R__get_obj_token(const H5R_ref_priv_t *ref, H5VL_token_t *obj_token, size_t *token_size); -H5_DLL herr_t H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, size_t token_size); +H5_DLL herr_t H5R__get_obj_token(const H5R_ref_priv_t *ref, H5O_token_t *obj_token, size_t *token_size); +H5_DLL herr_t H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, size_t token_size); H5_DLL herr_t H5R__get_region(const H5R_ref_priv_t *ref, H5S_t *space); H5_DLL ssize_t H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size); @@ -118,13 +118,13 @@ H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, c H5_DLL herr_t H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned char **data_ptr, size_t *data_size); H5_DLL herr_t H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes); -H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5VL_token_t *obj_token); +H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5O_token_t *obj_token); -H5_DLL herr_t H5R__encode_token_obj_compat(const H5VL_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); -H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5VL_token_t *obj_token, size_t token_size); +H5_DLL herr_t H5R__encode_token_obj_compat(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc); +H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size); -H5_DLL herr_t H5R__encode_token_region_compat(H5F_t *f, const H5VL_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc); -H5_DLL herr_t H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbytes, H5VL_token_t *obj_token, size_t token_size, H5S_t **space_ptr); +H5_DLL herr_t H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc); +H5_DLL herr_t H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size, H5S_t **space_ptr); #endif /* _H5Rpkg_H */ diff --git a/src/H5Rprivate.h b/src/H5Rprivate.h index 6afec47..870deaf 100644 --- a/src/H5Rprivate.h +++ b/src/H5Rprivate.h @@ -43,3 +43,4 @@ /******************************/ #endif /* _H5Rprivate_H */ + diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index a13d54b..13d82d7 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -71,7 +71,7 @@ typedef haddr_t hobj_ref_t; * Note! This type can only be used with the "native" HDF5 VOL connector. */ typedef struct { - char __data[H5R_DSET_REG_REF_BUF_SIZE]; + uint8_t __data[H5R_DSET_REG_REF_BUF_SIZE]; } hdset_reg_ref_t; /** @@ -80,7 +80,10 @@ typedef struct { * should always be used with the current reference API. */ typedef struct { - char __data[H5R_REF_BUF_SIZE]; + union { + uint8_t __data[H5R_REF_BUF_SIZE]; /* opaque data */ + int64_t align; /* ensures alignment */ + } u; } H5R_ref_t; /********************/ @@ -108,16 +111,16 @@ H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr); H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr); /* Dereference */ -H5_DLL hid_t H5Ropen_object(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); -H5_DLL hid_t H5Ropen_region(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); -H5_DLL hid_t H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id); +H5_DLL hid_t H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); +H5_DLL hid_t H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); +H5_DLL hid_t H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id); /* Get type */ -H5_DLL herr_t H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type); +H5_DLL herr_t H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type); /* Get name */ H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf, size_t size); -H5_DLL ssize_t H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size); +H5_DLL ssize_t H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size); H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf, size_t size); /* Symbols defined for compatibility with previous versions of the HDF5 API. @@ -652,7 +652,7 @@ int H5SL_term_package(void) /* Terminate all the factories */ if(H5SL_fac_nused_g > 0) { size_t i; - herr_t ret; + herr_t H5_ATTR_NDEBUG_UNUSED ret; for(i = 0; i < H5SL_fac_nused_g; i++) { ret = H5FL_fac_term(H5SL_fac_g[i]); diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 49ce2b4..6d0f2b0 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -212,8 +212,8 @@ H5SM__cache_table_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU *------------------------------------------------------------------------- */ static void * -H5SM__cache_table_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, + void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5F_t *f; /* File pointer -- from user data */ H5SM_master_table_t *table = NULL; /* Shared message table that we deserializing */ @@ -364,7 +364,7 @@ H5SM__cache_table_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t len, +H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5SM_master_table_t *table = (H5SM_master_table_t *)_thing; /* Shared message table to encode */ @@ -397,7 +397,7 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t len, *image++ = H5SM_LIST_VERSION; /* Is message index a list or a B-tree? */ - *image++ = table->indexes[u].index_type; + *image++ = (uint8_t)table->indexes[u].index_type; /* Type of messages in the index */ UINT16ENCODE(image, table->indexes[u].mesg_types); @@ -568,8 +568,8 @@ H5SM__cache_list_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo *------------------------------------------------------------------------- */ static void * -H5SM__cache_list_deserialize(const void *_image, size_t len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, + void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5SM_list_t *list = NULL; /* The SOHM list being read in */ H5SM_list_cache_ud_t *udata = (H5SM_list_cache_ud_t *)_udata; /* User data for callback */ @@ -687,7 +687,7 @@ H5SM__cache_list_image_len(const void *_thing, size_t *image_len) *------------------------------------------------------------------------- */ static herr_t -H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len, +H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_thing) { H5SM_list_t *list = (H5SM_list_t *)_thing ; /* Instance being serialized */ diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index 0cca6bb..e085204 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -298,7 +298,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) /* Sanity check */ HDassert(ctx); - *raw++ = message->location; + *raw++ = (uint8_t)message->location; UINT32ENCODE(raw, message->hash); if(message->location == H5SM_IN_HEAP) { diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 1e1538e..dc97ea2 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3688,7 +3688,7 @@ H5S__hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_ /* Determine the encoding size */ enc2 = H5S__hyper_get_enc_size_real(max2); - *enc_size = MAX(enc1, enc2); + *enc_size = (uint8_t)MAX(enc1, enc2); } /* end if */ else { hsize_t max_size = block_count; diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index f29319f..a61c505 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -238,7 +238,7 @@ H5_DLL herr_t H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *spac H5_DLL herr_t H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *buf); H5_DLL htri_t H5S_select_valid(const H5S_t *space); -H5_DLL hssize_t H5S_get_select_npoints(const H5S_t *space); +H5_DLL hsize_t H5S_get_select_npoints(const H5S_t *space); H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); H5_DLL herr_t H5S_get_select_offset(const H5S_t *space, hsize_t *offset); H5_DLL int H5S_get_select_unlim_dim(const H5S_t *space); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 6c8b898..13233ce 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -431,7 +431,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -H5_ATTR_PURE hssize_t +H5_ATTR_PURE hsize_t H5S_get_select_npoints(const H5S_t *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -439,7 +439,7 @@ H5S_get_select_npoints(const H5S_t *space) /* Check args */ HDassert(space); - FUNC_LEAVE_NOAPI((hssize_t)space->select.num_elem) + FUNC_LEAVE_NOAPI(space->select.num_elem) } /* end H5S_get_select_npoints() */ @@ -2601,9 +2601,9 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, { H5S_t *new_space = NULL; /* New dataspace constructed */ H5S_t *tmp_src_intersect_space = NULL; /* Temporary SIS converted from points->hyperslabs */ - H5S_sel_iter_t ss_iter; /* Selection iterator for src_space */ + H5S_sel_iter_t *ss_iter = NULL; /* Selection iterator for src_space */ hbool_t ss_iter_init = FALSE; /* Whether ss_iter has been initialized */ - H5S_sel_iter_t ds_iter; /* Selection iterator for dst_space */ + H5S_sel_iter_t *ds_iter = NULL; /* Selection iterator for dst_space */ hbool_t ds_iter_init = FALSE; /* Whether ds_iter has been initialized */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2617,6 +2617,11 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); + if(NULL == (ss_iter = H5FL_CALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + if(NULL == (ds_iter = H5FL_CALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + /* Create new space, using dst extent. Start with "all" selection. */ if(NULL == (new_space = H5S_create(H5S_SIMPLE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create output dataspace") @@ -2717,20 +2722,20 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") /* Initialize iterators */ - if(H5S_select_iter_init(&ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) + if(H5S_select_iter_init(ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize source space selection iterator") ss_iter_init = TRUE; - if(H5S_select_iter_init(&ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) + if(H5S_select_iter_init(ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize destination space selection iterator") ds_iter_init = TRUE; /* Iterate over points */ do { - HDassert(ss_iter.elmt_left > 0); - HDassert(ss_iter.elmt_left > 0); + HDassert(ss_iter->elmt_left > 0); + HDassert(ss_iter->elmt_left > 0); /* Get SS coords */ - if(H5S_SELECT_ITER_COORDS(&ss_iter, coords) < 0) + if(H5S_SELECT_ITER_COORDS(ss_iter, coords) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source selection coordinates") /* Check for intersection */ @@ -2740,7 +2745,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, /* Add point if it intersects */ if(intersect) { /* Get DS coords */ - if(H5S_SELECT_ITER_COORDS(&ds_iter, coords) < 0) + if(H5S_SELECT_ITER_COORDS(ds_iter, coords) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get destination selection coordinates") /* Add point to new_space */ @@ -2749,14 +2754,14 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, } /* end if */ /* Advance iterators */ - if(H5S_SELECT_ITER_NEXT(&ss_iter, 1) < 0) + if(H5S_SELECT_ITER_NEXT(ss_iter, 1) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne source selection iterator") - ss_iter.elmt_left--; - if(H5S_SELECT_ITER_NEXT(&ds_iter, 1) < 0) + ss_iter->elmt_left--; + if(H5S_SELECT_ITER_NEXT(ds_iter, 1) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne destination selection iterator") - ds_iter.elmt_left--; - } while(ss_iter.elmt_left > 0); - HDassert(H5S_SELECT_ITER_NELMTS(&ds_iter) == 0); + ds_iter->elmt_left--; + } while(ss_iter->elmt_left > 0); + HDassert(H5S_SELECT_ITER_NELMTS(ds_iter) == 0); } /* end if */ else { HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE); @@ -2783,11 +2788,14 @@ done: /* General cleanup */ if(tmp_src_intersect_space && H5S_close(tmp_src_intersect_space) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release temporary dataspace") - if(ss_iter_init && H5S_SELECT_ITER_RELEASE(&ss_iter) < 0) + if(ss_iter_init && H5S_SELECT_ITER_RELEASE(ss_iter) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release source selection iterator") - if(ds_iter_init && H5S_SELECT_ITER_RELEASE(&ds_iter) < 0) + if(ds_iter_init && H5S_SELECT_ITER_RELEASE(ds_iter) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release destination selection iterator") + ss_iter = H5FL_FREE(H5S_sel_iter_t, ss_iter); + ds_iter = H5FL_FREE(H5S_sel_iter_t, ds_iter); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_project_intersection() */ @@ -533,7 +533,7 @@ const unsigned H5O_dtype_ver_bounds[] = { H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V110 */ - H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V112 */ + H5O_DTYPE_VERSION_4, /* H5F_LIBVER_V112 */ H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; diff --git a/src/H5Tbit.c b/src/H5Tbit.c index df6d2c3..c6c1777 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -363,7 +363,7 @@ H5T__bit_set(uint8_t *buf, size_t offset, size_t size, hbool_t value) /* The middle bytes */ while (size >= 8) { - buf[idx++] = value ? 0xff : 0x00; + buf[idx++] = (uint8_t)(value ? 0xff : 0x00); size -= 8; } @@ -532,7 +532,7 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) acc = buf[idx]; acc++; carry = acc & 0x100; - buf[idx] = acc & 0xff; + buf[idx] = (uint8_t)(acc & 0xff); idx++; size -= 8; } diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index e5d12c0..1b922d5 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -106,7 +106,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_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_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -273,7 +273,7 @@ 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 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 */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -306,7 +306,8 @@ 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_LINK_CREATE_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 */ @@ -567,8 +568,8 @@ done: hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) { - void *dt = NULL; /* datatype token created by VOL connector */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *dt = NULL; /* datatype object created by VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -1095,7 +1096,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) { ssize_t nalloc; void *buf = NULL; - H5T_t *dt = NULL; /* datatype token from VOL connector */ + H5T_t *dt = NULL; /* datatype object from VOL connector */ H5T_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 4cc5f3c..29fd582 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1848,7 +1848,7 @@ H5T_conv_struct_free(H5T_conv_struct_t *priv) for(i = 0; i < priv->src_nmembs; i++) if(src2dst[i] >= 0) { - int status; + int H5_ATTR_NDEBUG_UNUSED status; status = H5I_dec_ref(src_memb_id[i]); HDassert(status >= 0); @@ -3609,23 +3609,22 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, for(elmtno = 0; elmtno < safe; elmtno++) { size_t buf_size; hbool_t dst_copy = FALSE; - hbool_t is_nil; /* Whether sequence is "nil" */ + hbool_t is_nil; /* Whether reference is "nil" */ - /* Check for "nil" source sequence */ + /* Check for "nil" source reference */ if((*(src->shared->u.atomic.u.r.cls->isnull))(src->shared->u.atomic.u.r.file, s, &is_nil) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if reference data is 'nil'") if(is_nil) { - - /* Write "nil" sequence to destination location */ + /* Write "nil" reference to destination location */ if((*(dst->shared->u.atomic.u.r.cls->setnull))(dst->shared->u.atomic.u.r.file, d, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set reference data to 'nil'") } /* end else-if */ else { /* Get size of references */ if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( - src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, &dst_copy))) + src->shared->u.atomic.u.r.file, s, src->shared->size, + dst->shared->u.atomic.u.r.file, &dst_copy))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size") /* Check if conversion buffer is large enough, resize if necessary. */ @@ -3636,26 +3635,26 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HDmemset(conv_buf, 0, conv_buf_size); } /* end if */ - if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { + if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) H5MM_memcpy(conv_buf, s, buf_size); - } else { + else { /* Read reference */ if(src->shared->u.atomic.u.r.cls->read( - src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) + src->shared->u.atomic.u.r.file, s, src->shared->size, + dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data") - } + } /* end else */ - if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) { + if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) H5MM_memcpy(d, conv_buf, buf_size); - } else { + else { /* Write reference to destination location */ if(dst->shared->u.atomic.u.r.cls->write( - src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, - dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0) + src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, + dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data") - } - } + } /* end else */ + } /* end else */ /* Advance pointers */ s += s_stride; diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 6ee0cd7..2c98dc0 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -110,7 +110,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_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_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -137,7 +137,8 @@ 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 */ @@ -174,8 +175,8 @@ done: hid_t H5Topen1(hid_t loc_id, const char *name) { - void *dt = NULL; /* Datatype token created by VOL connector */ - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + void *dt = NULL; /* Datatype object created by VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ diff --git a/src/H5Tref.c b/src/H5Tref.c index 6f21363..f97b78a 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -46,7 +46,7 @@ /* For region compatibility support */ struct H5Tref_dsetreg { - H5VL_token_t token; /* Object token */ + H5O_token_t token; /* Object token */ H5S_t *space; /* Dataspace */ }; @@ -159,24 +159,25 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Set up the function pointers to access the reference in memory */ dt->shared->u.atomic.u.r.cls = &H5T_ref_mem_g; - - } else if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) { + } /* end if */ + else if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) { /* Size in memory, disk size is different */ dt->shared->size = H5T_REF_OBJ_MEM_SIZE; dt->shared->u.atomic.prec = 8 * dt->shared->size; /* Unused for now */ dt->shared->u.atomic.u.r.cls = NULL; - - } else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) { + } /* end else-if */ + else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) { /* Size in memory, disk size is different */ dt->shared->size = H5T_REF_DSETREG_MEM_SIZE; dt->shared->u.atomic.prec = 8 * dt->shared->size; /* Unused for now */ dt->shared->u.atomic.u.r.cls = NULL; - - } + } /* end else-if */ + else + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid location") break; case H5T_LOC_DISK: /* Disk based reference datatype */ @@ -191,8 +192,18 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) if(dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) { H5F_t *f; - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (f = (H5F_t *)H5VL_object_data(file))) @@ -204,12 +215,22 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Set up the function pointers to access the reference in memory */ dt->shared->u.atomic.u.r.cls = &H5T_ref_obj_disk_g; - - } else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) { + } /* end if */ + else if(dt->shared->u.atomic.u.r.rtype == H5R_DATASET_REGION1) { H5F_t *f; - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (f = (H5F_t *)H5VL_object_data(file))) @@ -221,8 +242,8 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Set up the function pointers to access the reference in memory */ dt->shared->u.atomic.u.r.cls = &H5T_ref_dsetreg_disk_g; - - } else { + } /* end else-if */ + else { H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; size_t ref_encode_size; H5R_ref_priv_t fixed_ref; @@ -249,7 +270,6 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) * on disk, so use the same functions. */ dt->shared->u.atomic.u.r.cls = &H5T_ref_disk_g; - } break; @@ -267,8 +287,7 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) break; - case H5T_LOC_MAXLOC: - /* MAXLOC is invalid */ + case H5T_LOC_MAXLOC: /* MAXLOC is invalid */ default: HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid reference datatype location") } /* end switch */ @@ -345,17 +364,16 @@ static size_t H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, hbool_t *dst_copy) { - H5VL_object_t *vol_obj = NULL; + H5VL_object_t *vol_obj; /* VOL object for src ref's location */ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; - hbool_t files_equal = FALSE; - char file_name_buf_static[256]; - char *file_name_buf_dyn = NULL; - ssize_t file_name_len; - unsigned flags = 0; - size_t ret_value = 0; + hbool_t files_equal = FALSE; /* Whether src & dst references are in same file */ + char *file_name_buf_dyn = NULL; /* Pointer to dynamically allocated buffer for file name, if static buffer is too small */ + unsigned flags = 0; /* References flags */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_STATIC + /* Sanity check */ HDassert(src_buf); HDassert(src_size == H5T_REF_MEM_SIZE); @@ -364,21 +382,27 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") /* Set external flag if referenced file is not destination file */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, dst_file, &files_equal) < 0) + if(H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal") flags |= !files_equal ? H5R_IS_EXTERNAL : 0; /* Force re-calculating encoding size if any flags are set */ if(flags || !src_ref->encode_size) { + char file_name_buf_static[256]; /* File name */ + ssize_t file_name_len; /* Size of file name buffer */ + /* Pass the correct encoding version for the selection depending on the * file libver bounds, this is later retrieved in H5S hyper encode */ if(src_ref->type == (int8_t)H5R_DATASET_REGION2) { - /* Temporary hack to check if this is the native connector. We need to - * add a way to check if the terminal connector is native. For now this - * will break passthroughs, but it's needed for other VOL connectors to - * work. -NAF */ - if(dst_file->connector->cls->value == H5VL_NATIVE_VALUE) { - H5F_t *dst_f; + hbool_t is_native = FALSE; /* Whether the dest. file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(dst_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") + + /* Set the file's libver bounds if using the native VOL connector */ + if(is_native) { + H5F_t *dst_f; /* Native file struct */ if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") @@ -401,14 +425,15 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf /* Determine encoding size */ if(H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref, NULL, &ret_value, flags) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, 0, "unable to determine encoding size") - } else { + } /* end if */ + else { /* Can do a direct copy and skip blob decoding */ if(src_ref->type == (int8_t)H5R_OBJECT2) *dst_copy = TRUE; /* Get cached encoding size */ ret_value = src_ref->encode_size; - } + } /* end else */ done: H5MM_xfree(file_name_buf_dyn); @@ -431,17 +456,18 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size) { - H5VL_object_t *vol_obj = NULL; + H5VL_object_t *vol_obj; /* VOL object for src ref's location */ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; - hbool_t files_equal = FALSE; - char file_name_buf_static[256]; - char *file_name_buf_dyn = NULL; - ssize_t file_name_len; - unsigned flags = 0; - herr_t ret_value = SUCCEED; + hbool_t files_equal = FALSE; /* Whether src & dst references are in same file */ + char file_name_buf_static[256]; /* File name */ + char *file_name_buf_dyn = NULL; /* Pointer to dynamically allocated buffer for file name, if static buffer is too small */ + ssize_t file_name_len; /* Size of file name buffer */ + unsigned flags = 0; /* References flags */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC + /* Sanity check */ HDassert(src_buf); HDassert(src_size == H5T_REF_MEM_SIZE); HDassert(dst_file); @@ -453,18 +479,21 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") /* Set external flag if referenced file is not destination file */ - if(H5VL_file_specific(vol_obj, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, dst_file, &files_equal) < 0) + if(H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "can't check if files are equal") flags |= !files_equal ? H5R_IS_EXTERNAL : 0; /* Pass the correct encoding version for the selection depending on the * file libver bounds, this is later retrieved in H5S hyper encode */ if(src_ref->type == (int8_t)H5R_DATASET_REGION2) { - /* Temporary hack to check if this is the native connector. We need to - * add a way to check if the terminal connector is native. For now this - * will break passthroughs, but it's needed for other VOL connectors to - * work. -NAF */ - if(dst_file->connector->cls->value == H5VL_NATIVE_VALUE) { + hbool_t is_native = FALSE; /* Whether the dest. file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(dst_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") + + /* Set the file's libver bounds if using the native VOL connector */ + if(is_native) { H5F_t *dst_f; if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) @@ -517,14 +546,25 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size FUNC_ENTER_STATIC + /* Sanity check */ HDassert(src_file); HDassert(src_buf); HDassert(src_size); HDassert(dst_buf); HDassert(dst_size == H5T_REF_MEM_SIZE); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -534,24 +574,29 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size HDmemset(dst_buf, 0, dst_size); switch(src_type) { - case H5R_OBJECT1: { - size_t token_size = H5F_SIZEOF_ADDR(src_f); + case H5R_OBJECT1: + { + size_t token_size = H5F_SIZEOF_ADDR(src_f); - if(H5R__create_object((const H5VL_token_t *)src_buf, token_size, dst_ref) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference") - } + if(H5R__create_object((const H5O_token_t *)src_buf, token_size, dst_ref) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference") + } break; - case H5R_DATASET_REGION1: { - const struct H5Tref_dsetreg *src_reg = (const struct H5Tref_dsetreg *)src_buf; - size_t token_size = H5F_SIZEOF_ADDR(src_f); - - if(H5R__create_region(&src_reg->token, token_size, src_reg->space, dst_ref) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference") - /* create_region creates its internal copy of the space */ - if(H5S_close(src_reg->space) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace") - } + + case H5R_DATASET_REGION1: + { + const struct H5Tref_dsetreg *src_reg = (const struct H5Tref_dsetreg *)src_buf; + size_t token_size = H5F_SIZEOF_ADDR(src_f); + + if(H5R__create_region(&src_reg->token, token_size, src_reg->space, dst_ref) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference") + + /* create_region creates its internal copy of the space */ + if(H5S_close(src_reg->space) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace") + } break; + case H5R_DATASET_REGION2: /* Pass the correct encoding version for the selection depending on the * file libver bounds, this is later retrieved in H5S hyper decode */ @@ -563,12 +608,13 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size if(H5R__decode((const unsigned char *)src_buf, &src_size, dst_ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Cannot decode reference") break; + case H5R_BADTYPE: case H5R_MAXTYPE: default: HDassert("unknown reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") - } + } /* end switch */ /* If no filename set, this is not an external reference */ if(NULL == H5R_REF_FILENAME(dst_ref)) { @@ -576,10 +622,11 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size if((file_id = H5F_get_file_id(src_file, H5I_FILE, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* Attach loc ID to reference and hold reference to it */ - if(H5R__set_loc_id(dst_ref, file_id, TRUE) < 0) + /* Attach loc ID to reference and hold reference to it, this is a + * user exposed reference so set app_ref to TRUE. */ + if(H5R__set_loc_id(dst_ref, file_id, TRUE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") - } + } /* end if */ done: if((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0)) @@ -713,13 +760,14 @@ H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_bu *dst_copy = TRUE; ret_value = src_size; - } else { + } /* end if */ + else { /* Retrieve encoded data size */ UINT32DECODE(p, ret_value); /* Add size of the header */ ret_value += H5R_ENCODE_HEADER_SIZE; - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -736,7 +784,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, +H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_NDEBUG_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size) { const uint8_t *p = (const uint8_t *)src_buf; @@ -856,8 +904,18 @@ static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, HDassert(src_buf); HDassert(isnull); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -896,8 +954,18 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr HDassert(src_file); HDassert(src_buf); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -934,8 +1002,18 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ HDassert(src_buf); HDassert(dst_buf); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -946,7 +1024,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ /* Get object address */ if(H5R__decode_token_obj_compat((const unsigned char *)src_buf, &src_size, - (H5VL_token_t *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) + (H5O_token_t *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") done: @@ -979,8 +1057,18 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, HDassert(src_buf); HDassert(isnull); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -1013,26 +1101,37 @@ H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, { size_t ret_value = sizeof(struct H5Tref_dsetreg); +#ifndef NDEBUG FUNC_ENTER_STATIC +#else + FUNC_ENTER_STATIC_NOERR +#endif HDassert(src_buf); #ifndef NDEBUG { H5F_t *src_f; + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ + /* Must use native VOL connector for this operation */ + HDassert(is_native); /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); - } /* end block */ + } #endif /* NDEBUG */ +#ifndef NDEBUG done: +#endif FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_dsetreg_disk_getsize() */ @@ -1061,8 +1160,18 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t HDassert(dst_buf); HDassert(dst_size == sizeof(struct H5Tref_dsetreg)); - /* We should assert here that the terminal connector is H5VL_NATIVE once - * there is a facility to do so -NAF 2019/10/30 */ +#ifndef NDEBUG + { + hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ + + /* Check if using native VOL connector */ + if(H5VL_object_is_native(src_file, &is_native) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + + /* Must use native VOL connector for this operation */ + HDassert(is_native); + } +#endif /* NDEBUG */ /* Retrieve file from VOL object */ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) @@ -1072,7 +1181,7 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t /* Retrieve object address and space */ if(H5R__decode_token_region_compat(src_f, (const unsigned char *)src_buf, - &src_size, &dst_reg->token, H5F_SIZEOF_ADDR(src_f), &dst_reg->space) < 0) + &src_size, &dst_reg->token, H5F_SIZEOF_ADDR(src_f), &dst_reg->space) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") done: @@ -1100,8 +1209,7 @@ H5T_ref_reclaim(void *elem, const H5T_t *dt) HDassert(elem); HDassert(dt && (dt->shared->type == H5T_REFERENCE)); - if(dt->shared->u.atomic.u.r.opaque - && (H5R__destroy((H5R_ref_priv_t *)elem) < 0)) + if(dt->shared->u.atomic.u.r.opaque && H5R__destroy((H5R_ref_priv_t *)elem) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "cannot free reference") done: diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index ec84879..9d098c6 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -545,7 +545,8 @@ H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, 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) +H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, 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) { hvl_t vl; /* Temporary hvl_t to use during operation */ herr_t ret_value = SUCCEED; /* Return value */ @@ -728,7 +729,8 @@ H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5 *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len) +H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, + size_t len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s = *(char **)_vl; /* Pointer to the user's string information */ @@ -107,7 +107,7 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id) if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_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") - /* Check VOL initialization property list */ + /* Check VOL initialization property list */ if(H5P_DEFAULT == vipl_id) vipl_id = H5P_VOL_INITIALIZE_DEFAULT; else @@ -154,7 +154,7 @@ 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") - /* Check VOL initialization property list */ + /* Check VOL initialization property list */ if(H5P_DEFAULT == vipl_id) vipl_id = H5P_VOL_INITIALIZE_DEFAULT; else @@ -199,7 +199,7 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id) if(value < 0) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed") - /* Check VOL initialization property list */ + /* Check VOL initialization property list */ if(H5P_DEFAULT == vipl_id) vipl_id = H5P_VOL_INITIALIZE_DEFAULT; else @@ -249,6 +249,38 @@ done: /*------------------------------------------------------------------------- * Function: H5VLget_connector_id * + * Purpose: Retrieves the VOL connector ID for a given object ID. + * + * Return: A valid VOL connector ID. This ID will need to be closed + * using H5VLclose(). + * + * H5I_INVALID_HID on error. + * + * Programmer: Dana Robinson + * June 17, 2017 + * + *------------------------------------------------------------------------- + */ +hid_t +H5VLget_connector_id(hid_t obj_id) +{ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE1("i", "i", obj_id); + + /* Get connector ID */ + if((ret_value = H5VL__get_connector_id(obj_id, TRUE)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLget_connector_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLget_connector_id_by_name + * * Purpose: Retrieves the ID for a registered VOL connector. * * Return: A valid VOL connector ID if a connector by that name has @@ -264,7 +296,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLget_connector_id(const char *name) +H5VLget_connector_id_by_name(const char *name) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -272,12 +304,12 @@ H5VLget_connector_id(const char *name) H5TRACE1("i", "*s", name); /* Get connector ID with this name */ - if((ret_value = H5VL__get_connector_id(name, TRUE)) < 0) + if((ret_value = H5VL__get_connector_id_by_name(name, TRUE)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLget_connector_id() */ +} /* end H5VLget_connector_id_by_name() */ /*------------------------------------------------------------------------- @@ -411,7 +443,7 @@ H5VLunregister_connector(hid_t vol_id) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* For the time being, we disallow unregistering the native VOL connector */ - if(H5I_INVALID_HID == (native_id = H5VL__get_connector_id(H5VL_NATIVE_NAME, FALSE))) + if(H5I_INVALID_HID == (native_id = H5VL__get_connector_id_by_name(H5VL_NATIVE_NAME, FALSE))) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to find the native VOL connector ID") if(vol_id == native_id) HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "unregistering the native VOL connector is not allowed") @@ -477,6 +509,9 @@ done: * iteration routine callbacks (i.e. the callbacks from H5Aiterate*, * H5Literate* / H5Lvisit*, and H5Ovisit* ). * + * type must be a VOL-managed object class (H5I_FILE, + * H5I_GROUP, H5I_DATATYPE, H5I_DATASET, H5I_MAP, or H5I_ATTR). + * * Return: Success: Non-negative hid_t for the object. * Failure: Negative (H5I_INVALID_HID) * @@ -492,8 +527,34 @@ H5VLwrap_register(void *obj, H5I_type_t type) H5TRACE2("i", "*xIt", obj, type); /* Check args */ - if(type <= H5I_BADID || type >= H5I_NTYPES) - HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") + /* Use a switch here for (hopefully) better performance than a series of + * equality checks. We could also group these types together in H5I_type_t, + * make some assertions here to guarantee that, then just check the range. + */ + switch(type) { + case H5I_FILE: + case H5I_GROUP: + case H5I_DATATYPE: + case H5I_DATASET: + case H5I_MAP: + case H5I_ATTR: + /* VOL-managed objects, call is valid */ + break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + 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_SPACE_SEL_ITER: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") + } /* end switch */ if(NULL == obj) HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "obj is NULL") diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 77df207..e4ebb95 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -66,13 +66,13 @@ static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type 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_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, +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, 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_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type, + 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, const H5VL_loc_params_t *loc_params, @@ -87,26 +87,39 @@ static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req); -static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, +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, +static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static void * H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, + hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, + H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, + H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments); +static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, + H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); static void * H5VL__file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); 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_wrap_va_list(void *obj, const H5VL_class_t *cls, - H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); -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_get(void *obj, const H5VL_class_t *cls, + H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, + H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, + H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); static void *H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, @@ -115,12 +128,12 @@ static void *H5VL__group_create(void *obj, const 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, - 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, +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_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments); +static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, + H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, + H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__group_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, @@ -138,8 +151,8 @@ static herr_t H5VL__link_get(void *obj, const 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 herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, + H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static void *H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req); static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, @@ -152,23 +165,12 @@ static herr_t H5VL__object_get(void *obj, const 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, const H5VL_loc_params_t *loc_params, - const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, - hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -static void *H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, - const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, - void **req); -static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, - H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, - H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, - va_list arguments); -static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, - 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__object_optional(void *obj, const H5VL_class_t *cls, + H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls, + H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); +static herr_t H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, + H5VL_subclass_t subcls, int opt_type, hbool_t *supported); 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, @@ -177,7 +179,7 @@ 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); + H5VL_request_optional_t opt_type, va_list arguments); static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls); static herr_t H5VL__blob_put(void *obj, const H5VL_class_t *cls, const void *buf, size_t size, void *blob_id, void *ctx); @@ -185,6 +187,16 @@ static herr_t H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id, void *buf, size_t size, void *ctx); static herr_t H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); +static herr_t H5VL__blob_optional(void *obj, const H5VL_class_t *cls, + void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments); +static herr_t H5VL__token_cmp(void *obj, const H5VL_class_t *cls, + const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); +static herr_t H5VL__token_to_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, + const H5O_token_t *token, char **token_str); +static herr_t H5VL__token_from_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, + const char *token_str, H5O_token_t *token); +static herr_t H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, + hid_t dxpl_id, void **req, va_list arguments); /*********************/ /* Package Variables */ @@ -954,7 +966,7 @@ done: * * Purpose: Creates an attribute through the VOL * - * Return: Success: Pointer to the new attribute + * Return: Success: Pointer to the new attribute * Failure: NULL * *------------------------------------------------------------------------- @@ -986,13 +998,13 @@ done: * * Purpose: Creates an attribute through the VOL * - * Return: Success: Pointer to the new attribute + * Return: Success: Pointer to the new attribute * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_attr_create(const H5VL_object_t *vol_obj, const 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 type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { @@ -1002,7 +1014,7 @@ H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_para FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1067,7 +1079,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__attr_open(void *obj, const 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 */ @@ -1107,7 +1119,7 @@ H5VL_attr_open(const H5VL_object_t *vol_obj, const 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1171,7 +1183,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, +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 */ @@ -1202,7 +1214,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf, +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 */ @@ -1211,7 +1223,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1273,7 +1285,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 */ @@ -1304,7 +1316,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf, +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 */ @@ -1313,7 +1325,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1376,7 +1388,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, +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 */ @@ -1407,7 +1419,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_get(const H5VL_object_t *vol_obj, 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 */ @@ -1418,7 +1430,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1488,7 +1500,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, +H5VL__attr_specific(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) { @@ -1531,7 +1543,7 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1601,8 +1613,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1613,7 +1625,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((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (cls->attr_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: @@ -1632,7 +1644,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_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 */ @@ -1642,14 +1655,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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if((ret_value = 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, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: @@ -1676,13 +1689,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { 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, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVsi**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -1691,7 +1706,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((ret_value = H5VL__attr_optional(obj, cls, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__attr_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") done: @@ -1715,7 +1730,7 @@ H5VL__attr_close(void *obj, const H5VL_class_t *cls, 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->attr_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr close' method") @@ -1745,7 +1760,7 @@ 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); @@ -1845,7 +1860,7 @@ H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_p FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -1904,13 +1919,13 @@ done: * * Purpose: Opens a dataset through the VOL * - * Return: Success: Pointer to dataset + * Return: Success: Pointer to dataset * Failure: NULL * *------------------------------------------------------------------------- */ static void * -H5VL__dataset_open(void *obj, const 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 */ @@ -1935,7 +1950,7 @@ done: * * Purpose: Opens a dataset through the VOL * - * Return: Success: Pointer to dataset + * Return: Success: Pointer to dataset * Failure: NULL * *------------------------------------------------------------------------- @@ -1950,7 +1965,7 @@ H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2013,7 +2028,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +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 dxpl_id, void *buf, void **req) @@ -2045,7 +2060,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +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 dxpl_id, void *buf, void **req) @@ -2056,7 +2071,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2119,7 +2134,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req) @@ -2151,7 +2166,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req) @@ -2162,7 +2177,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2226,7 +2241,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, +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 */ @@ -2257,7 +2272,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_get(const H5VL_object_t *vol_obj, 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 */ @@ -2268,7 +2283,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2338,7 +2353,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, +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 */ @@ -2369,7 +2384,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_specific(const H5VL_object_t *vol_obj, 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 */ @@ -2380,7 +2395,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2450,8 +2465,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2462,7 +2477,7 @@ H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, 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) + if((cls->dataset_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: @@ -2481,8 +2496,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, - void **req, ...) +H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_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 */ @@ -2491,16 +2506,15 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, FUNC_ENTER_NOAPI(FAIL) - /* Call the corresponding VOL callback */ /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: @@ -2527,14 +2541,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, - va_list arguments) +H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { 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, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVti**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -2543,7 +2558,7 @@ H5VLdataset_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__dataset_optional(obj, cls, dxpl_id, req, arguments) < 0) + if(H5VL__dataset_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: @@ -2610,7 +2625,7 @@ H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) HDassert(vol_obj->connector->cls); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2662,6 +2677,658 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__datatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: Pointer to the new datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +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) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.commit) + 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))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") + +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, 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) +{ + 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) < 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->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: + /* 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() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_commit + * + * Purpose: Commits a datatype to the file + * + * Return: Success: Pointer to the new datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +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) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + 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) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + 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))) + 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: Pointer to the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +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) +{ + void *ret_value = NULL; /* Return value */ + + 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))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype 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, 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 */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 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->connector->cls, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype 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() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_open + * + * Purpose: Opens a named datatype + * + * Return: Success: Pointer to the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +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) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*x*xi*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(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))) + 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: 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 connector has no 'datatype get' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_get + * + * Purpose: Get specific information about the datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +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) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + HDva_start(arguments, req); + arg_started = TRUE; + 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: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_get + * + * Purpose: Gets information about the datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +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 connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + 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(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `datatype get' method") + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + 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 + * + *------------------------------------------------------------------------- + */ +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 connector 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 + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +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) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + HDva_start(arguments, req); + arg_started = TRUE; + 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: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_specific + * + * Purpose: Performs a connector-specific operation on a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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) +{ + 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, 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(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) + 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 connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + 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 connector has no 'datatype optional' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.optional)(obj, opt_type, 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 connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t opt_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) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + HDva_start(arguments, req); + arg_started = TRUE; + if(H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_optional + * + * Purpose: Performs an optional connector-specific operation on a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVui**xx", obj, connector_id, opt_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(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, opt_type, 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: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +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_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.close) + 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) + 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) < 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->connector->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() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_close + * + * Purpose: Closes a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) +{ + 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, 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(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) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_close() */ + + +/*------------------------------------------------------------------------- * Function: H5VL__file_create * * Purpose: Creates a file through the VOL @@ -2776,7 +3443,7 @@ done: * * Purpose: Opens a file through the VOL. * - * Return: Success: Pointer to file. + * Return: Success: Pointer to file. * Failure: NULL * *------------------------------------------------------------------------- @@ -2810,7 +3477,7 @@ done: * 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. + * Return: Success: Pointer to file. * Failure: NULL * *------------------------------------------------------------------------- @@ -2889,7 +3556,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, +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 */ @@ -2920,7 +3587,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_get(const H5VL_object_t *vol_obj, 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 */ @@ -2931,7 +3598,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -2991,43 +3658,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL__file_specific_wrap_va_list - * - * Purpose: Perform File specific operations through the VOL. Just - * starts a va_list and passes it to the connector's - * callback. Needed when the VOL layer needs to replace one - * of the variable arguments. - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL__file_specific_wrap_va_list(void *obj, 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_STATIC - - /* Start access to the varargs, so they are available in all situations below */ - HDva_start(arguments, req); - - /* 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: - /* End access to the va_list */ - HDva_end(arguments); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__file_specific_wrap_va_list() */ - - -/*------------------------------------------------------------------------- * Function: H5VL__file_specific * * Purpose: Perform File specific operations through the VOL @@ -3038,7 +3668,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, +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 */ @@ -3049,38 +3679,9 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t spe if(NULL == cls->file_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method") - /* Special handling for file is equal */ - if(specific_type == H5VL_FILE_IS_EQUAL) { - va_list tmp_args; /* Argument list passed from the API call */ - H5VL_object_t *vol_obj2; /* Second VOL object */ - hbool_t *is_equal; /* Output variable */ - int cmp_value; /* Comparison result */ - - /* Get parameters */ - HDva_copy(tmp_args, arguments); - vol_obj2 = HDva_arg(tmp_args, H5VL_object_t *); - is_equal = HDva_arg(tmp_args, hbool_t *); - HDva_end(tmp_args); - - HDassert(vol_obj2); - - /* Compare connector classes */ - if(H5VL_cmp_connector_cls(&cmp_value, cls, vol_obj2->connector->cls) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") - - /* If the classes are different the files are different */ - if(cmp_value) - *is_equal = FALSE; - else - /* Make callback (need to extract data from vol_obj2 and redo the - * va_list) */ - if(H5VL__file_specific_wrap_va_list(obj, cls, specific_type, dxpl_id, req, vol_obj2->data, is_equal) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") - } /* end if */ - else - /* 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") + /* 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) @@ -3090,7 +3691,7 @@ done: /*------------------------------------------------------------------------- * 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 @@ -3098,7 +3699,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_specific(const H5VL_object_t *vol_obj, 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 connector's class struct */ @@ -3113,7 +3714,8 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t HDva_start(arguments, req); arg_started = TRUE; - /* Special treatment of file access check */ + /* Special treatment of file access check & delete operations */ + /* (Retrieve the VOL connector from the FAPL, since the file isn't open) */ if(specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) { H5P_genplist_t *plist; /* Property list pointer */ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ @@ -3140,7 +3742,7 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t /* Sanity check */ HDassert(vol_obj); - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3212,8 +3814,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3224,7 +3826,7 @@ H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, 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) + if((cls->file_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: @@ -3243,7 +3845,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_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 */ @@ -3253,14 +3856,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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: @@ -3287,14 +3890,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, - va_list arguments) +H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { 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, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVvi**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -3303,7 +3907,7 @@ H5VLfile_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__file_optional(obj, cls, dxpl_id, req, arguments) < 0) + if(H5VL__file_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") done: @@ -3364,7 +3968,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3468,7 +4072,7 @@ H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3573,7 +4177,7 @@ H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param FUNC_ENTER_NOAPI(NULL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3637,7 +4241,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, +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 */ @@ -3668,7 +4272,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_get(const H5VL_object_t *vol_obj, 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 */ @@ -3679,7 +4283,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3749,7 +4353,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, +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 */ @@ -3780,7 +4384,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_specific(const H5VL_object_t *vol_obj, 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 */ @@ -3791,7 +4395,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -3861,8 +4465,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3873,7 +4477,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((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (cls->group_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3892,7 +4496,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_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 */ @@ -3902,14 +4507,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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if((ret_value = 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, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -3936,14 +4541,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, - va_list arguments) +H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { 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, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVwi**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -3952,7 +4558,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((ret_value = H5VL__group_optional(obj, cls, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__group_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") done: @@ -4013,7 +4619,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4077,7 +4683,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const 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, va_list arguments) { @@ -4113,7 +4719,7 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o 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 */ + H5VL_object_t tmp_vol_obj; /* Temporary object */ va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -4140,7 +4746,7 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o 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.connector) < 0) + if(H5VL_set_vol_wrapper(&tmp_vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4208,7 +4814,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +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) @@ -4240,7 +4846,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +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) @@ -4253,7 +4859,7 @@ H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa /* 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4317,7 +4923,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +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) @@ -4349,7 +4955,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +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) @@ -4362,7 +4968,7 @@ H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa /* 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4469,7 +5075,7 @@ H5VL_link_get(const H5VL_object_t *vol_obj, const 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4539,7 +5145,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, +H5VL__link_specific(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 */ @@ -4581,7 +5187,7 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4651,8 +5257,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4663,7 +5269,7 @@ H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, 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) + if((cls->link_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: @@ -4682,7 +5288,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_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 */ @@ -4692,14 +5299,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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: @@ -4726,13 +5333,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { 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, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVxi**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -4741,7 +5350,7 @@ H5VLlink_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__link_optional(obj, cls, dxpl_id, req, arguments) < 0) + if(H5VL__link_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: @@ -4800,7 +5409,7 @@ H5VL_object_open(const H5VL_object_t *vol_obj, const 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -4863,7 +5472,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +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, @@ -4896,7 +5505,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +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, @@ -4912,7 +5521,7 @@ H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_ 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->connector) < 0) + if(H5VL_set_vol_wrapper(src_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -5021,7 +5630,7 @@ H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -5091,7 +5700,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, +H5VL__object_specific(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) { @@ -5134,7 +5743,7 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_ FUNC_ENTER_NOAPI(FAIL) /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -5208,8 +5817,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5220,7 +5829,7 @@ H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, 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) + if((cls->object_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: @@ -5239,7 +5848,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_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 */ @@ -5249,14 +5859,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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: @@ -5283,13 +5893,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { 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, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVyi**xx", obj, connector_id, opt_type, dxpl_id, req, + arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -5298,7 +5910,7 @@ H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va 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) + if(H5VL__object_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: @@ -5307,220 +5919,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL__datatype_commit - * - * Purpose: Commits a datatype to the file through the VOL - * - * Return: Success: Pointer to the new datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -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) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.commit) - 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))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__datatype_commit() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_commit - * - * Purpose: Commits a datatype to the file through the VOL + * Function: H5VL__introspect_get_conn_cls * - * Return: Success: Pointer to the new datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -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) -{ - 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->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->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: - /* 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() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_commit - * - * Purpose: Commits a datatype to the file - * - * Return: Success: Pointer to the new datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -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) -{ - H5VL_class_t *cls; /* VOL connector's class struct */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API_NOINIT - 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) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - 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))) - 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: Pointer to the datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -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) -{ - void *ret_value = NULL; /* Return value */ - - 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))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype 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, 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 */ - 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->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->connector->cls, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype 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() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_open - * - * Purpose: Opens a named datatype - * - * Return: Success: Pointer to the datatype - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -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) -{ - H5VL_class_t *cls; /* VOL connector's class struct */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API_NOINIT - H5TRACE7("*x", "*x*xi*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(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))) - 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 + * Purpose: Calls the connector-specific callback to query the connector + * class. * * Return: Success: Non-negative * Failure: Negative @@ -5528,146 +5930,37 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) +H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls, + H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls) { 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 connector has no 'datatype get' method") - - /* Call the corresponding VOL callback */ - if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__datatype_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_get - * - * Purpose: Get specific information about the datatype through the VOL - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -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) - - /* 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 */ - HDva_start(arguments, req); - arg_started = TRUE; - if(H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") - -done: - /* End access to the va_list, if we started it */ - if(arg_started) - HDva_end(arguments); - - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_get - * - * Purpose: Gets information about the datatype - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -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 connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API_NOINIT - 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(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - - /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `datatype get' method") - - /* Call the corresponding internal VOL routine */ - if(H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) - 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 - * - *------------------------------------------------------------------------- - */ -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 + /* Sanity check */ + HDassert(obj); + HDassert(cls); + HDassert(lvl >= H5VL_GET_CONN_LVL_CURR && lvl <= H5VL_GET_CONN_LVL_TERM); + HDassert(conn_cls); /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method") + if(NULL == cls->introspect_cls.get_conn_cls) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'get_conn_cls' 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") + if((cls->introspect_cls.get_conn_cls)(obj, lvl, conn_cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__datatype_specific() */ +} /* end H5VL__introspect_get_conn_cls() */ /*------------------------------------------------------------------------- - * Function: H5VL_datatype_specific + * Function: H5VL_introspect_get_conn_cls * - * Purpose: Specific operation on datatypes through the VOL + * Purpose: Calls the connector-specific callback to query the connector + * class. * * Return: Success: Non-negative * Failure: Negative @@ -5675,44 +5968,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, - hid_t dxpl_id, void **req, ...) +H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t lvl, + const H5VL_class_t **conn_cls) { - 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - 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") + if(H5VL__introspect_get_conn_cls(vol_obj->data, vol_obj->connector->cls, lvl, conn_cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") done: - /* End access to the va_list, if we started it */ - if(arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_specific() */ +} /* end H5VL_introspect_get_conn_cls() */ /*------------------------------------------------------------------------- - * Function: H5VLdatatype_specific + * Function: H5VLintrospect_get_conn_cls * - * Purpose: Performs a connector-specific operation on a datatype + * Purpose: Calls the connector-specific callback to query the connector + * class. * * Return: Success: Non-negative * Failure: Negative @@ -5720,146 +6006,39 @@ done: *------------------------------------------------------------------------- */ 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) +H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t lvl, + const H5VL_class_t **conn_cls) { 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, connector_id, specific_type, dxpl_id, req, - arguments); + H5TRACE4("e", "*xiVL**x", obj, connector_id, lvl, conn_cls); - /* Check args and get class pointer */ + /* Check args */ if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - - /* 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: - FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL__datatype_optional - * - * Purpose: Optional operation specific to connectors. - * - * 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 connector 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 connectors. - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -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) - - /* 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 */ - HDva_start(arguments, req); - arg_started = TRUE; - 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: - /* End access to the va_list, if we started it */ - if(arg_started) - HDva_end(arguments); - - /* Reset object wrapping info in API context */ - if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL obj pointer") + if(NULL == conn_cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL conn_cls pointer") - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_optional - * - * Purpose: Performs an optional connector-specific operation on a datatype - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, - va_list arguments) -{ - 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, connector_id, dxpl_id, req, arguments); - - /* Check args and get class pointer */ - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + /* 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__datatype_optional(obj, cls, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + if(H5VL__introspect_get_conn_cls(obj, cls, lvl, conn_cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") done: FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_optional() */ +} /* end H5VLintrospect_get_conn_cls() */ /*------------------------------------------------------------------------- - * Function: H5VL__datatype_close + * Function: H5VL__introspect_opt_query * - * Purpose: Closes a datatype through the VOL + * Purpose: Calls the connector-specific callback to query if an optional + * operation is supported. * * Return: Success: Non-negative * Failure: Negative @@ -5867,30 +6046,31 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, - void **req) +H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t subcls, + int opt_type, hbool_t *supported) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ - if(NULL == cls->datatype_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype close' method") + if(NULL == cls->introspect_cls.opt_query) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'opt_query' method") /* Call the corresponding VOL callback */ - if((cls->datatype_cls.close)(obj, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + if((cls->introspect_cls.opt_query)(obj, subcls, opt_type, supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__datatype_close() */ +} /* end H5VL__introspect_opt_query() */ /*------------------------------------------------------------------------- - * Function: H5VL_datatype_close + * Function: H5VL_introspect_opt_query * - * Purpose: Closes a datatype through the VOL + * Purpose: Calls the connector-specific callback to query if an optional + * operation is supported. * * Return: Success: Non-negative * Failure: Negative @@ -5898,7 +6078,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, + int opt_type, hbool_t *supported) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5906,13 +6087,13 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if(H5VL__datatype_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + if(H5VL__introspect_opt_query(vol_obj->data, vol_obj->connector->cls, subcls, opt_type, supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: /* Reset object wrapping info in API context */ @@ -5920,13 +6101,14 @@ done: HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_close() */ +} /* end H5VL_introspect_opt_query() */ /*------------------------------------------------------------------------- - * Function: H5VLdatatype_close + * Function: H5VLintrospect_opt_query * - * Purpose: Closes a datatype + * Purpose: Calls the connector-specific callback to query if an optional + * operation is supported. * * Return: Success: Non-negative * Failure: Negative @@ -5934,27 +6116,26 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) +H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, + int opt_type, hbool_t *supported) { 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, connector_id, dxpl_id, req); + H5TRACE5("e", "*xiVSIs*b", obj, connector_id, subcls, opt_type, supported); - /* Check args and get class pointer */ - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + /* 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__datatype_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") + if(H5VL__introspect_opt_query(obj, cls, subcls, opt_type, supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: FUNC_LEAVE_API_NOINIT(ret_value) -} /* end H5VLdatatype_close() */ +} /* end H5VLintrospect_opt_query() */ /*------------------------------------------------------------------------- @@ -6022,7 +6203,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6138,7 +6319,7 @@ H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, HDassert(vol_obj); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6251,7 +6432,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6362,7 +6543,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6429,7 +6610,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments) +H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional_t opt_type, + va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -6444,7 +6626,7 @@ H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments) 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) + if((ret_value = (cls->request_cls.optional)(req, opt_type, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") done: @@ -6463,7 +6645,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_request_optional(const H5VL_object_t *vol_obj, ...) +H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_type, + ...) { va_list arguments; /* Argument list passed from the API call */ hbool_t arg_started = FALSE; /* Whether the va_list has been started */ @@ -6476,14 +6659,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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, vol_obj); + HDva_start(arguments, opt_type); arg_started = TRUE; - if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, arguments)) < 0) + if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, opt_type, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") done: @@ -6510,20 +6693,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments) +H5VLrequest_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_type, + va_list arguments) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "*xix", req, connector_id, arguments); + H5TRACE4("e", "*xiVzx", req, connector_id, opt_type, arguments); /* Get class pointer */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if((ret_value = H5VL__request_optional(req, cls, arguments)) < 0) + if((ret_value = H5VL__request_optional(req, cls, opt_type, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") done: @@ -6587,7 +6771,7 @@ 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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6699,7 +6883,7 @@ H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, HDassert(blob_id); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6809,7 +6993,7 @@ H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, HDassert(buf); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6923,7 +7107,7 @@ H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, HDassert(blob_id); /* Set wrapper info in API context */ - if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; @@ -6981,6 +7165,504 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__blob_optional + * + * Purpose: Optional operation on blobs through the VOL + * + * Return: SUCCEED / FAIL + * + * Programmer: Quincey Koziol + * Thursday, November 14, 2019 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, + H5VL_blob_optional_t opt_type, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(obj); + HDassert(cls); + HDassert(blob_id); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->blob_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob optional' method") + + /* Call the corresponding VOL callback */ + if((cls->blob_cls.optional)(obj, blob_id, opt_type, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__blob_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_blob_optional + * + * Purpose: Optional operation on blobs through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, + H5VL_blob_optional_t opt_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); + HDassert(blob_id); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + HDva_start(arguments, opt_type); + arg_started = TRUE; + if((ret_value = H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, opt_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_blob_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLblob_optional + * + * Purpose: Optional operation on blobs through the VOL + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, + H5VL_blob_optional_t opt_type, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xi*xVAx", obj, connector_id, blob_id, opt_type, arguments); + + /* Get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding VOL callback */ + if(H5VL__blob_optional(obj, cls, blob_id, opt_type, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob optional operation failed") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLblob_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__token_cmp + * + * Purpose: Compares two VOL connector object tokens. Sets *cmp_value + * to positive if token1 is greater than token2, negative if + * token2 is greater than token1 and zero if token1 and + * token2 are equal. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__token_cmp(void *obj, const H5VL_class_t *cls, + const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(obj); + HDassert(cls); + HDassert(cmp_value); + + /* Take care of cases where one or both pointers is NULL */ + if(token1 == NULL && token2 != NULL) + *cmp_value = -1; + else if(token1 != NULL && token2 == NULL) + *cmp_value = 1; + else if(token1 == NULL && token2 == NULL) + *cmp_value = 0; + else { + /* Use the class's token comparison routine to compare the tokens, + * if there is a callback, otherwise just compare the tokens as + * memory buffers. + */ + if(cls->token_cls.cmp) { + if((cls->token_cls.cmp)(obj, token1, token2, cmp_value) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare object tokens") + } /* end if */ + else + *cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t)); + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__token_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_token_cmp + * + * Purpose: Compares two VOL connector object tokens. Sets *cmp_value + * to positive if token1 is greater than token2, negative if + * token2 is greater than token1 and zero if token1 and + * token2 are equal. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, + const H5O_token_t *token2, int *cmp_value) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(vol_obj); + HDassert(cmp_value); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__token_cmp(vol_obj->data, vol_obj->connector->cls, token1, token2, cmp_value)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "token compare failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_token_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLtoken_cmp + * + * Purpose: Compares two VOL connector object tokens + * + * Note: Both object tokens must be from the same VOL connector class + * + * Return: Success: Non-negative, with *cmp_value set to positive if + * token1 is greater than token2, negative if token2 + * is greater than token1 and zero if token1 and + * token2 are equal. + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1, + const H5O_token_t *token2, int *cmp_value) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xi*k*k*Is", obj, connector_id, token1, token2, cmp_value); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + if(NULL == cmp_value) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid cmp_value pointer") + + /* Call the corresponding internal VOL routine */ + if(H5VL__token_cmp(obj, cls, token1, token2, cmp_value) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "object token comparison failed") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLtoken_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__token_to_str + * + * Purpose: Serialize a connector's object token into a string + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__token_to_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, + const H5O_token_t *token, char **token_str) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(obj); + HDassert(cls); + HDassert(token); + HDassert(token_str); + + /* Use the class's token serialization routine on the token if there is a + * callback, otherwise just set the token_str to NULL. + */ + if(cls->token_cls.to_str) { + if((cls->token_cls.to_str)(obj, obj_type, token, token_str) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize object token") + } /* end if */ + else + *token_str = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__token_to_str() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_token_to_str + * + * Purpose: Serialize a connector's object token into a string + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, + const H5O_token_t *token, char **token_str) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(vol_obj); + HDassert(token); + HDassert(token_str); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__token_to_str(vol_obj->data, obj_type, vol_obj->connector->cls, token, token_str)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "token serialization failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_token_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLtoken_to_str + * + * Purpose: Serialize a connector's object token into a string + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id, + const H5O_token_t *token, char **token_str) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xIti*k**s", obj, obj_type, connector_id, token, token_str); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + if(NULL == token) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + if(NULL == token_str) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token_str pointer") + + /* Call the corresponding internal VOL routine */ + if(H5VL__token_to_str(obj, obj_type, cls, token, token_str) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "object token to string failed") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLtoken_to_str() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__token_from_str + * + * Purpose: Deserialize a string into a connector object token + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__token_from_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, + const char *token_str, H5O_token_t *token) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(obj); + HDassert(cls); + HDassert(token_str); + HDassert(token); + + /* Use the class's token deserialization routine on the token if there is a + * callback, otherwise just set the token to H5_TOKEN_UNDEF. + */ + if(cls->token_cls.from_str) { + if((cls->token_cls.from_str)(obj, obj_type, token_str, token) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token string") + } /* end if */ + else + *token = H5O_TOKEN_UNDEF; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__token_from_str() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_token_from_str + * + * Purpose: Deserialize a string into a connector object token + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, + const char *token_str, H5O_token_t *token) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(vol_obj); + HDassert(token); + HDassert(token_str); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__token_from_str(vol_obj->data, obj_type, vol_obj->connector->cls, token_str, token)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "token deserialization failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_token_from_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLtoken_from_str + * + * Purpose: Deserialize a string into a connector object token + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id, + const char *token_str, H5O_token_t *token) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xIti*s*k", obj, obj_type, connector_id, token_str, token); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + if(NULL == token) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + if(NULL == token_str) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token_str pointer") + + /* Call the corresponding internal VOL routine */ + if(H5VL__token_from_str(obj, obj_type, cls, token_str, token) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "object token from string failed") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLtoken_from_str() */ + + +/*------------------------------------------------------------------------- * Function: H5VL__optional * * Purpose: Optional operation specific to connectors. @@ -6991,7 +7673,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, +H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -7003,7 +7685,7 @@ H5VL__optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'optional' method") /* Call the corresponding VOL callback */ - if((ret_value = (cls->optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (cls->optional)(obj, op_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback") done: @@ -7022,7 +7704,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, +H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* Argument list passed from the API call */ @@ -7033,14 +7715,14 @@ H5VL_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->connector) < 0) + if(H5VL_set_vol_wrapper(vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ HDva_start(arguments, req); arg_started = TRUE; - if((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, op_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute optional callback") done: @@ -7067,14 +7749,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLoptional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, - va_list arguments) +H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, + void **req, va_list arguments) { 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, connector_id, dxpl_id, req, arguments); + H5TRACE6("e", "*xiIsi**xx", obj, connector_id, op_type, dxpl_id, req, arguments); /* Check args and get class pointer */ if(NULL == obj) @@ -7083,7 +7765,7 @@ H5VLoptional(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((ret_value = H5VL__optional(obj, cls, dxpl_id, req, arguments)) < 0) + if((ret_value = H5VL__optional(obj, cls, op_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback") done: diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 373eb44..9bc3a7b 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -43,18 +43,28 @@ /* The maximum size allowed for blobs */ #define H5VL_MAX_BLOB_ID_SIZE (16) /* Allow for 128-bits blob IDs */ -/* The maximum size allowed for tokens */ -#define H5VL_MAX_TOKEN_SIZE (16) /* Allow for 128-bits tokens */ /*******************/ /* Public Typedefs */ /*******************/ -/* type for tokens. Token are unique and permanent identifiers that are - * used to reference HDF5 objects. */ -typedef struct { - char __data[H5VL_MAX_TOKEN_SIZE]; -} H5VL_token_t; +/* Enum type for each VOL subclass */ +/* (Used for various queries, etc) */ +typedef enum H5VL_subclass_t { + H5VL_SUBCLS_NONE, /* Operations outside of a subclass */ + H5VL_SUBCLS_INFO, /* 'Info' subclass */ + H5VL_SUBCLS_WRAP, /* 'Wrap' subclass */ + H5VL_SUBCLS_ATTR, /* 'Attribute' subclass */ + H5VL_SUBCLS_DATASET, /* 'Dataset' subclass */ + H5VL_SUBCLS_DATATYPE, /* 'Named datatype' subclass */ + H5VL_SUBCLS_FILE, /* 'File' subclass */ + H5VL_SUBCLS_GROUP, /* 'Group' subclass */ + H5VL_SUBCLS_LINK, /* 'Link' subclass */ + H5VL_SUBCLS_OBJECT, /* 'Object' subclass */ + H5VL_SUBCLS_REQUEST, /* 'Request' subclass */ + H5VL_SUBCLS_BLOB, /* 'Blob' subclass */ + H5VL_SUBCLS_TOKEN /* 'Token' subclass */ +} H5VL_subclass_t; /* types for attribute GET callback */ typedef enum H5VL_attr_get_t { @@ -74,13 +84,16 @@ typedef enum H5VL_attr_specific_t { H5VL_ATTR_RENAME /* H5Arename(_by_name) */ } H5VL_attr_specific_t; +/* Typedef for VOL connector attribute optional VOL operations */ +typedef int H5VL_attr_optional_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_SPACE_STATUS, /* space status */ H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */ H5VL_DATASET_GET_TYPE /* datatype */ } H5VL_dataset_get_t; @@ -92,6 +105,9 @@ typedef enum H5VL_dataset_specific_t { H5VL_DATASET_REFRESH /* H5Drefresh */ } H5VL_dataset_specific_t; +/* Typedef for VOL connector dataset optional VOL operations */ +typedef int H5VL_dataset_optional_t; + /* types for datatype GET callback */ typedef enum H5VL_datatype_get_t { H5VL_DATATYPE_GET_BINARY, /* get serialized form of transient type */ @@ -104,6 +120,10 @@ typedef enum H5VL_datatype_specific_t { H5VL_DATATYPE_REFRESH } H5VL_datatype_specific_t; +/* Typedef and values for native VOL connector named datatype optional VOL operations */ +typedef int H5VL_datatype_optional_t; +/* (No optional named datatype VOL operations currently) */ + /* types for file GET callback */ typedef enum H5VL_file_get_t { H5VL_FILE_GET_CONT_INFO, /* file get container info */ @@ -118,7 +138,6 @@ typedef enum H5VL_file_get_t { /* types for file SPECIFIC callback */ typedef enum H5VL_file_specific_t { - H5VL_FILE_POST_OPEN, /* Adjust file after open, with wrapping context */ H5VL_FILE_FLUSH, /* Flush file */ H5VL_FILE_REOPEN, /* Reopen the file */ H5VL_FILE_MOUNT, /* Mount a file */ @@ -128,6 +147,9 @@ typedef enum H5VL_file_specific_t { H5VL_FILE_IS_EQUAL /* Check if two files are the same */ } H5VL_file_specific_t; +/* Typedef for VOL connector file optional VOL operations */ +typedef int H5VL_file_optional_t; + /* types for group GET callback */ typedef enum H5VL_group_get_t { H5VL_GROUP_GET_GCPL, /* group creation property list */ @@ -140,6 +162,9 @@ typedef enum H5VL_group_specific_t { H5VL_GROUP_REFRESH } H5VL_group_specific_t; +/* Typedef for VOL connector group optional VOL operations */ +typedef int H5VL_group_optional_t; + /* link create types for VOL */ typedef enum H5VL_link_create_type_t { H5VL_LINK_CREATE_HARD, @@ -161,11 +186,16 @@ typedef enum H5VL_link_specific_t { H5VL_LINK_ITER /* H5Literate/visit(_by_name) */ } H5VL_link_specific_t; +/* Typedef and values for native VOL connector link optional VOL operations */ +typedef int H5VL_link_optional_t; +/* (No optional link VOL operations currently) */ + /* types for object GET callback */ typedef enum H5VL_object_get_t { H5VL_OBJECT_GET_FILE, /* object file */ H5VL_OBJECT_GET_NAME, /* object name */ - H5VL_OBJECT_GET_TYPE /* object type */ + H5VL_OBJECT_GET_TYPE, /* object type */ + H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name)3 */ } H5VL_object_get_t; /* types for object SPECIFIC callback */ @@ -178,6 +208,9 @@ typedef enum H5VL_object_specific_t { H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */ } H5VL_object_specific_t; +/* Typedef for VOL connector object optional VOL operations */ +typedef int H5VL_object_optional_t; + /* types for async request SPECIFIC callback */ typedef enum H5VL_request_specific_t { H5VL_REQUEST_WAITANY, /* Wait until any request completes */ @@ -185,6 +218,10 @@ typedef enum H5VL_request_specific_t { H5VL_REQUEST_WAITALL /* Wait until all requests complete */ } H5VL_request_specific_t; +/* Typedef and values for native VOL connector request optional VOL operations */ +typedef int H5VL_request_optional_t; +/* (No optional request VOL operations currently) */ + /* types for 'blob' SPECIFIC callback */ typedef enum H5VL_blob_specific_t { H5VL_BLOB_DELETE, /* Delete a blob (by ID) */ @@ -193,6 +230,10 @@ typedef enum H5VL_blob_specific_t { H5VL_BLOB_SETNULL /* Set a blob ID to the connector's "null" blob ID value */ } H5VL_blob_specific_t; +/* Typedef and values for native VOL connector blob optional VOL operations */ +typedef int H5VL_blob_optional_t; +/* (No optional blob VOL operations currently) */ + /* Types for different ways that objects are located in an HDF5 container */ typedef enum H5VL_loc_type_t { H5VL_OBJECT_BY_SELF, @@ -215,7 +256,7 @@ typedef struct H5VL_loc_by_idx { } H5VL_loc_by_idx_t; typedef struct H5VL_loc_by_token { - H5VL_token_t *token; + H5O_token_t *token; } H5VL_loc_by_token_t; /* Structure to hold parameters for object locations. @@ -278,7 +319,8 @@ typedef struct H5VL_attr_class_t { herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, + void **req, va_list arguments); herr_t (*close) (void *attr, hid_t dxpl_id, void **req); } H5VL_attr_class_t; @@ -296,7 +338,8 @@ typedef struct H5VL_dataset_class_t { 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 (*optional)(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, + void **req, va_list arguments); herr_t (*close) (void *dset, hid_t dxpl_id, void **req); } H5VL_dataset_class_t; @@ -309,7 +352,7 @@ typedef struct H5VL_datatype_class_t { 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 (*optional)(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*close) (void *dt, hid_t dxpl_id, void **req); } H5VL_datatype_class_t; @@ -321,7 +364,8 @@ typedef struct H5VL_file_class_t { 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 (*optional)(void *obj, H5VL_file_optional_t opt_type, hid_t dxpl_id, + void **req, va_list arguments); herr_t (*close) (void *file, hid_t dxpl_id, void **req); } H5VL_file_class_t; @@ -334,7 +378,7 @@ typedef struct H5VL_group_class_t { 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 (*optional)(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); herr_t (*close) (void *grp, hid_t dxpl_id, void **req); } H5VL_group_class_t; @@ -352,7 +396,8 @@ typedef struct H5VL_link_class_t { hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, + void **req, va_list arguments); } H5VL_link_class_t; /* H5O routines */ @@ -366,19 +411,37 @@ typedef struct H5VL_object_class_t { hid_t dxpl_id, void **req, va_list arguments); herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, H5VL_object_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments); } H5VL_object_class_t; /* Asynchronous request 'notify' callback */ typedef herr_t (*H5VL_request_notify_t)(void *ctx, H5ES_status_t status); +/* "Levels" for 'get connector class' introspection callback */ +typedef enum H5VL_get_conn_lvl_t { + H5VL_GET_CONN_LVL_CURR, /* Get "current" connector (for this object) */ + H5VL_GET_CONN_LVL_TERM /* Get "terminal" connector (for this object) */ + /* (Recursively called, for pass-through connectors) */ + /* (Connectors that "split" must choose which connector to return) */ +} H5VL_get_conn_lvl_t; + +/* Forward declaration of H5VL_class_t, defined later in this file */ +struct H5VL_class_t; + +/* Container/connector introspection routines */ +typedef struct H5VL_introspect_class_t { + herr_t (*get_conn_cls)(void *obj, H5VL_get_conn_lvl_t lvl, const struct H5VL_class_t **conn_cls); + herr_t (*opt_query)(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported); +} H5VL_introspect_class_t; + /* 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); + herr_t (*optional)(void *req, H5VL_request_optional_t opt_type, va_list arguments); herr_t (*free)(void *req); } H5VL_request_class_t; @@ -387,16 +450,15 @@ typedef struct H5VL_blob_class_t { herr_t (*put)(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); herr_t (*get)(void *obj, const void *blob_id, void *buf, size_t size, void *ctx); herr_t (*specific)(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); - herr_t (*optional)(void *obj, void *blob_id, va_list arguments); + herr_t (*optional)(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments); } H5VL_blob_class_t; -/* - * VOL connector identifiers. Values 0 through 255 are for connectors defined - * by the HDF5 library. Values 256 through 511 are available for testing new - * filters. Subsequent values should be obtained from the HDF5 development - * team at help@hdfgroup.org. - */ -typedef int H5VL_class_value_t; +/* Object token routines */ +typedef struct H5VL_token_class_t { + herr_t (*cmp)(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); + herr_t (*to_str)(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str); + herr_t (*from_str)(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token); +} H5VL_token_class_t; /* Class information for each VOL connector */ typedef struct H5VL_class_t { @@ -422,11 +484,13 @@ typedef struct H5VL_class_t { H5VL_object_class_t object_cls; /* Object (H5O*) class callbacks */ /* Infrastructure / Services */ + H5VL_introspect_class_t introspect_cls; /* Container/connector introspection class callbacks */ H5VL_request_class_t request_cls; /* Asynchronous request class callbacks */ - H5VL_blob_class_t blob_cls; /* 'blob' callbacks */ + H5VL_blob_class_t blob_cls; /* 'Blob' class callbacks */ + H5VL_token_class_t token_cls; /* VOL connector object token class callbacks */ /* Catch-all */ - herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ + herr_t (*optional)(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ } H5VL_class_t; @@ -444,6 +508,7 @@ extern "C" { #endif /* Helper routines for VOL connector authors */ +H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); H5_DLL void *H5VLobject(hid_t obj_id); H5_DLL hid_t H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id); diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h index a4c8742..b04f5eb 100644 --- a/src/H5VLconnector_passthru.h +++ b/src/H5VLconnector_passthru.h @@ -92,7 +92,7 @@ H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void 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, 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_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, 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 */ @@ -102,15 +102,23 @@ H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id 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_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req); +/* Public wrappers for named datatype callbacks */ +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, H5VL_datatype_optional_t opt_type, 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 file callbacks */ H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for group callbacks */ @@ -118,7 +126,7 @@ H5_DLL void *H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hi 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_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req); /* Public wrappers for link callbacks */ @@ -131,7 +139,7 @@ H5_DLL herr_t H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); 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); +H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); /* Public wrappers for object callbacks */ 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); @@ -140,31 +148,35 @@ H5_DLL herr_t H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *loc_params hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); 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); +H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); -/* Public wrappers for named datatype callbacks */ -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); -H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req); +/* Public wrappers for connector/container introspection callbacks */ +H5_DLL herr_t H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, + H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); +H5_DLL herr_t H5VLintrospect_opt_query(void *obj, hid_t connector_id, + H5VL_subclass_t subcls, int opt_type, hbool_t *supported); /* 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); +H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_type, va_list arguments); H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id); /* Public wrappers for blob callbacks */ H5_DLL herr_t H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size, void *blob_id, void *ctx); H5_DLL herr_t H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf, size_t size, void *ctx); H5_DLL herr_t H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); +H5_DLL herr_t H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments); + +/* Public wrappers for token callbacks */ +H5_DLL herr_t H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); +H5_DLL herr_t H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const H5O_token_t *token, char **token_str); +H5_DLL herr_t H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const char *token_str, H5O_token_t *token); /* Public wrappers for generic 'optional' callback */ -H5_DLL herr_t H5VLoptional(void *obj, hid_t connector_id, hid_t dxpl_id, +H5_DLL herr_t H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, void **req, va_list arguments); #ifdef __cplusplus diff --git a/src/H5VLint.c b/src/H5VLint.c index 284b266..9038d38 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -30,10 +30,15 @@ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ #include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ #include "H5FLprivate.h" /* Free lists */ +#include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ +#include "H5Mprivate.h" /* Maps */ #include "H5MMprivate.h" /* Memory management */ #include "H5PLprivate.h" /* Plugins */ #include "H5Tprivate.h" /* Datatypes */ @@ -189,6 +194,20 @@ H5VL_init_phase2(void) FUNC_ENTER_NOAPI(FAIL) + /* Initialize all packages for VOL-managed objects */ + if(H5T_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize datatype interface") + if(H5D_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize dataset interface") + if(H5F_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize file interface") + if(H5G_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize group interface") + if(H5A_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize attribute interface") + if(H5M_init() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize map interface") + /* Set up the default VOL connector in the default FAPL */ if(H5VL__set_def_conn() < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector") @@ -406,7 +425,7 @@ H5VL__set_def_conn(void) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check if VOL connector already registered") else if(connector_is_registered) { /* Retrieve the ID of the already-registered VOL connector */ - if((connector_id = H5VL__get_connector_id(tok, FALSE)) < 0) + if((connector_id = H5VL__get_connector_id_by_name(tok, FALSE)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector ID") } /* end else-if */ else { @@ -424,7 +443,7 @@ H5VL__set_def_conn(void) else { /* Register the VOL connector */ /* (NOTE: No provisions for vipl_id currently) */ - if((connector_id = H5VL__register_connector_by_name(tok, TRUE, H5P_DEFAULT)) < 0) + if((connector_id = H5VL__register_connector_by_name(tok, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register connector") } /* end else */ } /* end else */ @@ -705,7 +724,7 @@ H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ /* (Does not wrap object, since it's from a VOL callback) */ 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 */ if((ret_value = H5I_register(type, vol_obj, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle") @@ -720,7 +739,7 @@ done: * * 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, + * 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). @@ -972,6 +991,114 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_object_is_native + * + * Purpose: Query if an object is (if it's a file object) / is in (if its + * an object) a native connector's file. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * December 14, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native) +{ + const H5VL_class_t *cls; /* VOL connector class structs for object */ + const H5VL_class_t *native_cls; /* Native VOL connector class structs */ + int cmp_value; /* Comparison result */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + HDassert(obj); + HDassert(is_native); + + /* Retrieve the terminal connector class for the object */ + cls = NULL; + if(H5VL_introspect_get_conn_cls(obj, H5VL_GET_CONN_LVL_TERM, &cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") + + /* Retrieve the native connector class */ + if(NULL == (native_cls = (H5VL_class_t *)H5I_object_verify(H5VL_NATIVE, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve native VOL connector class") + + /* Compare connector classes */ + if(H5VL_cmp_connector_cls(&cmp_value, cls, native_cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + + /* If classes compare equal, then the object is / is in a native connector's file */ + *is_native = (cmp_value == 0); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_is_native() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_is_same + * + * Purpose: Query if two files are the same. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * December 14, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, + hbool_t *same_file) +{ + const H5VL_class_t *cls1; /* VOL connector class struct for first object */ + const H5VL_class_t *cls2; /* VOL connector class struct for second object */ + int cmp_value; /* Comparison result */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + HDassert(vol_obj1); + HDassert(vol_obj2); + HDassert(same_file); + + /* Retrieve the terminal connectors for each object */ + cls1 = NULL; + if(H5VL_introspect_get_conn_cls(vol_obj1, H5VL_GET_CONN_LVL_TERM, &cls1) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") + cls2 = NULL; + if(H5VL_introspect_get_conn_cls(vol_obj2, H5VL_GET_CONN_LVL_TERM, &cls2) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") + + /* Compare connector classes */ + if(H5VL_cmp_connector_cls(&cmp_value, cls1, cls2) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + + /* If the connector classes are different, the files are different */ + if(cmp_value) + *same_file = FALSE; + else { + void *obj2; /* Terminal object for second file */ + + /* Get unwrapped (terminal) object for vol_obj2 */ + if(NULL == (obj2 = H5VL_object_data(vol_obj2))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get unwrapped object") + + /* Make callback */ + if(H5VL_file_specific(vol_obj1, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, obj2, same_file) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_is_same() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_register_connector * * Purpose: Registers a new VOL connector as a member of the virtual object @@ -980,7 +1107,7 @@ done: * Return: Success: A VOL connector ID which is good until the * library is closed or the connector is unregistered. * - * Failure: H5I_INVALID_HID + * Failure: H5I_INVALID_HID * * Programmer: Dana Robinson * June 22, 2017 @@ -1239,6 +1366,41 @@ done: /*------------------------------------------------------------------------- * Function: H5VL__get_connector_id * + * Purpose: Retrieves the VOL connector ID for a given object ID. + * + * Return: Positive if the VOL class has been registered + * Negative on error (if the class is not a valid class or not registered) + * + * Programmer: Dana Robinson + * June 17, 2017 + * + *------------------------------------------------------------------------- + */ +hid_t +H5VL__get_connector_id(hid_t obj_id, hbool_t is_api) +{ + H5VL_object_t *vol_obj = NULL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Get the underlying VOL object for the object ID */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Return the VOL object's VOL class ID */ + ret_value = vol_obj->connector->id; + if(H5I_inc_ref(ret_value, is_api) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__get_connector_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__get_connector_id_by_name + * * Purpose: Retrieves the ID for a registered VOL connector. * * Return: Positive if the VOL class has been registered @@ -1250,7 +1412,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL__get_connector_id(const char *name, hbool_t is_api) +H5VL__get_connector_id_by_name(const char *name, hbool_t is_api) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -1266,7 +1428,7 @@ H5VL__get_connector_id(const char *name, hbool_t is_api) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__get_connector_id() */ +} /* end H5VL__get_connector_id_by_name() */ /*------------------------------------------------------------------------- @@ -1395,7 +1557,7 @@ done: * * 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 + * except for named datatypes, where the vol_obj is returned that * is attached to the H5T_t struct. * * Return: Success: object pointer @@ -1413,15 +1575,15 @@ H5VL_vol_object(hid_t id) FUNC_ENTER_NOAPI(NULL) obj_type = H5I_get_type(id); - if (H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type || + 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))) + 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))) + /* 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") } /* end if */ else @@ -1502,7 +1664,7 @@ done: static void * H5VL__object(hid_t id, H5I_type_t obj_type) { - H5VL_object_t *vol_obj = NULL; + H5VL_object_t *vol_obj = NULL; void *ret_value = NULL; FUNC_ENTER_STATIC @@ -1511,7 +1673,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type) switch(obj_type) { case H5I_GROUP: case H5I_DATASET: - case H5I_FILE: + case H5I_FILE: case H5I_ATTR: case H5I_MAP: /* get the object */ @@ -1891,17 +2053,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_set_vol_wrapper(void *obj, H5VL_t *connector) +H5VL_set_vol_wrapper(const H5VL_object_t *vol_obj) { H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object 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(connector); + /* Sanity check */ + HDassert(vol_obj); /* Retrieve the VOL object wrap context */ if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) @@ -1909,13 +2069,19 @@ H5VL_set_vol_wrapper(void *obj, H5VL_t *connector) /* Check for existing wrapping context */ if(NULL == vol_wrap_ctx) { + void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */ + + /* Sanity checks */ + HDassert(vol_obj->data); + HDassert(vol_obj->connector); + /* Check if the connector can create a wrap context */ - if(connector->cls->wrap_cls.get_wrap_ctx) { + if(vol_obj->connector->cls->wrap_cls.get_wrap_ctx) { /* Sanity check */ - HDassert(connector->cls->wrap_cls.free_wrap_ctx); + HDassert(vol_obj->connector->cls->wrap_cls.free_wrap_ctx); /* Get the wrap context from the connector */ - if((connector->cls->wrap_cls.get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) + if((vol_obj->connector->cls->wrap_cls.get_wrap_ctx)(vol_obj->data, &obj_wrap_ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context") } /* end if */ @@ -1924,11 +2090,11 @@ H5VL_set_vol_wrapper(void *obj, H5VL_t *connector) HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context") /* Increment the outstanding objects that are using the connector */ - H5VL__conn_inc_rc(connector); + H5VL__conn_inc_rc(vol_obj->connector); /* Set up VOL object wrapper context */ vol_wrap_ctx->rc = 1; - vol_wrap_ctx->connector = connector; + vol_wrap_ctx->connector = vol_obj->connector; vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx; } /* end if */ else diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 78eaee4..616ca60 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -16,9 +16,15 @@ */ #include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ +#include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ +#include "H5Tprivate.h" /* Datatypes */ #include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VLnative_private.h" /* Native VOL connector */ @@ -31,7 +37,7 @@ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; static herr_t H5VL__native_term(void); /* Native VOL connector class struct */ -static H5VL_class_t H5VL_native_cls_g = { +static const H5VL_class_t H5VL_native_cls_g = { H5VL_NATIVE_VERSION, /* version */ H5VL_NATIVE_VALUE, /* value */ H5VL_NATIVE_NAME, /* name */ @@ -112,6 +118,10 @@ static H5VL_class_t H5VL_native_cls_g = { H5VL__native_object_specific, /* specific */ H5VL__native_object_optional /* optional */ }, + { /* introspect_cls */ + H5VL__native_introspect_get_conn_cls, /* get_conn_cls */ + H5VL__native_introspect_opt_query, /* opt_query */ + }, { /* request_cls */ NULL, /* wait */ NULL, /* notify */ @@ -126,6 +136,11 @@ static H5VL_class_t H5VL_native_cls_g = { H5VL__native_blob_specific, /* specific */ NULL /* optional */ }, + { /* token_cls */ + H5VL__native_token_cmp, /* cmp */ + H5VL__native_token_to_str, /* to_str */ + H5VL__native_str_to_token /* from_str */ + }, NULL /* optional */ }; @@ -148,8 +163,8 @@ H5VL_native_register(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* 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, H5P_DEFAULT)) < 0) + if(H5I_INVALID_HID == H5VL_NATIVE_ID_g) + if((H5VL_NATIVE_ID_g = H5VL_register_connector(&H5VL_native_cls_g, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector") /* Set return value */ @@ -180,3 +195,365 @@ H5VL__native_term(void) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5VL__native_term() */ + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_introspect_get_conn_cls + * + * Purpose: Query the connector class. + * + * Note: This routine is in this file so that it can return the address + * of the staticly declared class struct. + * + * Returns: SUCCEED (Can't fail) + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_introspect_get_conn_cls(void H5_ATTR_UNUSED *obj, + H5VL_get_conn_lvl_t H5_ATTR_UNUSED lvl, const H5VL_class_t **conn_cls) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDassert(conn_cls); + + /* Retrieve the native VOL connector class */ + *conn_cls = &H5VL_native_cls_g; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__native_introspect_get_conn_cls() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_get_file_addr_len + * + * Purpose: Convenience function to get a file's address length from a + * location ID. Useful when you have to encode/decode addresses + * to/from tokens. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_native_get_file_addr_len(hid_t loc_id, size_t *addr_len) +{ + H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */ + void *vol_obj = NULL; /* VOL Object of loc_id */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check arguments */ + HDassert(addr_len); + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve underlying VOL object */ + if(NULL == (vol_obj = H5VL_object(loc_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve file address length */ + if(H5VL__native_get_file_addr_len(vol_obj, vol_obj_type, addr_len) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get file address length") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_get_file_addr_len() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_get_file_addr_len + * + * Purpose: Convenience function to get a file's address length from a + * VOL object. Useful when you have to encode/decode addresses + * to/from tokens. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL__native_get_file_addr_len(void *obj, H5I_type_t obj_type, size_t *addr_len) +{ + H5F_t *file = NULL; /* File stuct pointer */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* check arguments */ + HDassert(obj); + HDassert(addr_len); + + /* Retrieve file from the VOL object */ + if(H5VL_native_get_file_struct(obj, obj_type, &file) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get file from VOL object") + + /* Get the length of an address in this file */ + *addr_len = H5F_SIZEOF_ADDR(file); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_get_file_addr_len() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLnative_addr_to_token + * + * Purpose: Converts a native VOL haddr_t address to an abstract VOL token. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token) +{ + H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */ + void *vol_obj = NULL; /* VOL Object of loc_id */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "ia*k", loc_id, addr, token); + + /* Check args */ + if(NULL == token) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "token pointer can't be NULL") + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve underlying VOL object */ + if(NULL == (vol_obj = H5VL_object(loc_id))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + +#ifndef NDEBUG + { + H5VL_object_t *vol_obj_container; + hbool_t is_native_vol_obj; + + /* Get the location object */ + if(NULL == (vol_obj_container = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Make sure that the VOL object is a native connector object */ + if(H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + + HDassert(is_native_vol_obj && "not a native VOL connector object"); + } +#endif + + /* Convert the haddr_t to an object token */ + if(H5VL_native_addr_to_token(vol_obj, vol_obj_type, addr, token) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "couldn't serialize haddr_t into object token") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLnative_addr_to_token() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_addr_to_token + * + * Purpose: Converts a native VOL haddr_t address to an abstract VOL token. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_native_addr_to_token(void *obj, H5I_type_t obj_type, haddr_t addr, H5O_token_t *token) +{ + uint8_t *p; + size_t addr_len = 0; /* Size of haddr_t */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check args */ + HDassert(obj); + HDassert(token); + + /* Get the length of an haddr_t in the file */ + if(H5VL__native_get_file_addr_len(obj, obj_type, &addr_len) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get length of haddr_t from VOL object") + + /* Ensure that token is initialized */ + HDmemset(token, 0, sizeof(H5O_token_t)); + + /* Encode token */ + p = (uint8_t *)token; + H5F_addr_encode_len(addr_len, &p, addr); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_addr_to_token() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLnative_token_to_addr + * + * Purpose: Converts an abstract VOL token to a native VOL haddr_t address. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr) +{ + H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */ + void *vol_obj = NULL; /* VOL Object of loc_id */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "ik*a", loc_id, token, addr); + + /* Check args */ + if(NULL == addr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr pointer can't be NULL") + + /* Get object type */ + if((vol_obj_type = H5I_get_type(loc_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve underlying VOL object */ + if(NULL == (vol_obj = H5VL_object(loc_id))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + +#ifndef NDEBUG + { + H5VL_object_t *vol_obj_container; + hbool_t is_native_vol_obj; + + /* Get the location object */ + if(NULL == (vol_obj_container = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Make sure that the VOL object is a native connector object */ + if(H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + + HDassert(is_native_vol_obj && "not a native VOL connector object"); + } +#endif + + /* Convert the object token to an haddr_t */ + if(H5VL_native_token_to_addr(vol_obj, vol_obj_type, token, addr) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "couldn't deserialize object token into haddr_t") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLnative_token_to_addr() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_native_token_to_addr + * + * Purpose: Converts an abstract VOL token to a native VOL haddr_t address. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_native_token_to_addr(void *obj, H5I_type_t obj_type, H5O_token_t token, haddr_t *addr) +{ + const uint8_t *p; + size_t addr_len = 0; /* Size of haddr_t */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check args */ + HDassert(obj); + HDassert(addr); + + /* Get the length of an haddr_t in the file */ + if(H5VL__native_get_file_addr_len(obj, obj_type, &addr_len) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get length of haddr_t from VOL object") + + /* Decode token */ + p = (const uint8_t *)&token; + H5F_addr_decode_len(addr_len, &p, addr); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_token_to_addr() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_native_get_file_struct + * + * Purpose: Utility routine to get file struct for an object + * + * Returns: SUCCEED/FAIL + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file) +{ + H5O_loc_t *oloc = NULL; /* Object location for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL); + + *file = NULL; + + switch(type) { + case H5I_FILE: + *file = (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_MAP: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + 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_SPACE_SEL_ITER: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + } /* end switch */ + + /* Set return value for objects (not files) */ + if(oloc) + *file = oloc->file; + + /* Couldn't find a file struct */ + if(!*file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not associated with a file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5VL_native_get_file_struct */ + diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 73cec8d..e1f3f93 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -20,6 +20,11 @@ /* Public headers needed by this file */ #include "H5VLpublic.h" /* Virtual Object Layer */ + +/*****************/ +/* Public Macros */ +/*****************/ + /* Identifier for the native VOL connector */ #define H5VL_NATIVE (H5VL_native_register()) @@ -28,14 +33,12 @@ #define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */ #define H5VL_NATIVE_VERSION 0 -/* Typedef and values for native VOL connector attribute optional VOL operations */ -typedef int H5VL_native_attr_optional_t; +/* Values for VOL connector attribute optional VOL operations */ #ifndef H5_NO_DEPRECATED_SYMBOLS -#define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */ +#define H5VL_NATIVE_ATTR_ITERATE_OLD 0 /* H5Aiterate (deprecated routine) */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ -/* Typedef and values for native VOL connector dataset optional VOL operations */ -typedef int H5VL_native_dataset_optional_t; +/* Values for native VOL connector dataset optional VOL operations */ #define H5VL_NATIVE_DATASET_FORMAT_CONVERT 0 /* H5Dformat_convert (internal) */ #define H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE 1 /* H5Dget_chunk_index_type */ #define H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE 2 /* H5Dget_chunk_storage_size */ @@ -44,59 +47,86 @@ typedef int H5VL_native_dataset_optional_t; #define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD 5 /* H5Dget_chunk_info_by_coord */ #define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */ #define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */ +#define H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE 8 /* H5Dvlen_get_buf_size */ + +/* Values for native VOL connector file optional VOL operations */ +#define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */ +#define H5VL_NATIVE_FILE_GET_FILE_IMAGE 1 /* H5Fget_file_image */ +#define H5VL_NATIVE_FILE_GET_FREE_SECTIONS 2 /* H5Fget_free_sections */ +#define H5VL_NATIVE_FILE_GET_FREE_SPACE 3 /* H5Fget_freespace */ +#define H5VL_NATIVE_FILE_GET_INFO 4 /* H5Fget_info1/2 */ +#define H5VL_NATIVE_FILE_GET_MDC_CONF 5 /* H5Fget_mdc_config */ +#define H5VL_NATIVE_FILE_GET_MDC_HR 6 /* H5Fget_mdc_hit_rate */ +#define H5VL_NATIVE_FILE_GET_MDC_SIZE 7 /* H5Fget_mdc_size */ +#define H5VL_NATIVE_FILE_GET_SIZE 8 /* H5Fget_filesize */ +#define H5VL_NATIVE_FILE_GET_VFD_HANDLE 9 /* H5Fget_vfd_handle */ +#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 10 /* H5Freset_mdc_hit_rate_stats */ +#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 11 /* H5Fset_mdc_config */ +#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 12 /* H5Fget_metadata_read_retry_info */ +#define H5VL_NATIVE_FILE_START_SWMR_WRITE 13 /* H5Fstart_swmr_write */ +#define H5VL_NATIVE_FILE_START_MDC_LOGGING 14 /* H5Fstart_mdc_logging */ +#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 15 /* H5Fstop_mdc_logging */ +#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 16 /* H5Fget_mdc_logging_status */ +#define H5VL_NATIVE_FILE_FORMAT_CONVERT 17 /* H5Fformat_convert */ +#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 18 /* H5Freset_page_buffering_stats */ +#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 19 /* H5Fget_page_buffering_stats */ +#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 20 /* H5Fget_mdc_image_info */ +#define H5VL_NATIVE_FILE_GET_EOA 21 /* H5Fget_eoa */ +#define H5VL_NATIVE_FILE_INCR_FILESIZE 22 /* H5Fincrement_filesize */ +#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 23 /* H5Fset_latest_format/libver_bounds */ +#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 24 /* H5Fget_dset_no_attrs_hint */ +#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 25 /* H5Fset_dset_no_attrs_hint */ +#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */ +#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */ +#define H5VL_NATIVE_FILE_POST_OPEN 28 /* Adjust file after open, with wrapping context */ -/* Typedef and values for native VOL connector file optional VOL operations */ -typedef int H5VL_native_file_optional_t; -#define H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE 0 /* H5Fclear_elink_file_cache */ -#define H5VL_NATIVE_FILE_GET_FILE_IMAGE 1 /* H5Fget_file_image */ -#define H5VL_NATIVE_FILE_GET_FREE_SECTIONS 2 /* H5Fget_free_sections */ -#define H5VL_NATIVE_FILE_GET_FREE_SPACE 3 /* H5Fget_freespace */ -#define H5VL_NATIVE_FILE_GET_INFO 4 /* H5Fget_info1/2 */ -#define H5VL_NATIVE_FILE_GET_MDC_CONF 5 /* H5Fget_mdc_config */ -#define H5VL_NATIVE_FILE_GET_MDC_HR 6 /* H5Fget_mdc_hit_rate */ -#define H5VL_NATIVE_FILE_GET_MDC_SIZE 7 /* H5Fget_mdc_size */ -#define H5VL_NATIVE_FILE_GET_SIZE 8 /* H5Fget_filesize */ -#define H5VL_NATIVE_FILE_GET_VFD_HANDLE 9 /* H5Fget_vfd_handle */ -#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 10 /* H5Freset_mdc_hit_rate_stats */ -#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 11 /* H5Fset_mdc_config */ -#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 12 /* H5Fget_metadata_read_retry_info */ -#define H5VL_NATIVE_FILE_START_SWMR_WRITE 13 /* H5Fstart_swmr_write */ -#define H5VL_NATIVE_FILE_START_MDC_LOGGING 14 /* H5Fstart_mdc_logging */ -#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 15 /* H5Fstop_mdc_logging */ -#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 16 /* H5Fget_mdc_logging_status */ -#define H5VL_NATIVE_FILE_FORMAT_CONVERT 17 /* H5Fformat_convert */ -#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 18 /* H5Freset_page_buffering_stats */ -#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 19 /* H5Fget_page_buffering_stats */ -#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 20 /* H5Fget_mdc_image_info */ -#define H5VL_NATIVE_FILE_GET_EOA 21 /* H5Fget_eoa */ -#define H5VL_NATIVE_FILE_INCR_FILESIZE 22 /* H5Fincrement_filesize */ -#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 23 /* H5Fset_latest_format/libver_bounds */ -#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 24 /* H5Fget_dset_no_attrs_hint */ -#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 25 /* H5Fset_dset_no_attrs_hint */ -#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */ -#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */ - -/* Typedef and values for native VOL connector group optional VOL operations */ -typedef int H5VL_native_group_optional_t; +/* Values for native VOL connector group optional VOL operations */ #ifndef H5_NO_DEPRECATED_SYMBOLS -#define H5VL_NATIVE_GROUP_ITERATE_OLD 0 /* HG5Giterate (deprecated routine) */ -#define H5VL_NATIVE_GROUP_GET_OBJINFO 1 /* HG5Gget_objinfo (deprecated routine) */ +#define H5VL_NATIVE_GROUP_ITERATE_OLD 0 /* HG5Giterate (deprecated routine) */ +#define H5VL_NATIVE_GROUP_GET_OBJINFO 1 /* HG5Gget_objinfo (deprecated routine) */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ -/* Typedef and values for native VOL connector object optional VOL operations */ -typedef int H5VL_native_object_optional_t; -#define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */ -#define H5VL_NATIVE_OBJECT_GET_INFO 1 /* H5Oget_info(_by_idx, _by_name)(2) */ -#define H5VL_NATIVE_OBJECT_SET_COMMENT 2 /* H5G|H5Oset_comment, H5Oset_comment_by_name */ -#define H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES 3 /* H5Odisable_mdc_flushes */ -#define H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES 4 /* H5Oenable_mdc_flushes */ -#define H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED 5 /* H5Oare_mdc_flushes_disabled */ +/* Values for native VOL connector object optional VOL operations */ +#define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */ +#define H5VL_NATIVE_OBJECT_SET_COMMENT 1 /* H5G|H5Oset_comment, H5Oset_comment_by_name */ +#define H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES 2 /* H5Odisable_mdc_flushes */ +#define H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES 3 /* H5Oenable_mdc_flushes */ +#define H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED 4 /* H5Oare_mdc_flushes_disabled */ +#define H5VL_NATIVE_OBJECT_GET_NATIVE_INFO 5 /* H5Oget_native_info(_by_idx, _by_name) */ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ #ifdef __cplusplus extern "C" { #endif -/* Private functions */ +/* Token <--> address converters */ +H5_DLL herr_t H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token); +H5_DLL herr_t H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr); + +/* Not really public but must be included here */ H5_DLL hid_t H5VL_native_register(void); #ifdef __cplusplus diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c index 85af320..e54c49f 100644 --- a/src/H5VLnative_attr.c +++ b/src/H5VLnative_attr.c @@ -524,16 +524,14 @@ done: *------------------------------------------------------------------------- */ 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__native_attr_optional(void H5_ATTR_UNUSED *obj, H5VL_attr_optional_t opt_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { - H5VL_native_attr_optional_t optional_type; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - optional_type = HDva_arg(arguments, H5VL_native_attr_optional_t); - switch(optional_type) { + switch(opt_type) { #ifndef H5_NO_DEPRECATED_SYMBOLS case H5VL_NATIVE_ATTR_ITERATE_OLD: { diff --git a/src/H5VLnative_blob.c b/src/H5VLnative_blob.c index 6c7f9b2..8e34859 100644 --- a/src/H5VLnative_blob.c +++ b/src/H5VLnative_blob.c @@ -84,7 +84,7 @@ H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, HDassert(id); /* Write the VL information to disk (allocates space also) */ - if(H5HG_insert(f, size, (void *)buf, &hobjid) < 0) + if(H5HG_insert(f, size, buf, &hobjid) < 0) HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write blob information") /* Encode the heap information */ diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c index 399c19f..bea2c50 100644 --- a/src/H5VLnative_dataset.c +++ b/src/H5VLnative_dataset.c @@ -203,7 +203,7 @@ H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, 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) + 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: @@ -388,11 +388,10 @@ done: *------------------------------------------------------------------------- */ 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, H5VL_dataset_optional_t optional_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = NULL; /* Dataset */ - H5VL_native_dataset_optional_t optional_type = HDva_arg(arguments, H5VL_native_dataset_optional_t); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -426,7 +425,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, case H5D_NLAYOUTS: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") - default: + default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") } /* end switch */ @@ -607,6 +606,20 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, break; } + case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE: + { /* H5Dvlen_get_buf_size */ + hid_t type_id = HDva_arg(arguments, hid_t); + hid_t space_id = HDva_arg(arguments, hid_t); + hsize_t *size = HDva_arg(arguments, hsize_t *); + + dset = (H5D_t *)obj; + + if(H5D__vlen_get_buf_size(dset, type_id, space_id, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of vlen buf needed") + break; + } + + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") } /* end switch */ diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index fb3cb7e..23ea37b 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -226,7 +226,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, ssize_t *ret = HDva_arg(arguments, ssize_t *); size_t len; - if(NULL == (f = H5F__get_file(obj, type))) + if(H5VL_native_get_file_struct(obj, type, &f) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") len = HDstrlen(H5F_OPEN_NAME(f)); @@ -305,15 +305,6 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, FUNC_ENTER_PACKAGE switch(specific_type) { - /* Finalize H5Fopen */ - case H5VL_FILE_POST_OPEN: - { - /* Call package routine */ - if(H5F__post_open((H5F_t *)obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file") - break; - } - /* H5Fflush */ case H5VL_FILE_FLUSH: { @@ -322,7 +313,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 = H5F__get_file(obj, type))) + if(H5VL_native_get_file_struct(obj, type, &f) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Nothing to do if the file is read only. This determination is @@ -450,10 +441,10 @@ done: *------------------------------------------------------------------------- */ 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, H5VL_file_optional_t optional_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5F_t *f = NULL; /* File */ - H5VL_native_file_optional_t optional_type = HDva_arg(arguments, H5VL_native_file_optional_t); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -528,7 +519,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 = H5F__get_file(obj, type))) + if(H5VL_native_get_file_struct(obj, type, &f) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct") /* Get the file info */ @@ -565,8 +556,8 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR { size_t *max_size_ptr = HDva_arg(arguments, size_t *); size_t *min_clean_size_ptr = HDva_arg(arguments, size_t *); - size_t *cur_size_ptr = HDva_arg(arguments, size_t *); - int *cur_num_entries_ptr = HDva_arg(arguments, int *); + size_t *cur_size_ptr = HDva_arg(arguments, size_t *); + int *cur_num_entries_ptr = HDva_arg(arguments, int *); uint32_t cur_num_entries; /* Go get the size data */ @@ -706,7 +697,7 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR unsigned *misses = HDva_arg(arguments, unsigned *); unsigned *evictions = HDva_arg(arguments, unsigned *); unsigned *bypasses = HDva_arg(arguments, unsigned *); - + /* Sanity check */ if(NULL == f->shared->page_buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") @@ -828,6 +819,15 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR } #endif /* H5_HAVE_PARALLEL */ + /* Finalize H5Fopen */ + case H5VL_NATIVE_FILE_POST_OPEN: + { + /* Call package routine */ + if(H5F__post_open((H5F_t *)obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file") + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") } /* end switch */ diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c index b6bef7f..3fdb2d9 100644 --- a/src/H5VLnative_group.c +++ b/src/H5VLnative_group.c @@ -266,15 +266,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_group_optional(void *obj, H5VL_group_optional_t optional_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { - H5VL_native_group_optional_t optional_type; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - optional_type = HDva_arg(arguments, H5VL_native_group_optional_t); switch(optional_type) { #ifndef H5_NO_DEPRECATED_SYMBOLS /* H5Giterate (deprecated) */ diff --git a/src/H5VLnative_introspect.c b/src/H5VLnative_introspect.c new file mode 100644 index 0000000..45b8d8c --- /dev/null +++ b/src/H5VLnative_introspect.c @@ -0,0 +1,52 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: Connector/container introspection callbacks for the native VOL connector + * + */ + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5VLprivate.h" /* Virtual Object Layer */ + +#include "H5VLnative_private.h" /* Native VOL connector */ + +/* Note: H5VL__native_introspect_get_conn_cls is in src/H5VLnative.c so that + * it can return the address of the staticly declared class struct. + */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_introspect_opt_query + * + * Purpose: Query if an optional operation is supported by this connector + * + * Returns: SUCCEED (Can't fail) + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t H5_ATTR_UNUSED cls, + int H5_ATTR_UNUSED opt_type, hbool_t *supported) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDassert(supported); + + /* The native VOL connector supports all optional operations */ + *supported = TRUE; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__native_introspect_opt_query() */ + diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c index 2a8c27a..051de19 100644 --- a/src/H5VLnative_link.c +++ b/src/H5VLnative_link.c @@ -241,20 +241,21 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_ /* H5Lget_info/H5Lget_info_by_idx */ case H5VL_LINK_GET_INFO: { - H5L_info_t *linfo = HDva_arg(arguments, H5L_info_t *); + H5L_info2_t *linfo2 = HDva_arg(arguments, H5L_info2_t *); /* Get the link information */ if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */ - if(H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo) < 0) + if(H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo2) < 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) + loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo2) < 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; } @@ -340,12 +341,12 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ case H5VL_LINK_ITER: { H5G_loc_t loc; - hbool_t recursive = (hbool_t)HDva_arg(arguments, unsigned); - H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */ - H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */ - hsize_t *idx_p = HDva_arg(arguments, hsize_t *); - H5L_iterate_t op = HDva_arg(arguments, H5L_iterate_t); - void *op_data = HDva_arg(arguments, void *); + hbool_t recursive = (hbool_t)HDva_arg(arguments, unsigned); + H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */ + H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */ + hsize_t *idx_p = HDva_arg(arguments, hsize_t *); + H5L_iterate2_t op = HDva_arg(arguments, H5L_iterate2_t); + void *op_data = HDva_arg(arguments, void *); /* Get the location */ if(H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index 6a22b05..3a29b6c 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -72,11 +72,12 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ case H5VL_OBJECT_BY_TOKEN: { - const uint8_t *p = (const uint8_t *)loc_params->loc_data.loc_by_token.token; + H5O_token_t token = *loc_params->loc_data.loc_by_token.token; haddr_t addr; /* Decode token */ - H5F_addr_decode(loc.oloc->file, &p, &addr); + if(H5VL_native_token_to_addr(loc.oloc->file, H5I_FILE, token, &addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, NULL, "can't deserialize object token into address") /* Open the object */ if(NULL == (ret_value = H5O_open_by_addr(&loc, addr, opened_type))) @@ -184,13 +185,15 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj } /* end if */ else if(loc_params->type == H5VL_OBJECT_BY_TOKEN) { H5O_loc_t obj_oloc; /* Object location */ - const uint8_t *p = (const uint8_t *)loc_params->loc_data.loc_by_token.token; + H5O_token_t token = *loc_params->loc_data.loc_by_token.token; /* Initialize the object location */ H5O_loc_reset(&obj_oloc); obj_oloc.file = loc.oloc->file; + /* Decode token */ - H5F_addr_decode(obj_oloc.file, &p, &obj_oloc.addr); + if(H5VL_native_token_to_addr(obj_oloc.file, H5I_FILE, token, &obj_oloc.addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") /* Retrieve object's name */ if((*ret = H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, name, size)) < 0) @@ -209,13 +212,15 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj if(loc_params->type == H5VL_OBJECT_BY_TOKEN) { H5O_loc_t obj_oloc; /* Object location */ unsigned rc; /* Reference count of object */ - const uint8_t *p = (const uint8_t *)loc_params->loc_data.loc_by_token.token; + H5O_token_t token = *loc_params->loc_data.loc_by_token.token; /* Initialize the object location */ H5O_loc_reset(&obj_oloc); obj_oloc.file = loc.oloc->file; + /* Decode token */ - H5F_addr_decode(obj_oloc.file, &p, &obj_oloc.addr); + if(H5VL_native_token_to_addr(obj_oloc.file, H5I_FILE, token, &obj_oloc.addr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") /* Get the # of links for object, and its type */ /* (To check to make certain that this object hasn't been deleted) */ @@ -226,6 +231,56 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj break; } + /* H5Oget_info(_name|_by_idx)3 */ + case H5VL_OBJECT_GET_INFO: + { + H5O_info2_t *oinfo = HDva_arg(arguments, H5O_info2_t *); + unsigned fields = HDva_arg(arguments, unsigned); + + /* Use the original H5Oget_info code to get the data */ + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */ + /* Retrieve the object's information */ + if(H5G_loc_info(&loc, ".", oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ + /* Retrieve the object's information */ + if(H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, oinfo, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end else-if */ + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ + H5G_loc_t obj_loc; /* Location used to open group */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ + + /* 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, oinfo, 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) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + } /* end else-if */ + else + HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") } /* end switch */ @@ -287,7 +342,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V /* Lookup object */ case H5VL_OBJECT_LOOKUP: { - H5VL_token_t *token = va_arg(arguments, H5VL_token_t *); + H5O_token_t *token = va_arg(arguments, H5O_token_t *); HDassert(token); @@ -295,7 +350,6 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V H5G_loc_t obj_loc; /* Group hier. location of object */ H5G_name_t obj_path; /* Object group hier. path */ H5O_loc_t obj_oloc; /* Object object location */ - uint8_t *p = (uint8_t *)token; /* Pointer to token */ /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -307,7 +361,8 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") /* Encode token */ - H5F_addr_encode(obj_oloc.file, &p, obj_loc.oloc->addr); + if(H5VL_native_addr_to_token(loc.oloc->file, H5I_FILE, obj_loc.oloc->addr, token) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") /* Release the object location */ if(H5G_loc_free(&obj_loc) < 0) @@ -322,7 +377,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V { H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */ H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */ - H5O_iterate_t op = HDva_arg(arguments, H5O_iterate_t); + H5O_iterate2_t op = HDva_arg(arguments, H5O_iterate2_t); void *op_data = HDva_arg(arguments, void *); unsigned fields = HDva_arg(arguments, unsigned); @@ -384,10 +439,9 @@ done: *------------------------------------------------------------------------- */ 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, H5VL_object_optional_t optional_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { - H5VL_native_object_optional_t optional_type = HDva_arg(arguments, H5VL_native_object_optional_t); H5VL_loc_params_t *loc_params = HDva_arg(arguments, H5VL_loc_params_t *); H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ @@ -398,54 +452,6 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, 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_NATIVE_OBJECT_GET_INFO: - { - H5O_info_t *obj_info = HDva_arg(arguments, H5O_info_t *); - unsigned fields = HDva_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") - } /* 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 */ - 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") - } /* end if */ - - /* Release the object location */ - if(H5G_loc_free(&obj_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - } /* end else-if */ - else - HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") - break; - } - /* H5Oget_comment / H5Oget_comment_by_name */ case H5VL_NATIVE_OBJECT_GET_COMMENT: { @@ -521,6 +527,57 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, break; } + /* H5Oget_native_info(_name|_by_idx) */ + case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO: + { + H5O_native_info_t *native_info = HDva_arg(arguments, H5O_native_info_t *); + unsigned fields = HDva_arg(arguments, unsigned); + + /* Use the original H5Oget_info code to get the data */ + + if(loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */ + /* Retrieve the object's information */ + if(H5G_loc_native_info(&loc, ".", native_info, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end if */ + else if(loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ + /* Retrieve the object's information */ + if(H5G_loc_native_info(&loc, loc_params->loc_data.loc_by_name.name, native_info, fields) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + } /* end else-if */ + else if(loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ + H5G_loc_t obj_loc; /* Location used to open group */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ + + /* 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_native_info(obj_loc.oloc, native_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) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + } /* end else-if */ + else + HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object"); } /* end switch */ diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 69a057e..30bddb6 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -18,7 +18,8 @@ #define _H5VLnative_private_H /* Private headers needed by this file */ -#include "H5VLnative.h" /* Native VOL connector */ +#include "H5Fprivate.h" /* Files */ +#include "H5VLnative.h" /* Native VOL connector */ /**************************/ @@ -51,7 +52,7 @@ H5_DLL herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_ H5_DLL herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req); /* Dataset callbacks */ @@ -61,15 +62,22 @@ H5_DLL herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem H5_DLL herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); H5_DLL herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_dataset_optional(void *dset, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req); +/* Datatype callbacks */ +H5_DLL 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); +H5_DLL void *H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); + /* File callbacks */ H5_DLL void *H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */ @@ -77,7 +85,7 @@ H5_DLL void *H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_p H5_DLL void *H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req); /* Link callbacks */ @@ -92,20 +100,29 @@ H5_DLL void *H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_pa H5_DLL 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); H5_DLL herr_t H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VL__native_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); -/* Datatype callbacks */ -H5_DLL 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); -H5_DLL void *H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); +/* Connector/container introspection functions */ +H5_DLL herr_t H5VL__native_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); +H5_DLL herr_t H5VL__native_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported); /* Blob callbacks */ H5_DLL herr_t H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); H5_DLL herr_t H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx); H5_DLL herr_t H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); +/* Token callbacks */ +H5_DLL herr_t H5VL__native_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); +H5_DLL herr_t H5VL__native_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str); +H5_DLL herr_t H5VL__native_str_to_token(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token); + +/* Helper functions */ +H5_DLL herr_t H5VL_native_get_file_addr_len(hid_t loc_id, size_t *addr_len); +H5_DLL herr_t H5VL__native_get_file_addr_len(void *obj, H5I_type_t obj_type, size_t *addr_len); +H5_DLL herr_t H5VL_native_addr_to_token(void *obj, H5I_type_t obj_type, haddr_t addr, H5O_token_t *token); +H5_DLL herr_t H5VL_native_token_to_addr(void *obj, H5I_type_t obj_type, H5O_token_t token, haddr_t *addr); +H5_DLL herr_t H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file); + #ifdef __cplusplus } #endif diff --git a/src/H5VLnative_token.c b/src/H5VLnative_token.c new file mode 100644 index 0000000..2b5429e --- /dev/null +++ b/src/H5VLnative_token.c @@ -0,0 +1,157 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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: Object token callbacks for the native VOL connector + */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory handling */ +#include "H5VLnative_private.h" /* Native VOL connector */ + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_token_cmp + * + * Purpose: Compare two of the connector's object tokens, setting + * *cmp_value, following the same rules as strcmp(). + * + * Return: Success: 0 + * Failure: (can't fail) + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_token_cmp(void H5_ATTR_UNUSED *obj, + const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE_NOERR + + /* Check parameters */ + HDassert(token1); + HDassert(token2); + + *cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t)); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_token_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_token_to_str + * + * Purpose: Serialize an object token into a string + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, + char **token_str) +{ + haddr_t addr; + size_t addr_ndigits; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Check parameters */ + HDassert(obj); + HDassert(token); + + if(H5VL_native_token_to_addr(obj, obj_type, *token, &addr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert object token to address") + + if(addr == 0) + addr_ndigits = 1; + else + addr_ndigits = (size_t)(HDfloor(HDlog10((double)addr)) + 1); + + if(NULL == (*token_str = H5MM_malloc(addr_ndigits + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for token string") + + HDsnprintf(*token_str, addr_ndigits + 1, H5_PRINTF_HADDR_FMT, addr); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_token_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL__native_str_to_token + * + * Purpose: Deserialize a string into an object token + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL__native_str_to_token(void *obj, H5I_type_t obj_type, + const char *token_str, H5O_token_t *token) +{ + haddr_t addr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Check parameters */ + HDassert(token_str); + + HDsscanf(token_str, H5_PRINTF_HADDR_FMT, &addr); + + if(H5VL_native_addr_to_token(obj, obj_type, addr, token) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert address to object token") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_str_to_token() */ + diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index d9a207f..5c9f28c 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -117,8 +117,8 @@ static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *b 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); +static herr_t H5VL_pass_through_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); +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 lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); @@ -128,7 +128,7 @@ static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_ static herr_t H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL_pass_through_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req); /* Datatype callbacks */ @@ -136,7 +136,7 @@ static void *H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_ 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_optional(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req); /* File callbacks */ @@ -144,7 +144,7 @@ static void *H5VL_pass_through_file_create(const char *name, unsigned flags, hid 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_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */ @@ -152,7 +152,7 @@ static void *H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t * 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_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req); /* Link callbacks */ @@ -161,27 +161,40 @@ static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t 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); +static herr_t H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); /* 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); +static herr_t H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments); + +/* Container/connector introspection callbacks */ +static herr_t H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); +static herr_t H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported); /* 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_optional(void *req, H5VL_request_optional_t opt_type, va_list arguments); static herr_t H5VL_pass_through_request_free(void *req); /* Blob callbacks */ static herr_t H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx); static herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx); static herr_t H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments); +static herr_t H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments); + +/* Token callbacks */ +static herr_t H5VL_pass_through_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); +static herr_t H5VL_pass_through_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str); +static herr_t H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token); + +/* Generic optional callback */ +static herr_t H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments); /*******************/ @@ -270,6 +283,10 @@ static const H5VL_class_t H5VL_pass_through_g = { H5VL_pass_through_object_specific, /* specific */ H5VL_pass_through_object_optional /* optional */ }, + { /* introspect_cls */ + H5VL_pass_through_introspect_get_conn_cls, /* get_conn_cls */ + H5VL_pass_through_introspect_opt_query, /* opt_query */ + }, { /* request_cls */ H5VL_pass_through_request_wait, /* wait */ H5VL_pass_through_request_notify, /* notify */ @@ -282,9 +299,14 @@ static const H5VL_class_t H5VL_pass_through_g = { H5VL_pass_through_blob_put, /* put */ H5VL_pass_through_blob_get, /* get */ H5VL_pass_through_blob_specific, /* specific */ - NULL /* optional */ + H5VL_pass_through_blob_optional /* optional */ + }, + { /* token_cls */ + H5VL_pass_through_token_cmp, /* cmp */ + H5VL_pass_through_token_to_str, /* to_str */ + H5VL_pass_through_token_from_str /* from_str */ }, - NULL /* optional */ + H5VL_pass_through_optional /* optional */ }; /* The connector identification number, initialized at runtime */ @@ -489,7 +511,7 @@ H5VL_pass_through_info_cmp(int *cmp_value, const void *_info1, const void *_info /* 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) @@ -606,7 +628,7 @@ H5VL_pass_through_str_to_info(const char *str, void **_info) const char *under_vol_info_start, *under_vol_info_end; hid_t under_vol_id; void *under_vol_info = NULL; - + #ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL INFO String To Info\n"); #endif @@ -820,7 +842,7 @@ H5VL_pass_through_attr_create(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Create\n"); #endif @@ -857,7 +879,7 @@ H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Open\n"); #endif @@ -886,14 +908,14 @@ H5VL_pass_through_attr_open(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Read\n"); #endif @@ -917,14 +939,14 @@ H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *buf, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Write\n"); #endif @@ -948,14 +970,14 @@ H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Get\n"); #endif @@ -979,14 +1001,14 @@ H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Specific\n"); #endif @@ -1010,18 +1032,18 @@ H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -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_optional(void *obj, H5VL_attr_optional_t opt_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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n"); #endif - ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -1041,13 +1063,13 @@ H5VL_pass_through_attr_optional(void *obj, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL ATTRIBUTE Close\n"); #endif @@ -1078,13 +1100,13 @@ H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req) static void * H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, - 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) { H5VL_pass_through_t *dset; H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Create\n"); #endif @@ -1121,7 +1143,7 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Open\n"); #endif @@ -1150,14 +1172,14 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Read\n"); #endif @@ -1181,14 +1203,14 @@ H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Write\n"); #endif @@ -1212,14 +1234,14 @@ H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_i * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Get\n"); #endif @@ -1243,7 +1265,7 @@ H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, * *------------------------------------------------------------------------- */ -static herr_t +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) { @@ -1251,7 +1273,7 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t hid_t under_vol_id; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL H5Dspecific\n"); #endif @@ -1279,18 +1301,18 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t * *------------------------------------------------------------------------- */ -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_optional(void *obj, H5VL_dataset_optional_t opt_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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Optional\n"); #endif - ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -1310,13 +1332,13 @@ H5VL_pass_through_dataset_optional(void *obj, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Close\n"); #endif @@ -1353,7 +1375,7 @@ H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Commit\n"); #endif @@ -1387,10 +1409,10 @@ 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; + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Open\n"); #endif @@ -1419,14 +1441,14 @@ H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Get\n"); #endif @@ -1450,7 +1472,7 @@ H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, * *------------------------------------------------------------------------- */ -static herr_t +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) { @@ -1458,7 +1480,7 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific hid_t under_vol_id; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Specific\n"); #endif @@ -1486,18 +1508,18 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific * *------------------------------------------------------------------------- */ -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_optional(void *obj, H5VL_datatype_optional_t opt_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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Optional\n"); #endif - ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -1517,13 +1539,13 @@ H5VL_pass_through_datatype_optional(void *obj, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATATYPE Close\n"); #endif @@ -1562,7 +1584,7 @@ H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t under_fapl_id; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL FILE Create\n"); #endif @@ -1616,7 +1638,7 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t under_fapl_id; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL FILE Open\n"); #endif @@ -1661,14 +1683,14 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL FILE Get\n"); #endif @@ -1693,7 +1715,7 @@ H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, * *------------------------------------------------------------------------- */ -static herr_t +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, ...) { @@ -1718,7 +1740,7 @@ H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id, * *------------------------------------------------------------------------- */ -static herr_t +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) { @@ -1726,7 +1748,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t under_vol_id = -1; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL FILE Specific\n"); #endif @@ -1825,18 +1847,18 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, * *------------------------------------------------------------------------- */ -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_optional(void *file, H5VL_file_optional_t opt_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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL File Optional\n"); #endif - ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -1856,13 +1878,13 @@ H5VL_pass_through_file_optional(void *file, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL FILE Close\n"); #endif @@ -1899,7 +1921,7 @@ H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL GROUP Create\n"); #endif @@ -1936,7 +1958,7 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL GROUP Open\n"); #endif @@ -1965,14 +1987,14 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL GROUP Get\n"); #endif @@ -1996,7 +2018,7 @@ H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, * *------------------------------------------------------------------------- */ -static herr_t +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) { @@ -2004,7 +2026,7 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t under_vol_id; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL GROUP Specific\n"); #endif @@ -2032,18 +2054,18 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, * *------------------------------------------------------------------------- */ -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_optional(void *obj, H5VL_group_optional_t opt_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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL GROUP Optional\n"); #endif - ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -2063,13 +2085,13 @@ H5VL_pass_through_group_optional(void *obj, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL H5Gclose\n"); #endif @@ -2098,7 +2120,7 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req) * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...) @@ -2123,7 +2145,7 @@ H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type, * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments) @@ -2132,7 +2154,7 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, hid_t under_vol_id = -1; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Create\n"); #endif @@ -2188,7 +2210,7 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, * *------------------------------------------------------------------------- */ -static herr_t +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) @@ -2198,7 +2220,7 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, hid_t under_vol_id = -1; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Copy\n"); #endif @@ -2214,7 +2236,7 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, /* Check for async request */ if(req && *req) *req = H5VL_pass_through_new_obj(*req, under_vol_id); - + return ret_value; } /* end H5VL_pass_through_link_copy() */ @@ -2234,7 +2256,7 @@ H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, * *------------------------------------------------------------------------- */ -static herr_t +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) @@ -2244,7 +2266,7 @@ H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, hid_t under_vol_id = -1; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Move\n"); #endif @@ -2275,14 +2297,14 @@ H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Get\n"); #endif @@ -2291,7 +2313,7 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, /* Check for async request */ if(req && *req) *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); - + return ret_value; } /* end H5VL_pass_through_link_get() */ @@ -2306,14 +2328,14 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params, +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Specific\n"); #endif @@ -2338,17 +2360,17 @@ H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params, *------------------------------------------------------------------------- */ static herr_t -H5VL_pass_through_link_optional(void *obj, hid_t dxpl_id, void **req, - va_list arguments) +H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL LINK Optional\n"); #endif - ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -2376,7 +2398,7 @@ H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; void *under; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL OBJECT Open\n"); #endif @@ -2405,7 +2427,7 @@ H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params, * *------------------------------------------------------------------------- */ -static herr_t +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, @@ -2415,7 +2437,7 @@ H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_pa H5VL_pass_through_t *o_dst = (H5VL_pass_through_t *)dst_obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL OBJECT Copy\n"); #endif @@ -2439,13 +2461,13 @@ H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_pa * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL OBJECT Get\n"); #endif @@ -2469,7 +2491,7 @@ H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5V * *------------------------------------------------------------------------- */ -static herr_t +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) @@ -2478,7 +2500,7 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params hid_t under_vol_id; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL OBJECT Specific\n"); #endif @@ -2506,18 +2528,18 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, - va_list arguments) +static herr_t +H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, + hid_t dxpl_id, void **req, va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL OBJECT Optional\n"); #endif - ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, dxpl_id, req, arguments); + ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments); /* Check for async request */ if(req && *req) @@ -2528,6 +2550,66 @@ H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, /*------------------------------------------------------------------------- + * Function: H5VL_pass_through_introspect_get_conn_clss + * + * Purpose: Query the connector class. + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, + const H5VL_class_t **conn_cls) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL INTROSPECT GetConnCls\n"); +#endif + + /* Check for querying this connector's class */ + if(H5VL_GET_CONN_LVL_CURR == lvl) { + *conn_cls = &H5VL_pass_through_g; + ret_value = 0; + } /* end if */ + else + ret_value = H5VLintrospect_get_conn_cls(o->under_object, o->under_vol_id, + lvl, conn_cls); + + return ret_value; +} /* end H5VL_pass_through_introspect_get_conn_cls() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_introspect_opt_query + * + * Purpose: Query if an optional operation is supported by this connector + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, + int opt_type, hbool_t *supported) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL INTROSPECT OptQuery\n"); +#endif + + ret_value = H5VLintrospect_opt_query(o->under_object, o->under_vol_id, cls, + opt_type, supported); + + return ret_value; +} /* end H5VL_pass_through_introspect_opt_query() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_pass_through_request_wait * * Purpose: Wait (with a timeout) for an async operation to complete @@ -2540,14 +2622,14 @@ H5VL_pass_through_object_optional(void *obj, hid_t dxpl_id, void **req, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Wait\n"); #endif @@ -2573,13 +2655,13 @@ H5VL_pass_through_request_wait(void *obj, uint64_t timeout, * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Notify\n"); #endif @@ -2604,13 +2686,13 @@ H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx) * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Cancel\n"); #endif @@ -2634,7 +2716,7 @@ H5VL_pass_through_request_cancel(void *obj) * *------------------------------------------------------------------------- */ -static herr_t +static herr_t H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id, H5VL_request_specific_t specific_type, ...) { @@ -2659,13 +2741,13 @@ H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id, * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_type, +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Specific\n"); #endif @@ -2801,17 +2883,18 @@ H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_t * *------------------------------------------------------------------------- */ -static herr_t -H5VL_pass_through_request_optional(void *obj, va_list arguments) +static herr_t +H5VL_pass_through_request_optional(void *obj, H5VL_request_optional_t opt_type, + va_list arguments) { H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; herr_t ret_value; -#ifdef ENABLE_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Optional\n"); #endif - ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, arguments); + ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, opt_type, arguments); return ret_value; } /* end H5VL_pass_through_request_optional() */ @@ -2828,13 +2911,13 @@ H5VL_pass_through_request_optional(void *obj, va_list arguments) * *------------------------------------------------------------------------- */ -static herr_t +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_PASSTHRU_LOGGING +#ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL REQUEST Free\n"); #endif @@ -2926,3 +3009,156 @@ H5VL_pass_through_blob_specific(void *obj, void *blob_id, return ret_value; } /* end H5VL_pass_through_blob_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_blob_optional + * + * Purpose: Handles the blob 'optional' callback + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_pass_through_blob_optional(void *obj, void *blob_id, + H5VL_blob_optional_t opt_type, va_list arguments) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL BLOB Optional\n"); +#endif + + ret_value = H5VLblob_optional(o->under_object, o->under_vol_id, blob_id, + opt_type, arguments); + + return ret_value; +} /* end H5VL_pass_through_blob_optional() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_token_cmp + * + * Purpose: Compare two of the connector's object tokens, setting + * *cmp_value, following the same rules as strcmp(). + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_token_cmp(void *obj, const H5O_token_t *token1, + const H5O_token_t *token2, int *cmp_value) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL TOKEN Compare\n"); +#endif + + /* Sanity checks */ + assert(obj); + assert(token1); + assert(token2); + assert(cmp_value); + + ret_value = H5VLtoken_cmp(o->under_object, o->under_vol_id, token1, token2, cmp_value); + + return ret_value; +} /* end H5VL_pass_through_token_cmp() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_token_to_str + * + * Purpose: Serialize the connector's object token into a string. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_token_to_str(void *obj, H5I_type_t obj_type, + const H5O_token_t *token, char **token_str) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL TOKEN To string\n"); +#endif + + /* Sanity checks */ + assert(obj); + assert(token); + assert(token_str); + + ret_value = H5VLtoken_to_str(o->under_object, obj_type, o->under_vol_id, token, token_str); + + return ret_value; +} /* end H5VL_pass_through_token_to_str() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VL_pass_through_token_from_str + * + * Purpose: Deserialize the connector's object token from a string. + * + * Return: Success: 0 + * Failure: -1 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, + const char *token_str, H5O_token_t *token) +{ + H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj; + herr_t ret_value; + +#ifdef ENABLE_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL TOKEN From string\n"); +#endif + + /* Sanity checks */ + assert(obj); + assert(token); + assert(token_str); + + ret_value = H5VLtoken_from_str(o->under_object, obj_type, o->under_vol_id, token_str, token); + + return ret_value; +} /* end H5VL_pass_through_token_from_str() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_pass_through_optional + * + * Purpose: Handles the generic 'optional' callback + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_pass_through_optional(void *obj, int op_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_PASSTHRU_LOGGING + printf("------- PASS THROUGH VOL generic Optional\n"); +#endif + + ret_value = H5VLoptional(o->under_object, o->under_vol_id, op_type, + dxpl_id, req, arguments); + + return ret_value; +} /* end H5VL_pass_through_optional() */ + diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h index fc3088d..5965adc 100644 --- a/src/H5VLpkg.h +++ b/src/H5VLpkg.h @@ -54,7 +54,8 @@ H5_DLL hid_t H5VL__register_connector_by_name(const char *name, hbool_t app_ref, H5_DLL hid_t H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid_t vipl_id); H5_DLL htri_t H5VL__is_connector_registered(const char *name); -H5_DLL hid_t H5VL__get_connector_id(const char *name, hbool_t is_api); +H5_DLL hid_t H5VL__get_connector_id(hid_t obj_id, hbool_t is_api); +H5_DLL hid_t H5VL__get_connector_id_by_name(const char *name, hbool_t is_api); H5_DLL hid_t H5VL__peek_connector_id(const char *name); H5_DLL herr_t H5VL__connector_str_to_info(const char *str, hid_t connector_id, void **info); diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index c572b79..24ae1f3 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -91,6 +91,9 @@ 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 H5VL_object_t *H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id); H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); +H5_DLL herr_t H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native); +H5_DLL herr_t H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, + hbool_t *same_file); /* Functions that wrap / unwrap VOL objects */ H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, @@ -99,7 +102,7 @@ H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj, H5I_type_t obj_type); H5_DLL void * H5VL_unwrap_object(const H5VL_class_t *connector, void *obj); 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, H5VL_t *vol_connector); +H5_DLL herr_t H5VL_set_vol_wrapper(const H5VL_object_t *vol_obj); H5_DLL herr_t H5VL_inc_vol_wrapper(void *vol_wrap_ctx); H5_DLL herr_t H5VL_dec_vol_wrapper(void *vol_wrap_ctx); H5_DLL herr_t H5VL_reset_vol_wrapper(void); @@ -134,7 +137,7 @@ H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void 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, 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_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type, 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 */ @@ -144,15 +147,23 @@ H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req); H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_dataset_close(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, 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, H5VL_datatype_optional_t opt_type, 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); + /* File functions */ 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, ...); +H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Group functions */ @@ -160,7 +171,7 @@ H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_para 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_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Link functions */ @@ -169,38 +180,45 @@ H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_pa 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, ...); +H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, ...); /* Object functions */ 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, ...); +H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, ...); -/* Datatype functions */ -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, ...); -H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); +/* Connector/container introspection functions */ +H5_DLL herr_t H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t lvl, + const H5VL_class_t **conn_cls); +H5_DLL herr_t H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, + int opt_type, hbool_t *supported); /* 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, ...); +H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_type, ...); H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj); /* Blob functions */ H5_DLL herr_t H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void *blob_id, void *ctx); H5_DLL herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t size, void *ctx); H5_DLL herr_t H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_t specific_type, ...); +H5_DLL herr_t H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_optional_t opt_type, ...); + +/* Token functions */ +H5_DLL herr_t H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, + const H5O_token_t *token2, int *cmp_value); +H5_DLL herr_t H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, + const H5O_token_t *token, char **token_str); +H5_DLL herr_t H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, + const char *token_str, H5O_token_t *token); /* Generic functions */ -H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,void **req, ...); +H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...); #endif /* _H5VLprivate_H */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 12448b6..883aac8 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -21,11 +21,6 @@ #include "H5public.h" /* Generic Functions */ #include "H5Ipublic.h" /* IDs */ -/* Semi-public headers mainly for VOL connector authors */ -#include "H5VLconnector.h" -#include "H5VLconnector_passthru.h" - - /*****************/ /* Public Macros */ /*****************/ @@ -33,7 +28,7 @@ /* VOL connector identifier values * These are H5VL_class_value_t values, NOT hid_t values! */ -#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector iD */ +#define H5_VOL_INVALID (-1) /* Invalid ID for VOL connector ID */ #define H5_VOL_NATIVE 0 /* Native HDF5 file format VOL connector */ #define H5_VOL_RESERVED 256 /* VOL connector IDs below this value are reserved for library use */ #define H5_VOL_MAX 65535 /* Maximum VOL connector ID */ @@ -43,6 +38,16 @@ /* Public Typedefs */ /*******************/ + +/* + * VOL connector identifiers. Values 0 through 255 are for connectors defined + * by the HDF5 library. Values 256 through 511 are available for testing new + * filters. Subsequent values should be obtained from the HDF5 development + * team at help@hdfgroup.org. + */ +typedef int H5VL_class_value_t; + + /********************/ /* Public Variables */ /********************/ @@ -58,12 +63,11 @@ extern "C" { /* The H5VL types uses in the API calls are not opaque - they are defined in * H5VLconnector.h, which is included at the top of this file. */ - -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 hid_t H5VLget_connector_id(hid_t obj_id); +H5_DLL hid_t H5VLget_connector_id_by_name(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); @@ -73,5 +77,10 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); } #endif +/* Semi-public headers mainly for VOL connector authors */ +#include "H5VLconnector.h" /* VOL connector author routines */ +#include "H5VLconnector_passthru.h" /* Pass-through VOL connector author routines */ +#include "H5VLnative.h" /* Native VOL connector macros, for VOL connector authors */ + #endif /* _H5VLpublic_H */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 6d07513..2245bd3 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -324,7 +324,7 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); #define H5Z_XFORM_DO_OP5(TYPE, SIZE) \ { \ - TYPE val = ((tree->type == H5Z_XFORM_INTEGER) ? (TYPE)tree->value.int_val : (TYPE)tree->value.float_val); \ + TYPE val = (TYPE)((tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val); \ H5VM_array_fill(array, &val, sizeof(TYPE), (SIZE)); \ } diff --git a/src/H5mpi.c b/src/H5mpi.c index f529b3d..15451d4 100644 --- a/src/H5mpi.c +++ b/src/H5mpi.c @@ -75,7 +75,7 @@ H5_mpi_set_bigio_count(hsize_t new_count) *------------------------------------------------------------------------- */ hsize_t -H5_mpi_get_bigio_count() +H5_mpi_get_bigio_count(void) { return bigio_count; } diff --git a/src/H5overflow.txt b/src/H5overflow.txt index a9e5099..ed71b98 100644 --- a/src/H5overflow.txt +++ b/src/H5overflow.txt @@ -29,6 +29,7 @@ # Creation Date: 2009/04/09 unsigned, UNSIGNED; +int8_t, SIGNED; int, SIGNED; int64_t, SIGNED; uint8_t, UNSIGNED; diff --git a/src/H5private.h b/src/H5private.h index 5ab9daf..c3375df 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -305,15 +305,21 @@ */ #ifdef __cplusplus # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ -# define H5_ATTR_CONST /*void*/ -# define H5_ATTR_PURE /*void*/ -# define H5_ATTR_FALLTHROUGH /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NDEBUG_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_CONST /*void*/ +# define H5_ATTR_PURE /*void*/ +# define H5_ATTR_FALLTHROUGH /*void*/ #else /* __cplusplus */ #if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) # define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) # define H5_ATTR_UNUSED __attribute__((unused)) +#ifndef NDEBUG +#define H5_ATTR_NDEBUG_UNUSED /*void*/ +#else /* NDEBUG */ +#define H5_ATTR_NDEBUG_UNUSED H5_ATTR_UNUSED +#endif /* NDEBUG */ # define H5_ATTR_NORETURN __attribute__((noreturn)) # define H5_ATTR_CONST __attribute__((const)) # define H5_ATTR_PURE __attribute__((pure)) @@ -324,11 +330,12 @@ #endif #else # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ -# define H5_ATTR_CONST /*void*/ -# define H5_ATTR_PURE /*void*/ -# define H5_ATTR_FALLTHROUGH /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NDEBUG_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ +# define H5_ATTR_CONST /*void*/ +# define H5_ATTR_PURE /*void*/ +# define H5_ATTR_FALLTHROUGH /*void*/ #endif #endif /* __cplusplus */ diff --git a/src/H5public.h b/src/H5public.h index 8021027..86a1fbb 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -328,6 +328,18 @@ typedef struct H5_ih_info_t { hsize_t heap_size; } H5_ih_info_t; +/* Tokens are unique and permanent identifiers that are + * used to reference HDF5 objects in a container. */ + +/* The maximum size allowed for tokens */ +#define H5O_MAX_TOKEN_SIZE (16) /* Allows for 128-bit tokens */ + +/* Type for object tokens */ +/* (Hoisted here, since it's used by both the H5Lpublic.h and H5Opublic.h headers) */ +typedef struct H5O_token_t { + uint8_t __data[H5O_MAX_TOKEN_SIZE]; +} H5O_token_t; + /* Functions in H5.c */ H5_DLL herr_t H5open(void); H5_DLL herr_t H5close(void); diff --git a/src/H5system.c b/src/H5system.c index 384360d..9310243 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -86,7 +86,11 @@ static hbool_t H5_ntzset = FALSE; * prints an `hsize_t' value as a hex number right justified and * zero filled in an 18-character field. * - * The conversion `a' refers to an `haddr_t' type. + * The conversion 'a' refers to an haddr_t type. + * + * The conversion 't' refers to an htri_t type. + * + * The conversion 'k' refers to an H5O_token_t type. * * Return: Success: Number of characters printed * @@ -414,6 +418,32 @@ HDfprintf(FILE *stream, const char *fmt, ...) } break; + case 'k': + { + H5O_token_t token = HDva_arg(ap, H5O_token_t); + + /* Print the raw token. */ + n = fprintf(stream, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", + (unsigned char)token.__data[15], + (unsigned char)token.__data[14], + (unsigned char)token.__data[13], + (unsigned char)token.__data[12], + (unsigned char)token.__data[11], + (unsigned char)token.__data[10], + (unsigned char)token.__data[9], + (unsigned char)token.__data[8], + (unsigned char)token.__data[7], + (unsigned char)token.__data[6], + (unsigned char)token.__data[5], + (unsigned char)token.__data[4], + (unsigned char)token.__data[3], + (unsigned char)token.__data[2], + (unsigned char)token.__data[1], + (unsigned char)token.__data[0] + ); + } + break; + default: HDfputs(format_templ, stream); n = (int)HDstrlen(format_templ); diff --git a/src/H5trace.c b/src/H5trace.c index 65e267e..4a24804 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1630,6 +1630,22 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ break; + case 'k': + if(ptr) { + if(vp) + HDfprintf(out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5O_token_t token = HDva_arg(ap, H5O_token_t); + int j; + + for (j = 0; j < H5O_MAX_TOKEN_SIZE; j++) + HDfprintf(out, "%02x", token.__data[j]); + } /* end else */ + break; + case 'L': switch(type[1]) { case 'l': @@ -2605,6 +2621,25 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + + case 'A': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_blob_optional_t optional = (H5VL_blob_optional_t)HDva_arg(ap, int); + + switch(optional) { + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + case 'b': if(ptr) { if(vp) @@ -2634,6 +2669,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'B': if(ptr) { if(vp) @@ -2663,6 +2699,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'C': if(ptr) { if(vp) @@ -2679,6 +2716,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "%ld", (long)class_val); } /* end else */ break; + case 'c': if(ptr) { if(vp) @@ -2717,6 +2755,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'd': if(ptr) { if(vp) @@ -2743,6 +2782,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'e': if(ptr) { if(vp) @@ -2766,6 +2806,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'f': if(ptr) { if(vp) @@ -2789,6 +2830,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'g': if(ptr) { if(vp) @@ -2830,6 +2872,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'h': if(ptr) { if(vp) @@ -2859,12 +2902,16 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_DELETE: HDfprintf(out, "H5VL_FILE_DELETE"); break; + case H5VL_FILE_IS_EQUAL: + HDfprintf(out, "H5VL_FILE_IS_EQUAL"); + break; default: HDfprintf(out, "%ld", (long)specific); break; } /* end switch */ } /* end else */ break; + case 'i': if(ptr) { if(vp) @@ -2888,6 +2935,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'j': if(ptr) { if(vp) @@ -2911,6 +2959,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'k': if(ptr) { if(vp) @@ -2937,6 +2986,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'l': if(ptr) { if(vp) @@ -2963,6 +3013,31 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* 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_get_conn_lvl_t get = (H5VL_get_conn_lvl_t)HDva_arg(ap, int); + + switch(get) { + case H5VL_GET_CONN_LVL_CURR: + HDfprintf(out, "H5VL_GET_CONN_LVL_CURR"); + break; + case H5VL_GET_CONN_LVL_TERM: + HDfprintf(out, "H5VL_GET_CONN_LVL_TERM"); + break; + default: + HDfprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; + case 'm': if(ptr) { if(vp) @@ -2989,6 +3064,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'n': if(ptr) { if(vp) @@ -3009,12 +3085,16 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_OBJECT_GET_TYPE: HDfprintf(out, "H5VL_OBJECT_GET_TYPE"); break; + case H5VL_OBJECT_GET_INFO: + HDfprintf(out, "H5VL_OBJECT_GET_INFO"); + break; default: HDfprintf(out, "%ld", (long)get); break; } /* end switch */ } /* end else */ break; + case 'o': if(ptr) { if(vp) @@ -3050,6 +3130,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'r': if(ptr) { if(vp) @@ -3076,6 +3157,353 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + + case 's': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_attr_optional_t optional = (H5VL_attr_optional_t)HDva_arg(ap, int); + + switch(optional) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + case H5VL_NATIVE_ATTR_ITERATE_OLD: + HDfprintf(out, "H5VL_NATIVE_ATTR_ITERATE_OLD"); + break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'S': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_subclass_t subclass = (H5VL_subclass_t)HDva_arg(ap, int); + + switch(subclass) { + case H5VL_SUBCLS_NONE: + HDfprintf(out, "H5VL_SUBCLS_NONE"); + break; + case H5VL_SUBCLS_INFO: + HDfprintf(out, "H5VL_SUBCLS_INFO"); + break; + case H5VL_SUBCLS_WRAP: + HDfprintf(out, "H5VL_SUBCLS_WRAP"); + break; + case H5VL_SUBCLS_ATTR: + HDfprintf(out, "H5VL_SUBCLS_ATTR"); + break; + case H5VL_SUBCLS_DATASET: + HDfprintf(out, "H5VL_SUBCLS_DATASET"); + break; + case H5VL_SUBCLS_DATATYPE: + HDfprintf(out, "H5VL_SUBCLS_DATATYPE"); + break; + case H5VL_SUBCLS_FILE: + HDfprintf(out, "H5VL_SUBCLS_FILE"); + break; + case H5VL_SUBCLS_GROUP: + HDfprintf(out, "H5VL_SUBCLS_GROUP"); + break; + case H5VL_SUBCLS_LINK: + HDfprintf(out, "H5VL_SUBCLS_LINK"); + break; + case H5VL_SUBCLS_OBJECT: + HDfprintf(out, "H5VL_SUBCLS_OBJECT"); + break; + case H5VL_SUBCLS_REQUEST: + HDfprintf(out, "H5VL_SUBCLS_REQUEST"); + break; + case H5VL_SUBCLS_BLOB: + HDfprintf(out, "H5VL_SUBCLS_BLOB"); + break; + case H5VL_SUBCLS_TOKEN: + HDfprintf(out, "H5VL_SUBCLS_TOKEN"); + break; + default: + HDfprintf(out, "%ld", (long)subclass); + break; + } /* end switch */ + } /* end else */ + break; + + case 't': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_dataset_optional_t optional = (H5VL_dataset_optional_t)HDva_arg(ap, int); + + switch(optional) { + case H5VL_NATIVE_DATASET_FORMAT_CONVERT: + HDfprintf(out, "H5VL_NATIVE_DATASET_FORMAT_CONVERT"); + break; + case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE"); + break; + case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE"); + break; + case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_NUM_CHUNKS"); + break; + case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX"); + break; + case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD"); + break; + case H5VL_NATIVE_DATASET_CHUNK_READ: + HDfprintf(out, "H5VL_NATIVE_DATASET_CHUNK_READ"); + break; + case H5VL_NATIVE_DATASET_CHUNK_WRITE: + HDfprintf(out, "H5VL_NATIVE_DATASET_CHUNK_WRITE"); + break; + case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE: + HDfprintf(out, "H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE"); + break; + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'u': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_datatype_optional_t optional = (H5VL_datatype_optional_t)HDva_arg(ap, int); + + switch(optional) { + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'v': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_file_optional_t optional = (H5VL_file_optional_t)HDva_arg(ap, int); + + switch(optional) { + case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE: + HDfprintf(out, "H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE"); + break; + case H5VL_NATIVE_FILE_GET_FILE_IMAGE: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_FILE_IMAGE"); + break; + case H5VL_NATIVE_FILE_GET_FREE_SECTIONS: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_FREE_SECTIONS"); + break; + case H5VL_NATIVE_FILE_GET_FREE_SPACE: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_FREE_SPACE"); + break; + case H5VL_NATIVE_FILE_GET_INFO: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_INFO"); + break; + case H5VL_NATIVE_FILE_GET_MDC_CONF: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_CONF"); + break; + case H5VL_NATIVE_FILE_GET_MDC_HR: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_HR"); + break; + case H5VL_NATIVE_FILE_GET_MDC_SIZE: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_SIZE"); + break; + case H5VL_NATIVE_FILE_GET_SIZE: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_SIZE"); + break; + case H5VL_NATIVE_FILE_GET_VFD_HANDLE: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_VFD_HANDLE"); + break; + case H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE: + HDfprintf(out, "H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE"); + break; + case H5VL_NATIVE_FILE_SET_MDC_CONFIG: + HDfprintf(out, "H5VL_NATIVE_FILE_SET_MDC_CONFIG"); + break; + case H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO"); + break; + case H5VL_NATIVE_FILE_START_SWMR_WRITE: + HDfprintf(out, "H5VL_NATIVE_FILE_START_SWMR_WRITE"); + break; + case H5VL_NATIVE_FILE_START_MDC_LOGGING: + HDfprintf(out, "H5VL_NATIVE_FILE_START_MDC_LOGGING"); + break; + case H5VL_NATIVE_FILE_STOP_MDC_LOGGING: + HDfprintf(out, "H5VL_NATIVE_FILE_STOP_MDC_LOGGING"); + break; + case H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS"); + break; + case H5VL_NATIVE_FILE_FORMAT_CONVERT: + HDfprintf(out, "H5VL_NATIVE_FILE_FORMAT_CONVERT"); + break; + case H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS: + HDfprintf(out, "H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS"); + break; + case H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS"); + break; + case H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO"); + break; + case H5VL_NATIVE_FILE_GET_EOA: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_EOA"); + break; + case H5VL_NATIVE_FILE_INCR_FILESIZE: + HDfprintf(out, "H5VL_NATIVE_FILE_INCR_FILESIZE"); + break; + case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS: + HDfprintf(out, "H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS"); + break; + case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG"); + break; + case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG: + HDfprintf(out, "H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG"); + break; + case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY: + HDfprintf(out, "H5VL_NATIVE_FILE_GET_MPI_ATOMICITY"); + break; + case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY: + HDfprintf(out, "H5VL_NATIVE_FILE_SET_MPI_ATOMICITY"); + break; + case H5VL_NATIVE_FILE_POST_OPEN: + HDfprintf(out, "H5VL_NATIVE_FILE_POST_OPEN"); + break; + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'w': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_group_optional_t optional = (H5VL_group_optional_t)HDva_arg(ap, int); + + switch(optional) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + case H5VL_NATIVE_GROUP_ITERATE_OLD: + HDfprintf(out, "H5VL_NATIVE_GROUP_ITERATE_OLD"); + break; + case H5VL_NATIVE_GROUP_GET_OBJINFO: + HDfprintf(out, "H5VL_NATIVE_GROUP_GET_OBJINFO"); + break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'x': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_link_optional_t optional = (H5VL_link_optional_t)HDva_arg(ap, int); + + switch(optional) { + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'y': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_object_optional_t optional = (H5VL_object_optional_t)HDva_arg(ap, int); + + switch(optional) { + case H5VL_NATIVE_OBJECT_GET_COMMENT: + HDfprintf(out, "H5VL_NATIVE_OBJECT_GET_COMMENT"); + break; + case H5VL_NATIVE_OBJECT_SET_COMMENT: + HDfprintf(out, "H5VL_NATIVE_OBJECT_SET_COMMENT"); + break; + case H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES: + HDfprintf(out, "H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES"); + break; + case H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES: + HDfprintf(out, "H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES"); + break; + case H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED: + HDfprintf(out, "H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED"); + break; + case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO: + HDfprintf(out, "H5VL_NATIVE_OBJECT_GET_NATIVE_INFO"); + break; + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + + case 'z': + if(ptr) { + if(vp) + HDfprintf (out, "0x%lx", (unsigned long)vp); + else + HDfprintf(out, "NULL"); + } /* end if */ + else { + H5VL_request_optional_t optional = (H5VL_request_optional_t)HDva_arg(ap, int); + + switch(optional) { + default: + HDfprintf(out, "%ld", (long)optional); + break; + } /* end switch */ + } /* end else */ + break; + default: HDfprintf(out, "BADTYPE(Z%c)", type[1]); goto error; diff --git a/src/H5vers.txt b/src/H5vers.txt index 22117c3..ae1d600 100644 --- a/src/H5vers.txt +++ b/src/H5vers.txt @@ -20,7 +20,7 @@ # Blank lines and lines beginning with '#' are ignored # # The format of this file is as follows: -# <type>: <base routine name>; <list of parameter types for function>; <version introduced>, <list of revised versions> +# <type>: <base routine name>; <list of versioned parameter types for function>; <version introduced>, <list of revised versions> # # Where <type> is either 'FUNCTION' or 'TYPEDEF' # @@ -56,11 +56,26 @@ FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18 FUNCTION: H5Fget_info; H5F_info; v18, v110 FUNCTION: H5Gcreate; ; v10, v18 FUNCTION: H5Gopen; ; v10, v18 -FUNCTION: H5Oget_info; ; v18, v112 -FUNCTION: H5Oget_info_by_name; ; v18, v112 -FUNCTION: H5Oget_info_by_idx; ; v18, v112 -FUNCTION: H5Ovisit; ; v18, v112 -FUNCTION: H5Ovisit_by_name; ; v18, v112 +FUNCTION: H5Lget_info; H5L_info; v18, v112 +FUNCTION: H5Lget_info_by_idx; H5L_info; v18, v112 +FUNCTION: H5Literate; H5L_iterate; v18, v112 +FUNCTION: H5Literate_by_name; H5L_iterate; v18, v112 +FUNCTION: H5Lvisit; H5L_iterate; v18, v112 +FUNCTION: H5Lvisit_by_name; H5L_iterate; v18, v112 +# Note: v111 is allowed in make_vers because H5O functions were prematurely +# versioned in HDF5 1.10. Because users were affected by this, the +# versioning was rescinded but the H5O version 2 functions were kept +# to be called directly. Now that the version macros are added in 1.12, +# along with a 3rd version of the H5O functions, the H5O function +# version for default api=v110 should be version 1 to work correctly +# with 1.10 applications that were using unversioned H5O functions, +# and the H5O function version should be version 3 for default api=v112 +# (the default api version for 1.12). +FUNCTION: H5Oget_info; ; v18, v111, v112 +FUNCTION: H5Oget_info_by_name; ; v18, v111, v112 +FUNCTION: H5Oget_info_by_idx; ; v18, v111, v112 +FUNCTION: H5Ovisit; ; v18, v111, v112 +FUNCTION: H5Ovisit_by_name; ; v18, v111, v112 FUNCTION: H5Pencode; ; v110, v112 FUNCTION: H5Pget_filter; ; v10, v18 FUNCTION: H5Pget_filter_by_id; ; v16, v18 @@ -78,5 +93,7 @@ FUNCTION: H5Topen; ; v10, v18 # (although not required, it's easier to compare this file with the headers # generated if the list below is in alphanumeric sort order - QAK) TYPEDEF: H5E_auto; v10, v18 +TYPEDEF: H5O_info; v18, v112 +TYPEDEF: H5O_iterate; v18, v112 TYPEDEF: H5Z_class; v16, v18 diff --git a/src/Makefile.am b/src/Makefile.am index fa412c9..0c07c1b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,7 +38,8 @@ MOSTLYCLEANFILES=H5Tinit.c H5lib_settings.c DISTCLEANFILES=H5pubconf.h # library sources -libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ +libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \ + H5timer.c H5trace.c \ H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \ H5AC.c H5ACdbg.c H5ACproxy_entry.c \ H5B.c H5Bcache.c H5Bdbg.c \ @@ -48,59 +49,49 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Cprefetched.c H5Cquery.c H5Ctag.c H5Ctest.c \ H5CS.c \ H5CX.c \ - H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ - H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \ - H5Dio.c H5Dlayout.c H5Dnone.c \ - H5Doh.c H5Dscatgath.c H5Dselect.c \ - H5Dsingle.c H5Dtest.c H5Dvirtual.c \ + H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c \ + H5Ddbg.c H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c \ + H5Dint.c H5Dio.c H5Dlayout.c H5Dnone.c H5Doh.c H5Dscatgath.c \ + H5Dselect.c H5Dsingle.c H5Dtest.c H5Dvirtual.c \ H5E.c H5Edeprec.c H5Eint.c \ H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \ H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \ - H5F.c H5Faccum.c H5Fcwfs.c \ - H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fint.c H5Fio.c \ - H5Fmount.c H5Fquery.c \ - H5Fsfile.c H5Fspace.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \ + H5F.c H5Faccum.c H5Fcwfs.c H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c \ + H5Fint.c H5Fio.c H5Fmount.c H5Fquery.c H5Fsfile.c H5Fspace.c \ + H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \ H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ H5FAint.c H5FAstat.c H5FAtest.c \ H5FD.c H5FDcore.c H5FDfamily.c H5FDhdfs.c H5FDint.c H5FDlog.c \ H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c H5FDtest.c \ H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \ H5FSstat.c H5FStest.c \ - H5G.c H5Gbtree2.c H5Gcache.c \ - H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c \ - H5Gint.c H5Glink.c \ - H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c \ - H5Gtraverse.c \ + H5G.c H5Gbtree2.c H5Gcache.c H5Gcompact.c H5Gdense.c H5Gdeprec.c \ + H5Gent.c H5Gint.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c \ + H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c H5Gtraverse.c \ H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \ H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \ H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \ - H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c\ - H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \ + H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c \ + H5HP.c \ + H5I.c H5Itest.c \ + H5L.c H5Ldeprec.c H5Lexternal.c \ H5M.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ - H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ - H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ocache_image.c \ - H5Ochunk.c \ - H5Ocont.c H5Ocopy.c H5Ocopy_ref.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \ - H5Ofill.c H5Oflush.c H5Ofsinfo.c H5Oginfo.c \ - H5Oint.c H5Olayout.c \ - H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \ - H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \ - H5Osdspace.c H5Oshared.c \ - H5Oshmesg.c \ - H5Ostab.c \ - H5Otest.c H5Ounknown.c \ - H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ - H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ - H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ - H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \ - H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c \ - H5Ptest.c \ + H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c H5Oattribute.c \ + H5Obogus.c H5Obtreek.c H5Ocache.c H5Ocache_image.c H5Ochunk.c \ + H5Ocont.c H5Ocopy.c H5Ocopy_ref.c H5Odbg.c H5Odrvinfo.c H5Odtype.c \ + H5Oefl.c H5Ofill.c H5Oflush.c H5Ofsinfo.c H5Oginfo.c H5Oint.c \ + H5Olayout.c H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c H5Oname.c \ + H5Onull.c H5Opline.c H5Orefcount.c H5Osdspace.c H5Oshared.c \ + H5Oshmesg.c H5Ostab.c H5Otest.c H5Ounknown.c \ + H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ + H5Pfapl.c H5Pfcpl.c H5Pfmpl.c H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \ + H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \ H5PB.c \ H5PL.c H5PLint.c H5PLpath.c H5PLplugin_cache.c \ - H5R.c H5Rint.c H5Rdeprec.c \ + H5R.c H5Rdeprec.c H5Rint.c \ H5UC.c \ H5RS.c \ H5S.c H5Sall.c H5Sdbg.c H5Sdeprec.c H5Shyper.c H5Snone.c H5Spoint.c \ @@ -109,21 +100,20 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \ H5ST.c \ H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c \ - H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c \ - H5Tfixed.c \ - H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \ - H5Topaque.c \ - H5Torder.c \ - H5Tref.c \ - H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ + H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c \ + H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \ + H5Torder.c H5Tref.c H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c \ + H5Tvlen.c \ + H5TS.c \ H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \ H5VLnative_attr.c H5VLnative_blob.c H5VLnative_dataset.c \ H5VLnative_datatype.c H5VLnative_file.c H5VLnative_group.c \ - H5VLnative_link.c H5VLnative_object.c \ + H5VLnative_link.c H5VLnative_introspect.c H5VLnative_object.c \ + H5VLnative_token.c \ H5VLpassthru.c \ H5VM.c H5WB.c H5Z.c \ - H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ - H5Zscaleoffset.c H5Zszip.c H5Ztrans.c + H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zscaleoffset.c \ + H5Zszip.c H5Ztrans.c # Only compile parallel sources if necessary if BUILD_PARALLEL_CONDITIONAL diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c7a945e..77f9191 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -525,4 +525,6 @@ else () endif () set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test) -include (CMakeTests.cmake) +if (HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index cf938f5..d4a5ddc 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -15,7 +15,7 @@ ### T E S T I N G ### ############################################################################## ############################################################################## -# included from CMakeTEsts.cmake +# included from CMakeTests.cmake set (VFD_LIST sec2 diff --git a/test/cache.c b/test/cache.c index 9a60ba8..a90f12b 100644 --- a/test/cache.c +++ b/test/cache.c @@ -18,24 +18,38 @@ * H5C.c */ #include "cache_common.h" +#include "H5MFprivate.h" +H5C_t * saved_cache = NULL; /* store the pointer to the instance of + * of H5C_t created by H5Fcreate() + * here between test cache setup and + * shutdown. + */ + +haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the + * space allocated for cache items in the file between + * cache setup & takedown + */ + hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between - * cache setup and takedown. Note - * that if saved_fapl_id == H5P_DEFAULT, - * we assume that there is no fapl to - * close. - */ + * cache setup and takedown. Note + * that if saved_fapl_id == H5P_DEFAULT, + * we assume that there is no fapl to + * close. + */ hid_t saved_fcpl_id = H5P_DEFAULT; /* store the fcpl id here between - * cache setup and takedown. Note - * that if saved_fcpl_id == H5P_DEFAULT, - * we assume that there is no fcpl to - * close. - */ -hid_t saved_fid = -1; /* store the file id here between cache setup - * and takedown. - */ + * cache setup and takedown. Note + * that if saved_fcpl_id == H5P_DEFAULT, + * we assume that there is no fcpl to + * close. + */ + +hid_t saved_fid = -1; /* store the file id here between cache setup + * and takedown. + */ +hbool_t write_permitted = TRUE; hbool_t try_core_file_driver = FALSE; hbool_t core_file_driver_failed = FALSE; @@ -44,7 +58,6 @@ hbool_t core_file_driver_failed = FALSE; const char *FILENAME[] = { "cache_test", - "cache_api_test", NULL }; diff --git a/test/cache_api.c b/test/cache_api.c index 1d5aa56..87d0025 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -25,7 +25,6 @@ /* global variable declarations: */ const char *FILENAME[] = { - "cache_test", "cache_api_test", NULL }; @@ -213,7 +212,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -361,7 +360,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -694,7 +693,7 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -1040,7 +1039,7 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -1969,7 +1968,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: calling h5_fixname().\n", FUNC); } - if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; diff --git a/test/cache_common.c b/test/cache_common.c index 96c146c..038a0ed 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -17,24 +17,12 @@ * This file contains common code for tests of the cache * implemented in H5C.c */ +#include "H5private.h" #include "H5CXprivate.h" /* API Contexts */ -#include "H5MFprivate.h" #include "H5MMprivate.h" #include "cache_common.h" - -H5C_t * saved_cache = NULL; /* store the pointer to the instance of - * of H5C_t created by H5Fcreate() - * here between test cache setup and - * shutdown. - */ - -haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the - space allocated for cache items in the file between - cache setup & takedown */ - -hbool_t write_permitted = TRUE; hbool_t pass = TRUE; /* set to false on error */ const char *failure_mssg = NULL; @@ -566,7 +554,7 @@ addr_to_type_and_index(haddr_t addr, *------------------------------------------------------------------------- */ static herr_t -get_initial_load_size(void *udata, size_t *image_length, int32_t entry_type) +get_initial_load_size(void *udata, size_t *image_length, int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { test_entry_t *entry; test_entry_t *base_addr; @@ -676,7 +664,7 @@ notify_get_initial_load_size(void *udata, size_t *image_length) */ static herr_t get_final_load_size(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED image_len, - void *udata, size_t *actual_len, int32_t entry_type) + void *udata, size_t *actual_len, int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { test_entry_t *entry; test_entry_t *base_addr; @@ -736,7 +724,8 @@ variable_get_final_load_size(const void *image, size_t image_len, */ static htri_t -verify_chksum(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED len, void *udata, int32_t entry_type) +verify_chksum(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED len, void *udata, + int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { test_entry_t *entry; test_entry_t *base_addr; @@ -789,8 +778,8 @@ variable_verify_chksum(const void *image, size_t len, void *udata) *------------------------------------------------------------------------- */ static void * -deserialize(const void *image, size_t len, void *udata, hbool_t *dirty, - int32_t entry_type) +deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *udata, hbool_t *dirty, + int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { test_entry_t *entry; test_entry_t *base_addr; @@ -946,12 +935,10 @@ notify_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty) *------------------------------------------------------------------------- */ herr_t -image_len(const void *thing, size_t *image_length, int32_t entry_type) +image_len(const void *thing, size_t *image_length, int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { const test_entry_t *entry; - test_entry_t *base_addr; int32_t type; - int32_t idx; HDassert(thing); HDassert(image_length); @@ -961,14 +948,12 @@ image_len(const void *thing, size_t *image_length, int32_t entry_type) HDassert(entry->self == entry); type = entry->type; - idx = entry->index; HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES)); HDassert(type == entry_type); - HDassert((idx >= 0) && (idx <= max_indices[type])); + HDassert((entry->index >= 0) && (entry->index <= max_indices[type])); - base_addr = entries[type]; - HDassert(entry == &(base_addr[idx])); + HDassert(entry == &(entries[type][entry->index])); if(type != VARIABLE_ENTRY_TYPE) HDassert(entry->size == entry_sizes[type]); @@ -1068,18 +1053,15 @@ notify_image_len(const void *thing, size_t *image_length) *------------------------------------------------------------------------- */ herr_t -pre_serialize(H5F_t *f, +pre_serialize(H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *thing, - haddr_t addr, - size_t len, + haddr_t H5_ATTR_NDEBUG_UNUSED addr, + size_t H5_ATTR_NDEBUG_UNUSED len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr) { test_entry_t *entry; - test_entry_t *base_addr; - int32_t type; - int32_t idx; int32_t i; HDassert(f); @@ -1099,16 +1081,9 @@ pre_serialize(H5F_t *f, /* shouldn't serialize the entry unless it is dirty */ HDassert(entry->is_dirty); - - type = entry->type; - idx = entry->index; - - HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES)); - HDassert((idx >= 0) && (idx <= max_indices[type])); - - base_addr = entries[type]; - - HDassert(entry == &(base_addr[idx])); + HDassert((entry->type >= 0) && (entry->type < NUMBER_OF_ENTRY_TYPES)); + HDassert((entry->index >= 0) && (entry->index <= max_indices[entry->type])); + HDassert(entry == &(entries[entry->type][entry->index])); HDassert(entry->num_flush_ops >= 0); HDassert(entry->num_flush_ops < MAX_FLUSH_OPS); @@ -1320,9 +1295,7 @@ herr_t serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing) { test_entry_t *entry; - test_entry_t *base_addr; int32_t type; - int32_t idx; HDassert(image_ptr); HDassert(thing); @@ -1336,14 +1309,11 @@ serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thin HDassert(entry->is_dirty); type = entry->type; - idx = entry->index; HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES)); - HDassert((idx >= 0) && (idx <= max_indices[type])); + HDassert((entry->index >= 0) && (entry->index <= max_indices[type])); - base_addr = entries[type]; - - HDassert(entry == &(base_addr[idx])); + HDassert(entry == &(entries[type][entry->index])); HDassert(entry->num_flush_ops >= 0); HDassert(entry->num_flush_ops < MAX_FLUSH_OPS); @@ -1474,21 +1444,19 @@ notify_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, *------------------------------------------------------------------------- */ static herr_t -notify(H5C_notify_action_t action, void *thing, int32_t entry_type) +notify(H5C_notify_action_t action, void *thing, int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { test_entry_t *entry; - test_entry_t *base_addr; HDassert(thing); entry = (test_entry_t *)thing; - base_addr = entries[entry->type]; HDassert(entry->index >= 0); HDassert(entry->index <= max_indices[entry->type]); HDassert((entry->type >= 0) && (entry->type < NUMBER_OF_ENTRY_TYPES)); HDassert(entry->type == entry_type); - HDassert(entry == &(base_addr[entry->index])); + HDassert(entry == &(entries[entry->type][entry->index])); HDassert(entry == entry->self); if(!(action == H5C_NOTIFY_ACTION_ENTRY_DIRTIED && entry->action == TEST_ENTRY_ACTION_MOVE)) HDassert(entry->header.addr == entry->addr); @@ -1553,18 +1521,14 @@ notify_notify(H5C_notify_action_t action, void *thing) *------------------------------------------------------------------------- */ herr_t -free_icr(test_entry_t *entry, int32_t entry_type) +free_icr(test_entry_t *entry, int32_t H5_ATTR_NDEBUG_UNUSED entry_type) { - test_entry_t *base_addr; - HDassert(entry); - base_addr = entries[entry->type]; - HDassert(entry->type == entry_type); HDassert(entry->index >= 0); HDassert(entry->index <= max_indices[entry->type]); - HDassert(entry == &(base_addr[entry->index])); + HDassert(entry == &(entries[entry->type][entry->index])); HDassert(entry == entry->self); HDassert(entry->cache_ptr != NULL); HDassert(entry->cache_ptr->magic == H5C__H5C_T_MAGIC); diff --git a/test/cache_common.h b/test/cache_common.h index 61457d9..969cc2a 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -538,10 +538,6 @@ struct expected_entry_status /* global variable externs: */ -H5TEST_DLLVAR H5C_t * saved_cache; - -H5TEST_DLLVAR haddr_t saved_actual_base_addr; -H5TEST_DLLVAR hbool_t write_permitted; H5TEST_DLLVAR hbool_t pass; /* set to false on error */ H5TEST_DLLVAR const char *failure_mssg; diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 7ce4e88..cf0cd8d 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -24,6 +24,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5HLprivate.h" +#include "H5VLnative_private.h" /* Native VOL connector */ /* ============ */ /* Test Defines */ @@ -374,14 +375,15 @@ error: static int get_object_header_tag(hid_t loc_id, haddr_t *tag) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ /* Retrieve the info for the object */ - if(H5Oget_info2(loc_id, &oinfo, H5O_INFO_ALL) < 0) + if(H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR; /* Set the tag to return */ - *tag = oinfo.addr; + if(H5VLnative_token_to_addr(loc_id, oinfo.token, tag) < 0) + TEST_ERROR; return 0; @@ -439,7 +441,9 @@ check_file_creation_tags(hid_t fcpl_id, int type) { /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose test outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t sbe_tag = 0; @@ -526,7 +530,9 @@ check_file_open_tags(hid_t fcpl, int type) { /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag; /* Root Group Tag */ haddr_t sbe_tag; /* Sblock Extension Tag */ @@ -639,7 +645,9 @@ check_group_creation_tags(void) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */ haddr_t g_tag; /* Group Tag */ @@ -740,7 +748,9 @@ check_multi_group_creation_tags(void) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ char gname[16]; /* group name buffer */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access prop list */ @@ -869,7 +879,9 @@ check_link_iteration_tags(void) hid_t fid = -1; /* File Identifier */ hid_t sid = -1; /* Group Identifier */ hid_t did = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ int i = 0; /* iterator */ haddr_t root_tag = 0; /* Root Group Tag Value */ char dsetname[500]; /* Name of dataset */ @@ -989,7 +1001,9 @@ check_dense_attribute_tags(void) hid_t sid = -1; /* Group Identifier */ hid_t did = -1; /* Group Identifier */ hid_t dcpl = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access property list */ haddr_t d_tag = 0; /* Dataset tag value */ @@ -1171,7 +1185,9 @@ check_group_open_tags(void) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file output */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; @@ -1280,7 +1296,9 @@ check_attribute_creation_tags(hid_t fcpl, int type) hid_t aid = -1; /* Attribute Identifier */ hid_t gid = -1; /* Group Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; /* Root group tag */ haddr_t g_tag = 0; @@ -1414,7 +1432,9 @@ check_attribute_open_tags(hid_t fcpl, int type) hid_t aid = -1; /* Attribute Identifier */ hid_t gid = -1; /* Group Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t g_tag = 0; @@ -1551,7 +1571,9 @@ check_attribute_rename_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ hid_t fapl = -1; /* File access prop list */ @@ -1726,7 +1748,9 @@ check_attribute_delete_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ hid_t fapl = -1; /* File access prop list */ @@ -1892,7 +1916,9 @@ check_dataset_creation_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2025,7 +2051,9 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2162,7 +2190,9 @@ check_dataset_open_tags(void) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2288,7 +2318,9 @@ check_dataset_write_tags(void) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2430,7 +2462,9 @@ check_attribute_write_tags(hid_t fcpl, int type) hid_t gid = -1; /* Group Identifier */ hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ int *data = NULL; /* data buffer */ int i,j,k = 0; /* iterators */ hid_t fapl = -1; /* File access prop list */ @@ -2583,7 +2617,9 @@ check_dataset_read_tags(void) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2720,7 +2756,9 @@ check_dataset_size_retrieval(void) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2859,7 +2897,9 @@ check_dataset_extend_tags(void) hid_t fid = -1; /* File Identifier */ hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -2996,11 +3036,13 @@ check_object_info_tags(void) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file output */ +#endif /* NDEBUG */ /* end debugging functions */ 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 */ + H5O_native_info_t ninfo; /* Native object info struct */ /* Testing Macro */ TESTING("tag application during object info retrieval"); @@ -3040,7 +3082,10 @@ check_object_info_tags(void) /* Get information on an object by name */ /* ===================================== */ - if ( H5Oget_info_by_name2(fid, GROUPNAME, &oinfo, H5O_INFO_ALL, H5P_DEFAULT) < 0 ) TEST_ERROR; + /* Even though we do nothing with this, touching the internal + * data structures is needed for the test to pass. + */ + if ( H5Oget_native_info_by_name(fid, GROUPNAME, &ninfo, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0 ) TEST_ERROR; /* =================================== */ /* Verification of Metadata Tag Values */ @@ -3105,7 +3150,9 @@ check_object_copy_tags(void) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file output */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; @@ -3226,7 +3273,9 @@ check_link_removal_tags(hid_t fcpl, int type) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ hid_t gid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -3385,7 +3434,9 @@ check_link_getname_tags(void) hid_t did = -1; /* Dataset Identifier */ hid_t sid = -1; /* Dataspace Identifier */ hid_t gid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t dcpl = -1; /* dataset creation pl */ hsize_t cdims[2] = {1,1}; /* chunk dimensions */ int fillval = 0; @@ -3534,7 +3585,9 @@ check_external_link_creation_tags(void) hid_t fid = -1; /* File Identifier */ hid_t fid2 = -1; /* File Identifier */ hid_t gid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; @@ -3640,7 +3693,10 @@ check_external_link_open_tags(void) hid_t fid2 = -1; /* File Identifier */ hid_t gid = -1; /* Dataspace Identifier */ hid_t xid = -1; /* Dataspace Identifier */ +#ifndef NDEBUG int verbose = FALSE; /* verbose file outout */ +#endif /* NDEBUG */ /* end debugging functions */ + H5O_native_info_t ninfo; /* Native object info struct */ hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = 0; haddr_t root2_tag = 0; @@ -3694,6 +3750,11 @@ check_external_link_open_tags(void) if ( (fid2 = H5Iget_file_id(xid)) < 0) TEST_ERROR; if ( get_object_header_tag(xid, &link_tag) < 0 ) TEST_ERROR; + /* Even though we do nothing with this, touching the internal + * data structures is needed for the test to pass. + */ + if ( H5Oget_native_info(xid, &ninfo, H5O_NATIVE_INFO_ALL) < 0 ) TEST_ERROR; + /* =================================== */ /* Verification of Metadata Tag Values */ /* =================================== */ @@ -3836,12 +3897,13 @@ check_invalid_tag_application(void) return 0; -error: #if H5C_DO_TAGGING_SANITY_CHECKS +error: if(api_ctx_pushed) H5CX_pop(); -#endif /* H5C_DO_TAGGING_SANITY_CHECKS */ return 1; +#endif /* H5C_DO_TAGGING_SANITY_CHECKS */ + } /* check_invalid_tag_application */ diff --git a/test/chunk_info.c b/test/chunk_info.c index 057991c..0afff66 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -119,7 +119,7 @@ const char *FILENAME[] = { #define INVALID_CHK_INDEX 5 /* For compressed data */ -#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12.0) /* For use in error reporting */ #define MSG_CHK_ADDR "Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY." diff --git a/test/cork.c b/test/cork.c index 06a520d..125c53e 100644 --- a/test/cork.c +++ b/test/cork.c @@ -99,9 +99,10 @@ verify_old_dset_cork(void) hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */ hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */ hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */ - int buf[100][20]; /* Data buffer */ - int i = 0, j = 0; /* Local index variable */ - H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ + int **buf = NULL; /* Data bufer (pointers to fake 2D array) */ + int *buf_data = NULL; /* Data buffer (actual data) */ + int i = 0, j = 0; /* Local index variables */ + H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */ hsize_t dims2[2] = {8, 16}; /* Dataset dimension sizes */ /* Testing Macro */ @@ -126,7 +127,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Get dataset object header address: DSET_BT1 */ - if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_BT1 */ @@ -134,20 +135,28 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify cork status */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < 100; i++) + buf[i] = buf_data + (i * 20); + /* Initialize data buffer */ for(i = 0; i < (int)dims[0]; i++) for(j = 0; j < (int)dims[1]; j++) buf[i][j] = (i + 1) * (j + 1); /* Write to the dataset: DSET_BT1 */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR /* Verify the cork status for DSET_BT1 */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Create compact dataset: DSET_COMPACT */ @@ -163,7 +172,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Get dataset object address */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_COMPACT */ @@ -171,7 +180,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify cork status */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -196,11 +205,6 @@ verify_old_dset_cork(void) if((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR - /* Initialize data buffer */ - for(i = 0; i < (int)dims[0]; i++) - for(j = 0; j < (int)dims[1]; j++) - buf[i][j] = (i + 1) * (j + 1); - /* Open and write to the dataset: DSET_BT1 */ if((did = H5Dopen2(fid, DSET_BT1, H5P_DEFAULT)) < 0) TEST_ERROR @@ -216,7 +220,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Get dataset object address: DSET_CONTIG */ - if(H5Oget_info2(did3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_CONTIG */ @@ -224,11 +228,11 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify the cork status for DSET_CONTIG */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Verify the cork status for DSET_BT1 */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Un-cork the dataset: DSET_CONTIG */ @@ -236,7 +240,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify the cork status for DSET_CONTIG */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -249,6 +253,9 @@ verify_old_dset_cork(void) if(H5Fclose(fid) < 0) TEST_ERROR + HDfree(buf); + HDfree(buf_data); + PASSED(); return 0; @@ -265,6 +272,10 @@ error: H5Pclose(dcpl3); H5Fclose(fid); } H5E_END_TRY; + + HDfree(buf); + HDfree(buf_data); + return 1; } /* verify_old_dset_cork */ @@ -296,7 +307,7 @@ verify_obj_dset_cork(hbool_t swmr) int i = 0; /* Local index variable */ hsize_t dim[1] = {100}; /* Dataset dimension size */ hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */ - H5O_info_t oinfo, oinfo2; /* Object metadata information */ + H5O_info2_t oinfo, oinfo2; /* Object metadata information */ char attrname[500]; /* Name of attribute */ unsigned flags; /* File access flags */ @@ -329,11 +340,11 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Cork the dataset: DSET */ @@ -345,7 +356,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Close the attribute */ @@ -353,7 +364,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Create dcpl */ @@ -372,7 +383,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_NONE */ @@ -391,7 +402,7 @@ verify_obj_dset_cork(hbool_t swmr) } /* end for */ /* Verify cork status of the dataset: DSET_NONE */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -420,7 +431,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR /* Open the attribute attached to the dataset object: DSET_NONE */ @@ -432,7 +443,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET_NONE */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Close the attribute */ @@ -440,7 +451,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -496,9 +507,11 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */ hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */ hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */ - int buf[100][20]; int i = 0, j = 0; /* Data buffer */ - H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ - unsigned flags; /* File access flags */ + int **buf = NULL; /* Data bufer (pointers to fake 2D array) */ + int *buf_data = NULL; /* Data buffer (actual data) */ + int i = 0, j = 0; /* Local index variables */ + H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */ + unsigned flags; /* File access flags */ /* Testing Macro */ if(swmr) { @@ -546,7 +559,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_EA */ - if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_EA */ @@ -554,7 +567,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify cork status */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Create chunked dataset with fixed array indexing: DSET_FA */ @@ -564,7 +577,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_FA */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_FA */ @@ -576,11 +589,11 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_FA */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Verify the cork status for DSET_EA */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Create chunked dataset with v2-Btree indexing */ @@ -591,7 +604,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_BT2 */ - if(H5Oget_info2(did3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_BT2 */ @@ -599,7 +612,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_BT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -630,6 +643,14 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) if((fid = H5Fopen(FILENAME, flags, fapl)) < 0) TEST_ERROR + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < 100; i++) + buf[i] = buf_data + (i * 20); + /* Initialize data buffer */ for(i = 0; i < (int)dims[0]; i++) for(j = 0; j < (int)dims[1]; j++) @@ -638,17 +659,17 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) /* Open and write to the dataset: DSET_EA */ if((did = H5Dopen2(fid, DSET_EA, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR /* Verify the cork status for DSET_EA */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Open and write to the dataset: DSET_FA */ if((did2 = H5Dopen2(fid, DSET_FA, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR /* Cork the dataset: DSET_FA */ @@ -656,17 +677,17 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_FA */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Open and write to the dataset: DSET_BT2 */ if((did3 = H5Dopen2(fid, DSET_BT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR /* Verify the cork status for DSET_BT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Cork the dataset: DSET_BT2 */ @@ -674,7 +695,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Verify the cork status for DSET_BT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -689,6 +710,9 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR + HDfree(buf); + HDfree(buf_data); + PASSED(); return 0; @@ -704,6 +728,10 @@ error: H5Pclose(fapl); H5Fclose(fid); } H5E_END_TRY; + + HDfree(buf); + HDfree(buf_data); + return 1; } /* verify_dset_cork */ @@ -729,11 +757,11 @@ verify_group_cork(hbool_t swmr) hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ hid_t gid = -1, gid2 = -1, gid3 = -1; /* Group IDs */ - H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ - hid_t aid; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ + H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */ + hid_t aid; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ char attrname[500]; /* Name of attribute */ - unsigned flags; /* File access flags */ + unsigned flags; /* File access flags */ int i = 0; /* Local index variable */ /* Testing Macro */ @@ -770,19 +798,19 @@ verify_group_cork(hbool_t swmr) TEST_ERROR /* Get group object header addresses */ - if(H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gid3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the groups */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Close the second group: GRP2 */ @@ -794,7 +822,7 @@ verify_group_cork(hbool_t swmr) FAIL_STACK_ERROR /* Verify cork status of the second group: GRP2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -835,7 +863,7 @@ verify_group_cork(hbool_t swmr) if(i == 3) { if(H5Odisable_mdc_flushes(gid3) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR } if(H5Aclose(aid) < 0) @@ -843,7 +871,7 @@ verify_group_cork(hbool_t swmr) } /* end for */ /* Verify cork status of the third group: GRP3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Closing */ @@ -897,12 +925,12 @@ verify_named_cork(hbool_t swmr) hid_t fapl = -1; /* File access property list */ hid_t tid = -1, tid2 = -1, tid3 = -1; /* Datatype IDs */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */ - hid_t aid = -1; /* Attribute ID */ - hid_t sid; /* Dataspace ID */ - hid_t did; /* Dataset ID */ + H5O_info2_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */ + hid_t aid = -1; /* Attribute ID */ + hid_t sid; /* Dataspace ID */ + hid_t did; /* Dataset ID */ char attrname[500]; /* Name of attribute */ - unsigned flags; /* File access flags */ + unsigned flags; /* File access flags */ int i = 0; /* Local index variable */ /* Testing Macro */ @@ -959,19 +987,19 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Get named datatype object header addresses */ - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid3, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the named datatypes */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Close the datatypes */ @@ -991,11 +1019,11 @@ verify_named_cork(hbool_t swmr) FAIL_STACK_ERROR /* Verify cork status of the named datatypes */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -1051,7 +1079,7 @@ verify_named_cork(hbool_t swmr) if(i == 3) { if(H5Odisable_mdc_flushes(tid3) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR } if(H5Aclose(aid) < 0) @@ -1063,7 +1091,7 @@ verify_named_cork(hbool_t swmr) FAIL_STACK_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did, &oinfo4, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did, &oinfo4, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET */ @@ -1071,20 +1099,20 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0) TEST_ERROR /* Un-cork the datatype: DT3 */ if(H5Oenable_mdc_flushes(tid3) < 0) TEST_ERROR /* Verify cork status of the datatype: DT3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0) TEST_ERROR /* Cork the datatype: DT */ @@ -1092,14 +1120,14 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo4.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo4.token, TRUE) < 0) TEST_ERROR /* Close the dataset */ @@ -1107,11 +1135,11 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo4.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo4.token, FALSE) < 0) TEST_ERROR /* Closing */ @@ -1178,10 +1206,10 @@ verify_multiple_cork(hbool_t swmr) hid_t aidd1 = -1, aidd2 = -1; /* Attribute ID */ hid_t aidt1 = -1, aidt2 = -1; /* Attribute ID */ hid_t sid = -1; /* Dataspace ID */ - H5O_info_t oinfo1, oinfo2, oinfo3; /* Object metadata information */ - hsize_t dim[1] = {5}; /* Dimension sizes */ - unsigned flags; /* File access flags */ - hbool_t corked; /* Cork status */ + H5O_info2_t oinfo1, oinfo2, oinfo3; /* Object metadata information */ + hsize_t dim[1] = {5}; /* Dimension sizes */ + unsigned flags; /* File access flags */ + hbool_t corked; /* Cork status */ herr_t ret; /* Return value */ /* Testing Macro */ @@ -1277,9 +1305,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid2 */ - if(H5Oget_info2(gid2, &oinfo1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid2, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo1.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo1.token, TRUE) < 0) TEST_ERROR /* Check cork status of the group: gid1 */ @@ -1305,9 +1333,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did1 */ - if(H5Oget_info2(did1, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did1, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo2.token, TRUE) < 0) TEST_ERROR /* Check cork status of the dataset: did2 */ @@ -1333,9 +1361,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: tid2 */ - if(H5Oget_info2(tid2, &oinfo3, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(tid2, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo3.token, TRUE) < 0) TEST_ERROR /* Check cork status of the datatype: tid1 */ @@ -1349,9 +1377,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid1 */ - if(H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0) TEST_ERROR /* Check cork status of the group: gid2 */ @@ -1371,7 +1399,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid1 */ - if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0) TEST_ERROR /* Close the group: gid1 */ @@ -1383,9 +1411,9 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did2 */ - if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo2.token, FALSE) < 0) TEST_ERROR /* Check cork status of the dataset: did1 */ @@ -1405,7 +1433,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did1 */ - if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo2.token, FALSE) < 0) TEST_ERROR /* Close the dataset: did1 */ @@ -1826,8 +1854,9 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) hsize_t cdims[RANK] = {2,2}; /* Chunk dimensions */ int fillval = 0; /* Fill value */ int i, j, k = 0; /* Local index variables */ - int data[DIMS0][DIMS1]; /* Data buffer */ - int rbuf[DIMS0][DIMS1]; /* Data buffer */ + int **wbuf = NULL; /* Data buffer for writes (pointers to fake 2D array) */ + int *wbuf_data = NULL; /* Data buffer for writes (real data) */ + int *rbuf_data = NULL; /* Data buffer for reads (real data) */ hbool_t corked; /* Cork status of an object */ unsigned flags; /* File access flags */ @@ -1923,13 +1952,21 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) if(corked) TEST_ERROR + /* Set up data array */ + if(NULL == (wbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int)))) + TEST_ERROR; + if(NULL == (wbuf = (int **)HDcalloc(DIMS0, sizeof(wbuf_data)))) + TEST_ERROR; + for (i = 0; i < DIMS0; i++) + wbuf[i] = wbuf_data + (i * DIMS1); + /* Initialize the buffer */ for(i = 0; i < DIMS0;i++) for(j = 0;j < DIMS1;j++) - data[i][j] = k++; + wbuf[i][j] = k++; /* Write to the dataset */ - if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, data) < 0) + if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0) TEST_ERROR /* Flush the dataset */ @@ -1962,8 +1999,12 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) if(corked) TEST_ERROR + /* Set up data array */ + if(NULL == (rbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int)))) + TEST_ERROR; + /* Read from the dataset */ - if(H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + if(H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_data) < 0) TEST_ERROR /* Cork the dataset */ @@ -1993,7 +2034,7 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Write to the dataset */ - if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, data) < 0) + if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0) TEST_ERROR /* Refresh the dataset */ @@ -2106,6 +2147,10 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) if(H5Pclose(dcpl) < 0) TEST_ERROR + HDfree(wbuf); + HDfree(wbuf_data); + HDfree(rbuf_data); + PASSED(); return 0; @@ -2121,6 +2166,11 @@ error: H5Pclose(fapl); H5Fclose(fid); } H5E_END_TRY; + + HDfree(wbuf); + HDfree(wbuf_data); + HDfree(rbuf_data); + return 1; } /* test_dset_cork() */ diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 7b17043..6cf27c8 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -661,20 +661,20 @@ filter_bogus1(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, size_t *buf_size, void **buf) { int *int_ptr=(int *)*buf; /* Pointer to the data values */ - ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */ + size_t buf_left=*buf_size; /* Amount of data buffer left to process */ if(flags & H5Z_FLAG_REVERSE) { /* read */ /* Substract the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ -= (int)ADD_ON; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end if */ else { /* write */ /* Add the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ += (int)ADD_ON; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end else */ @@ -698,20 +698,20 @@ filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, size_t *buf_size, void **buf) { int *int_ptr=(int *)*buf; /* Pointer to the data values */ - ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */ + size_t buf_left=*buf_size; /* Amount of data buffer left to process */ if(flags & H5Z_FLAG_REVERSE) { /* read */ /* Substract the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ /= (int)FACTOR; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end if */ else { /* write */ /* Add the "add on" value to all the data values */ while(buf_left>0) { *int_ptr++ *= (int)FACTOR; - buf_left -= (ssize_t)sizeof(int); + buf_left -= sizeof(int); } /* end while */ } /* end else */ diff --git a/test/dsets.c b/test/dsets.c index d017ff3..061642a 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -147,10 +147,12 @@ const char *FILENAME[] = { #define DSET_COPY_DCPL_NAME_1 "copy_dcpl_1" #define DSET_COPY_DCPL_NAME_2 "copy_dcpl_2" #define COPY_DCPL_EXTFILE_NAME "ext_file" +#ifndef H5_NO_DEPRECATED_SYMBOLS #define DSET_DEPREC_NAME "deprecated" #define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked" #define DSET_DEPREC_NAME_COMPACT "deprecated_compact" #define DSET_DEPREC_NAME_FILTER "deprecated_filter" +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Dataset names for testing Fixed Array Indexing */ #define DSET_FIXED_MAX "DSET_FIXED_MAX" @@ -176,7 +178,9 @@ const char *FILENAME[] = { #define H5Z_FILTER_CORRUPT 306 #define H5Z_FILTER_CAN_APPLY_TEST 307 #define H5Z_FILTER_SET_LOCAL_TEST 308 +#ifndef H5_NO_DEPRECATED_SYMBOLS #define H5Z_FILTER_DEPREC 309 +#endif /* H5_NO_DEPRECATED_SYMBOLS */ #define H5Z_FILTER_EXPAND 310 #define H5Z_FILTER_CAN_APPLY_TEST2 311 #define H5Z_FILTER_COUNT 312 @@ -272,10 +276,16 @@ const char *FILENAME[] = { /* Shared global arrays */ #define DSET_DIM1 100 #define DSET_DIM2 200 -int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2]; -double points_dbl[DSET_DIM1][DSET_DIM2], check_dbl[DSET_DIM1][DSET_DIM2]; -size_t count_nbytes_read = 0; -size_t count_nbytes_written = 0; +int **points = NULL; +int *points_data = NULL; +double **points_dbl = NULL; +double *points_dbl_data = NULL; +int **check = NULL; +int *check_data = NULL; +double **check_dbl = NULL; +double *check_dbl_data = NULL; +size_t count_nbytes_read = 0; +size_t count_nbytes_written = 0; /* Temporary buffer dimensions */ #define DSET_TMP_DIM1 50 @@ -511,7 +521,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) void *tconv_buf = NULL; int f = -1; haddr_t offset; - int rdata[DSET_DIM1][DSET_DIM2]; + int **rdata = NULL; + int *rdata_bytes = NULL; TESTING("simple I/O"); @@ -519,6 +530,14 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { h5_fixname(FILENAME[4], fapl, filename, sizeof filename); + /* Set up data array */ + if(NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + rdata[i] = rdata_bytes + (i * DSET_DIM2); + /* Initialize the dataset */ for(i = n = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) @@ -548,7 +567,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) if(H5Dget_offset(dataset) != HADDR_UNDEF) goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points) < 0) + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points_data) < 0) goto error; /* Test dataset address in file. Open the same file as a C file, seek @@ -557,7 +576,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) if((offset=H5Dget_offset(dataset))==HADDR_UNDEF) goto error; /* Read the dataset back */ - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check_data) < 0) goto error; /* Check that the values read are the same as the values written */ @@ -581,7 +600,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) f = HDopen(filename, O_RDONLY); HDlseek(f, (off_t)offset, SEEK_SET); - if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0) + if(HDread(f, rdata_bytes, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0) goto error; /* Check that the values read are the same as the values written */ @@ -600,6 +619,9 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) f = -1; HDfree(tconv_buf); + HDfree(rdata_bytes); + HDfree(rdata); + PASSED(); } /* end if */ else { @@ -620,8 +642,11 @@ error: if(H5Fclose(file) < 0) TEST_ERROR if(f > 0) HDclose(f); - if(tconv_buf) - HDfree(tconv_buf); + + HDfree(tconv_buf); + HDfree(rdata_bytes); + HDfree(rdata); + return FAIL; } /* end test_simple_io() */ @@ -644,7 +669,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) hsize_t dims[2]; int f = -1; haddr_t offset; - int rdata[DSET_DIM1][DSET_DIM2]; + int **rdata = NULL; + int *rdata_bytes = NULL; TESTING("dataset offset with user block"); @@ -652,6 +678,14 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { h5_fixname(FILENAME[2], fapl, filename, sizeof filename); + /* Set up data array */ + if(NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + rdata[i] = rdata_bytes + (i * DSET_DIM2); + if((fcpl=H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; if(H5Pset_userblock(fcpl, (hsize_t)USER_BLOCK) < 0) goto error; if(new_format) @@ -675,7 +709,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) space = -1; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) goto error; /* Test dataset address in file. Open the same file as a C file, seek @@ -690,7 +724,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) f = HDopen(filename, O_RDONLY); HDlseek(f, (off_t)offset, SEEK_SET); - if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0) + if(HDread(f, rdata_bytes, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0) goto error; /* Check that the values read are the same as the values written */ @@ -708,6 +742,9 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) HDclose(f); f = -1; + HDfree(rdata_bytes); + HDfree(rdata); + PASSED(); } /* end if */ else { @@ -728,6 +765,10 @@ error: if(H5Fclose(file) < 0) TEST_ERROR if(f > 0) HDclose(f); + + HDfree(rdata_bytes); + HDfree(rdata); + return FAIL; } /* end test_userblock_offset() */ @@ -1786,7 +1827,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, */ TESTING(" filters (uninitialized read)"); - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; for(i=0; i<(size_t)size[0]; i++) { @@ -1815,7 +1856,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, } } - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0) + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0) TEST_ERROR; if((*dset_size=H5Dget_storage_size(dataset))==0) TEST_ERROR; @@ -1833,25 +1874,25 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Callback decides to fail when data is corrupted. */ if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; } else { - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -1885,33 +1926,33 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, points[i][j] = (int)HDrandom (); } } - if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0) + if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0) TEST_ERROR; if(corrupted) { /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Callback decides to fail when data is corrupted. */ if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; } else { /* Read the dataset back and check it */ - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -1946,13 +1987,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status >= 0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Callback decides to fail when data is corrupted. */ @@ -1960,12 +2001,12 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status >= 0) TEST_ERROR; } /* end if */ else { - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -1999,32 +2040,32 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) TEST_ERROR; /* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing) */ - if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points) < 0) + if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points_data) < 0) TEST_ERROR; if(corrupted) { /* Default behavior is failure when data is corrupted. */ /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0) TEST_ERROR; /* Callback decides to fail when data is corrupted. */ if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR; /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data); } H5E_END_TRY; if(status>=0) TEST_ERROR; } else { - if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check) < 0) + if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check_data) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ @@ -2629,7 +2670,7 @@ test_missing_filter(hid_t file) } /* end if */ /* Write data */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { + if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; @@ -2658,7 +2699,7 @@ test_missing_filter(hid_t file) } /* end if */ /* Read data */ - if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; @@ -2719,7 +2760,7 @@ test_missing_filter(hid_t file) /* Read data (should fail, since deflate filter is missing) */ H5E_BEGIN_TRY { - ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check); + ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data); } H5E_END_TRY; if(ret>=0) { H5_FAILED(); @@ -4127,149 +4168,164 @@ test_nbit_int_size(hid_t file) hid_t dataspace, dataset, datatype, mem_datatype, dset_create_props; hsize_t dims[2], chunk_size[2]; hsize_t dset_size = 0; - int orig_data[DSET_DIM1][DSET_DIM2]; + int **orig = NULL; + int *orig_data = NULL; double power; int i, j; size_t precision, offset; TESTING(" nbit integer dataset size"); - /* Define dataset datatype (integer), and set precision, offset */ - if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) { - H5_FAILED(); - HDprintf(" line %d: H5Tcopy failed\n",__LINE__); - goto error; - } /* end if */ + /* Set up data array */ + if(NULL == (orig_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (orig = (int **)HDcalloc(DSET_DIM1, sizeof(orig_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + orig[i] = orig_data + (i * DSET_DIM2); - precision = 16; /* precision includes sign bit */ - if(H5Tset_precision(datatype,precision)<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pset_precision failed\n",__LINE__); - goto error; - } /* end if */ + /* Define dataset datatype (integer), and set precision, offset */ + if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) { + H5_FAILED(); + HDprintf(" line %d: H5Tcopy failed\n",__LINE__); + goto error; + } - offset = 8; - if(H5Tset_offset(datatype,offset)<0) { - H5_FAILED(); - HDprintf(" line %d: H5Tset_offset failed\n",__LINE__); - goto error; - } /* end if */ + precision = 16; /* precision includes sign bit */ + if(H5Tset_precision(datatype,precision)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pset_precision failed\n",__LINE__); + goto error; + } - /* Copy to memory datatype */ - if((mem_datatype = H5Tcopy(datatype)) < 0) { - H5_FAILED(); - HDprintf(" line %d: H5Tcopy failed\n",__LINE__); - goto error; - } /* end if */ + offset = 8; + if(H5Tset_offset(datatype,offset)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Tset_offset failed\n",__LINE__); + goto error; + } - /* Set order of dataset datatype */ - if(H5Tset_order(datatype, H5T_ORDER_BE)<0) { + /* Copy to memory datatype */ + if((mem_datatype = H5Tcopy(datatype)) < 0) { H5_FAILED(); - HDprintf(" line %d: H5Pset_order failed\n",__LINE__); - goto error; - } /* end if */ + HDprintf(" line %d: H5Tcopy failed\n",__LINE__); + goto error; + } - if(H5Tset_size(datatype, 4)<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pset_size failed\n",__LINE__); - goto error; - } /* end if */ + /* Set order of dataset datatype */ + if(H5Tset_order(datatype, H5T_ORDER_BE)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pset_order failed\n",__LINE__); + goto error; + } - /* Initiliaze data buffer with random data within correct range - * corresponding to the memory datatype's precision and offset. - */ - for (i=0; i < DSET_DIM1; i++) - for (j=0; j < DSET_DIM2; j++) { - power = HDpow(2.0F, (double)(precision-1)); - orig_data[i][j] = HDrandom() % (int)power << offset; - } /* end for */ + if(H5Tset_size(datatype, 4)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pset_size failed\n",__LINE__); + goto error; + } + /* Initiliaze data buffer with random data within correct range + * corresponding to the memory datatype's precision and offset. + */ + for (i=0; i < DSET_DIM1; i++) + for (j=0; j < DSET_DIM2; j++) { + power = HDpow(2.0F, (double)(precision-1)); + orig[i][j] = HDrandom() % (int)power << offset; + } - /* Describe the dataspace. */ - dims[0] = DSET_DIM1; - dims[1] = DSET_DIM2; - if((dataspace = H5Screate_simple (2, dims, NULL))<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pcreate failed\n",__LINE__); - goto error; - } /* end if */ - /* - * Set the dataset creation property list to specify the chunks - */ - chunk_size[0] = DSET_DIM1/10; - chunk_size[1] = DSET_DIM2/10; - if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pcreate failed\n",__LINE__); - goto error; - } /* end if */ + /* Describe the dataspace. */ + dims[0] = DSET_DIM1; + dims[1] = DSET_DIM2; + if((dataspace = H5Screate_simple(2, dims, NULL))<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); + goto error; + } - if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__); - goto error; - } /* end if */ + /* + * Set the dataset creation property list to specify the chunks + */ + chunk_size[0] = DSET_DIM1/10; + chunk_size[1] = DSET_DIM2/10; + if((dset_create_props = H5Pcreate(H5P_DATASET_CREATE))<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); + goto error; + } - /* - * Set for n-bit compression - */ - if(H5Pset_nbit (dset_create_props)<0) { - H5_FAILED(); - HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__); - goto error; - } /* end if */ + if(H5Pset_chunk(dset_create_props, 2, chunk_size)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__); + goto error; + } - /* - * Create a new dataset within the file. - */ - if((dataset = H5Dcreate2 (file, DSET_NBIT_INT_SIZE_NAME, datatype, + /* + * Set for n-bit compression + */ + if(H5Pset_nbit(dset_create_props)<0) { + H5_FAILED(); + HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__); + goto error; + } + + /* + * Create a new dataset within the file. + */ + if((dataset = H5Dcreate2(file, DSET_NBIT_INT_SIZE_NAME, datatype, dataspace, H5P_DEFAULT, dset_create_props, H5P_DEFAULT))<0) { - H5_FAILED(); - HDprintf(" line %d: H5dwrite failed\n",__LINE__); - goto error; - } /* end if */ + H5_FAILED(); + HDprintf(" line %d: H5dwrite failed\n",__LINE__); + goto error; + } - /* - * Write the array to the file. - */ - if(H5Dwrite (dataset, mem_datatype, H5S_ALL, H5S_ALL, - H5P_DEFAULT, orig_data)<0) { - H5_FAILED(); - HDprintf(" Line %d: H5Dwrite failed\n",__LINE__); - goto error; - } /* end if */ + /* + * Write the array to the file. + */ + if(H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) { + H5_FAILED(); + HDprintf(" Line %d: H5Dwrite failed\n",__LINE__); + goto error; + } - /* - * Get the precision of the data type - */ - if((precision = H5Tget_precision(datatype)) == 0) { - H5_FAILED(); - HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); - goto error; - } /* end if */ + /* + * Get the precision of the data type + */ + if((precision = H5Tget_precision(datatype)) == 0) { + H5_FAILED(); + HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); + goto error; + } - /* - * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2 - */ - if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || - dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) { - H5_FAILED(); - HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size); - goto error; - } /* end if */ + /* + * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2 + */ + if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || + dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) { + H5_FAILED(); + HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size); + goto error; + } - H5Tclose (datatype); - H5Tclose (mem_datatype); - H5Dclose (dataset); - H5Sclose (dataspace); - H5Pclose (dset_create_props); + H5Tclose(datatype); + H5Tclose(mem_datatype); + H5Dclose(dataset); + H5Sclose(dataspace); + H5Pclose(dset_create_props); + + HDfree(orig); + HDfree(orig_data); PASSED(); - return SUCCEED; + return SUCCEED; + error: + HDfree(orig); + HDfree(orig_data); + return FAIL; } /* end test_nbit_int_size() */ @@ -4295,13 +4351,22 @@ test_nbit_flt_size(hid_t file) hid_t dataspace, dataset, datatype, dset_create_props; hsize_t dims[2], chunk_size[2]; hsize_t dset_size = 0; - float orig_data[DSET_DIM1][DSET_DIM2]; + float **orig = NULL; + float *orig_data = NULL; int i, j; size_t precision, offset; size_t spos, epos, esize, mpos, msize; TESTING(" nbit floating-number dataset size"); + /* Set up data array */ + if(NULL == (orig_data = (float *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(float)))) + TEST_ERROR; + if(NULL == (orig = (float **)HDcalloc(DSET_DIM1, sizeof(orig_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + orig[i] = orig_data + (i * DSET_DIM2); + /* Define floating-point type for dataset *------------------------------------------------------------------- * size=4 byte, precision=16 bits, offset=8 bits, @@ -4380,7 +4445,7 @@ test_nbit_flt_size(hid_t file) */ for (i=0; i < DSET_DIM1; i++) for (j=0; j < DSET_DIM2; j++) - orig_data[i][j] = (float)(HDrandom() % 1234567) / 2; + orig[i][j] = (float)(HDrandom() % 1234567) / 2; /* Describe the dataspace. */ @@ -4465,8 +4530,14 @@ test_nbit_flt_size(hid_t file) PASSED(); + HDfree(orig); + HDfree(orig_data); + return SUCCEED; error: + HDfree(orig); + HDfree(orig_data); + return FAIL; } /* end test_nbit_flt_size() */ @@ -5293,7 +5364,7 @@ test_types(hid_t file) (space=H5Screate_simple(1, &nelmts, NULL)) < 0 || (dset=H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; + for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; @@ -5307,7 +5378,7 @@ test_types(hid_t file) (space=H5Screate_simple(1, &nelmts, NULL)) < 0 || (dset=H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; + for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; @@ -5322,7 +5393,7 @@ test_types(hid_t file) (dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; for(i = 0; i < sizeof buf; i++) - buf[i] = (unsigned char)0xff ^ (unsigned char)i; + buf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; if(H5Tclose(type) < 0) goto error; @@ -5336,7 +5407,7 @@ test_types(hid_t file) (dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; for(i = 0; i < sizeof buf; i++) - buf[i] = (unsigned char)0xff ^ (unsigned char)i; + buf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; if(H5Tclose(type) < 0) goto error; @@ -5460,7 +5531,7 @@ test_can_apply(hid_t file) } /* end if */ /* Write data */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { + if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; @@ -5488,7 +5559,7 @@ test_can_apply(hid_t file) } /* end if */ /* Read data */ - if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; @@ -5619,7 +5690,7 @@ test_can_apply2(hid_t file) } /* end if */ /* Write data */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { + if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; @@ -5647,7 +5718,7 @@ test_can_apply2(hid_t file) } /* end if */ /* Read data */ - if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; @@ -5988,7 +6059,7 @@ test_set_local(hid_t fapl) } /* end if */ /* Write data */ - if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { + if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; @@ -6010,7 +6081,7 @@ test_set_local(hid_t fapl) } /* end if */ /* Write data */ - if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl) < 0) { + if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; @@ -6073,7 +6144,7 @@ test_set_local(hid_t fapl) } /* end if */ /* Read data */ - if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { + if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error reading dataset data\n", __LINE__); goto error; @@ -6123,7 +6194,7 @@ test_set_local(hid_t fapl) } /* end if */ /* Read data */ - if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl) < 0) { + if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl_data) < 0) { H5_FAILED(); HDprintf(" Line %d: Error reading dataset data\n", __LINE__); goto error; @@ -6856,10 +6927,12 @@ test_missing_chunk(hid_t file) hsize_t hs_start2[2], hs_stride2[2], hs_count2[2], hs_block2[2];/* Hyperslab setting */ /* Buffers for reading/writing dataset */ - int wdata[MISSING_CHUNK_DIM], - rdata[MISSING_CHUNK_DIM]; - int wdata2[MISSING_CHUNK_DIM][MISSING_CHUNK_DIM], - rdata2[MISSING_CHUNK_DIM][MISSING_CHUNK_DIM]; + int *wdata = NULL; + int *rdata = NULL; + int **wdata2 = NULL; + int **rdata2 = NULL; + int *wdata2_bytes = NULL; + int *rdata2_bytes = NULL; /* Setting for 1-D dataset */ hsize_t dsize=100, dmax=H5S_UNLIMITED; @@ -6876,6 +6949,26 @@ test_missing_chunk(hid_t file) TESTING("Read dataset with unwritten chunk & undefined fill value"); + /* Set up data arrays */ + if(NULL == (wdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int)))) + TEST_ERROR; + if(NULL == (rdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int)))) + TEST_ERROR; + + if(NULL == (wdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int)))) + TEST_ERROR; + if(NULL == (wdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(wdata2_bytes)))) + TEST_ERROR; + for (i = 0; i < MISSING_CHUNK_DIM; i++) + wdata2[i] = wdata2_bytes + (i * MISSING_CHUNK_DIM); + + if(NULL == (rdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int)))) + TEST_ERROR; + if(NULL == (rdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(rdata2_bytes)))) + TEST_ERROR; + for (i = 0; i < MISSING_CHUNK_DIM; i++) + rdata2[i] = rdata2_bytes + (i * MISSING_CHUNK_DIM); + /* Get the file's file access property list */ if((fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR; @@ -6893,10 +6986,10 @@ test_missing_chunk(hid_t file) /* Initialize data for 2-D dataset */ for(i = 0; i < MISSING_CHUNK_DIM; i++) { - for(j = 0; j < MISSING_CHUNK_DIM; j++) { - wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM)); - rdata2[i][j] = 911; - } + for(j = 0; j < MISSING_CHUNK_DIM; j++) { + wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM)); + rdata2[i][j] = 911; + } } /* end for */ /* Create dataspace */ @@ -6954,11 +7047,11 @@ test_missing_chunk(hid_t file) /* Write selected data to the datasets */ if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, wdata) < 0) TEST_ERROR; - if(H5Dwrite(did2, H5T_NATIVE_INT, sid2, sid2, H5P_DEFAULT, wdata2) < 0) TEST_ERROR; + if(H5Dwrite(did2, H5T_NATIVE_INT, sid2, sid2, H5P_DEFAULT, wdata2_bytes) < 0) TEST_ERROR; /* Read all data from the datasets */ if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR; - if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) TEST_ERROR; + if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2_bytes) < 0) TEST_ERROR; /* Validata values read for the 1-D dataset */ for(u=0; u<MISSING_CHUNK_DIM; u++) { @@ -7005,6 +7098,13 @@ test_missing_chunk(hid_t file) if(H5Dclose(d) < 0) TEST_ERROR; if(H5Dclose(did2) < 0) TEST_ERROR; + HDfree(rdata); + HDfree(wdata); + HDfree(rdata2); + HDfree(wdata2); + HDfree(rdata2_bytes); + HDfree(wdata2_bytes); + PASSED(); return SUCCEED; @@ -7019,6 +7119,14 @@ error: H5Sclose(s); H5Sclose(sid2); } H5E_END_TRY; + + HDfree(rdata); + HDfree(wdata); + HDfree(rdata2); + HDfree(wdata2); + HDfree(rdata2_bytes); + HDfree(wdata2_bytes); + return FAIL; } /* end test_missing_chunk() */ @@ -7065,6 +7173,7 @@ static void make_random_offset_and_increment(long nelts, long *offsetp, long *incp) { long inc; + long maxinc; HDassert(0 < nelts); @@ -7073,7 +7182,7 @@ make_random_offset_and_increment(long nelts, long *offsetp, long *incp) /* `maxinc` is chosen so that for any `x` in [0, nelts - 1], * `x + maxinc` does not overflow a long. */ - const long maxinc = MIN(nelts - 1, LONG_MAX - nelts); + maxinc = MIN(nelts - 1, LONG_MAX - nelts); /* Choose a random number in [1, nelts - 1]. If its greatest divisor * in common with `nelts` is 1, then it will "generate" the additive ring @@ -7160,8 +7269,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i=0; i<NPOINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -7281,14 +7390,14 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) for(j = 0; j < nsize[1] / csize[1]; j++) check2[i][j] = 0; - rows = nsize[0] / csize[0]; - cols = nsize[1] / csize[1]; + rows = (long)(nsize[0] / csize[0]); + cols = (long)(nsize[1] / csize[1]); make_random_offset_and_increment(rows * cols, &ofs, &inc); /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < NPOINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -7397,8 +7506,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < NPOINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!check2[chunk_row][chunk_col]); @@ -7546,10 +7655,10 @@ static herr_t test_deprec(hid_t file) { hid_t dataset, space, small_space, create_parms, dcpl; - hsize_t dims[2], small_dims[2]; - hsize_t deprec_size; - herr_t status; - hsize_t csize[2]; + hsize_t dims[2], small_dims[2]; + hsize_t deprec_size; + herr_t H5_ATTR_NDEBUG_UNUSED status; + hsize_t csize[2]; TESTING("deprecated API routines"); @@ -8076,9 +8185,13 @@ test_big_chunks_bypass_cache(hid_t fapl) hsize_t t_count[2], t_stride[2], t_offset[2], t_block[2]; /* Setting for hyperslab (2-D) */ /* Buffers for reading and writing data (1-D) */ int *wdata = NULL, *rdata1 = NULL, *rdata2 = NULL; - /* Buffer for reading and writing data (2-D) */ - static int t_wdata[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2], t_rdata1[BYPASS_DIM][BYPASS_DIM], - t_rdata2[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2]; + /* Buffers for reading and writing data (2-D) */ + int **t_wdata = NULL; + int **t_rdata1 = NULL; + int **t_rdata2 = NULL; + int *t_wdata_bytes = NULL; + int *t_rdata1_bytes = NULL; + int *t_rdata2_bytes = NULL; int i, j; /* Local index variables */ H5F_libver_t low; /* File format low bound */ H5D_chunk_index_t idx_type, t_idx_type; /* Dataset chunk index types */ @@ -8088,6 +8201,29 @@ test_big_chunks_bypass_cache(hid_t fapl) h5_fixname(FILENAME[9], fapl, filename, sizeof filename); + /* Set up data arrays */ + if(NULL == (t_wdata_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM/2) * (BYPASS_CHUNK_DIM/2), sizeof(int)))) + TEST_ERROR; + if(NULL == (t_wdata = (int **)HDcalloc((BYPASS_CHUNK_DIM/2), sizeof(t_wdata_bytes)))) + TEST_ERROR; + for (i = 0; i < (BYPASS_CHUNK_DIM/2); i++) + t_wdata[i] = t_wdata_bytes + (i * (BYPASS_CHUNK_DIM/2)); + + if(NULL == (t_rdata1_bytes = (int *)HDcalloc(BYPASS_DIM * BYPASS_DIM, sizeof(int)))) + TEST_ERROR; + if(NULL == (t_rdata1 = (int **)HDcalloc(BYPASS_DIM, sizeof(t_rdata1_bytes)))) + TEST_ERROR; + for (i = 0; i < BYPASS_DIM; i++) + t_rdata1[i] = t_rdata1_bytes + (i * BYPASS_DIM); + + if(NULL == (t_rdata2_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM/2) * (BYPASS_CHUNK_DIM/2), sizeof(int)))) + TEST_ERROR; + if(NULL == (t_rdata2 = (int **)HDcalloc((BYPASS_CHUNK_DIM/2), sizeof(t_rdata2_bytes)))) + TEST_ERROR; + for (i = 0; i < (BYPASS_CHUNK_DIM/2); i++) + t_rdata2[i] = t_rdata2_bytes + (i * (BYPASS_CHUNK_DIM/2)); + + /* Check if we are using the latest version of the format */ if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) FAIL_STACK_ERROR @@ -8176,8 +8312,8 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Initialize data to write for 2-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) - for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) - t_wdata[i][j] = j; + for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) + t_wdata[i][j] = j; /* Set up memory space for the 2-D dataset */ mid = H5Screate_simple(2, t_block, NULL); @@ -8186,7 +8322,7 @@ test_big_chunks_bypass_cache(hid_t fapl) /* This write should go through the cache because fill value is used. */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR - if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata) < 0) + if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0) FAIL_STACK_ERROR /* Close the first 1-D & 2-D datasets */ @@ -8201,7 +8337,7 @@ test_big_chunks_bypass_cache(hid_t fapl) * chunk is bigger than the cache size and it isn't allocated on disk. */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata1) < 0) FAIL_STACK_ERROR - if(H5Dread(t_dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rdata1) < 0) + if(H5Dread(t_dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rdata1_bytes) < 0) FAIL_STACK_ERROR /* Verify data for the first 1-D dataset */ @@ -8232,8 +8368,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++) for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) if(t_rdata1[i][j] != fvalue) { - HDprintf(" Read different values than written in the 2nd chunk.\n"); - HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the 2nd chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i, j, t_rdata1[i][j], fvalue); TEST_ERROR } /* end if */ @@ -8257,7 +8393,7 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Write to the second 1-D & 2-D dataset */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0) FAIL_STACK_ERROR - if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata) < 0) + if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0) FAIL_STACK_ERROR /* Close the second 1-D & 2-D dataset */ @@ -8273,7 +8409,7 @@ test_big_chunks_bypass_cache(hid_t fapl) * the cache size. */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rdata2) < 0) FAIL_STACK_ERROR - if(H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2) < 0) + if(H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2_bytes) < 0) FAIL_STACK_ERROR /* Verify data for the second 1-D dataset */ @@ -8308,6 +8444,12 @@ test_big_chunks_bypass_cache(hid_t fapl) HDfree(wdata); HDfree(rdata1); HDfree(rdata2); + HDfree(t_wdata); + HDfree(t_rdata1); + HDfree(t_rdata2); + HDfree(t_wdata_bytes); + HDfree(t_rdata1_bytes); + HDfree(t_rdata2_bytes); PASSED(); return SUCCEED; @@ -8323,12 +8465,17 @@ error: H5Sclose(t_sid); H5Fclose(fid); } H5E_END_TRY; - if(wdata) - HDfree(wdata); - if(rdata1) - HDfree(rdata1); - if(rdata2) - HDfree(rdata2); + + HDfree(wdata); + HDfree(rdata1); + HDfree(rdata2); + HDfree(t_wdata); + HDfree(t_rdata1); + HDfree(t_rdata2); + HDfree(t_wdata_bytes); + HDfree(t_rdata1_bytes); + HDfree(t_rdata2_bytes); + return FAIL; } /* end test_big_chunks_bypass_cache() */ @@ -8830,13 +8977,33 @@ test_chunk_fast_bug1(hid_t fapl) hid_t dsid = -1; /* Dataset ID */ hsize_t dim[2], max_dim[2], chunk_dim[2]; /* Dataset and chunk dimensions */ H5D_alloc_time_t alloc_time; /* Storage allocation time */ - static unsigned wbuf[40][20], rbuf[40][20]; /* Element written/read */ + + unsigned **wbuf = NULL; + unsigned **rbuf = NULL; + unsigned *wbuf_bytes = NULL; + unsigned *rbuf_bytes = NULL; + unsigned i, j; /* Local index variables */ TESTING("datasets w/extensible array chunk indexing bug"); h5_fixname(FILENAME[10], fapl, filename, sizeof filename); + /* Set up data array */ + if(NULL == (wbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned)))) + TEST_ERROR; + if(NULL == (wbuf = (unsigned **)HDcalloc(40, sizeof(wbuf_bytes)))) + TEST_ERROR; + for (i = 0; i < 40; i++) + wbuf[i] = wbuf_bytes + (i * 20); + + if(NULL == (rbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned)))) + TEST_ERROR; + if(NULL == (rbuf = (unsigned **)HDcalloc(40, sizeof(rbuf_bytes)))) + TEST_ERROR; + for (i = 0; i < 40; i++) + rbuf[i] = rbuf_bytes + (i * 20); + /* Initialize write buffer */ for(i=0; i<40; i++) for(j=0; j<20; j++) @@ -8870,7 +9037,7 @@ test_chunk_fast_bug1(hid_t fapl) FAIL_STACK_ERROR /* Write buffer to dataset */ - if(H5Dwrite(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, &wbuf) < 0) + if(H5Dwrite(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, wbuf_bytes) < 0) FAIL_STACK_ERROR /* Close everything */ @@ -8880,7 +9047,7 @@ test_chunk_fast_bug1(hid_t fapl) if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Read from dataset */ - if(H5Dread(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, &rbuf) < 0) + if(H5Dread(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, rbuf_bytes) < 0) FAIL_STACK_ERROR /* Verify read data */ @@ -8897,6 +9064,11 @@ test_chunk_fast_bug1(hid_t fapl) if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + HDfree(wbuf); + HDfree(rbuf); + HDfree(wbuf_bytes); + HDfree(rbuf_bytes); + PASSED(); return SUCCEED; @@ -8907,6 +9079,12 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; + + HDfree(wbuf); + HDfree(rbuf); + HDfree(wbuf_bytes); + HDfree(rbuf_bytes); + return FAIL; } /* end test_chunk_fast_bug1() */ @@ -9431,13 +9609,19 @@ test_fixed_array(hid_t fapl) int *rbuf_big = NULL; /* read buffer for big dataset */ const hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */ - int chunks[12][6]; /* # of chunks for dataset dimensions */ - int chunks_big[125][20]; /* # of chunks for big dataset dimensions */ + + int **chunks = NULL; /* # of chunks for dataset dimensions */ + int **chunks_big = NULL; /* # of chunks for big dataset dimensions */ + int *chunks_bytes = NULL; + int *chunks_big_bytes = NULL; + int chunk_row; /* chunk row index */ int chunk_col; /* chunk column index */ - hsize_t coord[POINTS][2]; /* datdaset coordinates */ - hsize_t coord_big[POINTS_BIG][2]; /* big dataset coordinates */ + hsize_t **coord = NULL; /* datdaset coordinates */ + hsize_t **coord_big = NULL; /* big datdaset coordinates */ + hsize_t *coord_bytes = NULL; + hsize_t *coord_big_bytes = NULL; H5D_chunk_index_t idx_type; /* Dataset chunk index type */ H5F_libver_t low, high; /* File format bounds */ @@ -9460,6 +9644,35 @@ test_fixed_array(hid_t fapl) h5_fixname(FILENAME[12], fapl, filename, sizeof filename); + /* Set up 2D data arrays */ + if(NULL == (chunks_bytes = (int *)HDcalloc(12 * 6, sizeof(int)))) + TEST_ERROR; + if(NULL == (chunks = (int **)HDcalloc(12, sizeof(chunks_bytes)))) + TEST_ERROR; + for (i = 0; i < 12; i++) + chunks[i] = chunks_bytes + (i * 6); + + if(NULL == (chunks_big_bytes = (int *)HDcalloc(125 * 20, sizeof(int)))) + TEST_ERROR; + if(NULL == (chunks_big = (int **)HDcalloc(125, sizeof(chunks_big_bytes)))) + TEST_ERROR; + for (i = 0; i < 125; i++) + chunks_big[i] = chunks_big_bytes + (i * 20); + + if(NULL == (coord_bytes = (hsize_t *)HDcalloc(POINTS * 2, sizeof(hsize_t)))) + TEST_ERROR; + if(NULL == (coord = (hsize_t **)HDcalloc(POINTS, sizeof(coord_bytes)))) + TEST_ERROR; + for (i = 0; i < POINTS; i++) + coord[i] = coord_bytes + (i * 2); + + if(NULL == (coord_big_bytes = (hsize_t *)HDcalloc(POINTS_BIG * 2, sizeof(hsize_t)))) + TEST_ERROR; + if(NULL == (coord_big = (hsize_t **)HDcalloc(POINTS_BIG, sizeof(coord_big_bytes)))) + TEST_ERROR; + for (i = 0; i < POINTS_BIG; i++) + coord_big[i] = coord_big_bytes + (i * 2); + /* Check if we are using the latest version of the format */ if(H5Pget_libver_bounds(fapl, &low, &high) < 0) FAIL_STACK_ERROR @@ -9519,8 +9732,8 @@ test_fixed_array(hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < POINTS; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!chunks[chunk_row][chunk_col]); @@ -9559,7 +9772,7 @@ test_fixed_array(hid_t fapl) if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; /* Select the random points for writing */ - if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) + if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR; /* Write into dataset */ @@ -9600,7 +9813,7 @@ test_fixed_array(hid_t fapl) if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; /* Select the random points for writing */ - if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) + if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR; /* Write into dataset */ @@ -9648,8 +9861,8 @@ test_fixed_array(hid_t fapl) /* Generate random point coordinates. Only one point is selected per chunk */ for(i = 0; i < POINTS_BIG; i++){ - chunk_row = ofs / cols; - chunk_col = ofs % cols; + chunk_row = (int)(ofs / cols); + chunk_col = (int)(ofs % cols); ofs = (ofs + inc) % (rows * cols); HDassert(!chunks_big[chunk_row][chunk_col]); @@ -9662,7 +9875,7 @@ test_fixed_array(hid_t fapl) if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR; /* Select the random points for writing */ - if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) + if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0) TEST_ERROR; /* Write into dataset */ @@ -9684,7 +9897,7 @@ test_fixed_array(hid_t fapl) if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; /* Select the random points for reading */ - if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR; + if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR; /* Read from dataset */ if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; @@ -9712,7 +9925,7 @@ test_fixed_array(hid_t fapl) if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; /* Select the random points for reading */ - if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR; + if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR; /* Read from dataset */ if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; @@ -9739,7 +9952,7 @@ test_fixed_array(hid_t fapl) if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR; /* Select the random points for reading */ - if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) TEST_ERROR; + if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0) TEST_ERROR; /* Read from dataset */ if(H5Dread(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, rbuf_big) < 0) TEST_ERROR; @@ -9781,6 +9994,15 @@ test_fixed_array(hid_t fapl) HDfree(wbuf_big); HDfree(rbuf_big); + HDfree(chunks); + HDfree(chunks_big); + HDfree(coord); + HDfree(coord_big); + HDfree(chunks_bytes); + HDfree(chunks_big_bytes); + HDfree(coord_bytes); + HDfree(coord_big_bytes); + PASSED(); return SUCCEED; @@ -9792,10 +10014,18 @@ error: H5Sclose(mem_id); H5Fclose(fid); } H5E_END_TRY; - if(wbuf_big) - HDfree(wbuf_big); - if(rbuf_big) - HDfree(rbuf_big); + + HDfree(wbuf_big); + HDfree(rbuf_big); + HDfree(chunks); + HDfree(chunks_big); + HDfree(coord); + HDfree(coord_big); + HDfree(chunks_bytes); + HDfree(chunks_big_bytes); + HDfree(coord_bytes); + HDfree(coord_big_bytes); + return FAIL; } /* end test_fixed_array() */ @@ -10762,7 +10992,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) const hsize_t maxshape[1] = { H5S_UNLIMITED }; const hsize_t chunk[1] = { 8 }; const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - H5O_info_t info; + H5O_info2_t info; TESTING("Extensible array chunk index header flush dependencies handled correctly"); @@ -10827,9 +11057,9 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -10882,7 +11112,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) const hsize_t maxshape[1] = { 64 }; const hsize_t chunk[1] = { 8 }; const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - H5O_info_t info; + H5O_info2_t info; TESTING("Fixed array chunk index header flush dependencies handled correctly"); @@ -10947,9 +11177,9 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -11002,7 +11232,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) const hsize_t maxshape[2] = { H5S_UNLIMITED, H5S_UNLIMITED }; const hsize_t chunk[2] = { 8, 8 }; const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7}; - H5O_info_t info; + H5O_info2_t info; TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly"); @@ -11067,9 +11297,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -12775,20 +13005,23 @@ error: } /* end dls_01_write_data() */ static herr_t -dls_01_read_stuff( hid_t fid ) +dls_01_read_stuff(hid_t fid) { int status = 0; hid_t did = 0; - H5O_info_t info; + H5O_info2_t info; - did = H5Dopen2( fid, DLS_01_DATASET, H5P_DEFAULT ); - if ( did <= 0 ) TEST_ERROR + did = H5Dopen2(fid, DLS_01_DATASET, H5P_DEFAULT); + if(did <= 0) + TEST_ERROR - status = H5Oget_info2( did, &info, H5O_INFO_BASIC ); - if ( status != 0 ) TEST_ERROR + status = H5Oget_info3(did, &info, H5O_INFO_BASIC); + if(status != 0) + TEST_ERROR - status = H5Dclose( did ); - if ( status != 0 ) TEST_ERROR + status = H5Dclose(did); + if(status != 0) + TEST_ERROR return SUCCEED; @@ -13132,7 +13365,7 @@ test_versionbounds(void) return FAIL; } /* end test_versionbounds() */ - + /*----------------------------------------------------------------------------- * Function: test_object_header_minimization_dcpl * @@ -13279,6 +13512,7 @@ main(void) int nerrors = 0; const char *envval; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + int i; /* Don't run this test using certain file drivers */ envval = HDgetenv("HDF5_DRIVER"); @@ -13291,6 +13525,39 @@ main(void) /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); + /* Initialize global arrays */ + /* points */ + if(NULL == (points_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (points = (int **)HDcalloc(DSET_DIM1, sizeof(points_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + points[i] = points_data + (i * DSET_DIM2); + + /* check */ + if(NULL == (check_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (check = (int **)HDcalloc(DSET_DIM1, sizeof(check_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + check[i] = check_data + (i * DSET_DIM2); + + /* points_dbl */ + if(NULL == (points_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double)))) + TEST_ERROR; + if(NULL == (points_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(points_dbl_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + points_dbl[i] = points_dbl_data + (i * DSET_DIM2); + + /* check_dbl */ + if(NULL == (check_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double)))) + TEST_ERROR; + if(NULL == (check_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(check_dbl_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + check_dbl[i] = check_dbl_data + (i * DSET_DIM2); + /* Testing setup */ h5_reset(); fapl = h5_fileaccess(); @@ -13476,9 +13743,29 @@ main(void) #endif /* H5_HAVE_FILTER_SZIP */ h5_cleanup(FILENAME, fapl); + HDfree(points); + HDfree(check); + HDfree(points_dbl); + HDfree(check_dbl); + + HDfree(points_data); + HDfree(check_data); + HDfree(points_dbl_data); + HDfree(check_dbl_data); + HDexit(EXIT_SUCCESS); error: + HDfree(points); + HDfree(check); + HDfree(points_dbl); + HDfree(check_dbl); + + HDfree(points_data); + HDfree(check_data); + HDfree(points_dbl_data); + HDfree(check_dbl_data); + nerrors = MAX(1, nerrors); HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); diff --git a/test/dtypes.c b/test/dtypes.c index 791e8e8..0f95830 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1216,8 +1216,8 @@ test_compound_6(void) orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)((void *)orig)) + i; - s_ptr->b = (i*8+1) & 0x7fff; - s_ptr->d = (i*8+6) & 0x7fff; + s_ptr->b = (int16_t)((i*8+1) & 0x7fff); + s_ptr->d = (int16_t)((i*8+6) & 0x7fff); } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); @@ -5884,7 +5884,7 @@ test_latest(void) hid_t file = (-1); /* File ID */ hid_t tid1 = (-1), tid2 = (-1); /* Datatype ID */ hid_t fapl = (-1); /* File access property list */ - H5O_info_t oi; /* Stat buffer for committed datatype */ + H5O_native_info_t oi; /* Stat buffer for committed datatype */ hsize_t old_dtype_oh_size; /* Size of object header with "old" format */ hsize_t new_dtype_oh_size; /* Size of object header with "new" format */ char filename[1024]; /* Buffer for filename */ @@ -5918,7 +5918,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR old_dtype_oh_size = oi.hdr.space.total; @@ -5943,7 +5943,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that the object header info is still the same */ @@ -5979,7 +5979,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR new_dtype_oh_size = oi.hdr.space.total; @@ -6008,7 +6008,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) + if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that the object header info is still the same */ @@ -6732,7 +6732,7 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl, hid_t my_fapl; /* Copy of file access property list ID */ hid_t dcpl; /* Dataset creation property list ID */ unsigned use_at_least_v18;/* Whether to use old or new format */ - herr_t status; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Generic return value */ /* Make copy of FAPL */ my_fapl = H5Pcopy(fapl); @@ -7292,7 +7292,7 @@ test_utf_ascii_conv(void) /* Test conversion in memory */ H5E_BEGIN_TRY { - status = H5Tconvert(utf8_vtid, ascii_vtid, 1, (void *)utf8_w, NULL, H5P_DEFAULT); + status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT); } H5E_END_TRY if(status >= 0) FAIL_STACK_ERROR @@ -7325,7 +7325,7 @@ test_utf_ascii_conv(void) ************************************************/ /* Test conversion in memory */ H5E_BEGIN_TRY { - status = H5Tconvert(ascii_vtid, utf8_vtid, 1, (void *)ascii_w, NULL, H5P_DEFAULT); + status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT); } H5E_END_TRY if(status >= 0) FAIL_STACK_ERROR @@ -32,8 +32,14 @@ const char *FILENAME[] = { NULL }; +/* Windows doesn't have PATH_MAX */ +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif /* !PATH_MAX */ + /* Global patched filename buffer */ -static char filename[6][1024]; +#define N_FILENAMES 6 +static char *filename[N_FILENAMES]; /* Global property lists - just copies of the defaults (necessary to use * internal functions */ @@ -2896,10 +2902,11 @@ error: int main(void) { - unsigned nerrors = 0; /* track errors */ - H5P_genplist_t *plist; /* Property list pointer for FAPL */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + unsigned nerrors = 0; /* track errors */ + H5P_genplist_t *plist; /* Property list pointer for FAPL */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + int i; /* iterator */ /* Test Setup */ HDputs("Testing the external file cache"); @@ -2908,13 +2915,18 @@ main(void) fcpl_id = H5Pcreate(H5P_FILE_CREATE); fapl_id = h5_fileaccess(); + /* Allocate memory for filenames */ + for(i = 0; i < N_FILENAMES; i++) { + filename[i] = (char *)HDcalloc(PATH_MAX, sizeof(char)); + } + /* Patch filenames */ - h5_fixname(FILENAME[0], fapl_id, filename[0], sizeof(filename[0])); - h5_fixname(FILENAME[1], fapl_id, filename[1], sizeof(filename[1])); - h5_fixname(FILENAME[2], fapl_id, filename[2], sizeof(filename[2])); - h5_fixname(FILENAME[3], fapl_id, filename[3], sizeof(filename[3])); - h5_fixname(FILENAME[4], fapl_id, filename[4], sizeof(filename[4])); - h5_fixname(FILENAME[5], fapl_id, filename[5], sizeof(filename[5])); + h5_fixname(FILENAME[0], fapl_id, filename[0], PATH_MAX); + h5_fixname(FILENAME[1], fapl_id, filename[1], PATH_MAX); + h5_fixname(FILENAME[2], fapl_id, filename[2], PATH_MAX); + h5_fixname(FILENAME[3], fapl_id, filename[3], PATH_MAX); + h5_fixname(FILENAME[4], fapl_id, filename[4], PATH_MAX); + h5_fixname(FILENAME[5], fapl_id, filename[5], PATH_MAX); /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR @@ -2942,7 +2954,8 @@ main(void) nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); /* Pop API context */ - if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + if(api_ctx_pushed && H5CX_pop() < 0) + FAIL_STACK_ERROR api_ctx_pushed = FALSE; if(nerrors) @@ -2952,6 +2965,10 @@ main(void) h5_clean_files(FILENAME, fapl_id); + for(i = 0; i < N_FILENAMES; i++) { + HDfree(filename[i]); + } + return EXIT_SUCCESS; error: @@ -2961,7 +2978,12 @@ error: H5Pclose(fapl_id); } H5E_END_TRY - if(api_ctx_pushed) H5CX_pop(); + if(api_ctx_pushed) + H5CX_pop(); + + for(i = 0; i < N_FILENAMES; i++) { + HDfree(filename[i]); + } return EXIT_FAILURE; } /* end main() */ diff --git a/test/err_compat.c b/test/err_compat.c index d2d039a..eb86760 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -35,7 +35,10 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int **ipoints2 = NULL; +int **icheck2 = NULL; +int *ipoints2_data = NULL; +int *icheck2_data = NULL; #define DSET_NAME "a_dataset" #define FAKE_ID (hid_t)-1 @@ -465,13 +468,29 @@ dump_error(void) int main(void) { - hid_t file, fapl; + hid_t file, fapl; char filename[1024]; - const char *FUNC_main="main"; + const char *FUNC_main="main"; + int i; HDfprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); fapl = h5_fileaccess(); + /* Set up data arrays */ + if(NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) + TEST_ERROR; + if(NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data)))) + TEST_ERROR; + for (i = 0; i < DIM0; i++) + ipoints2[i] = ipoints2_data + (i * DIM1); + + if(NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) + TEST_ERROR; + if(NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data)))) + TEST_ERROR; + for (i = 0; i < DIM0; i++) + icheck2[i] = icheck2_data + (i * DIM1); + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR ; @@ -500,10 +519,20 @@ main(void) if(H5Fclose(file) < 0) TEST_ERROR ; h5_clean_files(FILENAME, fapl); + HDfree(ipoints2); + HDfree(ipoints2_data); + HDfree(icheck2); + HDfree(icheck2_data); + HDprintf("All error API tests passed.\n"); return 0; error: + HDfree(ipoints2); + HDfree(ipoints2_data); + HDfree(icheck2); + HDfree(icheck2_data); + HDprintf("***** ERROR TEST FAILED! *****\n"); return 1; } diff --git a/test/error_test.c b/test/error_test.c index 1de9065..e99a82f 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -38,7 +38,10 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int **ipoints2 = NULL; +int **icheck2 = NULL; +int *ipoints2_data = NULL; +int *icheck2_data = NULL; hid_t ERR_CLS; hid_t ERR_CLS2; @@ -679,6 +682,7 @@ main(void) hid_t estack_id = -1; char filename[1024]; const char *FUNC_main = "main"; + int i; HDfprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n"); @@ -689,6 +693,21 @@ main(void) if ((fapl = h5_fileaccess()) < 0) TEST_ERROR; + /* Set up data arrays */ + if(NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) + TEST_ERROR; + if(NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data)))) + TEST_ERROR; + for (i = 0; i < DIM0; i++) + ipoints2[i] = ipoints2_data + (i * DIM1); + + if(NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) + TEST_ERROR; + if(NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data)))) + TEST_ERROR; + for (i = 0; i < DIM0; i++) + icheck2[i] = icheck2_data + (i * DIM1); + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -755,10 +774,20 @@ main(void) h5_clean_files(FILENAME, fapl); + HDfree(ipoints2); + HDfree(ipoints2_data); + HDfree(icheck2); + HDfree(icheck2_data); + HDfprintf(stderr, "\nAll error API tests passed.\n"); return 0; error: + HDfree(ipoints2); + HDfree(ipoints2_data); + HDfree(icheck2); + HDfree(icheck2_data); + HDfprintf(stderr, "\n***** ERROR TEST FAILED (real problem)! *****\n"); return 1; } diff --git a/test/extend.c b/test/extend.c index a31ac0e..1e2b5b5 100644 --- a/test/extend.c +++ b/test/extend.c @@ -25,11 +25,16 @@ const char *FILENAME[] = { NULL }; -#define NX 100 /* USE AN EVEN NUMBER!*/ -#define NY 100 /* USE AN EVEN NUMBER!*/ +#define N1X 100 /* USE AN EVEN NUMBER! */ +#define N1Y 100 /* USE AN EVEN NUMBER! */ +#define N2X (N1X / 2) +#define N2Y (N1Y / 2) /* Data buffers */ -static int buf1[NY][NX], buf2[NX / 2][NY / 2]; +static int **buf1 = NULL; +static int *buf1_data = NULL; +static int **buf2 = NULL; +static int *buf2_data = NULL; /*------------------------------------------------------------------------- @@ -49,8 +54,8 @@ static int write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t mem_space) { hid_t dataset, file_space, half_space; - static const hsize_t dims[2] = {NX, NY}; - static const hsize_t half_dims[2] = {NX / 2, NY / 2}; + static const hsize_t dims[2] = {N1X, N1Y}; + static const hsize_t half_dims[2] = {N2X, N2Y}; hsize_t size[2]; hsize_t max_size[2] = {0, 0}; hsize_t offset[2]; @@ -63,13 +68,13 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me /* Write the data */ for(i = 0; i < 5; i++) - for(j = 0; j < 5; j++) { + for(j = 0; j < 5; j++) { - /* Extend the dataset */ - offset[0] = (hsize_t)(i * NX); - offset[1] = (hsize_t)(j * NY); - size[0] = offset[0] + NX; - size[1] = offset[1] + NY; + /* Extend the dataset */ + offset[0] = (hsize_t)(i * N1X); + offset[1] = (hsize_t)(j * N1Y); + size[0] = offset[0] + N1X; + size[1] = offset[1] + N1Y; if(size[0] > max_size[0] || size[1] > max_size[1]) { if(size[0] > max_size[0]) max_size[0] = size[0]; @@ -78,42 +83,41 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me if(H5Dset_extent(dataset, max_size) < 0) TEST_ERROR; } /* end if */ - /* Select a hyperslab */ + /* Select a hyperslab */ if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR; - if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR; + if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR; - /* Write to the hyperslab */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1) < 0) TEST_ERROR; + /* Write to the hyperslab */ + if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0) TEST_ERROR; if(H5Sclose(file_space) < 0) TEST_ERROR; - } /* end for */ + } /* end for */ /* Read the data */ if((half_space = H5Screate_simple(2, half_dims, NULL)) < 0) TEST_ERROR; if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR; for(i = 0; i < 10; i++) { - for(j = 0; j < 10; j++) { - - /* Select a hyperslab */ - offset[0] = (hsize_t)(i * (NX / 2)); - offset[1] = (hsize_t)(j * (NY / 2)); - if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR; - - /* Read */ - if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2) < 0) TEST_ERROR; - - /* Compare */ - for(k = 0; k < (NX / 2); k++) - for(m = 0; m < (NY / 2); m++) - if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) { - HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); - HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); - HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); - TEST_ERROR; - } /* end if */ - } /* end for */ + for(j = 0; j < 10; j++) { + + /* Select a hyperslab */ + offset[0] = (hsize_t)(i * N2X); + offset[1] = (hsize_t)(j * N2Y); + if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR; + + /* Read */ + if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0) TEST_ERROR; + + /* Compare */ + for(k = 0; k < N2X; k++) + for(m = 0; m < N2Y; m++) + if(buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) { + HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); + HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); + HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m, buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]); + TEST_ERROR; + } /* end if */ + } /* end for */ } /* end for */ - /* Cleanup */ if(H5Dclose(dataset) < 0) TEST_ERROR; if(H5Sclose(file_space) < 0) TEST_ERROR; @@ -146,8 +150,8 @@ static int write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t mem_space) { hid_t dataset, file_space, half_space; - static const hsize_t dims[2] = {NX, NY}; - static const hsize_t half_dims[2] = {NX / 2, NY / 2}; + static const hsize_t dims[2] = {N1X, N1Y}; + static const hsize_t half_dims[2] = {N2X, N2Y}; static hsize_t size[2]; hsize_t offset[2]; int i, j, k, m; @@ -159,48 +163,48 @@ write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, h /* Write the data */ for(i = 0; i < 5; i++) - for(j = 0; j < 5; j++) { + for(j = 0; j < 5; j++) { - /* Extend the dataset */ - offset[0] = (hsize_t)(i * NX); - offset[1] = (hsize_t)(j * NY); - size[0] = offset[0] + NX; - size[1] = offset[1] + NY; - if(H5Dextend(dataset, size) < 0) TEST_ERROR; + /* Extend the dataset */ + offset[0] = (hsize_t)(i * N1X); + offset[1] = (hsize_t)(j * N1Y); + size[0] = offset[0] + N1X; + size[1] = offset[1] + N1Y; + if(H5Dextend(dataset, size) < 0) TEST_ERROR; - /* Select a hyperslab */ + /* Select a hyperslab */ if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR; - if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR; + if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR; - /* Write to the hyperslab */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1) < 0) TEST_ERROR; + /* Write to the hyperslab */ + if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0) TEST_ERROR; if(H5Sclose(file_space) < 0) TEST_ERROR; - } /* end for */ + } /* end for */ /* Read the data */ if((half_space = H5Screate_simple(2, half_dims, NULL)) < 0) TEST_ERROR; if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR; for(i = 0; i < 10; i++) { - for(j = 0; j < 10; j++) { - - /* Select a hyperslab */ - offset[0] = (hsize_t)(i * (NX / 2)); - offset[1] = (hsize_t)(j * (NY / 2)); - if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR; - - /* Read */ - if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2) < 0) TEST_ERROR; - - /* Compare */ - for(k = 0; k < (NX / 2); k++) - for(m = 0; m < (NY / 2); m++) - if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) { - HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); - HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); - HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); - TEST_ERROR; - } /* end if */ - } /* end for */ + for(j = 0; j < 10; j++) { + + /* Select a hyperslab */ + offset[0] = (hsize_t)(i * N2X); + offset[1] = (hsize_t)(j * N2Y); + if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR; + + /* Read */ + if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0) TEST_ERROR; + + /* Compare */ + for(k = 0; k < N2X; k++) + for(m = 0; m < N2Y; m++) + if(buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) { + HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); + HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); + HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m, buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]); + TEST_ERROR; + } /* end if */ + } /* end for */ } /* end for */ @@ -236,8 +240,8 @@ main (void) hid_t file, mem_space, cparms; hid_t fapl; int nerrors = 0; - static const hsize_t dims[2] = {NX, NY}; - static const hsize_t chunk_dims[2] = {NX/2, NY/2}; + static const hsize_t dims[2] = {N1X, N1Y}; + static const hsize_t chunk_dims[2] = {N2X, N2Y}; static hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; char filename[1024]; int i, j; @@ -246,9 +250,23 @@ main (void) fapl = h5_fileaccess(); /* Initialize buffer and space */ - for(i = 0; i < NX; i++) - for(j = 0; j < NY; j++) - buf1[i][j] = i * NY + j; + if(NULL == (buf1_data = (int *)HDcalloc(N1X * N1Y, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf1 = (int **)HDcalloc(N1X, sizeof(buf1_data)))) + TEST_ERROR; + for (i = 0; i < N1X; i++) + buf1[i] = buf1_data + (i * N1Y); + + if(NULL == (buf2_data = (int *)HDcalloc(N2X * N2Y, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf2 = (int **)HDcalloc(N2X, sizeof(buf2_data)))) + TEST_ERROR; + for (i = 0; i < N2X; i++) + buf2[i] = buf2_data + (i * N2Y); + + for(i = 0; i < N1X; i++) + for(j = 0; j < N1Y; j++) + buf1[i][j] = i * N1Y + j; if((mem_space = H5Screate_simple(2, dims, maxdims)) < 0) TEST_ERROR; @@ -288,9 +306,20 @@ main (void) HDprintf("All extend tests passed.\n"); h5_cleanup(FILENAME, fapl); + HDfree(buf1); + HDfree(buf1_data); + HDfree(buf2); + HDfree(buf2_data); + HDexit(EXIT_SUCCESS); error: + + HDfree(buf1); + HDfree(buf1_data); + HDfree(buf2); + HDfree(buf2_data); + HDprintf("*** One or more extend tests failed ***\n"); HDexit(EXIT_FAILURE); } /* end main() */ diff --git a/test/external_env.c b/test/external_env.c index 01f2cba..e9c7635 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -15,7 +15,6 @@ * Purpose: Tests datasets stored in external raw files. */ #include "external_common.h" -#include "external_fname.h" static const char *EXT_ENV_FNAME[] = { "extern_env_dir/env_file_1", @@ -189,7 +188,7 @@ main(void) HDputs("All external storage tests passed."); /* Clean up files used by file set tests */ - if(h5_cleanup(EXT_FNAME, fapl_id_old)) { + if(h5_cleanup(EXT_ENV_FNAME, fapl_id_old)) { HDremove("extern_env_1r.raw"); HDremove("extern_env_2r.raw"); HDremove("extern_env_3r.raw"); diff --git a/test/fheap.c b/test/fheap.c index 2cd2be3..b8c54d6 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -7617,7 +7617,8 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ - unsigned char heap_id[100][MAX_HEAP_ID_LEN]; /* Heap ID for object inserted */ + unsigned char **heap_id = NULL; + unsigned char *heap_id_data = NULL; struct a_type_t1 { char a[10]; char b[40]; @@ -7629,6 +7630,14 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + /* Set up data array */ + if(NULL == (heap_id_data = (unsigned char *)HDcalloc(100 * MAX_HEAP_ID_LEN, sizeof(unsigned char)))) + TEST_ERROR; + if(NULL == (heap_id = (unsigned char **)HDcalloc(100, sizeof(heap_id_data)))) + TEST_ERROR; + for (i = 0; i < 100; i++) + heap_id[i] = heap_id_data + (i * MAX_HEAP_ID_LEN); + /* Create the file to work on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0) FAIL_STACK_ERROR @@ -7695,7 +7704,10 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ /* All tests passed */ PASSED() - return(0); + HDfree(heap_id); + HDfree(heap_id_data); + + return 0; error: H5E_BEGIN_TRY { @@ -7703,7 +7715,11 @@ error: H5HF_close(fh); H5Fclose(file); } H5E_END_TRY; - return(1); + + HDfree(heap_id); + HDfree(heap_id_data); + + return 1; } /* test_man_incr_insert_remove() */ #endif /* QAK */ diff --git a/test/fillval.c b/test/fillval.c index 47cd53a..b3e2e88 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -758,7 +758,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, int fillval=(-1), val_rd, should_be; int i, j, *buf=NULL, odd; unsigned u; - comp_datatype rd_c, fill_c, should_be_c; + comp_datatype rd_c, fill_c, should_be_c; comp_datatype *buf_c=NULL; H5D_space_status_t allocation; @@ -822,7 +822,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, - (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z); + (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z); goto error; } } diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 92c9f87..20a4ba4 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -843,13 +843,13 @@ herr_t flush_verification(const char * obj_pathname, const char * expected) /* Variables */ hid_t oid = -1, fid = -1; herr_t status = 0; - H5O_info_t oinfo; + H5O_info2_t oinfo; /* Try to open the testfile and then obj_pathname within the file */ H5E_BEGIN_TRY { fid = H5Fopen(FILENAME, H5F_ACC_SWMR_READ, H5P_DEFAULT); oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT); - status = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); + status = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; /* Compare to expected result */ @@ -978,9 +978,12 @@ herr_t refresh_verification(const char * obj_pathname) { /* Variables */ hid_t oid,fid,status = 0; - H5O_info_t flushed_oinfo; - H5O_info_t refreshed_oinfo; + H5O_info2_t flushed_oinfo; + H5O_info2_t refreshed_oinfo; + H5O_native_info_t flushed_ninfo; + H5O_native_info_t refreshed_ninfo; int tries = 800, sleep_tries = 400; + int token_cmp; hbool_t ok = FALSE; HDremove(SIGNAL_BETWEEN_PROCESSES_2); @@ -990,8 +993,9 @@ herr_t refresh_verification(const char * obj_pathname) if((oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT)) < 0) PROCESS_ERROR; /* Get Object info */ - if((status = H5Oget_info2(oid, &flushed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; - + if((status = H5Oget_info3(oid, &flushed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR; + if((status = H5Oget_native_info(oid, &flushed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR; + /* Make sure there are no attributes on the object. This is just a sanity check to ensure we didn't erroneously flush the attribute before starting the verification. */ @@ -1009,18 +1013,20 @@ herr_t refresh_verification(const char * obj_pathname) /* Get object info again. This will NOT reflect what's on disk, only what's in the cache. Thus, all values will be unchanged from above, despite newer information being on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; + if((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR; + if((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR; /* Verify that before doing a refresh, getting the object info returns stale information. (i.e., unchanged from above, despite new info on disk). */ - if(flushed_oinfo.addr != refreshed_oinfo.addr) PROCESS_ERROR; - if(flushed_oinfo.type != refreshed_oinfo.type) PROCESS_ERROR; - if(flushed_oinfo.hdr.version != refreshed_oinfo.hdr.version) PROCESS_ERROR; - if(flushed_oinfo.hdr.flags != refreshed_oinfo.hdr.flags) PROCESS_ERROR; - if(flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) PROCESS_ERROR; - if(flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) PROCESS_ERROR; - if(flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) PROCESS_ERROR; - if(flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) PROCESS_ERROR; + if(H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0) PROCESS_ERROR; + if(token_cmp) PROCESS_ERROR; + if(flushed_oinfo.type != refreshed_oinfo.type) PROCESS_ERROR; + if(flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) PROCESS_ERROR; + if(flushed_ninfo.hdr.version != refreshed_ninfo.hdr.version) PROCESS_ERROR; + if(flushed_ninfo.hdr.flags != refreshed_ninfo.hdr.flags) PROCESS_ERROR; + if(flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) PROCESS_ERROR; + if(flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) PROCESS_ERROR; + if(flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total) PROCESS_ERROR; /* Refresh object */ /* The H5*refresh function called depends on which object we are trying @@ -1047,19 +1053,20 @@ herr_t refresh_verification(const char * obj_pathname) } /* 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; + if((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR; + if((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR; + if(H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 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) ) { + if( (!token_cmp) && + (flushed_oinfo.type == refreshed_oinfo.type) && + (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && + (flushed_ninfo.hdr.version == refreshed_ninfo.hdr.version) && + (flushed_ninfo.hdr.flags == refreshed_ninfo.hdr.flags) && + (flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) && + (flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) && + (flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total) ) { ok = TRUE; break; } @@ -1071,11 +1078,11 @@ herr_t refresh_verification(const char * obj_pathname) if(!ok) { 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); + (int)flushed_oinfo.num_attrs, (int)flushed_ninfo.hdr.nmesgs, + (int)flushed_ninfo.hdr.nchunks, (int)flushed_ninfo.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); + (int)refreshed_oinfo.num_attrs, (int)refreshed_ninfo.hdr.nmesgs, + (int)refreshed_ninfo.hdr.nchunks, (int)refreshed_ninfo.hdr.space.total); PROCESS_ERROR; } diff --git a/test/genall5.c b/test/genall5.c index 849d97c..3f55930 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -479,7 +479,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { u = 0; while ((pass) && (u < nlinks)) { - H5L_info_t lnk_info; + H5L_info2_t lnk_info; char linkname[16]; htri_t link_exists; @@ -493,7 +493,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(link_exists >= 0); HDmemset(&lnk_info, 0, sizeof(grp_info)); - ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT); if (ret < 0) { pass = FALSE; @@ -554,7 +554,8 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { HDfree(slinkval); } /* end if */ else if (1 == (u % 3)) { - H5O_info_t root_oinfo; + H5O_info2_t root_oinfo; + int token_cmp = 0; if (H5L_TYPE_HARD != lnk_info.type) { pass = FALSE; @@ -563,18 +564,25 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(H5L_TYPE_HARD == lnk_info.type); HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC); if (ret < 0) { pass = FALSE; failure_mssg = "vrfy_ns_grp_c: H5Oget_info() failed."; } - else if (root_oinfo.addr != lnk_info.u.address) { - pass = FALSE; - failure_mssg = "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address"; + else { + if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: H5Otoken_cmp() failed."; + } + + if (token_cmp) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_c: root_oinfo.token != lnk_info.u.token"; + } } HDassert(ret >= 0); - HDassert(root_oinfo.addr == lnk_info.u.address); + HDassert(!token_cmp); } /* end else-if */ else { void *elinkval; @@ -888,7 +896,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { u = 0; while ((pass) && (u < nlinks)) { - H5L_info_t lnk_info; + H5L_info2_t lnk_info; char linkname[16]; htri_t link_exists; @@ -902,7 +910,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(link_exists >= 0); HDmemset(&lnk_info, 0, sizeof(grp_info)); - ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT); if (ret < 0) { pass = FALSE; @@ -963,7 +971,8 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { HDfree(slinkval); } /* end if */ else if (1 == (u % 3)) { - H5O_info_t root_oinfo; + H5O_info2_t root_oinfo; + int token_cmp = 0; if (H5L_TYPE_HARD != lnk_info.type) { pass = FALSE; @@ -972,17 +981,24 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) { HDassert(H5L_TYPE_HARD == lnk_info.type); HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(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"; + else { + if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: H5Otoken_cmp() failed."; + } + + if (token_cmp) { + pass = FALSE; + failure_mssg = "vrfy_ns_grp_d: root_oinfo.token != lnk_info.u.token"; + } } HDassert(ret >= 0); - HDassert(root_oinfo.addr == lnk_info.u.address); + HDassert(!token_cmp); } /* end else-if */ else { void *elinkval; @@ -1486,7 +1502,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, u = 0; while ((pass) && (u < nlinks)) { - H5L_info_t lnk_info; + H5L_info2_t lnk_info; char linkname[32]; htri_t link_exists; @@ -1500,7 +1516,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, HDassert(link_exists >= 0); HDmemset(&lnk_info, 0, sizeof(grp_info)); - ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT); + ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT); if (ret < 0) { pass = FALSE; @@ -1557,7 +1573,8 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, HDfree(slinkval); } /* end if */ else { - H5O_info_t root_oinfo; + H5O_info2_t root_oinfo; + int token_cmp = 0; HDassert(1 == (u % 2)); @@ -1568,18 +1585,25 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, HDassert(H5L_TYPE_HARD == lnk_info.type); HDmemset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC); 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(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: H5Otoken_cmp() failed."; + } + + if (token_cmp) { + pass = FALSE; + failure_mssg = "vrfy_os_grp_n: root_oinfo.token != lnk_info.u.token"; + } } HDassert(ret >= 0); - HDassert(root_oinfo.addr == lnk_info.u.address); + HDassert(!token_cmp); } /* end else */ u++; diff --git a/test/getname.c b/test/getname.c index 873ceb9..f677d78 100644 --- a/test/getname.c +++ b/test/getname.c @@ -101,8 +101,8 @@ test_main(hid_t file_id, hid_t fapl) hid_t space_id; hid_t type_id, type2_id; hsize_t dims[1] = { 5 }; - size_t name_len; /* Name length */ - H5O_info_t oinfo; /* Object info structs */ + size_t name_len; /* Name length */ + H5O_info2_t oinfo; /* Object info structs */ hid_t dtype; /* Object identifier for testing */ hid_t dtype_anon; /* Object identifier for testing anonymous */ ssize_t size; /* Size returned by H5Iget_name */ @@ -2380,7 +2380,7 @@ test_main(hid_t file_id, hid_t fapl) if((size = H5Iget_name(dtype, NULL, 0)) != 0) TEST_ERROR /* Create a link to the object */ - if( H5Olink(dtype, file2_id, "datatype", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Olink(dtype, file2_id, "datatype", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Commit a second datatype with no links to it and commit it */ if((dtype_anon = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR @@ -2390,7 +2390,7 @@ test_main(hid_t file_id, hid_t fapl) if((size = H5Iget_name(dtype_anon, NULL,0)) != 0) TEST_ERROR /* Store the address of the datatype for later use */ - if(H5Oget_info2(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Update the reference count to dtype_anon to preserve the datatype */ if(H5Oincr_refcount(dtype_anon) < 0) TEST_ERROR @@ -2400,22 +2400,22 @@ test_main(hid_t file_id, hid_t fapl) if(H5Fclose(file2_id) < 0) TEST_ERROR /* Re-open the file and check that the anonymous datatypes persist */ - if( (file2_id = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((file2_id = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Check the H5Iget_name does not return an error for anon committed datatypes */ - if((dtype_anon = H5Oopen_by_addr(file2_id, oinfo.addr)) < 0) TEST_ERROR + if((dtype_anon = H5Oopen_by_token(file2_id, oinfo.token)) < 0) TEST_ERROR - if((size = H5Iget_name(dtype_anon,NULL,0)) != 0) TEST_ERROR + if((size = H5Iget_name(dtype_anon, NULL, 0)) != 0) TEST_ERROR if(H5Tclose(dtype_anon) < 0) TEST_ERROR if(H5Fclose(file2_id) < 0) TEST_ERROR PASSED(); - return(0); + return 0; error: - return(1); + return 1; } static int diff --git a/test/h5test.c b/test/h5test.c index 67c73f1..ab859a5 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1321,8 +1321,7 @@ h5_dump_info_object(MPI_Info info) int flag; int i, nkeys; - HDprintf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, - MPI_MAX_INFO_VAL); + HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL); if (info==MPI_INFO_NULL){ HDprintf("object is MPI_INFO_NULL\n"); } @@ -1698,7 +1697,7 @@ error: */ static herr_t h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, - const H5O_info_t *oinfo, void H5_ATTR_UNUSED *udata) + const H5O_info2_t *oinfo, void H5_ATTR_UNUSED *udata) { if(oinfo->type == H5O_TYPE_GROUP) return H5G__verify_cached_stabs_test(oid); @@ -1746,7 +1745,7 @@ h5_verify_cached_stabs(const char *base_name[], hid_t fapl) continue; } /* end if */ - if(H5Ovisit2(file, H5_INDEX_NAME, H5_ITER_NATIVE, + if(H5Ovisit3(file, H5_INDEX_NAME, H5_ITER_NATIVE, h5_verify_cached_stabs_cb, NULL, H5O_INFO_BASIC) < 0) goto error; diff --git a/test/links.c b/test/links.c index 5774f97..60d3152 100644 --- a/test/links.c +++ b/test/links.c @@ -31,10 +31,11 @@ #include "h5test.h" #include "H5srcdir.h" -#include "H5FDpkg.h" /* File drivers */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ +#include "H5FDpkg.h" /* File drivers */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5VLnative_private.h" /* Native VOL connector */ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" @@ -314,7 +315,119 @@ typedef struct { static hid_t dcpl_g; /* for [un]minimized dataset object headers */ +static herr_t +UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t lcpl_id); +static hid_t +UD_hard_traverse(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); +static herr_t +UD_hard_delete(const char *link_name, hid_t file, const void *udata, + size_t udata_size); + +/* User-defined link class */ +const H5L_class_t UD_hard_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_hard_link", /* Link class name for debugging */ + UD_hard_create, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_hard_traverse, /* The actual traversal function */ + UD_hard_delete, /* Deletion callback */ + NULL /* Query callback */ +}}; + +#ifndef H5_NO_DEPRECATED_SYMBOLS +static herr_t +UD_hard_create_deprec(const char *link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t lcpl_id); +static hid_t +UD_hard_traverse_deprec(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); +static herr_t +UD_hard_delete_deprec(const char *link_name, hid_t file, const void *udata, + size_t udata_size); + +/* User-defined link class */ +const H5L_class_t UD_hard_class_deprec[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_hard_link_deprec", /* Link class name for debugging */ + UD_hard_create_deprec, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_hard_traverse_deprec, /* The actual traversal function */ + UD_hard_delete_deprec, /* Deletion callback */ + NULL /* Query callback */ +}}; +#endif + +static hid_t +UD_rereg_traverse(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); + +/* This link class has the same ID number as the UD hard links but + * has a very different traversal function */ +const H5L_class_t UD_rereg_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_reregistered_type", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_rereg_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ +}}; + +static herr_t +UD_cb_create(const char * link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t lcpl_id); +static herr_t +UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, + size_t udata_size); +static hid_t +UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata, + size_t udata_size, hid_t lapl_id, hid_t dxpl_id); +static herr_t +UD_cb_delete(const char *link_name, hid_t file, const void *udata, + size_t udata_size); +static ssize_t +UD_cb_query(const char * link_name, const void *udata, size_t udata_size, + void *buf, size_t buf_size); + +const H5L_class_t UD_cb_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CB_TYPE, /* Link type id number */ + NULL, /* NULL name (to make sure this doesn't break anything */ + UD_cb_create, /* Creation callback */ + UD_cb_move, /* Move/rename callback */ + UD_cb_move, /* Copy callback */ + UD_cb_traverse, /* The actual traversal function */ + UD_cb_delete, /* Deletion callback */ + UD_cb_query /* Query callback */ +}}; +static hid_t +UD_plist_traverse(const char *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id); + +const H5L_class_t UD_plist_class[1] = {{ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */ + "UD_plist_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_plist_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ +}}; /*------------------------------------------------------------------------- * Function: fix_ext_filename @@ -499,10 +612,11 @@ static int cklinks(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; + H5O_info2_t oinfo1, oinfo2; + H5L_info2_t linfo; char linkval[LINK_BUF_SIZE]; char filename[NAME_BUF_SIZE]; + int token_cmp; herr_t status; if(new_format) @@ -515,14 +629,15 @@ cklinks(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Hard link */ - if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } /* end if */ - if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + if(H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) FAIL_STACK_ERROR + if(token_cmp) { H5_FAILED(); HDputs(" Hard link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -537,9 +652,9 @@ cklinks(hid_t fapl, hbool_t new_format) status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ H5E_BEGIN_TRY { status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); @@ -551,13 +666,14 @@ cklinks(hid_t fapl, hbool_t new_format) } /* end if */ /* Symbolic link */ - if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } /* end if */ - if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + if(H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) FAIL_STACK_ERROR + if(token_cmp) { H5_FAILED(); HDputs(" Soft link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -573,15 +689,15 @@ cklinks(hid_t fapl, hbool_t new_format) /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); TEST_ERROR } /* end if */ - if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5L_TYPE_SOFT != linfo2.type) { + if(H5Lget_info2(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); TEST_ERROR @@ -600,15 +716,15 @@ cklinks(hid_t fapl, hbool_t new_format) /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); TEST_ERROR } /* end if */ - if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5L_TYPE_SOFT != linfo2.type) { + if(H5Lget_info2(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { H5_FAILED(); HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); TEST_ERROR @@ -635,7 +751,7 @@ cklinks(hid_t fapl, hbool_t new_format) error: return FAIL; -} +} /* end cklinks() */ /*------------------------------------------------------------------------- @@ -652,8 +768,9 @@ static int ck_new_links(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; + H5O_info2_t oi_dset, oi_hard1, oi_hard2; char filename[NAME_BUF_SIZE]; + int token_cmp1, token_cmp2; if(new_format) TESTING("new link queries (w/new group format)") @@ -665,9 +782,9 @@ ck_new_links(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Check hard links */ if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { @@ -675,7 +792,10 @@ ck_new_links(hid_t fapl, hbool_t new_format) HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); TEST_ERROR } - if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { + + if(H5Otoken_cmp(file, &oi_dset.token, &oi_hard1.token, &token_cmp1) < 0) TEST_ERROR + if(H5Otoken_cmp(file, &oi_dset.token, &oi_hard2.token, &token_cmp2) < 0) TEST_ERROR + if(token_cmp1 || token_cmp2) { H5_FAILED(); HDputs(" Hard link test failed. Link seems not to point to the "); HDputs(" expected file location."); @@ -686,11 +806,11 @@ ck_new_links(hid_t fapl, hbool_t new_format) if(H5Fclose(file) < 0) TEST_ERROR PASSED(); - return SUCCEED; + return 0; error: - return FAIL; -} + return -1; +} /* end ck_new_links() */ /*------------------------------------------------------------------------- @@ -920,7 +1040,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) hid_t dset_id = -1; hid_t type_id = -1; hid_t lcpl_id = -1; - H5L_info_t linfo; + H5L_info2_t linfo; char filename[1024]; hsize_t dims[2]; @@ -942,7 +1062,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR /* Create and commit a datatype with the default LCPL */ @@ -951,7 +1071,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Tclose(type_id) < 0) TEST_ERROR /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR /* Create a dataspace */ @@ -964,7 +1084,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Dclose(dset_id) < 0) TEST_ERROR /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR /* Create a link creation property list with the UTF-8 character encoding */ @@ -976,7 +1096,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Create and commit a datatype with the new LCPL */ @@ -985,7 +1105,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Tclose(type_id) < 0) TEST_ERROR /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Create a dataset using the new LCPL */ @@ -993,7 +1113,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Dclose(dset_id) < 0) TEST_ERROR /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Create a new link to the dataset with a different character encoding. */ @@ -1004,35 +1124,35 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR /* Check that its character encoding is ASCII */ - if(H5Lget_info(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR /* Check that the first link's encoding hasn't changed */ - if(H5Lget_info(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Make sure that LCPLs work properly for other API calls: */ /* H5Lcreate_soft */ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* H5Lmove */ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR /* H5Lcopy */ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* H5Lcreate_external */ if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR /* Close open IDs */ @@ -1328,8 +1448,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) hid_t fcpl_id=-1; /* Group creation property list ID */ hid_t lcpl_id=-1; hid_t lcpl2_id=-1; - H5O_info_t oinfo; - H5L_info_t linfo; + H5O_info2_t oinfo; + H5L_info2_t linfo; H5T_cset_t old_cset; int64_t old_corder; /* Creation order value of link */ time_t old_modification_time; @@ -1366,8 +1486,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(H5Gclose(group_id) < 0) TEST_ERROR /* Get the group's link's information */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR old_cset = linfo.cset; if(old_cset != H5T_CSET_UTF8) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1385,8 +1505,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR /* Get the link's character set & modification time . They should be unchanged */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR if(old_cset != linfo.cset) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1394,9 +1514,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Create a new link to the group. It should have a different creation order value but the same modification time */ if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(old_corder == linfo.corder) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 1) TEST_ERROR @@ -1407,9 +1527,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) * should not change. */ if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 2) TEST_ERROR @@ -1418,9 +1538,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Move the link with the default property list. */ if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 3) TEST_ERROR @@ -1428,9 +1548,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR /* Check that the original link is unchanged */ - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(old_corder != linfo.corder) TEST_ERROR if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR @@ -1439,9 +1559,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) * Its creation order value will change, but modification time should not * change. */ if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 4) TEST_ERROR @@ -1450,9 +1570,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Move the link again using the default property list. */ if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR if(linfo.corder != 5) TEST_ERROR @@ -1625,6 +1745,3910 @@ error: } H5E_END_TRY; return 1; } /* end test_deprec() */ + +/*------------------------------------------------------------------------- + * Function: cklinks_deprec + * + * Purpose: Open the file created in the first step and check that the + * links look correct. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +cklinks_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t file; + H5O_info1_t oinfo1, oinfo2; + H5L_info1_t linfo; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; + + if(new_format) + TESTING("link queries using deprecated routines (w/new group format)") + else + TESTING("link queries using deprecated routines") + + /* Open the file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + + /* Hard link */ + if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + H5E_BEGIN_TRY { + status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ + H5E_BEGIN_TRY { + status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ + + /* Symbolic link */ + if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(linkval, "/d1")) { + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + + /* Dangling link */ + H5E_BEGIN_TRY { + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR + } /* end if */ + if(H5Lget_info1(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR + } /* end if */ + if(HDstrcmp(linkval, "foobar")) { + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + + /* Recursive link */ + H5E_BEGIN_TRY { + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR + } /* end if */ + if(H5Lget_info1(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR + } /* end if */ + if(HDstrcmp(linkval, "/grp1/recursive")) { + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + + /* Non-existent link */ + if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR + + /* Cleanup */ + if(H5Fclose(file) < 0) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + return FAIL; +} /* end chklinks_deprec() */ + +/*------------------------------------------------------------------------- + * Function: test_lcpl_deprec + * + * Purpose: Tests Link Creation Property Lists + * + * Return: Success: 0 + * Failure: number of errors + *------------------------------------------------------------------------- + */ +static int +test_lcpl_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t file_id = -1; + hid_t group_id = -1; + hid_t space_id = -1; + hid_t dset_id = -1; + hid_t type_id = -1; + hid_t lcpl_id = -1; + H5L_info1_t linfo; + char filename[1024]; + hsize_t dims[2]; + + if(new_format) + TESTING("link creation property lists using deprecated routines (w/new group format)") + else + TESTING("link creation property lists using deprecated routines") + + /* Actually, intermediate group creation is tested elsewhere (tmisc). + * Here we only need to test the character encoding property */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create and link a group with the default LCPL */ + if((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Check that its character encoding is the default */ + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + + /* Create and commit a datatype with the default LCPL */ + if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type_id) < 0) TEST_ERROR + + /* Check that its character encoding is the default */ + if(H5Lget_info1(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + + /* Create a dataspace */ + dims[0] = H5L_DIM1; + dims[1] = H5L_DIM2; + if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR + + /* Create a dataset using the default LCPL */ + if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + + /* Check that its character encoding is the default */ + if(H5Lget_info1(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + + /* Create a link creation property list with the UTF-8 character encoding */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + + /* Create and link a group with the new LCPL */ + if((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create and commit a datatype with the new LCPL */ + if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info1(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create a dataset using the new LCPL */ + if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info1(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create a new link to the dataset with a different character encoding. */ + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR + + if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that its character encoding is ASCII */ + if(H5Lget_info1(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* Check that the first link's encoding hasn't changed */ + if(H5Lget_info1(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Make sure that LCPLs work properly for other API calls: */ + /* H5Lcreate_soft */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* H5Lmove */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR + if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* H5Lcopy */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* H5Lcreate_external */ + if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Close open IDs */ + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if(H5Sclose(space_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Dclose(dset_id); + H5Tclose(type_id); + H5Pclose(lcpl_id); + H5Sclose(space_id); + H5Fclose(file_id); + } H5E_END_TRY; + return 1; +} /* end test_lcpl_deprec() */ + +/*------------------------------------------------------------------------- + * Function: test_move_preserves_deprec + * + * Purpose: Tests that moving and renaming links preserves their + * properties. + * + * Return: Success: 0 + * Failure: number of errors + *------------------------------------------------------------------------- + */ +static int +test_move_preserves_deprec(hid_t fapl_id, hbool_t new_format) +{ + hid_t file_id=-1; + hid_t group_id=-1; + hid_t fcpl_id=-1; /* Group creation property list ID */ + hid_t lcpl_id=-1; + hid_t lcpl2_id=-1; + H5O_info1_t oinfo; + H5L_info1_t linfo; + H5T_cset_t old_cset; + int64_t old_corder; /* Creation order value of link */ + time_t old_modification_time; + time_t curr_time; + unsigned crt_order_flags; /* Status of creation order info for GCPL */ + char filename[1024]; + + if(new_format) + TESTING("moving and copying links using deprecated routines preserves their properties (w/new group format)") + else + TESTING("moving and copying links using deprecated routines preserves their properties") + + /* Create a file creation property list with creation order stored for links + * in the root group + */ + if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR + if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != 0) TEST_ERROR + if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR + if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != H5P_CRT_ORDER_TRACKED) TEST_ERROR + + /* Create file */ + /* (with creation order tracking for the root group) */ + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) TEST_ERROR + + /* Create a link creation property list with the UTF-8 character encoding */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + + /* Create a group with that lcpl */ + if((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Get the group's link's information */ + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + old_cset = linfo.cset; + if(old_cset != H5T_CSET_UTF8) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + old_corder = linfo.corder; + if(old_corder != 0) TEST_ERROR + old_modification_time = oinfo.mtime; + + /* If this test happens too quickly, the times will all be the same. Make sure the time changes. */ + curr_time = HDtime(NULL); + while(HDtime(NULL) <= curr_time) + ; + + /* Close the file and reopen it */ + if(H5Fclose(file_id) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR + + /* Get the link's character set & modification time . They should be unchanged */ + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(old_cset != linfo.cset) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(old_corder != linfo.corder) TEST_ERROR + + /* Create a new link to the group. It should have a different creation order value but the same modification time */ + if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(old_corder == linfo.corder) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 1) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* Copy the first link to a UTF-8 name. + * Its creation order value should be different, but modification time + * should not change. + */ + if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 2) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the link with the default property list. */ + if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 3) TEST_ERROR + + /* Check that its character encoding is not UTF-8 */ + if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR + + /* Check that the original link is unchanged */ + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(old_corder != linfo.corder) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the first link to a UTF-8 name. + * Its creation order value will change, but modification time should not + * change. */ + if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 4) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the link again using the default property list. */ + if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info1(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 5) TEST_ERROR + + /* Check that its character encoding is not UTF-8 */ + if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR + + /* Close open IDs */ + if(H5Pclose(fcpl_id) < 0) TEST_ERROR + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return 1; +} /* end test_move_preserves_deprec() */ + +/*------------------------------------------------------------------------- + * Function: external_link_root_deprec + * + * Purpose: Build a file with external link to root group in external file + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +external_link_root_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info1_t linfo; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + const char *file; /* File from external link */ + const char *path; /* Path from external link */ + + if(new_format) + TESTING("external link to root using deprecated routines (w/new group format)") + else + TESTING("external link to root using deprecated routines") + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + + /* Create file to point to */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that external links are registered with the library */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + + /* Create file with link to first file */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create external link to object in first file */ + if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check information for external link */ + if(H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5L_TYPE_EXTERNAL != linfo.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; + } + if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } + if(HDstrcmp(path, "/")) { + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; + } + + /* Create external link to object in first file */ + /* (add a few extra '/'s to make certain library normalizes external link object names) */ + if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check information for external link */ + if(H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5L_TYPE_EXTERNAL != linfo.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; + } + if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } + if(HDstrcmp(path, "/")) { + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; + } + + /* Close and re-open file to ensure that data is written to disk */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/")) TEST_ERROR + + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR + + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create a new object using H5Gcreate2 through the external link + * directly + */ + if((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close file and group */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); + + /* Open first file again with read-only access and check on objects created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open objects created through external link */ + if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check names */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/new_group")) TEST_ERROR + if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/newer_group")) TEST_ERROR + + /* Close opened objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); + + /* Verify that new objects can't be created through a read-only external + * link. + */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + H5E_BEGIN_TRY { + gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY + if(gid >= 0) TEST_ERROR + + /* Close second file again */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return FAIL; +} /* end external_link_root_deprec() */ + +/*------------------------------------------------------------------------- + * Function: external_link_query_deprec + * + * Purpose: Query file & object names for external links, as well as + * information from H5Gget_obj_info + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +external_link_query_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + const char *file_name; /* Name of the file the external link points to */ + const char *object_name; /* Name of the object the external link points to */ + H5O_info1_t oi; /* Object information */ + H5L_info1_t li; /* Link information */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ + + if(new_format) + TESTING("query aspects of external link using deprecated routines (w/new group format)") + else + TESTING("query aspects of external link using deprecated routines") + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + + /* Create first file, with external link to object in second file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create external link */ + /* (add a few extra '/'s to make certain library normalizes external link object names) */ + if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get size of buffer for external link */ + if(H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR + if (H5L_TYPE_EXTERNAL != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; + } + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Get size of buffer for external link */ + if(H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR + if(H5L_TYPE_EXTERNAL != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; + } + + /* Get information for external link. It should be two strings right after each other */ + if(H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + + /* Extract the file and object names from the buffer */ + if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0) TEST_ERROR + + /* Compare the file and object names */ + if(HDstrcmp(file_name, filename2)) TEST_ERROR + if(HDstrcmp(object_name, "/dst")) TEST_ERROR + + /* Query information about object that external link points to */ + if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_GROUP != oi.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; + } + + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Make sure that passing in NULLs to H5Lunpack_elink_val works */ + if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0) TEST_ERROR + + /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */ + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end external_link_query_deprec() */ + +/*------------------------------------------------------------------------- + * Function: external_link_closing_deprec + * + * Purpose: Test that files are closed correctly when traversing + * external links. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +external_link_closing_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4=(-1); + hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); + hid_t lcpl_id=(-1); + hsize_t dims[2]; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ + H5L_info1_t li; + H5O_info1_t oi; + hobj_ref_t obj_ref; + + if(new_format) + TESTING("that external files are closed during traversal (w/new group format)") + else + TESTING("that external files are closed during traversal") + + /* In this test, external links will go from file1 to file2 and from + * file2 to file3. + * Test that all functions that can traverse external files close + * the files they open. + * Test that providing unusual paths containing external links can't + * make HDF5 forget to close a file it opened. + */ + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3); + h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4); + + /* Create four files */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */ + dims[0] = 2; + dims[1] = 2; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + + /* Create external links from each file to the next */ + if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close all files but the first */ + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Test creating each kind of object */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test that getting info works */ + if(H5Lget_info1(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Test move */ + if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, + "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Open file 4 so we can do some fancy things */ + if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid1, "elink/elink/elink/type1", fid4, + "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid4, "dataset1", fid1, + "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file 4 again */ + if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR + + /* Test copy (as of this test, it uses the same code as move) */ + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Test H5Gset and get comment */ + if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(buf, "comment")) TEST_ERROR + + /* Test H5*open */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5*open2 */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5Oopen */ + if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test H5Fmount */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR + } H5E_END_TRY + + /* Test H5Rcreate */ + if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR + + /* Test unlink */ + if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR + + /* We've tested that the various functions above don't leave files open. + * Now test that we can't confuse HDF5 by giving unusual paths with external links + */ + /* Create an external link that points to another external link */ + if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/elink", fid2, "elink2", + H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Do an external link traversal that recursively calls another external link. */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create two more groups so that the last three elements in the path are + * all within the same external file + */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Add a few regular groups and a soft link in file2 using intermediate group creation */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR + if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", + lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Try to traverse this path. There are three soft traversals in a row; + * slink points to (file2)/elink2, which points to (file3)/elink, which + * points to file 4. + */ + if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + + /* Some simpler tests */ + if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info1(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + + + /* Close file1, the only file that should still be open */ + if(H5Fclose(fid1) < 0) TEST_ERROR + + /* Re-create each file. If they are hanging open, these creates will fail */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Cleanup */ + if(H5Sclose(sid) < 0) TEST_ERROR + if(H5Tclose(tid2) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Tclose(tid); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid2); + H5Fclose(fid4); + H5Fclose(fid3); + H5Fclose(fid2); + H5Fclose(fid1); + } H5E_END_TRY; + return FAIL; +} /* external_link_closing_deprec() */ + +/* Callback functions for UD hard links. */ +/* UD_hard_create increments the object's reference count */ +static herr_t +UD_hard_create_deprec(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata, + size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) +{ + haddr_t addr; + hid_t target_obj = -1; + herr_t ret_value = 0; + + if(udata_size != sizeof(haddr_t)) { + ret_value = -1; + goto done; + } /* end if */ + + addr = *((const haddr_t *)udata); + + /* Open the object this link points to */ + target_obj= H5Oopen_by_addr(loc_group, addr); + if(target_obj < 0) { + ret_value = -1; + goto done; + } /* end if */ + + /* Increment the reference count of the target object */ + if(H5Oincr_refcount(target_obj) < 0) { + ret_value = -1; + goto done; + } /* end if */ + +done: + /* Close the target object if we opened it */ + if(target_obj >= 0) { + switch(H5Iget_type(target_obj)) { + case H5I_GROUP: + if(H5Gclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATASET: + if(H5Dclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATATYPE: + if(H5Tclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_MAP: + /* TODO: Not supported in native file format yet */ + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + 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_SPACE_SEL_ITER: + case H5I_NTYPES: + default: + return FAIL; + } /* end switch */ + } /* end if */ + + return ret_value; +} /* end UD_hard_create() */ + +/* Traverse a hard link by opening the object */ +static hid_t +UD_hard_traverse_deprec(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, + const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) +{ + haddr_t addr; + hid_t ret_value = -1; + + if(udata_size != sizeof(haddr_t)) + return FAIL; + + addr = *((const haddr_t *) udata); + + ret_value = H5Oopen_by_addr(cur_group, addr); /* If this fails, our return value will be negative. */ + + return ret_value; +} /* end UD_hard_traverse() */ + +/* UD_hard_delete decrements the object's reference count */ +static herr_t +UD_hard_delete_deprec(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata, + size_t udata_size) +{ + haddr_t addr; + hid_t target_obj = -1; + herr_t ret_value = 0; + + if(udata_size != sizeof(haddr_t)) { + ret_value = -1; + goto done; + } /* end if */ + + addr = *((const haddr_t *) udata); + + /* Open the object this link points to */ + target_obj= H5Oopen_by_addr(file, addr); + if(target_obj < 0) { + ret_value = -1; + goto done; + } /* end if */ + + /* Decrement the reference count of the target object */ + if(H5Odecr_refcount(target_obj) < 0) { + ret_value = -1; + goto done; + } /* end if */ + +done: + /* Close the target object if we opened it */ + if(target_obj >= 0) { + switch(H5Iget_type(target_obj)) { + case H5I_GROUP: + if(H5Gclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATASET: + if(H5Dclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATATYPE: + if(H5Tclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_MAP: + /* TODO: Not supported in native file format yet */ + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + 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_SPACE_SEL_ITER: + case H5I_NTYPES: + default: + return FAIL; + } /* end switch */ + } /* end if */ + + return ret_value; +} /* end UD_hard_delete() */ + +static int +ud_hard_links_deprec(hid_t fapl) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info1_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + h5_stat_size_t empty_size; /* Size of an empty file */ + char filename[NAME_BUF_SIZE]; + + TESTING("user-defined hard link using deprecated routines (w/new group format)") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Get the size of the empty file for reference */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Check that external links are registered and UD hard links are not */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + + /* Register "user-defined hard links" with the library */ + if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR + + /* Check that UD hard links are now registered */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + + /* Create a group for the UD hard link to point to */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Get address for the group to give to the hard link */ + if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create a user-defined "hard link" to the group using the address we got + * from H5Lget_info1 */ + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close and re-open file to ensure that data is written to disk */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Open group through UD link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/group")) TEST_ERROR + + /* Create object in group */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close groups*/ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Re-open group without using ud link to check that it was created properly */ + if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR + + /* Close opened object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Check that H5Lget_objinfo works on the hard link */ + if(H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* UD hard links have no query function, thus return a "link length" of 0 */ + if(li.u.val_size != 0) TEST_ERROR + if(UD_HARD_TYPE != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; + } /* end if */ + + /* Unlink the group pointed to by the UD link. It shouldn't be + * deleted because of the UD link. */ + if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Ensure we can open the group through the UD link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Unlink the group contained within it. */ + if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Now delete the UD link. This should cause the group to be + * deleted, too. */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + /* The file should be empty again. */ + if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR + + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end ud_hard_links_deprec() */ + +static int +ud_link_reregister_deprec(hid_t fapl) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info1_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + h5_stat_size_t empty_size; /* Size of an empty file */ + + TESTING("registering a new class for existing UD links using deprecated routines (w/new group format)") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Get the size of the empty file for reference */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR + + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Check that UD hard links are not registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + + /* Register "user-defined hard links" with the library */ + if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR + + /* Check that UD hard links are registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + + /* Point a UD defined hard link to a group in the same way as the previous test */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Create a group named REREG_TARGET_NAME in the same group as the ud link */ + if((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Now unregister UD hard links */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR + + /* Check that UD hard links are no longer registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + + /* Verify that we can't traverse the ud link anymore */ + H5E_BEGIN_TRY { + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR + } H5E_END_TRY + + /* Verify that we can't create any new links of this type */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR + } H5E_END_TRY + + /* Register a new kind of link with the same ID number */ + if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR + + /* Check that UD hard links are registered again */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + + /* Open a group through the ud link (now a different class of link). + * It should be a different group + * than the UD hard link pointed to */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/" REREG_TARGET_NAME)) TEST_ERROR + + /* Create object in group */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close groups*/ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Re-open group without using ud link to check that it was created properly */ + if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR + + /* Close opened object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Unlink the group pointed to by the UD hard link. It shouldn't be + * deleted because the UD link incremented its reference count. */ + if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* What a mess! Re-register user-defined links to clean up the + * reference counts. We shouldn't actually need to unregister the + * other link type */ + if(H5Lregister(UD_hard_class_deprec) < 0) FAIL_STACK_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR + + /* Ensure we can open the group through the UD link (now that UD hard + * links have been registered) */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Delete the UD hard link. This should cause the group to be + * deleted, too. */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Unlink the other two groups so that we can make sure the file is empty */ + if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + /* The file should be empty again. */ + if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR + + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end ud_link_reregister_deprec() */ + +static int +ud_callbacks_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t lcpl = -1; /* Link Creation PL */ + H5L_info1_t li; /* Link information */ + char ud_target_name[] = UD_CB_TARGET; /* Link target name */ + char filename[NAME_BUF_SIZE]; + char query_buf[NAME_BUF_SIZE]; + + if(new_format) + TESTING("user-defined link callbacks using deprecated routines (w/new group format)") + else + TESTING("user-defined link callbacks using deprecated routines") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Check that registered link classes are, and unregistered ones aren't */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE) TEST_ERROR + + /* Hit two birds with one stone: register UD hard links from previous + * test to check that having two UD links registered at once presents + * no problems. */ + if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR + + /* Register user-defined link class. This is the one we'll actually be using. */ + if(H5Lregister(UD_cb_class) < 0) TEST_ERROR + + /* Check that registered link classes are, and unregistered ones aren't */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE) TEST_ERROR + + /* Create a group for the UD link to point to */ + if((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create a user-defined link to the group. These UD links behave like soft links. */ + if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Try opening group through UD link */ + if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Query the link to test its query callback */ + if(H5Lget_info1(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; + } + + /* Fill the query buffer */ + if(H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR + + /* Move the link */ + if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Re-open group to ensure that move worked */ + if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* Remove UD link */ + if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Test that the callbacks don't work if the link class is not registered */ + + /* Create a new link. Just for fun, give it a non-default character + * encoding (to test that LAPLs work) */ + if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR + if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) FAIL_STACK_ERROR + if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR + + /* Check its character encoding */ + if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Unregister the link class so the library forgets what its callbacks do */ + if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) FAIL_STACK_ERROR + + /* Now test that each of the callbacks fails */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + } H5E_END_TRY + + /* The query callback should NOT fail, but should be unable to give a linklen */ + if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.u.val_size != 0) TEST_ERROR + if(li.type != UD_CB_TYPE) TEST_ERROR + + /* Unregister the UD hard links */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose (lcpl); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return FAIL; +} /* end ud_callbacks_deprec() */ + +/*------------------------------------------------------------------------- + * Function: lapl_nlinks_deprec + * + * Purpose: Check that the maximum number of soft links can be adjusted + * by the user using the Link Access Property List. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +lapl_nlinks_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t plist = -1; /* lapl ID */ + hid_t tid = -1, sid = -1, did = -1; /* Other IDs */ + hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + size_t nlinks; /* nlinks for H5Pset_nlinks */ + hsize_t dims[2]; + + if(new_format) + TESTING("adjusting nlinks with LAPL using deprecated routines (w/new group format)") + else + TESTING("adjusting nlinks with LAPL using deprecated routines") + + /* Make certain test is valid */ + /* XXX: should probably make a "generic" test that creates the proper + * # of links based on this value - QAK + */ + HDassert(H5L_NUM_LINKS == 16); + + /* Create file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group with short name in file (used as target for links) */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create chain of soft links to existing object (limited) */ + if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Open file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Create LAPL with higher-than-usual nlinks value */ + /* Create a non-default lapl with udata set to point to the first group */ + if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + nlinks = 20; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Ensure that nlinks was set successfully */ + nlinks = 0; + if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR + if(nlinks != 20) TEST_ERROR + + /* Open object through what is normally too many soft links using + * new property list */ + if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft17")) TEST_ERROR + + /* Create group using soft link */ + if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close groups */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Set nlinks to a smaller number */ + nlinks = 4; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Ensure that nlinks was set successfully */ + nlinks = 0; + if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR + if(nlinks != 4) TEST_ERROR + + /* Try opening through what is now too many soft links */ + H5E_BEGIN_TRY { + 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; + } + + /* Open object through lesser soft link */ + if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft4")) TEST_ERROR + + /* Test other functions that should use a LAPL */ + nlinks = 20; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Try copying and moving when both src and dst contain many soft links + * using a non-default LAPL + */ + if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Olink */ + if(H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Lcreate_hard and H5Lcreate_soft */ + if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Ldelete */ + if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR + + /* H5Lget_val and H5Lget_info1 */ + if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR + if(H5Lget_info1(fid, "soft17", NULL, plist) < 0) TEST_ERROR + + /* H5Lcreate_external and H5Lcreate_ud */ + if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR + if(H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* Close plist */ + if(H5Pclose(plist) < 0) TEST_ERROR + + /* Create a datatype and dataset as targets inside the group */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + + dims[0] = 2; + dims[1] = 2; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR + if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Close group */ + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Try to open the objects using too many symlinks with default *APLs */ + H5E_BEGIN_TRY { + if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + } H5E_END_TRY + + /* Create property lists with nlinks set */ + if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0) TEST_ERROR + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR + + nlinks = 20; + if(H5Pset_nlinks(gapl, nlinks) < 0) TEST_ERROR + if(H5Pset_nlinks(tapl, nlinks) < 0) TEST_ERROR + if(H5Pset_nlinks(dapl, nlinks) < 0) TEST_ERROR + + /* We should now be able to use these property lists to open each kind + * of object. + */ + if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR + if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Close plists */ + if(H5Pclose(gapl) < 0) TEST_ERROR + if(H5Pclose(tapl) < 0) TEST_ERROR + if(H5Pclose(dapl) < 0) TEST_ERROR + + /* Unregister UD hard link class */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gapl); + H5Pclose(dapl); + H5Pclose(tapl); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(plist); + H5Fclose(fid); + } H5E_END_TRY; + return FAIL; +} /* end lapl_nlinks_deprec() */ + +/*------------------------------------------------------------------------- + * Function: linkinfo_deprec + * + * Purpose: Check that the link class is returned correctly when queried. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +linkinfo_deprec(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t tid = -1; /* Type ID */ + hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ + H5L_info1_t li; /* Link information */ + char filename[NAME_BUF_SIZE]; + + if(new_format) + TESTING("link type field in H5Lget_info using deprecated routines (w/new group format)") + else + TESTING("link type field in H5Lget_info using deprecated routines") + + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Register a couple of user-defined link classes with the library */ + if(H5Lregister(UD_plist_class) < 0) TEST_ERROR + + /* Create an object of each type */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close all objects */ + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Make sure that link type is correct when objects are queried */ + if(H5Lget_info1(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + if(H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + + if(H5Lget_info1(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR + if(H5Lget_info1(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_SOFT) TEST_ERROR + if(H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != UD_PLIST_TYPE) TEST_ERROR + + /* Ensure that passing a NULL pointer doesn't cause an error */ + if(H5Lget_info1(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR + + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Tclose (tid); + H5Dclose (did); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return FAIL; +} /* end linkinfo_deprec() */ + +/*------------------------------------------------------------------------- + * Function: corder_create_compact_deprec + * + * Purpose: Create a group with creation order indices and insert links + * in it when in compact form + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +corder_create_compact_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned nlinks; /* Number of link messages in group's header */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + unsigned u; /* Local index variable */ + + TESTING("creating compact group with creation order indexing using deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check on group's initial status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Create several links, but keep group in compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (u + 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != max_compact) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Loop through links, checking their creation order values */ + /* (the name index is used, but the creation order value is in the same order) */ + for(u = 0; u < max_compact; u++) { + H5L_info1_t linfo; /* Link information */ + + /* Retrieve information for link */ + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify creation order of link */ + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != u) TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end corder_create_compact_deprec() */ + +/*------------------------------------------------------------------------- + * Function: corder_create_dense_deprec + * + * Purpose: Create a group with creation order indices and insert links + * in it until it's in dense form + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +corder_create_dense_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned nlinks; /* Number of link messages in group's header */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + unsigned u; /* Local index variable */ + + TESTING("creating dense group with creation order indexing using deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check on group's initial status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (u + 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ + + /* Create another link, to push group into dense form */ + HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Loop through links, checking their creation order values */ + /* (the name index is used, but the creation order value is in the same order) */ + for(u = 0; u < (max_compact + 1); u++) { + H5L_info1_t linfo; /* Link information */ + + /* Retrieve information for link */ + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify creation order of link */ + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != u) TEST_ERROR + } /* end for */ + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end corder_create_dense_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_info_by_idx_check_deprec + * + * Purpose: Support routine for link_info_by_idx, to verify the link + * info is correct for a link + * + * Note: This routine assumes that the links have been inserted in the + * group in alphabetical order. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n, + hbool_t hard_link, hbool_t use_index) +{ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ + H5L_info1_t linfo; /* Link info struct */ + + /* Make link value for increasing/native order queries */ + HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n); + + /* Verify the link information for first link, in increasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in increasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in increasing creation order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in increasing creation order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Don't test "native" order if there is no creation order index, since + * there's not a good way to easily predict the link's order in the name + * index. + */ + if(use_index) { + /* Verify the link information for first link, in native creation order (which is increasing) */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in native creation order (which is increasing) */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in native creation order (which is increasing) */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in native creation order (which is increasing) */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + } /* end if */ + + /* Verify the link information for first link, in decreasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in decreasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in decreasing creation order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in decreasing creation order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + + /* Verify the link information for first link, in increasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in increasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in increasing link name order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in increasing link name order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Don't test "native" order queries on link name order, since there's not + * a good way to easily predict the order of the links in the name index. + */ + + /* Verify the link information for first link, in decreasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in decreasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in decreasing link name order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ + + /* Verify the name for new link, in decreasing link name order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Success */ + return(0); + +error: + /* Failure */ + return(-1); +} /* end link_info_by_idx_check_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_info_by_idx_deprec + * + * Purpose: Create a group with creation order indices and test querying + * info by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_info_by_idx_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned hard_link; /* Create hard or soft link? */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + H5L_info1_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char filename[NAME_BUF_SIZE];/* File name */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + ssize_t name_len; /* Length of name */ + herr_t ret; /* Generic return value */ + + /* Loop over creating hard or soft links */ + for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + if(hard_link) { + if(use_index) + TESTING("querying info by index w/creation order index, using hard links and deprecated routines") + else + TESTING("querying info by index w/o creation order index, using hard links and deprecated routines") + } /* end if */ + else { + if(use_index) + TESTING("querying info by index w/creation order index, using soft links and deprecated routines") + else + TESTING("querying info by index w/o creation order index, using soft links and deprecated routines") + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Check for query on empty group */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + hid_t group_id2; /* Group ID */ + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound offset queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + hid_t group_id2; /* Group ID */ + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + + /* Verify state of group */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Check for out of bound offset queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end link_info_by_idx_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_info_by_idx_old_deprec + * + * Purpose: Create a old-format group and test querying + * info by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_info_by_idx_old_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + unsigned hard_link; /* Create hard or soft link? */ + H5L_info1_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char filename[NAME_BUF_SIZE];/* File name */ + haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ + unsigned u; /* Local index variable */ + ssize_t name_len; /* Length of name */ + herr_t ret; /* Generic return value */ + + /* Loop over creating hard or soft links */ + for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { + if(hard_link) + TESTING("querying info by index in old-style group, using hard links and deprecated routines") + else + TESTING("querying info by index in old-style group, using soft links and deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group to operate on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + H5O_info1_t oi; /* Buffer for querying object's info */ + + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; + + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + } /* end for */ + + /* Verify link information for created links */ + for(u = 0; u < CORDER_NLINKS; u++) { + unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */ + + /* Make link name for increasing/native order queries */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Make link value for increasing/native order queries */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Verify link information (in increasing order) */ + if(hard_link) { + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ + + /* Verify link name (in increasing order) */ + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR + + + /* Verify link information (in native order - native is increasing) */ + if(hard_link) { + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ + + /* Verify link name (in native order - native is increasing) */ + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR + + + /* Make link name for decreasing order queries */ + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + + /* Make link value for decreasing order queries */ + HDsnprintf(valname, sizeof(valname), "value %02u", dec_u); + + /* Verify link information (in decreasing order) */ + if(hard_link) { + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ + + /* Verify link name (in decreasing order) */ + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Check for creation order index queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end link_info_by_idx_old_deprec() */ + +/*------------------------------------------------------------------------- + * Function: delete_by_idx_deprec + * + * Purpose: Create a group with creation order indices and test deleting + * links by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +delete_by_idx_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + H5L_info1_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("deleting links by creation order index in increasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by creation order index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else { + if(use_index) + TESTING("deleting links by creation order index in decreasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by creation order index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("deleting links by name index in increasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by name index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else { + if(use_index) + TESTING("deleting links by name index in decreasing order w/creation order index using deprecated routines") + else + TESTING("deleting links by name index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Delete links from one end */ + + /* Check for deletion on empty group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for deletion on non-existing group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links from compact group */ + for(u = 0; u < (max_compact - 1); u++) { + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != (u + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != (max_compact - (u + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(u = 0; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group (dense) */ + if(u >= max_compact) + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Check for out of bound deletion again */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links from dense group, in appropriate order */ + for(u = 0; u < ((max_compact * 2) - 1); u++) { + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != (u + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Check for deletion on empty group again */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links in middle */ + + /* Create more links, to push group into dense form */ + for(u = 0; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group (dense) */ + if(u >= max_compact) + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Delete every other link from dense group, in appropriate order */ + for(u = 0; u < max_compact; u++) { + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for current link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != ((u * 2) + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for current link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete remaining links from dense group, in appropriate order */ + for(u = 0; u < (max_compact - 1); u++) { + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != ((u * 2) + 3)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + } /* end for */ + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return FAIL; +} /* end delete_by_idx_deprec() */ + +/*------------------------------------------------------------------------- + * Function: delete_by_idx_old_deprec + * + * Purpose: Create a old-format group and test deleting + * links by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +delete_by_idx_old_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + H5L_info1_t linfo; /* Link info struct */ + H5_iter_order_t order; /* Order within in the index */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + /* Print test banner */ + if(order == H5_ITER_INC) + TESTING("deleting links by index in increasing order in old-style group using deprecated routines") + else + TESTING("deleting links by index in decreasing order in old-style group using deprecated routines") + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group to operate on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Delete links from one end */ + + /* Check for deletion in empty group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + H5O_info1_t oi; /* Buffer for querying object's info */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; + + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Check for bad index type deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for out of bounds deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links, in appropriate order */ + for(u = 0; u < (CORDER_NLINKS - 1); u++) { + unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */ + + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check for deletion in empty group (again) */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Delete links in middle */ + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + H5O_info1_t oi; /* Buffer for querying object's info */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; + + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Delete every other link from group, in appropriate order */ + for(u = 0; u < (CORDER_NLINKS / 2); u++) { + unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */ + + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for current link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for current link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete remaining links from group, in appropriate order */ + for(u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) { + unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */ + + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + + return FAIL; +} /* end delete_by_idx_old_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_deprec_cb + * + * Purpose: Callback routine for iterating over links in group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info, + void *_op_data) +{ + link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ + char objname[NAME_BUF_SIZE]; /* Object name */ + H5L_info1_t my_info; /* Local link info */ + + /* Increment # of times the callback was called */ + op_data->ncalled++; + + /* Get the link information directly to compare */ + if(H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + return H5_ITER_ERROR; + + /* Check more things for link iteration (vs. group iteration) */ + if(info) { + /* Check for correct order of iteration */ + /* (if we are operating in increasing or decreasing order) */ + if(op_data->order != H5_ITER_NATIVE) + if(info->corder != op_data->curr) + return H5_ITER_ERROR; + + /* Compare link info structs */ + if(info->type != my_info.type) + return H5_ITER_ERROR; + if(info->corder_valid != my_info.corder_valid) + return H5_ITER_ERROR; + if(info->corder != my_info.corder) + return H5_ITER_ERROR; + if(info->cset != my_info.cset) + return H5_ITER_ERROR; + if(H5F_addr_ne(info->u.address, my_info.u.address)) + return H5_ITER_ERROR; + } /* end if */ + + /* Verify name of link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); + if(HDstrcmp(link_name, objname)) + return H5_ITER_ERROR; + + /* Check if we've visited this link before */ + if((size_t)op_data->curr >= op_data->max_visit) + return H5_ITER_ERROR; + if(op_data->visited[op_data->curr]) + return H5_ITER_ERROR; + op_data->visited[op_data->curr] = TRUE; + + /* Advance to next value, in correct direction */ + if(op_data->order != H5_ITER_DEC) + op_data->curr++; + else + op_data->curr--; + + /* Check for stopping in the middle of iterating */ + if(op_data->stop > 0) + if(--op_data->stop == 0) + return CORDER_ITER_STOP; + + return H5_ITER_CONT; +} /* end link_iterate_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: group_iterate_deprec_cb + * + * Purpose: Callback routine for iterating over links in group with + * H5Giterate() + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +group_iterate_deprec_cb(hid_t group_id, const char *link_name, void *_op_data) +{ + return link_iterate_deprec_cb(group_id, link_name, NULL, _op_data); +} /* end group_iterate_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_fail_deprec_cb + * + * Purpose: Callback routine for iterating over links in group that + * always returns failure + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_fail_deprec_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, + const H5L_info1_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) +{ + return H5_ITER_ERROR; +} /* end link_iterate_fail_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_check_deprec + * + * Purpose: Check iteration over links in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_check_deprec(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, + unsigned max_links, link_iter_info_t *iter_info) +{ + unsigned v; /* Local index variable */ + hsize_t skip; /* # of links to skip in group */ + int gskip; /* # of links to skip in group, with H5Giterate */ + herr_t ret; /* Generic return value */ + + /* Iterate over links in group */ + iter_info->nskipped = (unsigned)(skip = 0); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Iterate over links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Skip over some links in group */ + iter_info->nskipped = (unsigned)(skip = max_links / 2); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Skip over some links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Iterate over links in group, stopping in the middle */ + iter_info->nskipped = (unsigned)(skip = 0); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Iterate over links in group, stopping in the middle, with H5Giterate() */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Check for iteration routine indicating failure */ + skip = 0; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_fail_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end link_iterate_check_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_deprec + * + * Purpose: Create a group with creation order indices and test iterating over + * links by index. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Tuesday, November 14, 2006 + * + *------------------------------------------------------------------------- + */ +static int +link_iterate_deprec(hid_t fapl) +{ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + link_iter_info_t iter_info; /* Iterator info */ + hbool_t *visited = NULL; /* Array of flags for visiting links */ + hsize_t skip; /* # of links to skip in group */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Allocate the "visited link" array */ + iter_info.max_visit = max_compact * 2; + if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR + iter_info.visited = visited; + + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("iterating over links by creation order index in increasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by creation order index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("iterating over links by creation order index in decreasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by creation order index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("iterating over links by creation order index in native order w/creation order index using deprecated routines") + else + TESTING("iterating over links by creation order index in native order w/o creation order index using deprecated routines") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("iterating over links by name index in increasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by name index in increasing order w/o creation order index using deprecated routines") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("iterating over links by name index in decreasing order w/creation order index using deprecated routines") + else + TESTING("iterating over links by name index in decreasing order w/o creation order index using deprecated routines") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("iterating over links by name index in native order w/creation order index using deprecated routines") + else + TESTING("iterating over links by name index in native order w/o creation order index using deprecated routines") + } /* end else */ + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check for iteration on empty group */ + /* (should be OK) */ + if(H5Literate1(group_id, idx_type, order, NULL, link_iterate_deprec_cb, NULL) < 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound iteration on compact group */ + skip = (hsize_t)u; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Test iteration over links in compact group */ + if(link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (dense) */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Check for out of bound iteration on dense group */ + skip = (hsize_t)u; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Test iteration over links in dense group */ + if(link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR + + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + } /* end for */ + } /* end for */ + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Free resources */ + if(visited) + HDfree(visited); + + return SUCCEED; + +error: + /* Free resources */ + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + + if(visited) + HDfree(visited); + + return FAIL; +} /* end link_iterate_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_old_deprec_cb + * + * Purpose: Callback routine for iterating over [old] links in group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_old_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info, void *_op_data) +{ + link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ + char objname[NAME_BUF_SIZE]; /* Object name */ + H5L_info1_t my_info; /* Local link info */ + + /* Increment # of times the callback was called */ + op_data->ncalled++; + + /* Get the link information directly to compare */ + if(H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + return H5_ITER_ERROR; + + /* Check more things for link iteration (vs. group iteration) */ + if(info) { + /* Compare link info structs */ + if(info->type != my_info.type) + return H5_ITER_ERROR; + if(info->corder_valid != my_info.corder_valid) + return H5_ITER_ERROR; + if(info->corder != my_info.corder) + return H5_ITER_ERROR; + if(info->cset != my_info.cset) + return H5_ITER_ERROR; + if(H5F_addr_ne(info->u.address, my_info.u.address)) + return H5_ITER_ERROR; + } /* end if */ + + /* Verify name of link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); + if(HDstrcmp(link_name, objname)) + return H5_ITER_ERROR; + + /* Check if we've visited this link before */ + if((size_t)op_data->curr >= op_data->max_visit) + return H5_ITER_ERROR; + if(op_data->visited[op_data->curr]) + return H5_ITER_ERROR; + op_data->visited[op_data->curr] = TRUE; + + /* Advance to next value, in correct direction */ + if(op_data->order != H5_ITER_DEC) + op_data->curr++; + else + op_data->curr--; + + /* Check for stopping in the middle of iterating */ + if(op_data->stop > 0) + if(--op_data->stop == 0) + return CORDER_ITER_STOP; + + return H5_ITER_CONT; +} /* end link_iterate_old_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: group_iterate_old_deprec_cb + * + * Purpose: Callback routine for iterating over links in group with + * H5Giterate() + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +group_iterate_old_deprec_cb(hid_t group_id, const char *link_name, void *_op_data) +{ + return link_iterate_old_deprec_cb(group_id, link_name, NULL, _op_data); +} /* end group_iterate_old_deprec_cb() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_old_check_deprec + * + * Purpose: Check iteration over [old] links in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_old_check_deprec(hid_t group_id, H5_iter_order_t order, unsigned max_links, link_iter_info_t *iter_info) +{ + unsigned v; /* Local index variable */ + hsize_t skip; /* # of links to skip in group */ + int gskip; /* # of links to skip in group, with H5Giterate */ + herr_t ret; /* Generic return value */ + + /* Iterate over links in group */ + iter_info->nskipped = (unsigned)(skip = 0); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Iterate over links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + + /* Skip over some links in group */ + iter_info->nskipped = (unsigned)(skip = max_links / 2); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Skip over some links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); + iter_info->order = order; + iter_info->stop = -1; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if(H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR + + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ + + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; + + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ + + /* Iterate over links in group, stopping in the middle */ + iter_info->nskipped = (unsigned)(skip = 0); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Iterate over links in group, stopping in the middle, with H5Giterate() */ + iter_info->nskipped = (unsigned)(gskip = 0); + iter_info->order = order; + iter_info->stop = 3; + iter_info->ncalled = 0; + iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); + HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); + if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info)) < 0) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR + + /* Check for iteration routine indicating failure */ + skip = 0; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for iteration w/bad location ID */ + skip = 0; + H5E_BEGIN_TRY { + ret = H5Literate1((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + H5E_BEGIN_TRY { + ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_deprec_cb, iter_info); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end link_iterate_old_check_deprec() */ + +/*------------------------------------------------------------------------- + * Function: link_iterate_old_deprec + * + * Purpose: Create a "old-style" group and test iterating over links by index. + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +link_iterate_old_deprec(hid_t fapl) +{ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + H5_iter_order_t order; /* Order within in the index */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + link_iter_info_t iter_info; /* Iterator info */ + hbool_t *visited = NULL; /* Array of flags for visiting links */ + hsize_t skip; /* # of links to skip in group */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Allocate the "visited link" array */ + iter_info.max_visit = CORDER_NLINKS; + if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR + iter_info.visited = visited; + + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + /* Print appropriate test message */ + if(order == H5_ITER_INC) { + TESTING("iterating over links by name index in increasing order in old-style group using deprecated routines") + } /* end if */ + else if(order == H5_ITER_DEC) { + TESTING("iterating over links by name index in decreasing order in old-style group using deprecated routines") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + TESTING("iterating over links by name index in native order in old-style group using deprecated routines") + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Check for iteration on empty group */ + /* (should be OK) */ + if(H5Literate1(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_deprec_cb, NULL) < 0) TEST_ERROR + + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (symbol table) */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Check for out of bound iteration on old-style group */ + skip = (hsize_t)u; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for iteration on creation order */ + /* (should fail) */ + skip = (hsize_t)0; + H5E_BEGIN_TRY { + ret = H5Literate1(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_deprec_cb, NULL); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Test iteration over links in group */ + if(link_iterate_old_check_deprec(group_id, order, u, &iter_info) < 0) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + + /* Free resources */ + if(visited) + HDfree(visited); + + return SUCCEED; + +error: + /* Free resources */ + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + + if(visited) + HDfree(visited); + + return FAIL; +} /* end link_iterate_old_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -1642,7 +5666,7 @@ external_link_root(hid_t fapl, hbool_t new_format) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5L_info_t linfo; /* Link information */ + H5L_info2_t linfo; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename1[NAME_BUF_SIZE]; char filename2[NAME_BUF_SIZE]; @@ -1674,7 +5698,7 @@ external_link_root(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Check information for external link */ - if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been an external link"); @@ -1698,7 +5722,7 @@ external_link_root(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Check information for external link */ - if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + if(H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been an external link"); @@ -3456,33 +7480,58 @@ error: static int external_set_elink_fapl2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - hsize_t dims[2]; - int points[NUM40][NUM40]; - int i, j, n; - h5_stat_size_t filesize, new_filesize; + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t core_fapl = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t dapl_id = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + char *filename1 = NULL; + char *filename2 = NULL; + char *tmpname = NULL; + char *cwdpath = NULL; + hsize_t dims[2]; + int **points = NULL; + int *points_data = NULL; + int i, j, n; + h5_stat_size_t filesize; + h5_stat_size_t new_filesize; if(new_format) TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)") else TESTING("H5Pset/get_elink_fapl() with same physical layout") + /* Set up file names and paths */ + if(NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename2 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR + /* Set up data array */ + if(NULL == (points_data = (int *)HDcalloc(NUM40 * NUM40, sizeof(int)))) + TEST_ERROR; + if(NULL == (points = (int **)HDcalloc(NUM40, sizeof(points_data)))) + TEST_ERROR; + for (i = 0; i < NUM40; i++) + points[i] = points_data + (i * NUM40); + /* * set up name for main file: * Linux: "/CWD/tmp_links/extlinks0" * Windows: "<cur drive>:/CWD/tmp_links/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); - h5_fixname(tmpname, fapl, filename1, sizeof filename1); + h5_fixname(tmpname, fapl, filename1, NAME_BUF_SIZE); /* create fapl for the target file to be a "core" file */ core_fapl = h5_fileaccess(); @@ -3490,7 +7539,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* set up name for external linked target file: "extlinks17" */ /* set up name for target file: "extlinks17" */ - h5_fixname(FILENAME[39], core_fapl, filename2, sizeof filename2); + h5_fixname(FILENAME[39], core_fapl, filename2, NAME_BUF_SIZE); /* Create the target file to be a "core" file */ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, core_fapl)) < 0) TEST_ERROR @@ -3505,7 +7554,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) dcpl = H5Pcreate(H5P_DATASET_CREATE); else dcpl = H5Pcopy(dcpl_g); - if (0 > dcpl) TEST_ERROR; + if (0 > dcpl) + TEST_ERROR; if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR; /* create "Dataset" in group "A" of target file */ @@ -3548,7 +7598,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) points[i][j] = n++; /* Write the data to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) TEST_ERROR if(H5Pclose(dapl_id) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -3561,6 +7611,14 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Pclose(core_fapl) < 0) TEST_ERROR + HDfree(points); + HDfree(points_data); + + HDfree(filename1); + HDfree(filename2); + HDfree(tmpname); + HDfree(cwdpath); + PASSED(); return SUCCEED; @@ -3575,6 +7633,15 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; + + HDfree(points); + HDfree(points_data); + + HDfree(filename1); + HDfree(filename2); + HDfree(tmpname); + HDfree(cwdpath); + return FAIL; } /* end external_set_elink_fapl2() */ @@ -4970,15 +9037,15 @@ error: static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group IDs */ - const char *file_name; /* Name of the file the external link points to */ - const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ - H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ - query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + const char *file_name; /* Name of the file the external link points to */ + const char *object_name; /* Name of the object the external link points to */ + H5O_info2_t oi; /* Object information */ + H5L_info2_t li; /* Link information */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) TESTING("query aspects of external link (w/new group format)") @@ -4997,7 +9064,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Get size of buffer for external link */ - if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if (H5L_TYPE_EXTERNAL != li.type) { H5_FAILED(); @@ -5022,7 +9089,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get size of buffer for external link */ - if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if(H5L_TYPE_EXTERNAL != li.type) { H5_FAILED(); @@ -5041,7 +9108,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(HDstrcmp(object_name, "/dst")) TEST_ERROR /* Query information about object that external link points to */ - if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been a group"); @@ -5686,8 +9753,8 @@ external_link_closing(hid_t fapl, hbool_t new_format) filename3[NAME_BUF_SIZE], filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ buf[NAME_BUF_SIZE]; /* misc. buffer */ - H5L_info_t li; - H5O_info_t oi; + H5L_info2_t li; + H5O_info2_t oi; hobj_ref_t obj_ref; if(new_format) @@ -5743,10 +9810,10 @@ external_link_closing(hid_t fapl, hbool_t new_format) if(H5Dclose(did) < 0) TEST_ERROR /* Test that getting info works */ - if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Test move */ if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, @@ -5833,7 +9900,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Add a few regular groups and a soft link in file2 using intermediate group creation */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR @@ -5847,13 +9914,13 @@ external_link_closing(hid_t fapl, hbool_t new_format) */ if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR /* Some simpler tests */ if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR /* Close file1, the only file that should still be open */ @@ -6059,19 +10126,26 @@ static int external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) { #ifdef H5_HAVE_SYMLINK - hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1; - hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1; - char filename1[NAME_BUF_SIZE], - filename2a[NAME_BUF_SIZE], - filename2b[NAME_BUF_SIZE], - filename3a[NAME_BUF_SIZE], - filename3b[NAME_BUF_SIZE], - filename4a[NAME_BUF_SIZE], - filename4b[NAME_BUF_SIZE], - filename5a[NAME_BUF_SIZE], - filename5b[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t file1 = H5I_INVALID_HID; + hid_t file2 = H5I_INVALID_HID; + hid_t file3 = H5I_INVALID_HID; + hid_t file4 = H5I_INVALID_HID; + hid_t file5 = H5I_INVALID_HID; + hid_t group2 = H5I_INVALID_HID; + hid_t group3 = H5I_INVALID_HID; + hid_t group4 = H5I_INVALID_HID; + hid_t group5 = H5I_INVALID_HID; + char *filename1 = NULL; + char *filename2a = NULL; + char *filename2b = NULL; + char *filename3a = NULL; + char *filename3b = NULL; + char *filename4a = NULL; + char *filename4b = NULL; + char *filename5a = NULL; + char *filename5b = NULL; + char *tmpname = NULL; + char *cwdpath = NULL; hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */ #endif /* H5_HAVE_SYMLINK */ @@ -6087,144 +10161,179 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) have_posix_compat_vfd = (hbool_t)(!HDstrcmp(env_h5_drvr, "sec2") || !HDstrcmp(env_h5_drvr, "core") || !HDstrcmp(env_h5_drvr, "nomatch")); - if(have_posix_compat_vfd) { - /* set up name for main file: "extlinks21A" */ - h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1)); + if(!have_posix_compat_vfd) { + SKIPPED(); + HDputs(" Current VFD doesn't support POSIX I/O calls"); + return SUCCEED; + } - /* create tmp_links directory and get current working directory path */ - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR + if(NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename2a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename2b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename3a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename3b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename4a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename4b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename5a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename5b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + + /* set up name for main file: "extlinks21A" */ + h5_fixname(FILENAME[45], fapl, filename1, NAME_BUF_SIZE); - /* Set up names for files in the subdirectories */ + /* create tmp_links directory and get current working directory path */ + if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) + TEST_ERROR - /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */ - h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a)); - fix_ext_filename(tmpname, cwdpath, FILENAME[46]); - h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b)); + /* Set up names for files in the subdirectories */ - /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */ - /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */ - if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR + /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */ + h5_fixname(FILENAME[46], fapl, filename2a, NAME_BUF_SIZE); + fix_ext_filename(tmpname, cwdpath, FILENAME[46]); + h5_fixname(tmpname, fapl, filename2b, NAME_BUF_SIZE); - /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */ - h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a)); - h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b)); + /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */ + /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */ + if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */ - h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a)); - fix_ext_filename(tmpname, cwdpath, FILENAME[49]); - h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b)); + /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */ + h5_fixname(FILENAME[47], fapl, filename3a, NAME_BUF_SIZE); + h5_fixname(FILENAME[48], fapl, filename3b, NAME_BUF_SIZE); - /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */ - /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */ - if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR + /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */ + h5_fixname(FILENAME[49], fapl, filename4a, NAME_BUF_SIZE); + fix_ext_filename(tmpname, cwdpath, FILENAME[49]); + h5_fixname(tmpname, fapl, filename4b, NAME_BUF_SIZE); - /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */ - h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); - h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); + /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */ + /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */ + if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR - /* Create file #1 in current directory */ - if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */ + h5_fixname(FILENAME[50], fapl, filename5a, NAME_BUF_SIZE); + h5_fixname(FILENAME[51], fapl, filename5b, NAME_BUF_SIZE); - /* Create external link to file & object in temporary directory #2, using symlink #1 name */ - if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create file #1 in current directory */ + if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Close file #1 */ - if(H5Fclose(file1) < 0) TEST_ERROR + /* Create external link to file & object in temporary directory #2, using symlink #1 name */ + if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create file #2 in tmp_links directory #2 */ - if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Fclose(file2) < 0) TEST_ERROR + /* Close file #1 */ + if(H5Fclose(file1) < 0) TEST_ERROR - /* Re-open file #2 in tmp_links directory through symlink */ - if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Create file #2 in tmp_links directory #2 */ + if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(H5Fclose(file2) < 0) TEST_ERROR - /* Create group in file #2 in temporary directory */ - if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Re-open file #2 in tmp_links directory through symlink */ + if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Create external link to file #3 & object in temporary directory #2 */ - if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create group in file #2 in temporary directory */ + if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in file #2 */ - if(H5Gclose(group2) < 0) TEST_ERROR + /* Create external link to file #3 & object in temporary directory #2 */ + if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file #2 */ - if(H5Fclose(file2) < 0) TEST_ERROR + /* Close group in file #2 */ + if(H5Gclose(group2) < 0) TEST_ERROR - /* Create file #3 in temp. directory #2 */ - if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Close file #2 */ + if(H5Fclose(file2) < 0) TEST_ERROR - /* Create group in file #3 */ - if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create file #3 in temp. directory #2 */ + if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to file & object in temporary directory #1, using symlink #2 name */ - if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create group in file #3 */ + if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in file #3 */ - if(H5Gclose(group3) < 0) TEST_ERROR + /* Create external link to file & object in temporary directory #1, using symlink #2 name */ + if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file #3 */ - if(H5Fclose(file3) < 0) TEST_ERROR + /* Close group in file #3 */ + if(H5Gclose(group3) < 0) TEST_ERROR - /* Create file #4 in temporary directory #1 */ - if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Close file #3 */ + if(H5Fclose(file3) < 0) TEST_ERROR - /* Create group in file #4 in 'temporary' directory */ - if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create file #4 in temporary directory #1 */ + if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to file #5 & object in temporary directory #1 */ - if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create group in file #4 in 'temporary' directory */ + if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in file #4 */ - if(H5Gclose(group4) < 0) TEST_ERROR + /* Create external link to file #5 & object in temporary directory #1 */ + if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file #4 */ - if(H5Fclose(file4) < 0) TEST_ERROR + /* Close group in file #4 */ + if(H5Gclose(group4) < 0) TEST_ERROR - /* Create file #5 in temporary directory #1 */ - if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Close file #4 */ + if(H5Fclose(file4) < 0) TEST_ERROR - /* Create group in file #5 in 'temporary' directory #1 */ - if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group5) < 0) TEST_ERROR + /* Create file #5 in temporary directory #1 */ + if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Close file #5 */ - if(H5Fclose(file5) < 0) TEST_ERROR + /* Create group in file #5 in 'temporary' directory #1 */ + if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group5) < 0) TEST_ERROR - /* Actual tests... */ + /* Close file #5 */ + if(H5Fclose(file5) < 0) TEST_ERROR - /* Reopen file #1 */ - if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Actual tests... */ - /* Open group in file #2, through external link w/symlink */ - if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group2) < 0) TEST_ERROR + /* Reopen file #1 */ + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open group in file #3, through external link w/symlink to external link */ - if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group3) < 0) TEST_ERROR + /* Open group in file #2, through external link w/symlink */ + if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2) < 0) TEST_ERROR - /* Open group in file #4, through external link w/symlink to external link w/symlink */ - if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group4) < 0) TEST_ERROR + /* Open group in file #3, through external link w/symlink to external link */ + if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3) < 0) TEST_ERROR - /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */ - if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group5) < 0) TEST_ERROR + /* Open group in file #4, through external link w/symlink to external link w/symlink */ + if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group4) < 0) TEST_ERROR - /* Close file #1 */ - if(H5Fclose(file1) < 0) TEST_ERROR + /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */ + if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group5) < 0) TEST_ERROR - PASSED(); - } /* end if */ - else { - SKIPPED(); - HDputs(" Current VFD doesn't support POSIX I/O calls"); - } /* end else */ + /* Close file #1 */ + if(H5Fclose(file1) < 0) TEST_ERROR + + HDfree(filename1); + HDfree(filename2a); + HDfree(filename2b); + HDfree(filename3a); + HDfree(filename3b); + HDfree(filename4a); + HDfree(filename4b); + HDfree(filename5a); + HDfree(filename5b); + HDfree(tmpname); + HDfree(cwdpath); + + PASSED(); return SUCCEED; @@ -6240,7 +10349,21 @@ error: H5Fclose(file2); H5Fclose(file1); } H5E_END_TRY; + + HDfree(filename1); + HDfree(filename2a); + HDfree(filename2b); + HDfree(filename3a); + HDfree(filename3b); + HDfree(filename4a); + HDfree(filename4b); + HDfree(filename5a); + HDfree(filename5b); + HDfree(tmpname); + HDfree(cwdpath); + return FAIL; + #else /* H5_HAVE_SYMLINK */ SKIPPED(); HDputs(" Current file system or operating system doesn't support symbolic links"); @@ -7069,19 +11192,19 @@ static herr_t UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) { - haddr_t addr; + H5O_token_t token; hid_t target_obj = -1; herr_t ret_value = 0; - if(udata_size != sizeof(haddr_t)) { + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } /* end if */ - addr = *((const haddr_t *)udata); + token = *(const H5O_token_t *)udata; /* Open the object this link points to */ - target_obj= H5Oopen_by_addr(loc_group, addr); + target_obj = H5Oopen_by_token(loc_group, token); if(target_obj < 0) { ret_value = -1; goto done; @@ -7143,15 +11266,16 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id) { - haddr_t addr; + H5O_token_t token; hid_t ret_value = -1; - if(udata_size != sizeof(haddr_t)) + if(udata_size != sizeof(H5O_token_t)) return FAIL; - addr = *((const haddr_t *) udata); + token = *(const H5O_token_t *)udata; - ret_value = H5Oopen_by_addr(cur_group, addr); /* If this fails, our return value will be negative. */ + /* If this fails, our return value will be negative. */ + ret_value = H5Oopen_by_token(cur_group, token); return ret_value; } /* end UD_hard_traverse() */ @@ -7161,19 +11285,19 @@ static herr_t UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata, size_t udata_size) { - haddr_t addr; + H5O_token_t token; hid_t target_obj = -1; herr_t ret_value = 0; - if(udata_size != sizeof(haddr_t)) { + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } /* end if */ - addr = *((const haddr_t *) udata); + token = *(const H5O_token_t *)udata; /* Open the object this link points to */ - target_obj= H5Oopen_by_addr(file, addr); + target_obj = H5Oopen_by_token(file, token); if(target_obj < 0) { ret_value = -1; goto done; @@ -7229,24 +11353,12 @@ done: return ret_value; } /* end UD_hard_delete() */ -const H5L_class_t UD_hard_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ - "UD_hard_link", /* Link class name for debugging */ - UD_hard_create, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_hard_traverse, /* The actual traversal function */ - UD_hard_delete, /* Deletion callback */ - NULL /* Query callback */ -}}; - static int ud_hard_links(hid_t fapl) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5L_info_t li; /* Link information */ + H5L_info2_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ char filename[NAME_BUF_SIZE]; @@ -7279,13 +11391,13 @@ ud_hard_links(hid_t fapl) if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Get address for the group to give to the hard link */ - if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR /* Create a user-defined "hard link" to the group using the address we got - * from H5Lget_info */ - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + * from H5Lget_info2 */ + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close and re-open file to ensure that data is written to disk */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -7316,7 +11428,7 @@ ud_hard_links(hid_t fapl) if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Check that H5Lget_objinfo works on the hard link */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* UD hard links have no query function, thus return a "link length" of 0 */ if(li.u.val_size != 0) TEST_ERROR if(UD_HARD_TYPE != li.type) { @@ -7371,7 +11483,7 @@ error: * Failure: -1 *------------------------------------------------------------------------- */ - /* A traversal function that ignores any udata and simply opens an object +/* A traversal function that ignores any udata and simply opens an object * in the current group named REREG_TARGET_NAME */ static hid_t @@ -7389,26 +11501,12 @@ error: return FAIL; } /* end UD_rereg_traverse() */ -/* This link class has the same ID number as the UD hard links but - * has a very different traversal function */ -const H5L_class_t UD_rereg_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ - "UD_reregistered_type", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_rereg_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ -}}; - static int ud_link_reregister(hid_t fapl) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5L_info_t li; /* Link information */ + H5L_info2_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ @@ -7437,11 +11535,11 @@ ud_link_reregister(hid_t fapl) /* Point a UD defined hard link to a group in the same way as the previous test */ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0) + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), + sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create a group named REREG_TARGET_NAME in the same group as the ud link */ @@ -7461,8 +11559,8 @@ ud_link_reregister(hid_t fapl) /* Verify that we can't create any new links of this type */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), + sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR } H5E_END_TRY @@ -7544,7 +11642,7 @@ error: /*------------------------------------------------------------------------- - * Function: ud_callbacks + * Function: UD_cb_create * * Purpose: Check that all callbacks are called and are given the correct * information. @@ -7660,25 +11758,13 @@ error: return FAIL; } /* end UD_cb_query() */ -const H5L_class_t UD_cb_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CB_TYPE, /* Link type id number */ - NULL, /* NULL name (to make sure this doesn't break anything */ - UD_cb_create, /* Creation callback */ - UD_cb_move, /* Move/rename callback */ - UD_cb_move, /* Copy callback */ - UD_cb_traverse, /* The actual traversal function */ - UD_cb_delete, /* Deletion callback */ - UD_cb_query /* Query callback */ -}}; - static int ud_callbacks(hid_t fapl, hbool_t new_format) { hid_t fid = -1; /* File ID */ hid_t gid = -1; /* Group ID */ hid_t lcpl = -1; /* Link Creation PL */ - H5L_info_t li; /* Link information */ + H5L_info2_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; @@ -7723,7 +11809,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Query the link to test its query callback */ - if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(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(); @@ -7755,7 +11841,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR /* Check its character encoding */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.cset != H5T_CSET_UTF8) TEST_ERROR /* Unregister the link class so the library forgets what its callbacks do */ @@ -7771,7 +11857,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) } H5E_END_TRY /* The query callback should NOT fail, but should be unable to give a linklen */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.u.val_size != 0) TEST_ERROR if(li.type != UD_CB_TYPE) TEST_ERROR @@ -7825,18 +11911,6 @@ error: return FAIL; } /* end UD_plist_traverse() */ -const H5L_class_t UD_plist_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */ - "UD_plist_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_plist_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ -}}; - static int lapl_udata(hid_t fapl, hbool_t new_format) { @@ -8132,12 +12206,12 @@ const H5L_class_t UD_error4_class[1] = {{ static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - char query_buf[NAME_BUF_SIZE]; - H5L_info_t li; /* Link information */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + char query_buf[NAME_BUF_SIZE]; + H5L_info2_t li; /* Link information */ if(new_format) TESTING("user-defined link error conditions (w/new group format)") @@ -8202,7 +12276,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0) TEST_ERROR /* The query callback will fail */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR } H5E_END_TRY /* Now use a class with different callback functions */ @@ -8215,7 +12289,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* The query callback will succeed when we only want to get the size of the buffer... */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.u.val_size != 0) TEST_ERROR /* ...but fail when we try to write data to the buffer itself*/ H5E_BEGIN_TRY { @@ -8226,7 +12300,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lregister(UD_cbfail_class3) < 0) FAIL_STACK_ERROR /* Now querying should succeed */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(li.u.val_size != 8) TEST_ERROR if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR @@ -8392,9 +12466,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* H5Ldelete */ if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR - /* H5Lget_val and H5Lget_info */ + /* H5Lget_val and H5Lget_info2 */ if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR - if(H5Lget_info(fid, "soft17", NULL, plist) < 0) TEST_ERROR + if(H5Lget_info2(fid, "soft17", NULL, plist) < 0) TEST_ERROR /* H5Lcreate_external and H5Lcreate_ud */ if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR @@ -8493,12 +12567,12 @@ error: static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - hid_t tid = -1; /* Type ID */ - hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ - H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t tid = -1; /* Type ID */ + hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ + H5L_info2_t li; /* Link information */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") @@ -8531,22 +12605,22 @@ linkinfo(hid_t fapl, hbool_t new_format) if(H5Dclose(did) < 0) TEST_ERROR /* Make sure that link type is correct when objects are queried */ - if(H5Lget_info(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR - if(H5Lget_info(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_SOFT) TEST_ERROR - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != UD_PLIST_TYPE) TEST_ERROR /* Ensure that passing a NULL pointer doesn't cause an error */ - if(H5Lget_info(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR @@ -8716,7 +12790,7 @@ error: *------------------------------------------------------------------------- */ static int -visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, void *_op_data) +visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info2_t *linfo, void *_op_data) { lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data; @@ -8758,26 +12832,26 @@ link_visit(hid_t fapl, hbool_t new_format) /* Visit all the links reachable from the root group (with file ID) */ udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit1; - if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit2; - if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -8822,34 +12896,34 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) /* Visit all the links reachable from the root group (with file ID) */ udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit_by_name(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit0; - if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the links reachable from each internal group */ udata.idx = 0; udata.info = lvisit1; - if(H5Lvisit_by_name(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit1; - if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit2; - if(H5Lvisit_by_name(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = lvisit2; - if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -8877,7 +12951,7 @@ error: *------------------------------------------------------------------------- */ static int -visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, void *_op_data) +visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info2_t *oinfo, void *_op_data) { ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data; @@ -8919,26 +12993,26 @@ obj_visit(hid_t fapl, hbool_t new_format) /* Visit all the objects reachable from the root group (with file ID) */ udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -8983,34 +13057,34 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) /* Visit all the objects reachable from the root group (with file ID) */ udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from each internal group */ udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file created */ @@ -9037,7 +13111,7 @@ error: *------------------------------------------------------------------------- */ static int -visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, void *_op_data) +visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info2_t H5_ATTR_UNUSED *oinfo, void *_op_data) { unsigned *op_data = (unsigned *)_op_data; @@ -9077,14 +13151,14 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) * returns H5_ITER_STOP */ nvisited = 0; - if((ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0) + if((ret = H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR /* Same test with H5Ovisit_by_name */ nvisited = 0; - if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, + if((ret = H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR @@ -9878,11 +13952,11 @@ corder_create_compact(hid_t fapl) /* Loop through links, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ for(u = 0; u < max_compact; u++) { - H5L_info_t linfo; /* Link information */ + H5L_info2_t linfo; /* Link information */ /* Retrieve information for link */ HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR /* Verify creation order of link */ if(linfo.corder_valid != TRUE) TEST_ERROR @@ -10006,11 +14080,11 @@ corder_create_dense(hid_t fapl) /* Loop through links, checking their creation order values */ /* (the name index is used, but the creation order value is in the same order) */ for(u = 0; u < (max_compact + 1); u++) { - H5L_info_t linfo; /* Link information */ + H5L_info2_t linfo; /* Link information */ /* Retrieve information for link */ HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR /* Verify creation order of link */ if(linfo.corder_valid != TRUE) TEST_ERROR @@ -10404,19 +14478,19 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ char valname[NAME_BUF_SIZE]; /* Link value name */ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ - H5L_info_t linfo; /* Link info struct */ + H5L_info2_t linfo; /* Link info struct */ /* Make link value for increasing/native order queries */ HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n); /* Verify the link information for first link, in increasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in increasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in increasing creation order */ @@ -10438,12 +14512,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, if(use_index) { /* Verify the link information for first link, in native creation order (which is increasing) */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in native creation order (which is increasing) */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in native creation order (which is increasing) */ @@ -10461,12 +14535,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, /* Verify the link information for first link, in decreasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in decreasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in decreasing creation order */ @@ -10484,12 +14558,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, /* Verify the link information for first link, in increasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in increasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in increasing link name order */ @@ -10510,12 +14584,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, /* Verify the link information for first link, in decreasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != 0) TEST_ERROR /* Verify the link information for new link, in decreasing link name order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder != (int64_t)n) TEST_ERROR /* Verify value for new soft link, in decreasing link name order */ @@ -10559,7 +14633,7 @@ link_info_by_idx(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5L_info_t linfo; /* Link info struct */ + H5L_info2_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[NAME_BUF_SIZE]; /* Link value name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10603,7 +14677,7 @@ link_info_by_idx(hid_t fapl) /* Check for query on empty group */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -10641,11 +14715,11 @@ link_info_by_idx(hid_t fapl) /* Check for out of bound offset queries */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -10683,11 +14757,11 @@ link_info_by_idx(hid_t fapl) /* Check for out of bound offset queries */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -10733,19 +14807,22 @@ error: static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = -1; /* File ID */ - hid_t group_id = -1, group_id2 = -1; /* Group IDs */ - unsigned hard_link; /* Create hard or soft link? */ - H5L_info_t linfo; /* Link info struct */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value name */ - char filename[NAME_BUF_SIZE];/* File name */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ - char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ - char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ - unsigned u; /* Local index variable */ - ssize_t name_len; /* Length of name */ - herr_t ret; /* Generic return value */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + H5F_t *f = NULL; + unsigned hard_link; /* Create hard or soft link? */ + H5L_info2_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char valname[NAME_BUF_SIZE]; /* Link value name */ + char filename[NAME_BUF_SIZE];/* File name */ + H5O_token_t objtoken[CORDER_NLINKS];/* Tokens (Addresses) of the objects created */ + void *vol_obj_file = NULL; /* Object of file_id */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ + unsigned u; /* Local index variable */ + ssize_t name_len; /* Length of name */ + int token_cmp; + herr_t ret; /* Generic return value */ /* Loop over creating hard or soft links */ for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { @@ -10758,6 +14835,12 @@ link_info_by_idx_old(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Need the file struct to address encoding */ + /* Retrieve VOL object */ + if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) TEST_ERROR + /* Retrieve file from VOL object */ + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) TEST_ERROR + /* Create group to operate on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -10768,14 +14851,15 @@ link_info_by_idx_old(hid_t fapl) /* Check for creating hard or soft link */ if(hard_link) { - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's object token */ + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t)); /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -10801,8 +14885,9 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in increasing order) */ if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR @@ -10816,8 +14901,9 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in native order - native is increasing) */ if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR @@ -10837,8 +14923,9 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in decreasing order) */ if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR @@ -10852,7 +14939,7 @@ link_info_by_idx_old(hid_t fapl) /* Check for creation order index queries */ H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { @@ -10904,7 +14991,7 @@ delete_by_idx(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5L_info_t linfo; /* Link info struct */ + H5L_info2_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ @@ -11008,7 +15095,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != (u + 1)) TEST_ERROR } /* end if */ @@ -11064,7 +15151,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != (u + 1)) TEST_ERROR } /* end if */ @@ -11123,7 +15210,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for current link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != ((u * 2) + 1)) TEST_ERROR } /* end if */ @@ -11148,7 +15235,7 @@ delete_by_idx(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { if(linfo.corder != ((u * 2) + 3)) TEST_ERROR } /* end if */ @@ -11212,16 +15299,19 @@ error: static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = -1; /* File ID */ - hid_t group_id = -1, group_id2 = -1; /* Group IDs */ - H5L_info_t linfo; /* Link info struct */ - H5_iter_order_t order; /* Order within in the index */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE];/* File name */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ - char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + H5F_t *f = NULL; + H5L_info2_t linfo; /* Link info struct */ + H5_iter_order_t order; /* Order within in the index */ + void *vol_obj_file = NULL; /* Object of file_id */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + H5O_token_t objtoken[CORDER_NLINKS];/* Tokens (Addresses) of the objects created */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + int token_cmp; + herr_t ret; /* Generic return value */ /* Loop over operating in different orders */ for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { @@ -11235,6 +15325,12 @@ delete_by_idx_old(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Need the file struct to address encoding */ + /* Retrieve VOL object */ + if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) TEST_ERROR + /* Retrieve file from VOL object */ + if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) TEST_ERROR + /* Create group to operate on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11248,7 +15344,7 @@ delete_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11256,9 +15352,10 @@ delete_by_idx_old(hid_t fapl) /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's object token */ + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t)); /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -11285,12 +15382,14 @@ delete_by_idx_old(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u + 1], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end else */ /* Verify the name for first link in appropriate order */ @@ -11319,7 +15418,7 @@ delete_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11327,9 +15426,10 @@ delete_by_idx_old(hid_t fapl) /* Create group */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's object token */ + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t)); /* Close group */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -11344,12 +15444,14 @@ delete_by_idx_old(hid_t fapl) /* Verify the link information for current link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 1], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end else */ /* Verify the name for current link in appropriate order */ @@ -11371,12 +15473,14 @@ delete_by_idx_old(hid_t fapl) /* Verify the link information for first link in appropriate order */ HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 3], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end else */ /* Verify the name for first link in appropriate order */ @@ -11426,22 +15530,24 @@ error: *------------------------------------------------------------------------- */ static int -link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, +link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info, void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info2_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ - if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + if(H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0) return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { + int token_cmp; + /* Check for correct order of iteration */ /* (if we are operating in increasing or decreasing order) */ if(op_data->order != H5_ITER_NATIVE) @@ -11457,7 +15563,9 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, return H5_ITER_ERROR; if(info->cset != my_info.cset) return H5_ITER_ERROR; - if(H5F_addr_ne(info->u.address, my_info.u.address)) + if(H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0) + return H5_ITER_ERROR; + if(token_cmp) return H5_ITER_ERROR; } /* end if */ @@ -11519,7 +15627,7 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) */ static int link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, - const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) + const H5L_info2_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) { return H5_ITER_ERROR; } /* end link_iterate_fail_cb() */ @@ -11552,7 +15660,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR + if(H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -11582,7 +15690,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR + if(H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -11644,7 +15752,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if((ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR + if((ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR @@ -11664,7 +15772,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -11782,7 +15890,7 @@ link_iterate(hid_t fapl) /* Check for iteration on empty group */ /* (should be OK) */ - if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR + if(H5Literate2(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -11802,7 +15910,7 @@ link_iterate(hid_t fapl) /* Check for out of bound iteration on compact group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -11827,7 +15935,7 @@ link_iterate(hid_t fapl) /* Check for out of bound iteration on dense group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); + ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -11880,21 +15988,23 @@ error: *------------------------------------------------------------------------- */ static int -link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, void *_op_data) +link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info, void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info2_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ - if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) + if(H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0) return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { + int token_cmp; + /* Compare link info structs */ if(info->type != my_info.type) return H5_ITER_ERROR; @@ -11904,7 +16014,9 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf return H5_ITER_ERROR; if(info->cset != my_info.cset) return H5_ITER_ERROR; - if(H5F_addr_ne(info->u.address, my_info.u.address)) + if(H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0) + return H5_ITER_ERROR; + if(token_cmp) return H5_ITER_ERROR; } /* end if */ @@ -11980,7 +16092,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR + if(H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -12010,7 +16122,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links iter_info->ncalled = 0; iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR + if(H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR /* Verify that we visited all the links */ if(skip != max_links) TEST_ERROR @@ -12072,7 +16184,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); - if((ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR + if((ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR @@ -12092,14 +16204,14 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Check for iteration w/bad location ID */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate2((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12169,7 +16281,7 @@ link_iterate_old(hid_t fapl) /* Check for iteration on empty group */ /* (should be OK) */ - if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR + if(H5Literate2(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { @@ -12189,7 +16301,7 @@ link_iterate_old(hid_t fapl) /* Check for out of bound iteration on old-style group */ skip = (hsize_t)u; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); + ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12197,7 +16309,7 @@ link_iterate_old(hid_t fapl) /* (should fail) */ skip = (hsize_t)0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL); + ret = H5Literate2(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12244,15 +16356,16 @@ error: */ static int open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, - H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno) + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) { char mntname[NAME_BUF_SIZE]; /* Link value */ hid_t group_id = -1; /* ID of group to test */ - H5O_info_t oi; /* Buffer for querying object's info */ - haddr_t mnt_root_addr; /* Address of root group in file to mount */ + H5O_info2_t oi; /* Buffer for querying object's info */ + H5O_token_t mnt_root_token; /* Token (address) of root group in file to mount */ hid_t obj_id; /* ID of object opened */ unsigned mnt_idx; /* Index to mount group on */ unsigned u, v; /* Local index variables */ + int token_cmp; /* Work through main & soft link groups */ for(v = 0; v < 2; v++) { @@ -12268,16 +16381,18 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { - if(H5F_addr_ne(oi.addr, objno[u])) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &objno[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else if(order == H5_ITER_DEC) { unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ - if(H5F_addr_ne(oi.addr, objno[dec_u])) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &objno[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR } /* end if */ else { /* XXX: What to do about native order? */ @@ -12291,8 +16406,9 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* Verify opening correct object by index when file mounting is present */ /* Get the address of the root group in the file to mount */ - if(H5Oget_info2(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - mnt_root_addr = oi.addr; + if(H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0) + TEST_ERROR + HDmemcpy(&mnt_root_token, &oi.token, sizeof(mnt_root_token)); /* Mount a file over a group in main group */ mnt_idx = 2; @@ -12303,11 +16419,13 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR /* Check that the object is the root of the mounted file and not in the previous file */ - if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR - if(H5F_addr_eq(oi.addr, objno[mnt_idx])) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &mnt_root_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(H5Otoken_cmp(obj_id, &oi.token, &objno[mnt_idx], &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR /* Close object */ if(H5Oclose(obj_id) < 0) TEST_ERROR @@ -12346,11 +16464,11 @@ open_by_idx(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ - haddr_t *objno = NULL; /* Addresses of the objects created */ + H5O_token_t *objno = NULL; /* Tokens (addresses) of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -12360,8 +16478,8 @@ open_by_idx(hid_t fapl) /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate object address array */ - if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + /* Allocate object token array */ + if(NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2)))) TEST_ERROR /* Create file to mount */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); @@ -12447,8 +16565,8 @@ open_by_idx(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.token; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -12456,7 +16574,7 @@ open_by_idx(hid_t fapl) /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + } /* Verify state of group (compact) */ if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR @@ -12481,8 +16599,8 @@ open_by_idx(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.token; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -12546,6 +16664,100 @@ error: /*------------------------------------------------------------------------- + * Function: open_by_idx_check_old + * + * Purpose: Check opening by index in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +open_by_idx_check_old(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) +{ + char mntname[NAME_BUF_SIZE]; /* Link value */ + hid_t group_id = -1; /* ID of group to test */ + H5O_info2_t oi; /* Buffer for querying object's info */ + H5O_token_t mnt_root_token; /* Token of root group in file to mount */ + hid_t obj_id; /* ID of object opened */ + unsigned mnt_idx; /* Index to mount group on */ + unsigned u, v; /* Local index variables */ + int cmp_value; /* Token comparison value */ + + /* Work through main & soft link groups */ + for(v = 0; v < 2; v++) { + /* Choose appropriate group to open links within */ + if(0 == v) + group_id = main_group_id; + else + group_id = soft_group_id; + + /* Open each object in main group by index and check that it's the correct one */ + for(u = 0; u < max_links; u++) { + /* Open the object */ + if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Get the object's information */ + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + /* Check that the object is the correct one */ + if(order == H5_ITER_INC) { + if(H5Otoken_cmp(group_id, &oi.token, &objno[u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ + + if(H5Otoken_cmp(group_id, &oi.token, &objno[dec_u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + } /* end if */ + else { + /* XXX: What to do about native order? */ + } /* end else */ + + /* Close object */ + if(H5Oclose(obj_id) < 0) TEST_ERROR + } /* end for */ + } /* end for */ + + /* Verify opening correct object by index when file mounting is present */ + + /* Get the address of the root group in the file to mount */ + if(H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + mnt_root_token = oi.token; + + /* Mount a file over a group in main group */ + mnt_idx = 2; + HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx); + if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Open the object that the file is mounted on */ + if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Get the object's information */ + if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + + /* Check that the object is the root of the mounted file and not in the previous file */ + if(H5Otoken_cmp(group_id, &oi.token, &mnt_root_token, &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(H5Otoken_cmp(group_id, &oi.token, &objno[mnt_idx], &cmp_value) < 0) TEST_ERROR + if(0 == cmp_value) TEST_ERROR + + /* Close object */ + if(H5Oclose(obj_id) < 0) TEST_ERROR + + /* Unmount the file */ + if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end open_by_idx_check_old() */ + +/*------------------------------------------------------------------------- * Function: open_by_idx_old * * Purpose: Create an old-style group and test opening @@ -12563,11 +16775,11 @@ open_by_idx_old(hid_t fapl) hid_t group_id = -1; /* Group ID */ hid_t soft_group_id = -1; /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ - H5O_info_t oi; /* Buffer for querying object's info */ + H5O_info2_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -12617,8 +16829,8 @@ open_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.token; /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR @@ -12644,7 +16856,7 @@ open_by_idx_old(hid_t fapl) if(ret >= 0) TEST_ERROR /* Verify opening objects by index */ - if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR + if(open_by_idx_check_old(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -12685,12 +16897,13 @@ error: */ static int object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, - H5_iter_order_t order, unsigned max_links, haddr_t *objno) + H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) { char objname[NAME_BUF_SIZE]; /* Object name */ hid_t group_id = -1; /* ID of group to test */ - H5O_info_t oinfo; /* Buffer for querying object's info */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ unsigned u, v; /* Local index variables */ + int token_cmp; /* Work through main & soft link groups */ for(v = 0; v < 2; v++) { @@ -12706,25 +16919,28 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Query the object's information, by name */ - if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ - if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR /* Query the object's information, by index */ - if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { - if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR } /* end if */ else if(order == H5_ITER_DEC) { unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ - if(H5F_addr_ne(oinfo.addr, objno[dec_u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, dec_u)) TEST_ERROR + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR + if(oinfo.num_attrs != dec_u) TEST_ERROR } /* end if */ else { /* XXX: What to do about native order? */ @@ -12764,12 +16980,12 @@ object_info(hid_t fapl) unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5O_info_t oinfo; /* Buffer for querying object's info */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ - haddr_t *objno = NULL; /* Addresses of the objects created */ + H5O_token_t *objno = NULL; /* Tokens (addresses) of the objects created */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -12779,8 +16995,8 @@ object_info(hid_t fapl) /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate object address array */ - if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + /* Allocate object token array */ + if(NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2)))) TEST_ERROR /* Create dataspace for attributes */ if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR @@ -12851,7 +17067,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12867,8 +17083,8 @@ object_info(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.token; /* Create attributes on new object */ for(v = 0; v < u; v++) { @@ -12895,7 +17111,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12915,8 +17131,8 @@ object_info(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.token; /* Create attributes on new object */ for(v = 0; v < u; v++) { @@ -12943,7 +17159,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -12989,6 +17205,77 @@ error: /*------------------------------------------------------------------------- + * Function: object_info_check_old + * + * Purpose: Check querying object info in a group + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +object_info_check_old(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, + H5_iter_order_t order, unsigned max_links, H5O_token_t *objno) +{ + char objname[NAME_BUF_SIZE]; /* Object name */ + hid_t group_id = -1; /* ID of group to test */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ + unsigned u, v; /* Local index variables */ + + /* Work through main & soft link groups */ + for(v = 0; v < 2; v++) { + /* Choose appropriate group to open links within */ + if(0 == v) + group_id = main_group_id; + else + group_id = soft_group_id; + + /* Open each object in group by name and check that it's the correct one */ + for(u = 0; u < max_links; u++) { + int cmp_value; /* Token comparison value */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Query the object's information, by name */ + if(H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that the object is the correct one */ + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR + + /* Query the object's information, by index */ + if(H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that the object is the correct one */ + if(order == H5_ITER_INC) { + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(oinfo.num_attrs != u) TEST_ERROR + } + else if(order == H5_ITER_DEC) { + unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ + + if(H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &cmp_value) < 0) TEST_ERROR + if(0 != cmp_value) TEST_ERROR + if(oinfo.num_attrs != dec_u) TEST_ERROR + } + else { + /* XXX: What to do about native order? */ + } + + } /* end for */ + } /* end for */ + + /* Success */ + return SUCCEED; + +error: + return FAIL; +} /* end object_info_check_old() */ + +/*------------------------------------------------------------------------- * Function: object_info_old * * Purpose: Create an old-style group test querying object info. @@ -13005,12 +17292,12 @@ object_info_old(hid_t fapl) hid_t soft_group_id = -1; /* Group ID for soft links */ hid_t space_id = -1; /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ - H5O_info_t oinfo; /* Buffer for querying object's info */ + H5O_info2_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ - haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ + H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -13044,7 +17331,7 @@ object_info_old(hid_t fapl) /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13060,8 +17347,8 @@ object_info_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.token; /* Create attributes on new object */ for(v = 0; v < u; v++) { @@ -13088,18 +17375,18 @@ object_info_old(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Check for creation order index query */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Verify querying objects by name */ - if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR + if(object_info_check_old(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -13768,7 +18055,8 @@ timestamps(hid_t fapl) hid_t group_id2 = -1; /* Group ID */ hid_t gcpl_id = -1; /* Group creation property list ID */ hid_t gcpl_id2 = -1; /* Group creation property list ID */ - H5O_info_t oinfo, oinfo2; /* Object info for groups created */ + H5O_info2_t oinfo, oinfo2; /* Object info for groups created */ + H5O_native_info_t ninfo, ninfo2; /* Native info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -13817,10 +18105,15 @@ timestamps(hid_t fapl) if(track_times != TRUE) TEST_ERROR /* Query the object information for each group */ - if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + /* Generic info */ + if(H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0) TEST_ERROR + if(H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0) TEST_ERROR + /* Native file format info */ + if(H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR /* Sanity check object information for each group */ + /* Generic info */ if(oinfo.atime != 0) TEST_ERROR if(oinfo.mtime != 0) TEST_ERROR if(oinfo.ctime != 0) TEST_ERROR @@ -13829,10 +18122,11 @@ timestamps(hid_t fapl) if(oinfo.mtime == oinfo2.mtime) TEST_ERROR if(oinfo.ctime == oinfo2.ctime) TEST_ERROR if(oinfo.btime == oinfo2.btime) TEST_ERROR - if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR - if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR - if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR - if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR + /* Native file format info */ + if((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR + if((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR + if(ninfo.hdr.space.total >= ninfo2.hdr.space.total) TEST_ERROR + if(ninfo.hdr.space.meta >= ninfo2.hdr.space.meta) TEST_ERROR /* Close the property lists */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR @@ -13863,10 +18157,14 @@ timestamps(hid_t fapl) if(track_times != TRUE) TEST_ERROR /* Query the object information for each group */ - if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0) TEST_ERROR + if(H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0) TEST_ERROR + /* Native file format info */ + if(H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR /* Sanity check object information for each group */ + /* Generic info */ if(oinfo.atime != 0) TEST_ERROR if(oinfo.mtime != 0) TEST_ERROR if(oinfo.ctime != 0) TEST_ERROR @@ -13875,10 +18173,11 @@ timestamps(hid_t fapl) if(oinfo.mtime == oinfo2.mtime) TEST_ERROR if(oinfo.ctime == oinfo2.ctime) TEST_ERROR if(oinfo.btime == oinfo2.btime) TEST_ERROR - if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR - if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR - if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR - if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR + /* Native file format info */ + if((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR + if((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR + if(ninfo.hdr.space.total >= ninfo2.hdr.space.total) TEST_ERROR + if(ninfo.hdr.space.meta >= ninfo2.hdr.space.meta) TEST_ERROR /* Close the property lists */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR @@ -13966,6 +18265,9 @@ main(void) /* General tests... (on both old & new format groups */ nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += cklinks_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; @@ -13973,13 +18275,18 @@ main(void) /* Test new H5L link creation routine */ nerrors += test_lcpl(my_fapl, new_format); +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += test_lcpl_deprec(my_fapl, new_format); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += test_move(my_fapl, new_format); nerrors += test_copy(my_fapl, new_format); nerrors += test_move_preserves(my_fapl, new_format); #ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += test_move_preserves_deprec(my_fapl, new_format); nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ + /* tests for external link */ /* Test external file cache first, so it sees the default efc setting on the fapl */ @@ -14007,6 +18314,9 @@ main(void) } /* end else */ nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += external_link_root_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; @@ -14014,11 +18324,17 @@ main(void) nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += external_link_query_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += external_link_endian(new_format) < 0 ? 1 : 0; nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; @@ -14057,14 +18373,29 @@ main(void) * above has already been tested for UD links. */ if(new_format == TRUE) { - nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += ud_hard_links_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += ud_link_reregister_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += ud_callbacks_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += lapl_nlinks_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += linkinfo_deprec(my_fapl, new_format) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Misc. extra tests, useful for both new & old format files */ nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; @@ -14088,12 +18419,27 @@ main(void) * correct. */ nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += corder_create_compact_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += corder_create_dense_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += corder_transition(fapl2) < 0 ? 1 : 0; nerrors += corder_delete(fapl2) < 0 ? 1 : 0; nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_info_by_idx_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += delete_by_idx_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += link_iterate(fapl2) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_iterate_deprec(fapl2) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; nerrors += object_info(fapl2) < 0 ? 1 : 0; nerrors += group_info(fapl2) < 0 ? 1 : 0; @@ -14101,8 +18447,17 @@ main(void) /* Test new API calls on old-style groups */ nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_info_by_idx_old_deprec(fapl) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += delete_by_idx_old_deprec(fapl) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; +#ifndef H5_NO_DEPRECATED_SYMBOLS + nerrors += link_iterate_old_deprec(fapl) < 0 ? 1 : 0; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; nerrors += object_info_old(fapl) < 0 ? 1 : 0; nerrors += group_info_old(fapl) < 0 ? 1 : 0; @@ -7528,7 +7528,7 @@ error: *------------------------------------------------------------------------- */ static int -set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) +set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t is_multi_or_split) { H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl_arr[H5FD_MEM_NTYPES]; @@ -7537,7 +7537,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) hbool_t relax; H5FD_mem_t mt; - HDassert(multi || split); + HDassert(is_multi_or_split); HDmemset(memb_name, 0, sizeof memb_name); @@ -7545,7 +7545,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) if(H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0) TEST_ERROR - if(split) { + if(is_multi_or_split) { /* Set memb_addr aligned */ memb_addr[H5FD_MEM_SUPER] = ((memb_addr[H5FD_MEM_SUPER] + pagesize - 1) / pagesize) * pagesize; memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize; @@ -7614,7 +7614,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR if(multi || split) - if(set_multi_split(fapl_new, 4096, multi, split) < 0) + if(set_multi_split(fapl_new, 4096, split) < 0) TEST_ERROR; /* Test with TRUE or FALSE for persisting free-space */ diff --git a/test/mount.c b/test/mount.c index b7d2858..3abe084 100644 --- a/test/mount.c +++ b/test/mount.c @@ -400,43 +400,60 @@ static int test_hide(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; char filename1[1024], filename2[1024]; + hbool_t same_obj; TESTING("name hiding under mount point"); - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); - h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); + h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1)); + h5_fixname(FILENAME[1], fapl, filename2, sizeof(filename2)); if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Get information about file1:/mnt1/file1 for later */ - if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR /* Build the virtual file */ - if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR /* Original names under file1:/mnt1 should not be accessible */ H5E_BEGIN_TRY { - grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT); + grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT); } H5E_END_TRY; if(grp >= 0) { - H5_FAILED(); - HDputs(" Name is still accessible under mount point."); - TEST_ERROR - } /* end if */ + H5_FAILED(); + HDputs(" Name is still accessible under mount point."); + TEST_ERROR + } /* * The original objects under file1:/mnt1 are still accessible by their * other names. This is a rather stupid test but demonstrates a point. */ - if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { - H5_FAILED(); - HDputs(" Hard link failed for hidden object."); - TEST_ERROR - } /* end if */ + if(H5Oget_info_by_name3(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + + same_obj = TRUE; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0) + FAIL_STACK_ERROR + if(token_cmp) + same_obj = FALSE; + } + else + same_obj = FALSE; + + if(!same_obj) { + H5_FAILED(); + HDputs(" Hard link failed for hidden object."); + TEST_ERROR + } /* Unmount and close objects */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -448,9 +465,9 @@ test_hide(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(grp); - H5Fclose(file1); - H5Fclose(file2); + H5Gclose(grp); + H5Fclose(file1); + H5Fclose(file2); } H5E_END_TRY; return 1; } /* end test_hide() */ @@ -477,8 +494,9 @@ static int test_assoc(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; char filename1[1024], filename2[1024]; + hbool_t same_obj; TESTING("mount point open"); h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); @@ -490,20 +508,35 @@ test_assoc(hid_t fapl) FAIL_STACK_ERROR /* Get information about the root of file2 */ - if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Oget_info3(file2, &oi1, H5O_INFO_BASIC) < 0) + FAIL_STACK_ERROR /* Create the virtual file */ - if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR /* * Get info about the mount point -- should be the same as the root group * of file2. */ - if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR - if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { - H5_FAILED(); - HDputs(" Association failed."); + same_obj = TRUE; + if(oi1.fileno == oi2.fileno) { + int token_cmp; + + if(H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0) + FAIL_STACK_ERROR + if(token_cmp) + same_obj = FALSE; + } + else + same_obj = FALSE; + + if(!same_obj) { + H5_FAILED(); + HDputs(" Association failed."); TEST_ERROR } /* end if */ @@ -517,8 +550,8 @@ test_assoc(hid_t fapl) error: H5E_BEGIN_TRY { - H5Fclose(file2); - H5Fclose(file1); + H5Fclose(file2); + H5Fclose(file1); } H5E_END_TRY; return 1; } /* end test_assoc() */ @@ -670,7 +703,7 @@ static int test_preopen(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("preopening objects under the mount point"); @@ -688,7 +721,7 @@ test_preopen(hid_t fapl) if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Oget_info2(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -732,7 +765,7 @@ test_postopen(hid_t fapl) { hid_t file1 = -1, file2 = -1, grp = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("open object access after unmount"); @@ -752,10 +785,10 @@ test_postopen(hid_t fapl) if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Oget_info2(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Try accessing it from the file */ - if(H5Oget_info_by_name2(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Gclose(grp) < 0) FAIL_STACK_ERROR @@ -797,7 +830,7 @@ static int test_unlink(hid_t fapl) { hid_t file1 = -1, file2 = -1, mnt = -1, root = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; herr_t status; @@ -825,12 +858,12 @@ test_unlink(hid_t fapl) * before the H5Fmount() and thus refers to the mount point itself rather * than the group mounted there. */ - if(H5Oget_info_by_name2(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -845,9 +878,9 @@ test_unlink(hid_t fapl) * We should still be able to get to "/file2" of file2 by starting at * `root' which is still open, but not by name. */ - if(H5Oget_info_by_name2(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -855,7 +888,7 @@ test_unlink(hid_t fapl) TEST_ERROR } /* end if */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name3(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -926,7 +959,7 @@ static int test_mvmpt(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("mount point renaming"); @@ -943,7 +976,7 @@ test_mvmpt(hid_t fapl) if(H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access something under the new name */ - if(H5Oget_info_by_name2(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt_move_b") < 0) FAIL_STACK_ERROR @@ -1088,7 +1121,7 @@ static int test_uniformity(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("file handle uniformity"); @@ -1102,18 +1135,18 @@ test_uniformity(hid_t fapl) if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access some things from the file1 handle */ - if(H5Oget_info_by_name2(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access the same things from the file2 handle */ - if(H5Oget_info_by_name2(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -1152,7 +1185,7 @@ static int test_close(hid_t fapl) { hid_t file1 = -1, file2 = -1; - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; TESTING("file handle close"); @@ -1170,7 +1203,7 @@ test_close(hid_t fapl) * still accessible through the file2 handle. */ if(H5Fclose(file1) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { H5_FAILED(); HDputs(" File1 contents are not accessible!"); TEST_ERROR @@ -1191,7 +1224,7 @@ test_close(hid_t fapl) * Close file2. It is not actually closed because it's a child of file1. */ if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Fclose(file1) < 0) FAIL_STACK_ERROR /* Check that all file IDs have been closed */ @@ -2426,7 +2459,7 @@ test_fcdegree_strong(hid_t fapl) hid_t fid1 = -1, fid2 = -1; /* File IDs */ hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */ hid_t fapl_id = -1; /* FAPL IDs */ - H5O_info_t oinfo; + H5O_info2_t oinfo; char filename1[1024], filename2[1024]; /* Name of files to mount */ herr_t ret; /* Generic return value */ @@ -2495,9 +2528,9 @@ test_fcdegree_strong(hid_t fapl) TEST_ERROR /* Check that objects are still open */ - if(H5Oget_info2(gidA, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gidAM, &oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Close file #2 (should close open objects also) */ @@ -2506,12 +2539,12 @@ test_fcdegree_strong(hid_t fapl) /* Check that objects are closed */ H5E_BEGIN_TRY { - ret = H5Oget_info2(gidA, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Oget_info2(gidAM, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; if(ret >= 0) TEST_ERROR diff --git a/test/mtime.c b/test/mtime.c index f7a441d..81a20db 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -39,9 +39,7 @@ const char *FILENAME[] = { * * Purpose: H5O_mtime_decode() test. * - * Return: Success: - * - * Failure: + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Thursday, July 30, 1998 @@ -62,9 +60,10 @@ main(void) hsize_t size[1] = {2}; time_t now; struct tm *tm; - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; signed char buf1[32], buf2[32]; char filename[1024]; + int token_cmp; h5_reset(); fapl = h5_fileaccess(); @@ -90,14 +89,15 @@ main(void) */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; - if(H5Oget_info_by_name2(file, "dset", &oi1, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; + if(H5Oget_info_by_name3(file, "dset", &oi1, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) TEST_ERROR; - if(H5Oget_info2(dset, &oi2, H5O_INFO_BASIC|H5O_INFO_TIME) < 0) TEST_ERROR; + if(H5Oget_info3(dset, &oi2, H5O_INFO_BASIC|H5O_INFO_TIME) < 0) TEST_ERROR; + if(H5Otoken_cmp(file, &oi1.token, &oi2.token, &token_cmp) < 0)TEST_ERROR; if(H5Dclose(dset) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; - /* Compare addresses & times from the two ways of calling H5Oget_info() */ - if(oi1.addr != oi2.addr || oi1.ctime != oi2.ctime) { + /* Compare object tokens & times from the two ways of calling H5Oget_info() */ + if(token_cmp || oi1.ctime != oi2.ctime) { H5_FAILED(); HDputs(" Calling H5Oget_info() with the dataset ID returned"); HDputs(" different values than calling it with a file and dataset"); @@ -134,7 +134,7 @@ main(void) file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); if(file >= 0){ - if(H5Oget_info_by_name2(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if(oi1.ctime != MTIME1) { H5_FAILED(); @@ -164,7 +164,7 @@ main(void) file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); if(file >= 0){ - if(H5Oget_info_by_name2(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if(oi2.ctime != MTIME2) { H5_FAILED(); @@ -188,10 +188,10 @@ main(void) /* All looks good */ HDputs("All modification time tests passed."); h5_cleanup(FILENAME, fapl); - return 0; + return EXIT_SUCCESS; /* Something broke */ error: - return 1; -} + return EXIT_FAILURE; +} /* end main() */ diff --git a/test/ntypes.c b/test/ntypes.c index 34558f5..f1d2449 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -2484,7 +2484,7 @@ test_opaque_dtype(hid_t file) TEST_ERROR; for(i = 0; i < sizeof(wbuf); i++) - wbuf[i] = (unsigned char)0xff ^ (unsigned char)i; + wbuf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; if(H5Sclose(space) < 0) TEST_ERROR; diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c index 14e1a38..ef76fe6 100644 --- a/test/null_vol_connector.c +++ b/test/null_vol_connector.c @@ -28,101 +28,110 @@ /* The VOL class struct */ static const H5VL_class_t null_vol_g = { - 0, /* version */ - NULL_VOL_CONNECTOR_VALUE, /* value */ - NULL_VOL_CONNECTOR_NAME, /* name */ + 0, /* version */ + NULL_VOL_CONNECTOR_VALUE, /* value */ + NULL_VOL_CONNECTOR_NAME, /* name */ 0, /* capability flags */ - NULL, /* initialize */ - NULL, /* terminate */ + NULL, /* initialize */ + NULL, /* terminate */ { /* info_cls */ - (size_t)0, /* size */ - NULL, /* copy */ - NULL, /* compare */ - NULL, /* free */ - NULL, /* to_str */ - NULL, /* from_str */ + (size_t)0, /* size */ + NULL, /* copy */ + NULL, /* compare */ + NULL, /* free */ + NULL, /* to_str */ + NULL, /* from_str */ }, { /* wrap_cls */ - NULL, /* get_object */ - NULL, /* get_wrap_ctx */ - NULL, /* wrap_object */ - NULL, /* unwrap_object */ - NULL, /* free_wrap_ctx */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL, /* unwrap_object */ + NULL, /* free_wrap_ctx */ }, { /* attribute_cls */ - NULL, /* create */ - NULL, /* open */ - NULL, /* read */ - NULL, /* write */ - NULL, /* get */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* close */ + 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 */ + 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 */ + 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 */ + 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 */ + 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 */ + NULL, /* create */ + NULL, /* copy */ + NULL, /* move */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ }, { /* object_cls */ - NULL, /* open */ - NULL, /* copy */ - NULL, /* get */ - NULL, /* specific */ - NULL /* optional */ + NULL, /* open */ + NULL, /* copy */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* introspect_cls */ + NULL, /* get_conn_cls */ + NULL, /* opt_query */ }, { /* request_cls */ - NULL, /* wait */ - NULL, /* notify */ - NULL, /* cancel */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* free */ + NULL, /* wait */ + NULL, /* notify */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ }, { /* blob_cls */ - NULL, /* put */ - NULL, /* get */ - NULL, /* specific */ - NULL /* optional */ + NULL, /* put */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* token_cls */ + NULL, /* cmp */ + NULL, /* to_str */ + NULL /* from_str */ }, - NULL /* optional */ + NULL /* optional */ }; /* These two functions are necessary to load this plugin using diff --git a/test/objcopy.c b/test/objcopy.c index 751fe72..5174700 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -157,6 +157,7 @@ const char *FILENAME[] = { #define NUM_SUB_GROUPS 20 #define NUM_WIDE_LOOP_GROUPS 10 #define NUM_DATASETS 10 +#define ATTR_CMPD_STRING "ThisIsAString" char src_obj_full_name[215]; /* the full path + name of the object to be copied */ @@ -167,7 +168,7 @@ unsigned num_attributes_g; /* Number of attributes created */ static struct { size_t nalloc; /* number of slots allocated */ size_t nobjs; /* number of objects */ - haddr_t *obj; /* Addresses of objects seen */ + H5O_token_t *obj; /* Tokens of objects seen */ } idtab_g; /* Local function prototypes */ @@ -190,19 +191,19 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2); /*------------------------------------------------------------------------- - * Function: addr_insert + * Function: token_insert * - * Purpose: Add an address to the table. + * Purpose: Add a token to the table. * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- */ static void -addr_insert(H5O_info_t *oi) +token_insert(H5O_info2_t *oi) { size_t n; @@ -214,64 +215,67 @@ addr_insert(H5O_info_t *oi) /* Extend the table */ if(idtab_g.nobjs >= idtab_g.nalloc) { idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc); - idtab_g.obj = (haddr_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); + idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); } /* end if */ /* Insert the entry */ n = idtab_g.nobjs++; - idtab_g.obj[n] = oi->addr; -} /* end addr_insert() */ + idtab_g.obj[n] = oi->token; +} /* end token_insert() */ /*------------------------------------------------------------------------- - * Function: addr_lookup - * - * Purpose: Check if address has already been encountered + * Function: token_lookup * - * Return: Success: TRUE/FALSE + * Purpose: Check if a token has already been encountered * - * Failure: (can't fail) + * Return: Success: TRUE/FALSE + * Failure: (can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- */ static H5_ATTR_PURE hbool_t -addr_lookup(H5O_info_t *oi) +token_lookup(hid_t loc_id, H5O_info2_t *oi) { - size_t n; + size_t n; + int token_cmp; if(oi->rc < 2) return FALSE; /*only one link possible*/ - for(n = 0; n < idtab_g.nobjs; n++) - if(H5F_addr_eq(idtab_g.obj[n], oi->addr)) + for(n = 0; n < idtab_g.nobjs; n++) { + if(H5Otoken_cmp(loc_id, &idtab_g.obj[n], &oi->token, &token_cmp) < 0) + return FALSE; + if(!token_cmp) return TRUE; + } return FALSE; -} /* end addr_lookup() */ +} /* end token_lookup() */ /*------------------------------------------------------------------------- - * Function: addr_reset + * Function: token_reset * - * Purpose: Reset the address tracking data structures + * Purpose: Reset the token tracking data structures * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- */ static void -addr_reset(void) +token_reset(void) { if(idtab_g.obj) HDfree(idtab_g.obj); idtab_g.obj = NULL; idtab_g.nalloc = idtab_g.nobjs = 0; -} /* end addr_reset() */ +} /* end token_reset() */ /*------------------------------------------------------------------------- @@ -852,7 +856,7 @@ static int compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) { hid_t aid = -1, aid2 = -1; /* Attribute IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info */ + H5O_info2_t oinfo1, oinfo2; /* Object info */ unsigned cpy_flags; /* Object copy flags */ /* Retrieve the object copy flags from the property list, if it's non-DEFAULT */ @@ -863,10 +867,10 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) cpy_flags = 0; /* Check the number of attributes on source dataset */ - if(H5Oget_info2(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR /* Check the number of attributes on destination dataset */ - if(H5Oget_info2(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) { /* Check that the destination has no attributes */ @@ -1055,11 +1059,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* break the infinite loop when the ref_object points to itself */ if(obj_owner > 0) { - H5O_info_t oinfo1, oinfo2; + H5O_info2_t oinfo1, oinfo2; + int token_cmp; - if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { + if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -1116,11 +1122,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* break the infinite loop when the ref_object points to itself */ if(obj_owner > 0) { - H5O_info_t oinfo1, oinfo2; + H5O_info2_t oinfo1, oinfo2; + int token_cmp; - if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { + if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -1273,7 +1281,7 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf) /* Check that the space used is the same */ /* (Don't check if the dataset is filtered (i.e. compressed, etc.) and - * the datatype is VLEN, since the addresses for the vlen + * the datatype is VLEN, since the tokens for the vlen * data in each dataset will (probably) be different and the storage * size will thus vary) */ @@ -1394,8 +1402,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(ginfo2.nlinks > 0) { char objname[NAME_BUF_SIZE]; /* Name of object in group */ char objname2[NAME_BUF_SIZE]; /* Name of object in group */ - H5L_info_t linfo; /* Link information */ - H5L_info_t linfo2; /* Link information */ + H5L_info2_t linfo; /* Link information */ + H5L_info2_t linfo2; /* Link information */ /* Loop over contents of groups */ for(idx = 0; idx < ginfo.nlinks; idx++) { @@ -1405,18 +1413,24 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(HDstrcmp(objname, objname2)) TEST_ERROR /* Get link info */ - if(H5Lget_info(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != linfo2.type) TEST_ERROR /* Extra checks for "real" objects */ if(linfo.type == H5L_TYPE_HARD) { - hid_t oid, oid2; /* IDs of objects within group */ - H5O_info_t oinfo, oinfo2; /* Object info */ + hid_t oid, oid2; /* IDs of objects within group */ + H5O_info2_t oinfo, oinfo2; /* Data model object info */ + H5O_native_info_t ninfo, ninfo2; /* Native file format object info */ /* Compare some pieces of the object info */ - if(H5Oget_info_by_name2(gid, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(gid2, objname2, &oinfo2, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + /* Get data model object info */ + if(H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get native object info */ + if(H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR if(oinfo.type != oinfo2.type) TEST_ERROR if(oinfo.rc != oinfo2.rc) TEST_ERROR @@ -1427,17 +1441,17 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) * of messages hasn't increased. */ if(H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) { - if(oinfo.hdr.nmesgs != oinfo2.hdr.nmesgs) + if(ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs) ; else - if(oinfo.hdr.nmesgs < oinfo2.hdr.nmesgs) TEST_ERROR + if(ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs) TEST_ERROR } /* Check for object already having been compared */ - if(addr_lookup(&oinfo)) + if(token_lookup(gid, &oinfo)) continue; else - addr_insert(&oinfo); + token_insert(&oinfo); /* Open objects */ if((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1580,8 +1594,8 @@ test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1605,7 +1619,7 @@ test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1673,8 +1687,8 @@ test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1698,7 +1712,7 @@ test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1766,8 +1780,8 @@ test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1797,7 +1811,7 @@ test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1861,10 +1875,11 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap hid_t aid = -1; /* Attribute ID */ hid_t sid = -1; /* Dataspace ID */ hsize_t dims[2] = {3, 4}; /* Dataspace dimensions */ - H5O_info_t oinfo, oinfo2; /* Object info */ + H5O_info2_t oinfo, oinfo2; /* Object info */ H5G_info_t ginfo; /* Group info */ - char src_filename[NAME_BUF_SIZE]; - char dst_filename[NAME_BUF_SIZE]; + hbool_t same_type; + char src_filename[NAME_BUF_SIZE]; + char dst_filename[NAME_BUF_SIZE]; TESTING("H5Ocopy(): named datatype with self-referential attribute"); @@ -1872,8 +1887,8 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1912,7 +1927,7 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datatype from SRC to DST */ @@ -1939,10 +1954,20 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* verify that the attribute's datatype is committed */ if(H5Tcommitted(tid) != TRUE) TEST_ERROR - /* verify that the addresses of the datatypes are the same */ - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.fileno != oinfo2.fileno || oinfo.addr != oinfo2.addr) + /* verify that the tokens of the datatypes are the same */ + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + + same_type = TRUE; + if(oinfo.fileno == oinfo2.fileno) { + int token_cmp; + if(H5Otoken_cmp(tid2, &oinfo.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) same_type = FALSE; + } + else + same_type = FALSE; + + if(!same_type) FAIL_PUTS_ERROR("destination attribute does not use the same committed datatype") /* Verify that there are only 2 links int he destination root group */ @@ -2015,8 +2040,8 @@ test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2053,7 +2078,7 @@ test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -2144,8 +2169,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) h5_fixname(FILENAME[4], fapl_src, src_fname, sizeof src_fname); h5_fixname(FILENAME[5], fapl_dst, dst_fname, sizeof dst_fname); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ fid_src = H5Fcreate(src_fname, H5F_ACC_TRUNC, fcpl_src, fapl_src); @@ -2202,7 +2227,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) fid_dst = H5Fcreate(dst_fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_dst); if (fid_dst < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -2306,8 +2331,8 @@ test_copy_dataset_simple_samefile(hid_t fcpl, hid_t fapl) /* Initialize the filenames */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR @@ -2413,8 +2438,8 @@ test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2451,7 +2476,7 @@ test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -2537,8 +2562,8 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2582,7 +2607,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -2669,8 +2694,8 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -2867,7 +2892,7 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datasets from SRC to DST */ @@ -3072,8 +3097,8 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -3265,7 +3290,7 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datasets from SRC to DST */ @@ -3482,8 +3507,8 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -3640,7 +3665,7 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the datasets from SRC to DST */ @@ -3795,8 +3820,8 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -3942,7 +3967,7 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4129,8 +4154,8 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4180,7 +4205,7 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4276,8 +4301,8 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4323,7 +4348,7 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4408,8 +4433,8 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4450,7 +4475,7 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4530,8 +4555,8 @@ test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hi h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4571,7 +4596,7 @@ test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hi /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4652,8 +4677,8 @@ test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4708,7 +4733,7 @@ test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4791,8 +4816,8 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4847,7 +4872,7 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -4936,8 +4961,8 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fa h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -4991,7 +5016,7 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fa /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5078,8 +5103,8 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5137,7 +5162,7 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5224,8 +5249,8 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5258,7 +5283,7 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5362,8 +5387,8 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5417,7 +5442,7 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5545,8 +5570,8 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5586,7 +5611,7 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5677,8 +5702,8 @@ test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -5712,7 +5737,7 @@ test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -5784,7 +5809,8 @@ attach_attribute_compound_vlstr(hid_t loc_id) int i; char *v; } s1; - s1 buf; /* Buffer */ + size_t len; + s1 buf = {0, NULL}; /* Buffer */ int ret_value = -1; /* Return value */ /* Create dataspace */ @@ -5814,8 +5840,11 @@ attach_attribute_compound_vlstr(hid_t loc_id) goto done; /* Write to the attribute */ + len = HDstrlen(ATTR_CMPD_STRING) + 1; buf.i = 9; - buf.v = "ThisIsAString"; + if(NULL == (buf.v = (char *)HDcalloc(len, sizeof(char)))) + goto done; + HDstrncpy(buf.v, ATTR_CMPD_STRING, len); if(H5Awrite(aid, cmpd_tid, &buf) < 0) goto done; @@ -5832,6 +5861,9 @@ done: H5Tclose(cmpd_tid); if(aid > 0) H5Aclose(aid); + + HDfree(buf.v); + return ret_value; } /* attach_attribute_compound_vlstr */ @@ -5963,8 +5995,8 @@ test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -6019,7 +6051,7 @@ test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) FAIL_STACK_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -6145,8 +6177,8 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6188,7 +6220,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -6278,8 +6310,8 @@ test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6303,7 +6335,7 @@ test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6382,8 +6414,8 @@ test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6431,7 +6463,7 @@ test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6513,8 +6545,8 @@ test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6563,7 +6595,7 @@ test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6646,8 +6678,8 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6705,7 +6737,7 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6777,8 +6809,8 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6816,7 +6848,7 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -6894,8 +6926,8 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -6945,7 +6977,7 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -7011,7 +7043,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ hid_t plid = -1; /* Object copy plist ID */ hsize_t dim2d[2]; hsize_t dim1d[1]; - H5L_info_t linfo; + H5L_info2_t linfo; int buf[DIM_SIZE_1][DIM_SIZE_2]; int i, j; unsigned expand_soft; @@ -7033,8 +7065,8 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); h5_fixname(FILENAME[2], dst_fapl, ext_filename, sizeof ext_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7128,7 +7160,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the group from SRC to DST */ @@ -7145,7 +7177,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ * re-add it as a soft link so compare_groups() works */ if(expand_soft) { /* Check link type */ - if(H5Lget_info(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != H5L_TYPE_HARD) FAIL_PUTS_ERROR("Soft link was not expanded to a hard link") @@ -7168,7 +7200,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_ * and re-add it as an external link so compare_groups() works */ if(expand_ext) { /* Check link type */ - if(H5Lget_info(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != H5L_TYPE_HARD) FAIL_PUTS_ERROR("External link was not expanded to a hard link") @@ -7288,8 +7320,8 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fa h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7334,7 +7366,7 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fa /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -7418,8 +7450,8 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); h5_fixname(FILENAME[2], dst_fapl, ext_filename, sizeof ext_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7467,7 +7499,7 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -7551,8 +7583,8 @@ test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7589,7 +7621,7 @@ test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -7660,8 +7692,8 @@ test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -7698,7 +7730,7 @@ test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST (should fail - intermediate groups not there) */ @@ -7782,8 +7814,8 @@ test_copy_same_file_named_datatype(hid_t fcpl_src, hid_t fapl) /* Initialize the filenames */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR @@ -7861,8 +7893,8 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) /* Initialize the destination filename */ h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Setup */ if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR @@ -7876,7 +7908,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(test_open) { @@ -7968,8 +8000,8 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8018,7 +8050,7 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8122,8 +8154,8 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8165,7 +8197,7 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8277,8 +8309,8 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8330,7 +8362,7 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8438,8 +8470,8 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8489,7 +8521,7 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8608,8 +8640,8 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8652,7 +8684,7 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8778,8 +8810,8 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -8823,7 +8855,7 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -8944,8 +8976,8 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9152,8 +9184,8 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9319,8 +9351,8 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9357,7 +9389,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -9465,8 +9497,8 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9510,7 +9542,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -9618,8 +9650,8 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -9663,7 +9695,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy the dataset from SRC to DST */ @@ -9769,8 +9801,8 @@ test_copy_null_ref(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap h5_fixname(FILENAME[1], src_fapl, mid_filename, sizeof mid_filename); h5_fixname(FILENAME[2], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -9938,8 +9970,8 @@ test_copy_null_ref_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds h5_fixname(FILENAME[1], src_fapl, mid_filename, sizeof mid_filename); h5_fixname(FILENAME[2], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -10100,8 +10132,8 @@ test_copy_attr_crt_order(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -10218,11 +10250,12 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src1_filename[NAME_BUF_SIZE]; char src2_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) { TESTING("H5Ocopy(): merging committed datatypes with reopen") @@ -10239,8 +10272,8 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap h5_fixname(FILENAME[3], src_fapl, src2_filename, sizeof src2_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source files */ if((fid_src1 = H5Fcreate(src1_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -10316,7 +10349,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy SRC1 to DST */ @@ -10331,31 +10364,34 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open SRC1 committed dtype, get address */ + /* Open SRC1 committed dtype, get token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open SRC1 dset dtype, check address */ + /* Open SRC1 dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open SRC2 committed dtype, check address */ + /* Open SRC2 committed dtype, check token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* Open SRC2 dset dtype, check address */ + /* Open SRC2 dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10369,7 +10405,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* recreate destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* copy SRC1 to DST */ @@ -10384,19 +10420,20 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open SRC1 dset dtype, get address */ + /* Open SRC1 dset dtype, get token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open SRC2 dset dtype, check address */ + /* Open SRC2 dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10456,9 +10493,10 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes to the source file with reopen") @@ -10472,8 +10510,8 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Initialize the filename */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR @@ -10546,7 +10584,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* * First copy each group to the destination group 3 (each with their own * group), and verify the committed datatypes are merged as expected. All - * datatypes copied should reference (share an address with) the + * datatypes copied should reference (share a token with) the * corresponding source datatype. */ /* Create destination group */ @@ -10565,61 +10603,68 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR } /* end if */ - /* Open group 1 source committed dtype, get address */ + /* Open group 1 source committed dtype, get token */ if((tid = H5Topen2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 1 source dset dtype, check address */ + /* Open group 1 source dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 1 committed dtype, check address */ + /* Open group 1 committed dtype, check token */ if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 1 dset dtype, check address */ + /* Open group 1 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 source committed dtype, get address and make sure it is + /* Open group 2 source committed dtype, get token and make sure it is * different from group 1 source committed dtype */ if((tid = H5Topen2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 2 source dset dtype, check address */ + /* Open group 2 source dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 committed dtype, check address */ + /* Open group 2 committed dtype, check token */ if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* Open group 2 dset dtype, check address */ + /* Open group 2 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10643,37 +10688,40 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR } /* end if */ - /* Open group 1 source dset dtype, get address */ + /* Open group 1 source dset dtype, get token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 1 dset dtype, check address */ + /* Open group 1 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 source dset dtype, get address and make sure it is + /* Open group 2 source dset dtype, get token and make sure it is * different from group 1 source dset dtype */ if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open group 2 dset dtype, check address */ + /* Open group 2 dset dtype, check token */ if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10729,10 +10777,11 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes with suggestions and reopen") @@ -10747,8 +10796,8 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -10837,17 +10886,18 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10875,31 +10925,33 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset 2 dtype, check address */ + /* Open dset 2 dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10960,10 +11012,11 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes with attributes and reopen") @@ -10978,8 +11031,8 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -11071,19 +11124,20 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open attribute dtype, get address */ + /* Open attribute dtype, get token */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_TOP, "attr", H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11191,10 +11245,11 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d int i; /* Local index variable */ hsize_t dim1d[1]; /* dimension sizes */ int buf[DIM_SIZE_1]; /* Buffer for data */ - haddr_t exp_addr_int, exp_addr_short; /* Expected object addresses */ - H5O_info_t oinfo; /* Object info */ + H5O_token_t exp_token_int, exp_token_short; /* Expected object tokenes */ + H5O_info2_t oinfo; /* Object info */ char src_filename[NAME_BUF_SIZE]; /* Source file name */ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */ + int token_cmp; if(reopen) TESTING("H5Ocopy(): hier. of committed datatypes and merging with reopen") @@ -11209,8 +11264,8 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -11331,16 +11386,16 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d */ if(H5Ocopy(fid_src, "/", fid_dst, SRC_ROOT_GROUP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR - /* get address of committed datatype at root group */ + /* get token of committed datatype at root group */ if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP "/" ROOT_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr_int = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token_int, &oinfo.token, sizeof(exp_token_int)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype at /g0 */ + /* get token of committed datatype at /g0 */ if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr_short = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token_short, &oinfo.token, sizeof(exp_token_short)); if(H5Tclose(tid) < 0) TEST_ERROR /* verify the datatype of first dataset is not committed */ @@ -11350,19 +11405,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for second dataset */ + /* check token of datatype for second dataset */ if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for third dataset */ + /* check token of datatype for third dataset */ if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11371,10 +11428,11 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d */ if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR - /* get address of committed datatype at /g0 */ + /* get token of committed datatype at /g0 */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* verify the datatype of first dataset is not committed */ @@ -11384,19 +11442,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for second dataset */ + /* check token of datatype for second dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for third dataset */ + /* check token of datatype for third dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11407,19 +11467,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET2, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET3, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR - /* Open attribute with anon ndt (short), get address */ + /* Open attribute with anon ndt (short), get token */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_SHORT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR - /* Open attribute with anon ndt (int), get address */ + /* Open attribute with anon ndt (int), get token */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_INT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11430,19 +11492,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for second dataset */ + /* check token of datatype for second dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_short) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for third dataset */ + /* check token of datatype for third dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr_int) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11464,8 +11528,8 @@ error: H5Tclose(f_tid); H5Tclose(g_tid); H5Tclose(anon_tid); - H5Pclose(ocpypl_id); - H5Aclose(aid); + H5Pclose(ocpypl_id); + H5Aclose(aid); H5Dclose(did); H5Sclose(sid); H5Gclose(gid); @@ -11515,10 +11579,11 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds hid_t aid = -1; /* Attribute ID */ hid_t ocpypl_id = -1; /* Object copy plist ID */ hsize_t dim1d[1]; /* dimension sizes */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object addresses */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; /* Source file name */ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */ + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging various committed datatypes with reopen") @@ -11529,8 +11594,8 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -11642,53 +11707,57 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds /* * Verification */ - /* get address of committed datatype: /src_root/src_ndt_double */ + /* get token of committed datatype: /src_root/src_ndt_double */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /dst_ndt_double */ + /* get token of committed datatype: /dst_ndt_double */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /src_root/src_ndt_float */ + /* get token of committed datatype: /src_root/src_ndt_float */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /dst_ndt_float */ + /* get token of committed datatype: /dst_ndt_float */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /src_root/src_ndt_int */ + /* get token of committed datatype: /src_root/src_ndt_int */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /dst_ndt_int */ + /* get token of committed datatype: /dst_ndt_int */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR - /* get address of committed datatype: /src_root/src_ndt_short */ + /* get token of committed datatype: /src_root/src_ndt_short */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* open attribute; get its dtype; get dtype's address: /src_root/src_ndt_double/dst_attr */ + /* open attribute; get its dtype; get dtype's token: /src_root/src_ndt_double/dst_attr */ if((aid = H5Aopen_by_name(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11704,14 +11773,14 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds error: H5E_BEGIN_TRY { - H5Pclose(ocpypl_id); - H5Tclose(tid); - H5Tclose(tid1); - H5Tclose(tid2); - H5Tclose(tid3); - H5Tclose(tid4); - H5Tclose(tid5); - H5Aclose(aid); + H5Pclose(ocpypl_id); + H5Tclose(tid); + H5Tclose(tid1); + H5Tclose(tid2); + H5Tclose(tid3); + H5Tclose(tid4); + H5Tclose(tid5); + H5Aclose(aid); H5Sclose(sid); H5Fclose(fid_dst); H5Fclose(fid_src); @@ -11741,10 +11810,11 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1; /* Datatype ID */ hid_t ocpypl_id = -1; /* Object copy plist ID */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes with suggestions and reopen") @@ -11755,8 +11825,8 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -11816,16 +11886,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open committed dtype "/dst_ndt_int", get its address */ + /* open committed dtype "/dst_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/uncopied/src_ndt_int" */ + /* check token of "/uncopied/src_ndt_int" */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11849,16 +11920,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open committed dtype "/uncopied/src_ndt_int", get its address */ + /* open committed dtype "/uncopied/src_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/src_ndt_int" */ + /* check token of "/src_ndt_int" */ if((tid = H5Topen2(fid_dst, SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11887,16 +11959,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "/uncopied/src_ndt_int", get its address */ + /* Open committed dtype "/uncopied/src_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/src_ndt_int2" */ + /* check token of "/src_ndt_int2" */ if((tid = H5Topen2(fid_dst, SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11921,16 +11994,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "/dst_dt_int", get its address */ + /* Open committed dtype "/dst_dt_int", get its token */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of "/uncopied/src_ndt_int2" */ + /* check token of "/uncopied/src_ndt_int2" */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* close the DST file */ @@ -11981,10 +12055,11 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; + int token_cmp; if(reopen) TESTING("H5Ocopy(): merging committed datatypes of datasets with suggestions and reopen") @@ -11999,8 +12074,8 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -12077,17 +12152,18 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "/dst_ndt_int", get its address */ + /* Open committed dtype "/dst_ndt_int", get its token */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: "/uncopied/src_ndt_dset" */ + /* check token of datatype for the copied dataset: "/uncopied/src_ndt_dset" */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12112,19 +12188,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype address */ + /* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: "/src_ndt_dset" */ + /* check token of datatype for the copied dataset: "/src_ndt_dset" */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12154,19 +12231,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open the copied dataset: /uncopied/src_ndt_dset", get its address */ + /* open the copied dataset: /uncopied/src_ndt_dset", get its token */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: "/src_ndt_dset2" */ + /* check token of datatype for the copied dataset: "/src_ndt_dset2" */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12192,19 +12270,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open the copied dataset: "/src_ndt_dset", get its datatype address */ + /* open the copied dataset: "/src_ndt_dset", get its datatype token */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* check address of datatype for the copied dataset: /uncopied/src_ndt_dset2 */ + /* check token of datatype for the copied dataset: /uncopied/src_ndt_dset2 */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12272,8 +12351,8 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* * Populate source file @@ -12537,7 +12616,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* open committed dtype "/dst_grp/dst_dt_int", get its address */ + /* open committed dtype "/dst_grp/dst_dt_int", get its token */ if((exp_tid = H5Topen2(fid_dst, "/" DST_GRP "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR /* open datatype of dataset */ @@ -12630,7 +12709,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((aid = H5Aopen_by_name(fid_dst, DST_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((exp_tid = H5Aget_type(aid)) < 0) TEST_ERROR - /* Open datatype of dataset, check address */ + /* Open datatype of dataset, check token */ if((did = H5Dopen2(fid_dst, "A_src_dset", H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR @@ -12667,7 +12746,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open committed dtype "/dst_ndt_short" */ if((exp_tid = H5Topen2(fid_dst, "/" DST_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - /* open datatype of dataset, check address */ + /* open datatype of dataset, check token */ if((did = H5Dopen2(fid_dst, "B_src_dset", H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR @@ -12749,11 +12828,12 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ int buf[DIM_SIZE_1]; /* Buffer for writing data */ - H5O_info_t oinfo; /* Object info */ - haddr_t exp_addr; /* Expected object address */ + H5O_info2_t oinfo; /* Object info */ + H5O_token_t exp_token; /* Expected object token */ char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; mcdt_search_cb_ud cb_udata; /* User data for callback */ + int token_cmp; if(reopen) TESTING("H5Ocopy(): H5Pset_mcdt_search_cb and reopen") @@ -12768,8 +12848,8 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -12861,17 +12941,18 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open dset dtype, check address */ + /* Open dset dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12909,17 +12990,18 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open copied dataset and its dtype, check address */ + /* Open copied dataset and its dtype, check token */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr != exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12948,31 +13030,33 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -13008,31 +13092,33 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR } /* end if */ - /* Open committed dtype "a", get address */ + /* Open committed dtype "a", get token */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR - /* Open committed dtype "b", get address */ + /* Open committed dtype "b", get token */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - exp_addr = oinfo.addr; + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token)); if(H5Tclose(tid) < 0) TEST_ERROR - /* Open the copied dataset and get its dtype, addresses should not be equal */ + /* Open the copied dataset and get its dtype, tokens should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(oinfo.addr == exp_addr) TEST_ERROR + if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR + if(!token_cmp) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -13127,8 +13213,8 @@ test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -13375,7 +13461,7 @@ error: */ static herr_t test_copy_iterate_cb(hid_t loc_id, const char *name, - const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data) + const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data) { hid_t dst_loc_id = *((hid_t *)op_data); @@ -13404,8 +13490,8 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Create source file */ if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) @@ -13435,8 +13521,7 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl /* Iterate over links in the root group, copying each object */ if((gid = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb, - &fid2) < 0) + if(H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb, &fid2) < 0) TEST_ERROR /* Close */ @@ -13499,8 +13584,8 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -13634,7 +13719,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -13820,8 +13905,8 @@ test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -13829,7 +13914,7 @@ test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Set dataspace dimensions */ @@ -14366,8 +14451,8 @@ main(void) */ } /* end for */ - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index b539b8a..20c6138 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -44,53 +44,15 @@ const char *FILENAME[] = { #define CONFIG_DENSE 16 #define MAX_CONFIGURATION 31 -#define NAME_DATATYPE_SIMPLE "H5T_NATIVE_INT" -#define NAME_DATATYPE_SIMPLE2 "H5T_NATIVE_INT-2" -#define NAME_DATATYPE_VL "vlen of int" -#define NAME_DATATYPE_VL_VL "vlen of vlen of int" #define NAME_DATASET_SIMPLE "dataset_simple" -#define NAME_DATASET_SIMPLE2 "dataset_simple_copy" -#define NAME_DATASET_SIMPLE3 "dataset_simple_another_copy" -#define NAME_DATASET_COMPOUND "dataset_compound" -#define NAME_DATASET_CHUNKED "dataset_chunked" -#define NAME_DATASET_CHUNKED_SINGLE "dataset_chunked_single" -#define NAME_DATASET_CHUNKED2 "dataset_chunked2" -#define NAME_DATASET_CHUNKED2_SINGLE "dataset_chunked2_single" -#define NAME_DATASET_CHUNKED3 "dataset_chunked3" -#define NAME_DATASET_CHUNKED3_SINGLE "dataset_chunked3_single" -#define NAME_DATASET_CHUNKED4 "dataset_chunked4" -#define NAME_DATASET_CHUNKED4_SINGLE "dataset_chunked4_single" -#define NAME_DATASET_COMPACT "dataset_compact" -#define NAME_DATASET_EXTERNAL "dataset_ext" -#define NAME_DATASET_NAMED_DTYPE "dataset_named_dtype" -#define NAME_DATASET_NAMED_DTYPE2 "dataset_named_dtype2" -#define NAME_DATASET_MULTI_OHDR "dataset_multi_ohdr" -#define NAME_DATASET_MULTI_OHDR2 "dataset_multi_ohdr2" -#define NAME_DATASET_VL "dataset_vl" -#define NAME_DATASET_VL2 "dataset_vl2" -#define NAME_DATASET_VL_VL "dataset_vl_vl" -#define NAME_DATASET_VL_VL2 "dataset_vl_vl2" -#define NAME_DATASET_CMPD_VL "dataset_cmpd_vl" #define NAME_DATASET_SUB_SUB "/g0/g00/g000/dataset_simple" #define NAME_GROUP_UNCOPIED "/uncopied" -#define NAME_GROUP_EMPTY "/empty" #define NAME_GROUP_TOP "/g0" -#define NAME_GROUP_TOP2 "/g1" -#define NAME_GROUP_TOP3 "/g2" -#define NAME_GROUP_TOP4 "/g3" #define NAME_GROUP_SUB "/g0/g00" -#define NAME_GROUP_SUB_2 "/g0/g01" -#define NAME_GROUP_SUB_SUB "/g0/g00/g000" #define NAME_GROUP_SUB_SUB2 "g000" -#define NAME_GROUP_DATASET "/g0/dataset_simple" #define NAME_GROUP_LINK "/g_links" #define NAME_GROUP_LINK2 "/g_links2" -#define NAME_GROUP_LOOP "g_loop" -#define NAME_GROUP_LOOP2 "g_loop2" -#define NAME_GROUP_LOOP3 "g_loop3" #define NAME_GROUP_REF "ref_grp" -#define NAME_LINK_DATASET "/g_links/dataset_simple" -#define NAME_LINK_HARD "/g_links/hard_link_to_dataset_simple" #define NAME_LINK_SOFT "/g_links/soft_link_to_dataset_simple" #define NAME_LINK_SOFT2 "/g_links2/soft_link_to_dataset_simple" #define NAME_LINK_EXTERN "/g_links/external_link_to_dataset_simple" @@ -99,28 +61,20 @@ const char *FILENAME[] = { #define NAME_LINK_SOFT_DANGLE2 "/g_links2/soft_link_to_nowhere" #define NAME_LINK_EXTERN_DANGLE "/g_links/external_link_to_nowhere" #define NAME_LINK_EXTERN_DANGLE2 "/g_links2/external_link_to_nowhere" -#define NAME_OLD_FORMAT "/dset1" #define NAME_BUF_SIZE 1024 #define ATTR_NAME_LEN 80 #define DIM_SIZE_1 12 #define DIM_SIZE_2 6 -#define MAX_DIM_SIZE_1 100 -#define MAX_DIM_SIZE_2 80 -#define CHUNK_SIZE_1 5 /* Not an even fraction of dimension sizes, so we test copying partial chunks */ -#define CHUNK_SIZE_2 5 -#define NUM_SUB_GROUPS 20 -#define NUM_WIDE_LOOP_GROUPS 10 -#define NUM_DATASETS 10 unsigned num_attributes_g; /* Number of attributes created */ /* Table containing object id and object name */ /* (Used for detecting duplicate objects when comparing groups */ static struct { - size_t nalloc; /* number of slots allocated */ - size_t nobjs; /* number of objects */ - haddr_t *obj; /* Addresses of objects seen */ + size_t nalloc; /* number of slots allocated */ + size_t nobjs; /* number of objects */ + H5O_token_t *obj; /* tokens for objects seen */ } idtab_g; /* Local function prototypes */ @@ -133,88 +87,92 @@ static int compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags); /*------------------------------------------------------------------------- - * Function: addr_insert + * Function: token_insert * - * Purpose: Add an address to the table. + * Purpose: Add a token to the table. * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- */ static void -addr_insert(H5O_info_t *oi) +token_insert(H5O_info2_t *oinfo) { size_t n; /* Don't add it if the link count is 1 because such an object can only * be encountered once. */ - if(oi->rc < 2) + if(oinfo->rc < 2) return; /* Extend the table */ if(idtab_g.nobjs >= idtab_g.nalloc) { - idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc); - idtab_g.obj = (haddr_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); - } /* end if */ + idtab_g.nalloc = MAX(256, 2 * idtab_g.nalloc); + idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); + } /* Insert the entry */ n = idtab_g.nobjs++; - idtab_g.obj[n] = oi->addr; -} /* end addr_insert() */ + idtab_g.obj[n] = oinfo->token; +} /* end token_insert() */ /*------------------------------------------------------------------------- - * Function: addr_lookup + * Function: token_lookup * - * Purpose: Check if address has already been encountered + * Purpose: Check if a token has already been encountered * - * Return: Success: TRUE/FALSE + * Return: Success: TRUE/FALSE + * Failure: (can't fail) * - * Failure: (can't fail) - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- */ static H5_ATTR_PURE hbool_t -addr_lookup(H5O_info_t *oi) +token_lookup(hid_t loc_id, H5O_info2_t *oinfo) { - size_t n; + size_t n; + int token_cmp; - if(oi->rc < 2) return FALSE; /*only one link possible*/ + if(oinfo->rc < 2) + return FALSE; /*only one link possible*/ - for(n = 0; n < idtab_g.nobjs; n++) - if(H5F_addr_eq(idtab_g.obj[n], oi->addr)) + for(n = 0; n < idtab_g.nobjs; n++) { + if(H5Otoken_cmp(loc_id, &(idtab_g.obj[n]), &oinfo->token, &token_cmp) < 0) + return FALSE; + if(0 == token_cmp) return TRUE; + } return FALSE; -} /* end addr_lookup() */ +} /* end token_lookup() */ /*------------------------------------------------------------------------- - * Function: addr_reset + * Function: token_reset * - * Purpose: Reset the address tracking data structures + * Purpose: Reset the token tracking data structures * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- */ static void -addr_reset(void) +token_reset(void) { if(idtab_g.obj) HDfree(idtab_g.obj); idtab_g.obj = NULL; idtab_g.nalloc = idtab_g.nobjs = 0; -} /* end addr_reset() */ +} /* end token_reset() */ /*------------------------------------------------------------------------- @@ -672,7 +630,7 @@ static int compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) { hid_t aid = -1, aid2 = -1; /* Attribute IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info */ + H5O_info2_t oinfo1, oinfo2; /* Object info */ unsigned cpy_flags; /* Object copy flags */ /* Retrieve the object copy flags from the property list, if it's non-DEFAULT */ @@ -683,10 +641,10 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) cpy_flags = 0; /* Check the number of attributes on source dataset */ - if(H5Oget_info2(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR /* Check the number of attributes on destination dataset */ - if(H5Oget_info2(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR + if(H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) { /* Check that the destination has no attributes */ @@ -855,11 +813,11 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* Check for object or region reference */ if(H5Tequal(tid, H5T_STD_REF) > 0) { - const H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */ + H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */ /* Loop over elements in buffers */ - ref_buf1 = (const H5R_ref_t *)buf1; - ref_buf2 = (const H5R_ref_t *)buf2; + ref_buf1 = (H5R_ref_t *)buf1; + ref_buf2 = (H5R_ref_t *)buf2; for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) { hid_t obj1_id, obj2_id; /* IDs for objects referenced */ H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */ @@ -875,11 +833,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, /* break the infinite loop when the ref_object points to itself */ if(obj_owner > 0) { - H5O_info_t oinfo1, oinfo2; + H5O_info2_t oinfo1, oinfo2; + int token_cmp; - if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { + if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR + if(0 == token_cmp) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR return TRUE; @@ -1157,8 +1117,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(ginfo2.nlinks > 0) { char objname[NAME_BUF_SIZE]; /* Name of object in group */ char objname2[NAME_BUF_SIZE]; /* Name of object in group */ - H5L_info_t linfo; /* Link information */ - H5L_info_t linfo2; /* Link information */ + H5L_info2_t linfo; /* Link information */ + H5L_info2_t linfo2; /* Link information */ /* Loop over contents of groups */ for(idx = 0; idx < ginfo.nlinks; idx++) { @@ -1168,18 +1128,24 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(HDstrcmp(objname, objname2)) TEST_ERROR /* Get link info */ - if(H5Lget_info(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.type != linfo2.type) TEST_ERROR /* Extra checks for "real" objects */ if(linfo.type == H5L_TYPE_HARD) { - hid_t oid, oid2; /* IDs of objects within group */ - H5O_info_t oinfo, oinfo2; /* Object info */ + hid_t oid, oid2; /* IDs of objects within group */ + H5O_info2_t oinfo, oinfo2; /* Data model object info */ + H5O_native_info_t ninfo, ninfo2; /* Native file format object info */ /* Compare some pieces of the object info */ - if(H5Oget_info_by_name2(gid, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(gid2, objname2, &oinfo2, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + /* Get data model object info */ + if(H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get native object info */ + if(H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR if(oinfo.type != oinfo2.type) TEST_ERROR if(oinfo.rc != oinfo2.rc) TEST_ERROR @@ -1190,17 +1156,18 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) * of messages hasn't increased. */ if(H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) { - if(oinfo.hdr.nmesgs != oinfo2.hdr.nmesgs) + if(ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs) ; else - if(oinfo.hdr.nmesgs < oinfo2.hdr.nmesgs) TEST_ERROR + if(ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs) + TEST_ERROR } /* Check for object already having been compared */ - if(addr_lookup(&oinfo)) + if(token_lookup(gid, &oinfo)) continue; else - addr_insert(&oinfo); + token_insert(&oinfo); /* Open objects */ if((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1316,8 +1283,8 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename); h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename); - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* create source file */ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR @@ -1451,7 +1418,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl, /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR - /* Create an uncopied object in destination file so that addresses in source and destination + /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -1683,8 +1650,8 @@ main(void) FALSE, "H5Ocopy(): expand object reference"); } /* end for */ - /* Reset file address checking info */ - addr_reset(); + /* Reset file token checking info */ + token_reset(); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); diff --git a/test/ohdr.c b/test/ohdr.c index 9d2d414..120935c 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -50,7 +50,8 @@ const char *FILENAME[] = { * To get this data file, define H5O_ENABLE_BOGUS in src/H5Oprivate, rebuild * the library and simply compile gen_bogus.c with that HDF5 library and run it. */ -#define FILE_BOGUS "tbogus.h5" +#define FILE_BOGUS "tbogus.h5" +#define TESTFILE_LEN 256 /* */ #define FILE_OHDR_SWMR "ohdr_swmr.h5" @@ -321,7 +322,7 @@ test_ohdr_swmr(hbool_t new_format) hsize_t dims[1]; /* Dimension sizes */ size_t u; /* Iterator */ int n; /* Data variable */ - H5O_info_t obj_info; /* Information for the object */ + H5O_native_info_t ninfo; /* Information for the object */ if(new_format) { TESTING("exercise the coding for the re-read of the object header for SWMR access: latest-format"); @@ -391,16 +392,16 @@ test_ohdr_swmr(hbool_t new_format) FAIL_STACK_ERROR /* Get the object information */ - if(H5Oget_info2(did, &obj_info, H5O_INFO_HDR) < 0) + if(H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR) < 0) FAIL_STACK_ERROR if(new_format) - if(obj_info.hdr.version != OBJ_VERSION_LATEST) + if(ninfo.hdr.version != OBJ_VERSION_LATEST) FAIL_STACK_ERROR /* The size of object header should be greater than the speculative read size of H5O_SPEC_READ_SIZE */ /* This will exercise the coding for the re-read of the object header for SWMR access */ - if(obj_info.hdr.space.total < H5O_SPEC_READ_SIZE) + if(ninfo.hdr.space.total < H5O_SPEC_READ_SIZE) TEST_ERROR; /* Close the dataset */ @@ -473,13 +474,13 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) hid_t fid_bogus = -1; /* bogus file ID */ hid_t gid_bogus = -1; /* bogus group ID */ hid_t loc_bogus = -1; /* location: bogus file or group ID */ - char testfile[256]; + char testfile[TESTFILE_LEN]; /* 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, HDstrlen(FILE_BOGUS)); - testfile[HDstrlen(FILE_BOGUS)]='\0'; + HDstrncpy(testfile, FILE_BOGUS, TESTFILE_LEN); + testfile[TESTFILE_LEN - 1]='\0'; HDstrncat(testfile, ".copy", 5); /* Make a copy of the data file from svn. */ @@ -756,10 +757,10 @@ error: */ static int count_attributes(hid_t dset_id) -{ - H5O_info_t info; - - if(H5Oget_info2(dset_id, &info, H5O_INFO_ALL) < 0) +{ + H5O_info2_t info; + + if(H5Oget_info3(dset_id, &info, H5O_INFO_NUM_ATTRS) < 0) return -1; else return (int)info.num_attrs; /* should never exceed int bounds */ @@ -773,10 +774,13 @@ count_attributes(hid_t dset_id) static herr_t _oh_getsize(hid_t did, hsize_t *size_out) { - H5O_info_t info; - if(FAIL == H5Oget_info2(did, &info, H5O_INFO_HDR)) + H5O_native_info_t ninfo; + + if(FAIL == H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR)) return FAIL; - *size_out = info.hdr.space.total; + + *size_out = ninfo.hdr.space.total; + return SUCCEED; } /* _oh_getsize */ diff --git a/test/page_buffer.c b/test/page_buffer.c index 5313c9b..21ffbf5 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -38,23 +38,25 @@ #define FILENAME_LEN 1024 + +/* test routines */ +#ifdef H5_HAVE_PARALLEL +static unsigned verify_page_buffering_disabled(hid_t orig_fapl, + const char *env_h5_drvr); +#else #define NUM_DSETS 5 #define NX 100 #define NY 50 -/* helper routines */ -static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl); -static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size); - -/* test routines */ static unsigned test_args(hid_t fapl, const char *env_h5_drvr); static unsigned test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr); static unsigned test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr); static unsigned test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr); static unsigned test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr); -#ifdef H5_HAVE_PARALLEL -static unsigned verify_page_buffering_disabled(hid_t orig_fapl, - const char *env_h5_drvr); + +/* helper routines */ +static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl); +static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size); #endif /* H5_HAVE_PARALLEL */ const char *FILENAME[] = { @@ -62,6 +64,7 @@ const char *FILENAME[] = { NULL }; +#ifndef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: create_file() @@ -296,6 +299,7 @@ error: } H5E_END_TRY; return 1; } +#endif /* H5_HAVE_PARALLEL */ /* * @@ -357,6 +361,7 @@ error: } /* set_multi_split() */ +#ifndef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: test_args() @@ -379,6 +384,7 @@ error: * *------------------------------------------------------------------------- */ + static unsigned test_args(hid_t orig_fapl, const char *env_h5_drvr) { @@ -2002,6 +2008,7 @@ error: return 1; } /* test_stats_collection */ +#endif /* #ifndef H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- diff --git a/test/stab.c b/test/stab.c index 80c8b06..215d748 100644 --- a/test/stab.c +++ b/test/stab.c @@ -70,8 +70,10 @@ const char *FILENAME[] = { #define GCPL_ON_ROOT_MAX_COMPACT 4 #define GCPL_ON_ROOT_MIN_DENSE 2 +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Definitions for 'old_api' test */ #define OLD_API_GROUP "/old_api" +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Definitions for 'corrupt_stab_msg' test */ #define CORRUPT_STAB_FILE "corrupt_stab_msg.h5" @@ -328,7 +330,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) unsigned est_num_entries; /* Estimated # of entries in group */ unsigned est_name_len; /* Estimated length of entry name */ unsigned nmsgs; /* Number of messages in group's header */ - H5O_info_t oinfo; /* Object info */ + H5O_native_info_t ninfo; /* Object info */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ @@ -419,11 +421,11 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(H5G__is_new_dense_test(gid) != FALSE) TEST_ERROR /* Check that the object header is only one chunk and the space has been allocated correctly */ - if(H5Oget_info2(gid, &oinfo, H5O_INFO_HDR) < 0) TEST_ERROR - if(oinfo.hdr.space.total != 151) TEST_ERROR - if(oinfo.hdr.space.free != 0) TEST_ERROR - if(oinfo.hdr.nmesgs != 6) TEST_ERROR - if(oinfo.hdr.nchunks != 1) TEST_ERROR + if(H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(ninfo.hdr.space.total != 151) TEST_ERROR + if(ninfo.hdr.space.free != 0) TEST_ERROR + if(ninfo.hdr.nmesgs != 6) TEST_ERROR + if(ninfo.hdr.nchunks != 1) TEST_ERROR /* Create one more "bottom" group, which should push top group into using a symbol table */ HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); @@ -441,11 +443,11 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Check that the object header is still one chunk and the space has been allocated correctly */ - if(H5Oget_info2(gid, &oinfo, H5O_INFO_HDR) < 0) TEST_ERROR - if(oinfo.hdr.space.total != 151) TEST_ERROR - if(oinfo.hdr.space.free != 92) TEST_ERROR - if(oinfo.hdr.nmesgs != 3) TEST_ERROR - if(oinfo.hdr.nchunks != 1) TEST_ERROR + if(H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR + if(ninfo.hdr.space.total != 151) TEST_ERROR + if(ninfo.hdr.space.free != 92) TEST_ERROR + if(ninfo.hdr.nmesgs != 3) TEST_ERROR + if(ninfo.hdr.nchunks != 1) TEST_ERROR /* Unlink objects from top group */ while(u >= LIFECYCLE_MIN_DENSE) { diff --git a/test/tattr.c b/test/tattr.c index b89ec3f..bcd8698 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -20,6 +20,7 @@ *************************************************************/ #include "testhdf5.h" +#include "H5VLnative_private.h" /* * This file needs to access private information from the H5O package. @@ -427,7 +428,7 @@ test_attr_basic_read(hid_t fapl) hid_t dataset; /* Dataset ID */ hid_t group; /* Group ID */ hid_t attr; /* Attribute ID */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */ int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ int i, j; /* Local index variables */ @@ -445,9 +446,9 @@ test_attr_basic_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 2, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 2, "H5Oget_info3"); /* Open first attribute for the dataset */ attr = H5Aopen(dataset, ATTR_TMP_NAME, H5P_DEFAULT); @@ -474,9 +475,9 @@ test_attr_basic_read(hid_t fapl) CHECK(group, FAIL, "H5Gopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(group, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(group, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open the attribute for the group */ attr = H5Aopen(group, ATTR2_NAME, H5P_DEFAULT); @@ -811,7 +812,7 @@ test_attr_compound_read(hid_t fapl) hid_t field; /* Attribute field datatype */ struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; /* Buffer for reading 4th attribute */ ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int i, j; /* Local index variables */ herr_t ret; /* Generic return value */ @@ -827,9 +828,9 @@ test_attr_compound_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open 1st attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1016,7 +1017,7 @@ test_attr_scalar_read(hid_t fapl) hid_t attr; /* Attribute ID */ H5S_class_t stype; /* Dataspace class */ float rdata = 0.0F; /* Buffer for reading 1st attribute */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1031,9 +1032,9 @@ test_attr_scalar_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open an attribute for the dataset */ attr = H5Aopen(dataset, ATTR5_NAME, H5P_DEFAULT); @@ -1218,7 +1219,7 @@ test_attr_mult_read(hid_t fapl) int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */ double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; /* Buffer for reading 3rd attribute */ ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int i, j, k; /* Local index values */ herr_t ret; /* Generic return value */ @@ -1234,9 +1235,9 @@ test_attr_mult_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Open 1st attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1468,7 +1469,7 @@ test_attr_iterate(hid_t fapl) hid_t dataset; /* Dataset ID */ hid_t sid; /* Dataspace ID */ int count; /* operator data for the iterator */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1491,9 +1492,9 @@ test_attr_iterate(hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 0, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 0, "H5Oget_info3"); /* Iterate over attributes on dataset */ count = 0; @@ -1509,9 +1510,9 @@ test_attr_iterate(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Iterate over attributes on dataset */ count = 0; @@ -1541,7 +1542,7 @@ test_attr_delete(hid_t fapl) hid_t attr; /* Attribute ID */ char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */ ssize_t name_len; /* Length of attribute name */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1556,27 +1557,27 @@ test_attr_delete(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Try to delete bogus attribute */ ret = H5Adelete(dataset, "Bogus"); VERIFY(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 3, "H5Oget_info3"); /* Delete middle (2nd) attribute */ ret = H5Adelete(dataset, ATTR2_NAME); CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 2, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 2, "H5Oget_info3"); /* Open 1st attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1611,9 +1612,9 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 1, "H5Oget_info3"); /* Open last (formally 3rd) attribute for the dataset */ attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); @@ -1634,9 +1635,9 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, 0, "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, 0, "H5Oget_info3"); /* Close dataset */ ret = H5Dclose(dataset); @@ -1664,7 +1665,7 @@ test_attr_dtype_shared(hid_t fapl) hid_t attr_id; /* Attribute ID */ int data = 8; /* Data to write */ int rdata = 0; /* Read read in */ - H5O_info_t oinfo; /* Object's information */ + H5O_info2_t oinfo; /* Object's information */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ herr_t ret; /* Generic return value */ @@ -1698,9 +1699,9 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Tcommit2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3"); /* Create dataspace for dataset */ space_id = H5Screate(H5S_SCALAR); @@ -1711,18 +1712,18 @@ test_attr_dtype_shared(hid_t fapl) CHECK(dset_id, FAIL, "H5Dcreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3"); /* Create attribute on dataset */ attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Acreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3"); /* Close attribute */ ret = H5Aclose(attr_id); @@ -1733,18 +1734,18 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3"); /* Create attribute on dataset */ attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Acreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3"); /* Write data into the attribute */ ret = H5Awrite(attr_id, H5T_NATIVE_INT, &data); @@ -1797,18 +1798,18 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3"); /* Unlink the dataset */ ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3"); /* Unlink the named datatype */ ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT); @@ -2440,7 +2441,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) unsigned u; /* Local index variable */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ @@ -2523,9 +2524,9 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check # of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3"); } /* end for */ /* Check on dataset's attribute storage status */ @@ -2634,7 +2635,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) htri_t is_dense; /* Are attributes stored densely? */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ unsigned u; /* Local index variable */ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); unsigned use_corder; /* Track creation order or not */ @@ -2726,9 +2727,9 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Arename_by_name"); /* Check # of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3"); } /* end for */ /* Check on dataset's attribute storage status */ @@ -2826,7 +2827,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) size_t mesg_count; /* # of shared messages */ h5_stat_size_t empty_filesize; /* Size of empty file */ h5_stat_size_t filesize; /* Size of file after modifications */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ unsigned u; /* Local index variable */ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ @@ -2904,9 +2905,9 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check # of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info3"); + VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3"); } /* end for */ /* Check on dataset's attribute storage status */ @@ -10863,9 +10864,10 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) hid_t gid; /* Group ID */ hid_t oid; /* Object ID */ hsize_t dims = 256; /* Attribute dimensions */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ H5A_info_t ainfo; /* Attribute info */ haddr_t root_addr; /* Root group address */ + haddr_t link_addr; /* Link (to root group) address */ herr_t ret; /* Generic return status */ /* Output message about test being performed */ @@ -10881,9 +10883,10 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gcreate2"); /* Get root group address */ - ret = H5Oget_info2(fid, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(fid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - root_addr = oinfo.addr; + ret = H5VLnative_token_to_addr(fid, oinfo.token, &root_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); /* * Create link to root group @@ -10906,10 +10909,12 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT); CHECK(oid, FAIL, "H5Oopen"); - ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - if(oinfo.addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); + ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + if(link_addr != root_addr) + TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)link_addr, (long long unsigned)root_addr); /* Close file */ ret = H5Fclose(fid); @@ -10951,10 +10956,12 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT); CHECK(oid, FAIL, "H5Oopen"); - ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); + ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - if(oinfo.addr != root_addr) - TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); + ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + if(link_addr != root_addr) + TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)link_addr, (long long unsigned)root_addr); ret = H5Aget_info_by_name(gid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); if(ainfo.data_size != dims) diff --git a/test/tfile.c b/test/tfile.c index 7da8b85..d6047dc 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -25,6 +25,7 @@ #include "H5Iprivate.h" #include "H5Pprivate.h" #include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5private.h" /* * This file needs to access private information from the H5F package. @@ -4208,7 +4209,7 @@ test_filespace_info(const char *env_h5_drvr) ** *****************************************************************/ static int -set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) +set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t split) { H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl_arr[H5FD_MEM_NTYPES]; @@ -4217,7 +4218,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) hbool_t relax; H5FD_mem_t mt; - HDassert(split || multi); + HDassert(split); HDmemset(memb_name, 0, sizeof memb_name); @@ -4308,7 +4309,7 @@ test_file_freespace(const char *env_h5_drvr) my_fapl = new_fapl; if(multi_vfd || split_vfd) { - ret = set_multi_split(new_fapl, FSP_SIZE_DEF, multi_vfd, split_vfd); + ret = set_multi_split(new_fapl, FSP_SIZE_DEF, split_vfd); CHECK(ret, FAIL, "set_multi_split"); } @@ -4474,7 +4475,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format) /* Set up paged aligned address space for multi/split driver */ if(multi_vfd || split_vfd) { - ret = set_multi_split(fapl, FSP_SIZE_DEF, multi_vfd, split_vfd); + ret = set_multi_split(fapl, FSP_SIZE_DEF, split_vfd); CHECK(ret, FAIL, "set_multi_split"); } @@ -5177,7 +5178,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, { hid_t file, group; /* Handles */ hid_t fapl; /* File access property list */ - H5O_info_t oinfo; /* Object info */ + H5O_native_info_t ninfo; /* Object info */ herr_t ret; /* Return value */ /* @@ -5195,9 +5196,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, /* * Make sure the root group has the correct object header version */ - ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name"); /* * Reopen the file and make sure the root group still has the correct version @@ -5211,9 +5212,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, file = H5Fopen("tfile5.h5", H5F_ACC_RDWR, fapl); CHECK(file, FAIL, "H5Fopen"); - ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name"); /* * Create a group named "G1" in the file, and make sure it has the correct @@ -5222,9 +5223,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, group = H5Gcreate2(file, "/G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(group, FAIL, "H5Gcreate"); - ret = H5Oget_info2(group, &oinfo, H5O_INFO_HDR); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info"); + ret = H5Oget_native_info(group, &ninfo, H5O_NATIVE_INFO_HDR); + CHECK(ret, FAIL, "H5Oget_native)info"); + VERIFY(ninfo.hdr.version, oh_vers_mod, "H5Oget_native_info"); ret = H5Gclose(group); CHECK(ret, FAIL, "H5Gclose"); @@ -5236,9 +5237,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, group = H5Gcreate2(file, "/G1/G3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(group, FAIL, "H5Gcreate"); - ret = H5Oget_info2(group, &oinfo, H5O_INFO_HDR); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info_by_name"); + ret = H5Oget_native_info(group, &ninfo, H5O_NATIVE_INFO_HDR); + CHECK(ret, FAIL, "H5Oget_native_info"); + VERIFY(ninfo.hdr.version, oh_vers_mod, "H5Oget_native_info"); ret = H5Gclose(group); CHECK(ret, FAIL, "H5Gclose"); @@ -5246,9 +5247,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, /* * Make sure the root group still has the correct object header version */ - ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name"); ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); @@ -6034,7 +6035,7 @@ test_libver_bounds_obj(hid_t fapl) hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ - H5O_info_t oinfo; /* Object info */ + H5O_native_info_t ninfo; /* Object info */ H5G_info_t ginfo; /* Group info */ herr_t ret; /* Return value */ @@ -6058,11 +6059,11 @@ test_libver_bounds_obj(hid_t fapl) CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ - ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(fid, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify object header version is 2 because shared message is enabled */ - VERIFY(oinfo.hdr.version, H5O_VERSION_2, "H5O_obj_ver_bounds"); + VERIFY(ninfo.hdr.version, H5O_VERSION_2, "H5O_obj_ver_bounds"); /* Close the file */ ret = H5Fclose(fid); @@ -6077,11 +6078,11 @@ test_libver_bounds_obj(hid_t fapl) CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ - ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(fid, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify object header version is as indicated by low_bound */ - VERIFY(oinfo.hdr.version, H5O_obj_ver_bounds[low], "H5O_obj_ver_bounds"); + VERIFY(ninfo.hdr.version, H5O_obj_ver_bounds[low], "H5O_obj_ver_bounds"); /* Close the file */ ret = H5Fclose(fid); @@ -6132,11 +6133,11 @@ test_libver_bounds_obj(hid_t fapl) VERIFY(ginfo.storage_type, H5G_STORAGE_TYPE_SYMBOL_TABLE, "H5Gget_info"); /* Get object header information */ - ret = H5Oget_info_by_name2(gid, GRP_NAME, &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(gid, GRP_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify object header version as indicated by low_bound */ - VERIFY(oinfo.hdr.version, H5O_obj_ver_bounds[f->shared->low_bound], "H5O_obj_ver_bounds"); + VERIFY(ninfo.hdr.version, H5O_obj_ver_bounds[f->shared->low_bound], "H5O_obj_ver_bounds"); /* Close the group */ ret = H5Gclose(gid); diff --git a/test/th5o.c b/test/th5o.c index 354245f..ab4a8de 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -20,6 +20,9 @@ *************************************************************/ #include "testhdf5.h" +#include "H5Fprivate.h" +#include "H5VLprivate.h" +#include "H5VLnative_private.h" #define TEST_FILENAME "th5o_file" @@ -231,6 +234,7 @@ test_h5o_close(void) } +#ifndef H5_NO_DEPRECATED_SYMBOLS /**************************************************************** ** ** test_h5o_open_by_addr(): Test H5Oopen_by_addr function. @@ -239,17 +243,17 @@ test_h5o_close(void) static void test_h5o_open_by_addr(void) { - hid_t fid; /* HDF5 File ID */ - hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info_t li; /* Buffer for H5Lget_info */ - haddr_t grp_addr; /* Addresses for objects */ - haddr_t dset_addr; - haddr_t dtype_addr; - hsize_t dims[RANK]; - H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ - H5G_info_t ginfo; /* Group info struct */ - H5T_class_t type_class; /* Class of the datatype */ - herr_t ret; /* Value returned from API calls */ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + H5L_info2_t li; /* Buffer for H5Lget_info */ + haddr_t grp_addr; /* Addresses for objects */ + haddr_t dset_addr; + haddr_t dtype_addr; + hsize_t dims[RANK]; + H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ + H5G_info_t ginfo; /* Group info struct */ + H5T_class_t type_class; /* Class of the datatype */ + herr_t ret; /* Value returned from API calls */ /* Create a new HDF5 file */ fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -285,15 +289,20 @@ test_h5o_open_by_addr(void) CHECK(ret, FAIL, "H5Sclose"); /* Get address for each object */ - ret = H5Lget_info(fid, "group", &li, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info"); - grp_addr = li.u.address; - ret = H5Lget_info(fid, "group/datatype", &li, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info"); - dtype_addr = li.u.address; - ret = H5Lget_info(fid, "dataset", &li, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info"); - dset_addr = li.u.address; + ret = H5Lget_info2(fid, "group", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info2"); + ret = H5VLnative_token_to_addr(fid, li.u.token, &grp_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + + ret = H5Lget_info2(fid, "group/datatype", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info2"); + ret = H5VLnative_token_to_addr(fid, li.u.token, &dtype_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); + + ret = H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info2"); + ret = H5VLnative_token_to_addr(fid, li.u.token, &dset_addr); + CHECK(ret, FAIL, "H5VLnative_token_to_addr"); /* Now make sure that H5Oopen_by_addr can open all three types of objects */ grp = H5Oopen_by_addr(fid, grp_addr); @@ -366,7 +375,122 @@ test_h5o_open_by_addr(void) }H5E_END_TRY VERIFY(dtype, FAIL, "H5Oopen_by_addr"); } /* test_h5o_open_by_addr() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + +/**************************************************************** +** +** test_h5o_open_by_token(): Test H5Oopen_by_token function. +** +****************************************************************/ +static void +test_h5o_open_by_token(void) +{ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + H5L_info2_t li; /* Buffer for H5Lget_info */ + hsize_t dims[RANK]; + H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ + H5G_info_t ginfo; /* Group info struct */ + H5T_class_t type_class; /* Class of the datatype */ + herr_t ret; /* Value returned from API calls */ + + /* Create a new HDF5 file */ + fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create a group, dataset, and committed datatype within the file */ + /* Create the group */ + grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gcreate2"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* Commit the type inside the group */ + dtype = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + + /* Create the data space for the dataset. */ + dims[0] = DIM0; + dims[1] = DIM1; + dspace = H5Screate_simple(RANK, dims, NULL); + CHECK(dspace, FAIL, "H5Screate_simple"); + + /* Create the dataset. */ + dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dcreate2"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + + /* Make sure that H5Oopen_by_token can open all three types of objects */ + ret = H5Lget_info2(fid, "group", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + grp = H5Oopen_by_token(fid, li.u.token); + CHECK(grp, FAIL, "H5Oopen_by_token"); + + ret = H5Lget_info2(fid, "group/datatype", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + dtype = H5Oopen_by_token(fid, li.u.token); + CHECK(dtype, FAIL, "H5Oopen_by_token"); + + ret = H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + /* Check that we can use the group ID as a valid location */ + dset = H5Oopen_by_token(grp, li.u.token); + CHECK(dset, FAIL, "H5Oopen_by_token"); + + /* Make sure that each is the right kind of ID */ + id_type = H5Iget_type(grp); + VERIFY(id_type, H5I_GROUP, "H5Iget_type for group ID"); + id_type = H5Iget_type(dtype); + VERIFY(id_type, H5I_DATATYPE, "H5Iget_type for datatype ID"); + id_type = H5Iget_type(dset); + VERIFY(id_type, H5I_DATASET, "H5Iget_type for dataset ID"); + + /* Do something more complex with each of the IDs to make sure they "work" */ + ret = H5Gget_info(grp, &ginfo); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 1, "H5Gget_info"); /* There should be one object, the datatype */ + + type_class = H5Tget_class(dtype); + VERIFY(type_class, H5T_INTEGER, "H5Tget_class"); + + dspace = H5Dget_space(dset); + CHECK(dspace, FAIL, "H5Dget_space"); + + /* Close the IDs */ + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Try giving some bogus values to H5O_open_by_token */ + /* Try opening an object using H5O_TOKEN_UNDEF (should fail) */ + H5E_BEGIN_TRY{ + dtype = H5Oopen_by_token(fid, H5O_TOKEN_UNDEF); + }H5E_END_TRY + VERIFY(dtype, FAIL, "H5Oopen_by_token"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Also, trying to open an object without a valid location (should fail) */ + H5E_BEGIN_TRY{ + dtype = H5Oopen_by_token(fid, li.u.token); + }H5E_END_TRY + VERIFY(dtype, FAIL, "H5Oopen_by_token"); +} /* test_h5o_open_by_token() */ /**************************************************************** ** @@ -378,7 +502,7 @@ test_h5o_refcount(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info2_t oinfo; /* Object info struct */ hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ @@ -410,15 +534,15 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Sclose"); /* Get ref counts for each object. They should all be 1, since each object has a hard link. */ - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); /* Increment each object's reference count. */ ret = H5Oincr_refcount(grp); @@ -429,15 +553,15 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Oincr_refcount"); /* Get ref counts for each object. They should all be 2 now. */ - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); /* Decrement the reference counts and check that they decrease back to 1. */ ret = H5Odecr_refcount(grp); @@ -447,15 +571,15 @@ test_h5o_refcount(void) ret = H5Odecr_refcount(dset); CHECK(ret, FAIL, "H5Odecr_refcount"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); /* Increment the reference counts and then close the file to make sure the increment is permanant */ ret = H5Oincr_refcount(grp); @@ -485,15 +609,15 @@ test_h5o_refcount(void) dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); CHECK(dset, FAIL, "H5Dopen2"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3"); /* Decrement the reference counts and close the file */ ret = H5Odecr_refcount(grp); @@ -523,15 +647,15 @@ test_h5o_refcount(void) dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); CHECK(dset, FAIL, "H5Dopen2"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3"); /* Close the IDs */ ret = H5Gclose(grp); @@ -1254,7 +1378,7 @@ test_h5o_getinfo_same_file(void) { hid_t fid1, fid2; /* HDF5 File ID */ hid_t gid1, gid2; /* Group IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info2_t oinfo1, oinfo2; /* Object info structs */ herr_t ret; /* Value returned from API calls */ /* Create a new HDF5 file */ @@ -1272,24 +1396,24 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, through group IDs */ - ret = H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); + ret = H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Reset object info */ HDmemset(&oinfo1, 0, sizeof(oinfo1)); HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, by name */ - ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Close everything */ ret = H5Gclose(gid1); @@ -1317,24 +1441,24 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, through group IDs */ - ret = H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC); - CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); + ret = H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC); + CHECK(ret, FAIL, "H5Oget_info3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Reset object info */ HDmemset(&oinfo1, 0, sizeof(oinfo1)); HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, by name */ - ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); - VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3"); /* Close everything */ ret = H5Gclose(gid1); @@ -1352,6 +1476,143 @@ test_h5o_getinfo_same_file(void) /**************************************************************** ** +** test_h5o_open_by_addr_deprec(): Test H5Oopen_by_addr function. +** +****************************************************************/ +static void +test_h5o_open_by_addr_deprec(void) +{ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + H5L_info1_t li; /* Buffer for H5Lget_info1 */ + haddr_t grp_addr; /* Addresses for objects */ + haddr_t dset_addr; + haddr_t dtype_addr; + hsize_t dims[RANK]; + H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ + H5G_info_t ginfo; /* Group info struct */ + H5T_class_t type_class; /* Class of the datatype */ + herr_t ret; /* Value returned from API calls */ + + /* Create a new HDF5 file */ + fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create a group, dataset, and committed datatype within the file */ + /* Create the group */ + grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gcreate2"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + + /* Commit the type inside the group */ + dtype = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype, FAIL, "H5Tcopy"); + ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Tcommit2"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + + /* Create the data space for the dataset. */ + dims[0] = DIM0; + dims[1] = DIM1; + dspace = H5Screate_simple(RANK, dims, NULL); + CHECK(dspace, FAIL, "H5Screate_simple"); + + /* Create the dataset. */ + dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset, FAIL, "H5Dcreate2"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + + /* Get address for each object */ + ret = H5Lget_info1(fid, "group", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + grp_addr = li.u.address; + ret = H5Lget_info1(fid, "group/datatype", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + dtype_addr = li.u.address; + ret = H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info"); + dset_addr = li.u.address; + + /* Now make sure that H5Oopen_by_addr can open all three types of objects */ + grp = H5Oopen_by_addr(fid, grp_addr); + CHECK(grp, FAIL, "H5Oopen_by_addr"); + dtype = H5Oopen_by_addr(fid, dtype_addr); + CHECK(dtype, FAIL, "H5Oopen_by_addr"); + /* Check that we can use the group ID as a valid location */ + dset = H5Oopen_by_addr(grp, dset_addr); + CHECK(dset, FAIL, "H5Oopen_by_addr"); + + /* Make sure that each is the right kind of ID */ + id_type = H5Iget_type(grp); + VERIFY(id_type, H5I_GROUP, "H5Iget_type for group ID"); + id_type = H5Iget_type(dtype); + VERIFY(id_type, H5I_DATATYPE, "H5Iget_type for datatype ID"); + id_type = H5Iget_type(dset); + VERIFY(id_type, H5I_DATASET, "H5Iget_type for dataset ID"); + + /* Do something more complex with each of the IDs to make sure they "work" */ + ret = H5Gget_info(grp, &ginfo); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 1, "H5Gget_info"); /* There should be one object, the datatype */ + + type_class = H5Tget_class(dtype); + VERIFY(type_class, H5T_INTEGER, "H5Tget_class"); + + dspace = H5Dget_space(dset); + CHECK(dspace, FAIL, "H5Dget_space"); + + /* Close the IDs */ + ret = H5Sclose(dspace); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Gclose(grp); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Tclose(dtype); + CHECK(ret, FAIL, "H5Tclose"); + ret = H5Dclose(dset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Try giving some bogus values to H5O_open_by_addr. */ + /* Try to open an object with a bad address */ + grp_addr += 20; + H5E_BEGIN_TRY{ + grp = H5Oopen_by_addr(fid, grp_addr); + }H5E_END_TRY + VERIFY(grp, FAIL, "H5Oopen_by_addr"); + + /* For instance, an objectno smaller than the end of the file's superblock should + * trigger an error */ + grp_addr = 10; + H5E_BEGIN_TRY{ + grp = H5Oopen_by_addr(fid, grp_addr); + }H5E_END_TRY + VERIFY(grp, FAIL, "H5Oopen_by_addr"); + + /* Likewise, an objectno larger than the size of the file should fail */ + grp_addr = 0; + grp_addr = 1000000000; + H5E_BEGIN_TRY{ + grp = H5Oopen_by_addr(fid, grp_addr); + }H5E_END_TRY + VERIFY(grp, FAIL, "H5Oopen_by_addr"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Also, trying to open an object without a valid location should fail */ + H5E_BEGIN_TRY{ + dtype = H5Oopen_by_addr(fid, dtype_addr); + }H5E_END_TRY + VERIFY(dtype, FAIL, "H5Oopen_by_addr"); +} /* test_h5o_open_by_addr_deprec() */ + + +/**************************************************************** +** ** visit_obj_cb(): ** This is the callback function invoked by H5Ovisit1() in ** test_h5o_getinfo_visit(): @@ -1360,10 +1621,10 @@ test_h5o_getinfo_same_file(void) ** ****************************************************************/ static int -visit_obj_cb(hid_t group_id, const char *name, const H5O_info_t *oinfo1, +visit_obj_cb(hid_t group_id, const char *name, const H5O_info1_t *oinfo1, void H5_ATTR_UNUSED *_op_data) { - H5O_info_t oinfo2; /* Object info structs */ + H5O_info1_t oinfo2; /* Object info structs */ /* Verify the object info for "group1", "group2" and the root group */ if(!(HDstrcmp(name, "group1"))) { @@ -1399,7 +1660,7 @@ test_h5o_getinfo_visit(void) hid_t gid1 = -1, gid2 = -1; /* Group IDs */ hid_t sid = -1; /* Dataspace ID */ hid_t aid = -1; /* Attribute ID */ - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info1_t oinfo1, oinfo2; /* Object info structs */ char attrname[25]; /* Attribute name */ int j; /* Local index variable */ herr_t ret; /* Value returned from API calls */ @@ -1438,9 +1699,9 @@ test_h5o_getinfo_visit(void) /* Query the object info for "group1" via H5Oget_info1 and H5Oget_info2 */ ret = H5Oget_info1(gid1, &oinfo1); - CHECK(ret, FAIL, "H5Oget_info"); + CHECK(ret, FAIL, "H5Oget_info1"); ret = H5Oget_info2(gid1, &oinfo2, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); + CHECK(ret, FAIL, "H5Oget_info2"); /* Verify the object info for "group1" is correct */ VERIFY(oinfo1.fileno, oinfo2.fileno, "obj info from H5Oget_info1/2"); @@ -1452,9 +1713,9 @@ test_h5o_getinfo_visit(void) /* Query the object info for "group2" via H5Oget_info1 and H5Oget_info2 */ ret = H5Oget_info_by_name1(fid, "group2", &oinfo1, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); ret = H5Oget_info_by_name2(fid, "group2", &oinfo2, H5O_INFO_HDR|H5O_INFO_META_SIZE, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); /* Verify the object info for "group2" is correct */ VERIFY(oinfo1.hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Oget_info1/2"); @@ -1491,18 +1752,22 @@ test_h5o(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Objects\n")); - test_h5o_open(); /* Test generic open function */ - test_h5o_open_by_addr(); /* Test opening objects by address */ - test_h5o_close(); /* Test generic close function */ - test_h5o_refcount(); /* Test incrementing and decrementing reference count */ - test_h5o_plist(); /* Test object creation properties */ - test_h5o_link(); /* Test object link routine */ - test_h5o_comment(); /* Test routines for comment */ - test_h5o_comment_by_name(); /* Test routines for comment by name */ - test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ + test_h5o_open(); /* Test generic open function */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */ -#endif + test_h5o_open_by_addr(); /* Test opening objects by address */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + test_h5o_open_by_token(); /* Test opening objects by token */ + test_h5o_close(); /* Test generic close function */ + test_h5o_refcount(); /* Test incrementing and decrementing reference count */ + test_h5o_plist(); /* Test object creation properties */ + test_h5o_link(); /* Test object link routine */ + test_h5o_comment(); /* Test routines for comment */ + test_h5o_comment_by_name(); /* Test routines for comment by name */ + test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + test_h5o_open_by_addr_deprec(); /* Test opening objects by address with H5Lget_info1 */ + test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_h5o() */ diff --git a/test/th5s.c b/test/th5s.c index 747e741..c60b1ff 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1739,12 +1739,12 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high) case CONFIG_16: stride = POWER16 - 1; block = 4; - expected_enc_size = expected_version == 3 ? 2 : 4; + expected_enc_size = (uint8_t)(expected_version == 3 ? 2 : 4); break; case CONFIG_32: stride = POWER32 - 1; block = 4; - expected_enc_size = expected_version == 3 ? 4 : 8; + expected_enc_size = (uint8_t)(expected_version == 3 ? 4 : 8); break; default: @@ -1765,12 +1765,12 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high) case CONFIG_16: stride = POWER16 - 1; block = POWER16 - 2; - expected_enc_size = expected_version == 3 ? 2 : 4; + expected_enc_size = (uint8_t)(expected_version == 3 ? 2 : 4); break; case CONFIG_32: stride = POWER32 - 1; block = POWER32 - 2; - expected_enc_size = expected_version == 3 ? 4 : 8; + expected_enc_size = (uint8_t)(expected_version == 3 ? 4 : 8); break; default: HDassert(0); @@ -1912,7 +1912,7 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high) for(config = CONFIG_8; config <= CONFIG_32; config++) { hbool_t expected_to_fail = FALSE; /* Whether H5Sencode2 is expected to fail */ uint32_t expected_version = 0; /* Expected version for selection info */ - uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */ + uint32_t expected_enc_size = 0; /* Expected encoded size for selection info */ start = 0; count = 2; @@ -1984,7 +1984,8 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high) VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab"); /* Verify the version and encoded size expected for the configuration */ - ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail); + HDassert(expected_enc_size <= 255); + ret = test_h5s_check_encoding(fapl, sid, expected_version, (uint8_t)expected_enc_size, expected_to_fail); CHECK(ret, FAIL, "test_h5s_check_encoding"); } /* for config */ @@ -2458,11 +2459,12 @@ test_h5s_compound_scalar_read(void) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_h5s_compound_scalar_read() */ +} /* end test_h5s_compound_scalar_read() */ -/* Data arrays for chunk test */ -double chunk_data_dbl[50000][3]; -float chunk_data_flt[50000][3]; + +/* Data array sizes for chunk test */ +#define CHUNK_DATA_NX 50000 +#define CHUNK_DATA_NY 3 /**************************************************************** ** @@ -2480,22 +2482,41 @@ test_h5s_chunk(void) hid_t space_id; hsize_t dims[2]; hsize_t csize[2]; + double **chunk_data_dbl = NULL; + double *chunk_data_dbl_data = NULL; + float **chunk_data_flt = NULL; + float *chunk_data_flt_data = NULL; int i,j; + /* Allocate memory */ + chunk_data_dbl_data = (double *)HDcalloc(CHUNK_DATA_NX * CHUNK_DATA_NY, sizeof(double)); + CHECK_PTR(chunk_data_dbl_data, "HDcalloc"); + chunk_data_dbl = (double **)HDcalloc(CHUNK_DATA_NX, sizeof(chunk_data_dbl_data)); + CHECK_PTR(chunk_data_dbl, "HDcalloc"); + for (i = 0; i < CHUNK_DATA_NX; i++) + chunk_data_dbl[i] = chunk_data_dbl_data + (i * CHUNK_DATA_NY); + + chunk_data_flt_data = (float *)HDcalloc(CHUNK_DATA_NX * CHUNK_DATA_NY, sizeof(float)); + CHECK_PTR(chunk_data_flt_data, "HDcalloc"); + chunk_data_flt = (float **)HDcalloc(CHUNK_DATA_NX, sizeof(chunk_data_flt_data)); + CHECK_PTR(chunk_data_flt, "HDcalloc"); + for (i = 0; i < CHUNK_DATA_NX; i++) + chunk_data_flt[i] = chunk_data_flt_data + (i * CHUNK_DATA_NY); + fileID = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fileID, FAIL, "H5Fcreate"); plist_id = H5Pcreate(H5P_DATASET_CREATE); CHECK(plist_id, FAIL, "H5Pcreate"); - csize[0] = 50000; - csize[1] = 3; + csize[0] = CHUNK_DATA_NX; + csize[1] = CHUNK_DATA_NY; status = H5Pset_chunk(plist_id, 2, csize); CHECK(status, FAIL, "H5Pset_chunk"); /* Create the dataspace */ - dims[0] = 50000; - dims[1] = 3; + dims[0] = CHUNK_DATA_NX; + dims[1] = CHUNK_DATA_NY; space_id = H5Screate_simple(2, dims, NULL); CHECK(space_id, FAIL, "H5Screate_simple"); @@ -2503,11 +2524,11 @@ test_h5s_chunk(void) CHECK(dsetID, FAIL, "H5Dcreate2"); /* Initialize float array */ - for(i = 0; i < 50000; i++) - for(j = 0; j < 3; j++) + for(i = 0; i < CHUNK_DATA_NX; i++) + for(j = 0; j < CHUNK_DATA_NY; j++) chunk_data_flt[i][j] = (float)(i + 1) * 2.5F - (float)j * 100.3F; - status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt); + status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data); CHECK(status, FAIL, "H5Dwrite"); status = H5Pclose(plist_id); @@ -2520,17 +2541,17 @@ test_h5s_chunk(void) CHECK(status, FAIL, "H5Fclose"); /* Reset/initialize the data arrays to read in */ - HDmemset(chunk_data_dbl, 0, sizeof(double) * 50000 * 3); - HDmemset(chunk_data_flt, 0, sizeof(float) * 50000 * 3); + HDmemset(chunk_data_dbl_data, 0, sizeof(double) * CHUNK_DATA_NX * CHUNK_DATA_NY); + HDmemset(chunk_data_flt_data, 0, sizeof(float) * CHUNK_DATA_NX * CHUNK_DATA_NY); fileID = H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fileID, FAIL, "H5Fopen"); dsetID = H5Dopen2(fileID, "coords", H5P_DEFAULT); CHECK(dsetID, FAIL, "H5Dopen2"); - status= H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl); + status= H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl_data); CHECK(status, FAIL, "H5Dread"); - status= H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt); + status= H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data); CHECK(status, FAIL, "H5Dread"); status = H5Dclose(dsetID); @@ -2538,13 +2559,18 @@ test_h5s_chunk(void) status = H5Fclose(fileID); CHECK(status, FAIL, "H5Fclose"); - for(i=0; i<50000; i++) { - for(j=0; j<3; j++) { + for(i = 0; i < CHUNK_DATA_NX; i++) { + for(j = 0; j < CHUNK_DATA_NY; j++) { /* Check if the two values are within 0.001% range. */ if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], (double)0.00001F)) TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, (double)chunk_data_flt[i][j]); } /* end for */ } /* end for */ + + HDfree(chunk_data_dbl); + HDfree(chunk_data_dbl_data); + HDfree(chunk_data_flt); + HDfree(chunk_data_flt_data); } /* test_h5s_chunk() */ /**************************************************************** diff --git a/test/titerate.c b/test/titerate.c index 289a46c..9d60915 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -68,9 +68,9 @@ static int find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_clie /* Local functions */ int iter_strcmp(const void *s1, const void *s2); int iter_strcmp2(const void *s1, const void *s2); -static herr_t liter_cb(hid_t group, const char *name, const H5L_info_t *info, +static herr_t liter_cb(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); -static herr_t liter_cb2(hid_t group, const char *name, const H5L_info_t *info, +static herr_t liter_cb2(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); herr_t aiter_cb(hid_t group, const char *name, const H5A_info_t *ainfo, void *op_data); @@ -91,7 +91,7 @@ H5_ATTR_PURE int iter_strcmp(const void *s1, const void *s2) ** ****************************************************************/ static herr_t -liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, +liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data) { iter_info *info = (iter_info *)op_data; @@ -153,8 +153,8 @@ test_iter_group(hid_t fapl, hbool_t new_format) /* Test iterating over empty group */ info.command = RET_ZERO; idx = 0; - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); - VERIFY(ret, SUCCEED, "H5Literate"); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + VERIFY(ret, SUCCEED, "H5Literate2"); datatype = H5Tcopy(H5T_NATIVE_INT); CHECK(datatype, FAIL, "H5Tcopy"); @@ -220,12 +220,12 @@ test_iter_group(hid_t fapl, hbool_t new_format) VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info"); for(i = 0; i< (int)ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); } /* end for */ @@ -246,13 +246,13 @@ test_iter_group(hid_t fapl, hbool_t new_format) VERIFY(ginfo.nlinks, NDATASETS + 2, "H5Gget_info"); for(i = 0; i< (int)ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); } /* end for */ H5E_BEGIN_TRY { @@ -264,28 +264,28 @@ test_iter_group(hid_t fapl, hbool_t new_format) info.command = RET_ZERO; idx = (hsize_t)-1; H5E_BEGIN_TRY { - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Literate"); + VERIFY(ret, FAIL, "H5Literate2"); /* Test skipping exactly as many entries as in the group */ idx = NDATASETS + 2; H5E_BEGIN_TRY { - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Literate"); + VERIFY(ret, FAIL, "H5Literate2"); /* Test skipping more entries than are in the group */ idx = NDATASETS + 3; H5E_BEGIN_TRY { - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Literate"); + VERIFY(ret, FAIL, "H5Literate2"); /* Test all objects in group, when callback always returns 0 */ info.command = RET_ZERO; idx = 0; - if((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) + if((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) TestErrPrintf("Group iteration function didn't return zero correctly!\n"); /* Test all objects in group, when callback always returns 1 */ @@ -293,15 +293,15 @@ test_iter_group(hid_t fapl, hbool_t new_format) info.command = RET_TWO; i = 0; idx = 0; - while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { + while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ - VERIFY(ret, 2, "H5Literate"); + VERIFY(ret, 2, "H5Literate2"); /* Increment the number of times "2" is returned */ i++; /* Verify that the index is the correct value */ - VERIFY(idx, (hsize_t)i, "H5Literate"); + VERIFY(idx, (hsize_t)i, "H5Literate2"); if(idx > (NDATASETS + 2)) TestErrPrintf("Group iteration function walked too far!\n"); @@ -309,7 +309,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0) TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]); } /* end while */ - VERIFY(ret, -1, "H5Literate"); + VERIFY(ret, -1, "H5Literate2"); if(i != (NDATASETS + 2)) TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__); @@ -319,15 +319,15 @@ test_iter_group(hid_t fapl, hbool_t new_format) info.command = new_format ? RET_CHANGE2 : RET_CHANGE; i = 0; idx = 0; - while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { + while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { /* Verify return value from iterator gets propagated correctly */ - VERIFY(ret, 1, "H5Literate"); + VERIFY(ret, 1, "H5Literate2"); /* Increment the number of times "1" is returned */ i++; /* Verify that the index is the correct value */ - VERIFY(idx, (hsize_t)(i + 10), "H5Literate"); + VERIFY(idx, (hsize_t)(i + 10), "H5Literate2"); if(idx > (NDATASETS + 2)) TestErrPrintf("Group iteration function walked too far!\n"); @@ -335,7 +335,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0) TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]); } /* end while */ - VERIFY(ret, -1, "H5Literate"); + VERIFY(ret, -1, "H5Literate2"); if(i != 42 || idx != 52) TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__); @@ -550,11 +550,11 @@ H5_ATTR_PURE int iter_strcmp2(const void *s1, const void *s2) ** ****************************************************************/ static herr_t -liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, +liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *opdata) { const iter_info *test_info = (const iter_info *)opdata; - H5O_info_t oinfo; + H5O_info2_t oinfo; herr_t ret; /* Generic return value */ if(HDstrcmp(name, test_info->name)) { @@ -565,8 +565,8 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_ /* * Get type of the object and check it. */ - ret = H5Oget_info_by_name2(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); if(test_info->type != oinfo.type) { TestErrPrintf("test_info->type = %d, oinfo.type = %d\n", test_info->type, (int)oinfo.type); @@ -683,14 +683,14 @@ test_iter_group_large(hid_t fapl) /* Iterate through the file to see members of the root group */ curr_name = &names[0]; - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name); - CHECK(ret, FAIL, "H5Literate"); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name); + CHECK(ret, FAIL, "H5Literate2"); for(i = 1; i < 100; i++) { hsize_t idx = (hsize_t)i; curr_name = &names[i]; - ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name); - CHECK(ret, FAIL, "H5Literate"); + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name); + CHECK(ret, FAIL, "H5Literate2"); } /* end for */ /* Close file */ @@ -793,7 +793,7 @@ static void test_grp_memb_funcs(hid_t fapl) VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info"); for(i = 0; i < (int)ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ /* Test with NULL for name, to query length */ name_len = H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, NULL, (size_t)NAMELEN, H5P_DEFAULT); @@ -809,8 +809,8 @@ static void test_grp_memb_funcs(hid_t fapl) obj_names[i] = HDstrdup(dataset_name); CHECK_PTR(obj_names[i], "strdup"); - ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); if(!HDstrcmp(dataset_name, "grp")) VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); @@ -890,21 +890,21 @@ static void test_links(hid_t fapl) /* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */ for(i = 0; i < ginfo.nlinks; i++) { - H5O_info_t oinfo; /* Object info */ - H5L_info_t linfo; /* Link info */ + H5O_info2_t oinfo; /* Object info */ + H5L_info2_t linfo; /* Link info */ /* Get link name */ name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(name_len, FAIL, "H5Lget_name_by_idx"); /* Get link type */ - ret = H5Lget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Lget_info_by_idx"); + ret = H5Lget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info_by_idx2"); /* Get object type */ if(linfo.type == H5L_TYPE_HARD) { - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); } /* end if */ if(!HDstrcmp(obj_name, "g1.1")) @@ -1015,6 +1015,87 @@ static void test_corrupted_attnamelen(void) } /* test_corrupted_attnamelen() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS +/**************************************************************** +** +** test_links_deprec(): Test soft and hard link iteration +** +****************************************************************/ +static void test_links_deprec(hid_t fapl) +{ + hid_t file; /* File ID */ + char obj_name[NAMELEN]; /* Names of the object in group */ + ssize_t name_len; /* Length of object's name */ + hid_t gid, gid1; + H5G_info_t ginfo; /* Buffer for querying object's info */ + hsize_t i; + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality Using Deprecated Routines\n")); + + /* Create the test file with the datasets */ + file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(file, FAIL, "H5Fcreate"); + + /* create groups */ + gid = H5Gcreate2(file, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gcreate2"); + + gid1 = H5Gcreate2(file, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid1, FAIL, "H5Gcreate2"); + + /* create soft and hard links to the group "/g1". */ + ret = H5Lcreate_soft("something", gid, "softlink", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_soft"); + + ret = H5Lcreate_hard(gid, "/g1", H5L_SAME_LOC, "hardlink", H5P_DEFAULT, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lcreate_hard"); + + ret = H5Gget_info(gid, &ginfo); + CHECK(ret, FAIL, "H5Gget_info"); + VERIFY(ginfo.nlinks, 3, "H5Gget_info"); + + /* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */ + for(i = 0; i < ginfo.nlinks; i++) { + H5O_info2_t oinfo; /* Object info */ + H5L_info2_t linfo; /* Link info */ + + /* Get link name */ + name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT); + CHECK(name_len, FAIL, "H5Lget_name_by_idx"); + + /* Get link type */ + ret = H5Lget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Lget_info_by_idx1"); + + /* Get object type */ + if(linfo.type == H5L_TYPE_HARD) { + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx"); + } /* end if */ + + if(!HDstrcmp(obj_name, "g1.1")) + VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); + else if(!HDstrcmp(obj_name, "hardlink")) + VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); + else if(!HDstrcmp(obj_name, "softlink")) + VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx"); + else + CHECK(0, 0, "unknown object name"); + } /* end for */ + + ret = H5Gclose(gid); + CHECK(ret, FAIL, "H5Gclose"); + + ret = H5Gclose(gid1); + CHECK(ret, FAIL, "H5Gclose"); + + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); +} /* test_links_deprec() */ +#endif + /**************************************************************** ** ** test_iterate(): Main iteration testing routine. @@ -1045,10 +1126,13 @@ test_iterate(void) /* These next tests use the same file */ for(new_format = FALSE; new_format <= TRUE; new_format++) { test_iter_group(new_format ? fapl2 : fapl, new_format); /* Test group iteration */ - test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */ + test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */ test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */ - test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */ - test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ + test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */ + test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + test_links_deprec(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ +#endif } /* end for */ /* Test the fix for issue HDFFV-10588 */ diff --git a/test/tmisc.c b/test/tmisc.c index d637802..0ea9c4c 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -128,15 +128,19 @@ typedef struct /* Definitions for misc. test #8 */ #define MISC8_FILE "tmisc8.h5" #define MISC8_DSETNAME1 "Dataset1" -#define MISC8_DSETNAME2 "Dataset2" -#define MISC8_DSETNAME3 "Dataset3" #define MISC8_DSETNAME4 "Dataset4" #define MISC8_DSETNAME5 "Dataset5" +#define MISC8_DSETNAME8 "Dataset8" + +#ifndef H5_HAVE_PARALLEL +#define MISC8_DSETNAME2 "Dataset2" +#define MISC8_DSETNAME3 "Dataset3" #define MISC8_DSETNAME6 "Dataset6" #define MISC8_DSETNAME7 "Dataset7" -#define MISC8_DSETNAME8 "Dataset8" #define MISC8_DSETNAME9 "Dataset9" #define MISC8_DSETNAME10 "Dataset10" +#endif + #define MISC8_RANK 2 #define MISC8_DIM0 50 #define MISC8_DIM1 50 @@ -309,6 +313,7 @@ typedef struct /* Definitions for misc. test #30 */ #define MISC30_FILE "tmisc30.h5" +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Definitions for misc. test #31 */ #define MISC31_FILE "tmisc31.h5" #define MISC31_DSETNAME "dset" @@ -317,6 +322,7 @@ typedef struct #define MISC31_GROUPNAME "group" #define MISC31_PROPNAME "misc31_prop" #define MISC31_DTYPENAME "dtype" +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Definitions for misc. test #33 */ /* Note that this test file is generated by "gen_bad_offset.c" */ @@ -649,7 +655,7 @@ static void test_misc4(void) { hid_t file1, file2, group1, group2, group3; - H5O_info_t oinfo1, oinfo2, oinfo3; + H5O_info2_t oinfo1, oinfo2, oinfo3; herr_t ret; /* Output message about test being performed */ @@ -674,12 +680,12 @@ test_misc4(void) CHECK(group3, FAIL, "H5Gcreate2"); /* Get the stat information for each group */ - ret = H5Oget_info_by_name2(file1, MISC4_GROUP_1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(file1, MISC4_GROUP_2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(file2, MISC4_GROUP_1, &oinfo3, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name3(file1, MISC4_GROUP_1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(file1, MISC4_GROUP_2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); + ret = H5Oget_info_by_name3(file2, MISC4_GROUP_1, &oinfo3, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name3"); /* Verify that the fileno values are the same for groups from file1 */ VERIFY(oinfo1.fileno, oinfo2.fileno, "H5Oget_info_by_name"); @@ -2911,7 +2917,11 @@ test_misc18(void) hid_t sid; /* 'Space ID */ hid_t did1, did2; /* Dataset IDs */ hid_t aid; /* Attribute ID */ - H5O_info_t oinfo; /* Information about object */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5O_info1_t old_oinfo; /* (deprecated) information about object */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + H5O_info2_t oinfo; /* Data model information about object */ + H5O_native_info_t ninfo; /* Native file format information about object */ char attr_name[32]; /* Attribute name buffer */ unsigned u; /* Local index variable */ herr_t ret; /* Generic return value */ @@ -2929,26 +2939,48 @@ test_misc18(void) CHECK(did1, FAIL, "H5Dcreate2"); /* Get object information */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET1_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 6, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 1, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 272, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 152, "H5Oget_native_info_by_name"); /* Create second dataset */ did2 = H5Dcreate2(fid, MISC18_DSET2_NAME, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(did2, FAIL, "H5Dcreate2"); /* Get object information */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 272, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 152, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 0, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET2_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 6, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 1, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 272, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 152, "H5Oget_native_info_by_name"); /* Loop creating attributes on each dataset, flushing them to the file each time */ for(u = 0; u < 10; u++) { @@ -2975,22 +3007,44 @@ test_misc18(void) } /* end for */ /* Get object information for dataset #1 now */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET1_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 24, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 9, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 888, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 16, "H5Oget_native_info_by_name"); /* Get object information for dataset #2 now */ - ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); - VERIFY(oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#ifndef H5_NO_DEPRECATED_SYMBOLS + ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.total, 888, "H5Oget_info_by_name"); + VERIFY(old_oinfo.hdr.space.free, 16, "H5Oget_info_by_name"); + VERIFY(old_oinfo.num_attrs, 10, "H5Oget_info_by_name"); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + ret = H5Oget_native_info_by_name(fid, MISC18_DSET2_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_mative_info_by_name"); + VERIFY(ninfo.hdr.nmesgs, 24, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.nchunks, 9, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.total, 888, "H5Oget_native_info_by_name"); + VERIFY(ninfo.hdr.space.free, 16, "H5Oget_native_info_by_name"); /* Close second dataset */ ret = H5Dclose(did2); @@ -3915,7 +3969,7 @@ test_misc23(void) hid_t file_id=0, group_id=0, type_id=0, space_id=0, tmp_id=0, create_id=H5P_DEFAULT, access_id=H5P_DEFAULT; char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */ - H5O_info_t oinfo; + H5O_info2_t oinfo; htri_t tri_status; ssize_t namelen; herr_t status; @@ -3998,9 +4052,9 @@ test_misc23(void) tmp_id = H5Gopen2(file_id, "/A/B01", H5P_DEFAULT); CHECK(tmp_id, FAIL, "H5Gopen2"); - status = H5Oget_info2(tmp_id, &oinfo, H5O_INFO_BASIC); - CHECK(status, FAIL, "H5Oget_info"); - VERIFY(oinfo.rc, 1, "H5Oget_info"); + status = H5Oget_info3(tmp_id, &oinfo, H5O_INFO_BASIC); + CHECK(status, FAIL, "H5Oget_info3"); + VERIFY(oinfo.rc, 1, "H5Oget_info3"); status = H5Gclose(tmp_id); CHECK(status, FAIL, "H5Gclose"); @@ -5274,18 +5328,18 @@ test_misc29(void) static int -test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *info, +test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *op_data) { - H5O_info_t object_info; + H5O_info2_t object_info; - return H5Oget_info_by_name2(loc_id, name, &object_info, H5O_INFO_BASIC, H5P_DEFAULT); + return H5Oget_info_by_name3(loc_id, name, &object_info, H5O_INFO_BASIC, H5P_DEFAULT); } static int 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); + return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); } @@ -5364,6 +5418,7 @@ test_misc30(void) static void test_misc31(void) { +#ifndef H5_NO_DEPRECATED_SYMBOLS hid_t file_id; /* File id */ hid_t space_id; /* Dataspace id */ hid_t dset_id; /* Dataset id */ @@ -5371,6 +5426,7 @@ test_misc31(void) hid_t group_id; /* Group id */ hid_t dtype_id; /* Datatype id */ herr_t ret; /* Generic return value */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Output message about test being performed */ MESSAGE(5, ("Deprecated routines initialize after H5close()\n")); @@ -5533,7 +5589,7 @@ test_misc33(void) { hid_t fid = -1; /* File ID */ const char *testfile = H5_get_srcdir_filename(MISC33_FILE); /* Corrected test file name */ - H5O_info_t oinfo; /* Structure for object metadata information */ + H5O_info2_t oinfo; /* Structure for object metadata information */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -5545,21 +5601,21 @@ test_misc33(void) /* Case (1) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Case (2) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Case (3) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret = H5Oget_info_by_name3(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Oget_info_by_name"); + VERIFY(ret, FAIL, "H5Oget_info_by_name3"); /* Close the file */ ret = H5Fclose(fid); @@ -5728,6 +5784,8 @@ cleanup_misc(void) HDremove(MISC28_FILE); HDremove(MISC29_COPY_FILE); HDremove(MISC30_FILE); +#ifndef H5_NO_DEPRECATED_SYMBOLS HDremove(MISC31_FILE); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end cleanup_misc() */ diff --git a/test/trefer.c b/test/trefer.c index cd09c8e..441b7aa 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -568,7 +568,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t high[SPACE2_RANK]; /* Selection bounds */ H5R_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ - H5R_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */ + H5R_ref_t nvrbuf[3]={{{{0}}},{{{101}}},{{{255}}}}; /* buffer with non-valid refs */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ @@ -1380,7 +1380,7 @@ test_reference_obj_deleted(void) ** ****************************************************************/ static herr_t -test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *info, +test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info, void *op_data) { int *count = (int *)op_data; /* Pointer to name counter */ @@ -1430,7 +1430,7 @@ test_reference_group(void) H5R_ref_t rref; /* Reference to read */ H5G_info_t ginfo; /* Group info struct */ char objname[NAME_SIZE]; /* Buffer to store name */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info2_t oinfo; /* Object info struct */ int count = 0; /* Count within iterated group */ ssize_t size; /* Name length */ herr_t ret; @@ -1508,7 +1508,7 @@ test_reference_group(void) CHECK(gid, H5I_INVALID_HID, "H5Ropen_object"); /* Iterate through objects in dereferenced group */ - ret = H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); + ret = H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); CHECK(ret, FAIL, "H5Literate"); /* Various queries on the group opened */ @@ -1520,9 +1520,9 @@ test_reference_group(void) CHECK(size, (-1), "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); - VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); + VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx3"); /* Unlink one of the objects in the dereferenced group */ ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT); @@ -2516,7 +2516,8 @@ test_reference_perf(void) ret = H5Rdestroy(&wbuf[0]); CHECK(ret, FAIL, "H5Rdestroy"); } - HDprintf("--- Object reference create time: %lfs\n", t / MAX_ITER_CREATE); + if(VERBOSE_MED) + HDprintf("--- Object reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Create reference to dataset */ ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); @@ -2534,7 +2535,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Object reference write time: %lfs\n", t / MAX_ITER_WRITE); + if(VERBOSE_MED) + HDprintf("--- Object reference write time: %lfs\n", t / MAX_ITER_WRITE); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2552,7 +2554,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated object reference create time: %lfs\n", t / MAX_ITER_CREATE); + if(VERBOSE_MED) + HDprintf("--- Deprecated object reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Create reference to dataset */ ret = H5Rcreate(&wbuf_deprec[0], fid1, "/Group1/Dataset1", H5R_OBJECT1, H5I_INVALID_HID); @@ -2567,7 +2570,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated object reference write time: %lfs\n", t / MAX_ITER_WRITE); + if(VERBOSE_MED) + HDprintf("--- Deprecated object reference write time: %lfs\n", t / MAX_ITER_WRITE); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2588,7 +2592,8 @@ test_reference_perf(void) ret = H5Rdestroy(&wbuf_reg[0]); CHECK(ret, FAIL, "H5Rdestroy"); } - HDprintf("--- Region reference create time: %lfs\n", t / MAX_ITER_CREATE); + if(VERBOSE_MED) + HDprintf("--- Region reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Store first dataset region */ ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]); @@ -2603,7 +2608,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Region reference write time: %lfs\n", t / MAX_ITER_WRITE); + if(VERBOSE_MED) + HDprintf("--- Region reference write time: %lfs\n", t / MAX_ITER_WRITE); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2622,7 +2628,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated region reference create time: %lfs\n", t / MAX_ITER_CREATE); + if(VERBOSE_MED) + HDprintf("--- Deprecated region reference create time: %lfs\n", t / MAX_ITER_CREATE); t = 0; for(i = 0; i < MAX_ITER_WRITE; i++) { @@ -2633,7 +2640,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated region reference write time: %lfs\n", t / MAX_ITER_WRITE); + if(VERBOSE_MED) + HDprintf("--- Deprecated region reference write time: %lfs\n", t / MAX_ITER_WRITE); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2666,7 +2674,8 @@ test_reference_perf(void) ret = H5Rdestroy(&rbuf[0]); CHECK(ret, FAIL, "H5Rdestroy"); } - HDprintf("--- Object reference read time: %lfs\n", t / MAX_ITER_READ); + if(VERBOSE_MED) + HDprintf("--- Object reference read time: %lfs\n", t / MAX_ITER_READ); /* Read selection from disk */ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); @@ -2711,7 +2720,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated object reference read time: %lfs\n", t / MAX_ITER_READ); + if(VERBOSE_MED) + HDprintf("--- Deprecated object reference read time: %lfs\n", t / MAX_ITER_READ); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2732,7 +2742,8 @@ test_reference_perf(void) ret = H5Rdestroy(&rbuf_reg[0]); CHECK(ret, FAIL, "H5Rdestroy"); } - HDprintf("--- Region reference read time: %lfs\n", t / MAX_ITER_READ); + if(VERBOSE_MED) + HDprintf("--- Region reference read time: %lfs\n", t / MAX_ITER_READ); /* Read selection from disk */ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg); @@ -2755,7 +2766,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated region reference read time: %lfs\n", t / MAX_ITER_READ); + if(VERBOSE_MED) + HDprintf("--- Deprecated region reference read time: %lfs\n", t / MAX_ITER_READ); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2816,7 +2828,7 @@ test_reference(void) for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Invalid combinations, just continue */ - if(high <= H5F_LIBVER_V112 || high < low) + if(high <= H5F_LIBVER_V110 || high < low) continue; test_reference_region(low, high); /* Test basic H5R dataset region reference code */ diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 272b866..a830314 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -1313,7 +1313,7 @@ test_reference_obj_deleted(void) ** ****************************************************************/ static herr_t -test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *info, +test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info, void *op_data) { int *count = (int *)op_data; /* Pointer to name counter */ @@ -1363,7 +1363,7 @@ test_reference_group(void) hobj_ref_t rref; /* Reference to read */ H5G_info_t ginfo; /* Group info struct */ char objname[NAME_SIZE]; /* Buffer to store name */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info2_t oinfo; /* Object info struct */ int count = 0; /* Count within iterated group */ ssize_t size; /* Name length */ herr_t ret; @@ -1438,7 +1438,7 @@ test_reference_group(void) CHECK(gid, FAIL, "H5Rdereference2"); /* Iterate through objects in dereferenced group */ - ret = H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); + ret = H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count); CHECK(ret, FAIL, "H5Literate"); /* Various queries on the group opened */ @@ -1450,9 +1450,9 @@ test_reference_group(void) CHECK(size, FAIL, "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_idx"); - VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx"); + ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_idx3"); + VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx3"); /* Unlink one of the objects in the dereferenced group */ ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT); diff --git a/test/trefer_shutdown.c b/test/trefer_shutdown.c new file mode 100644 index 0000000..89a44b3 --- /dev/null +++ b/test/trefer_shutdown.c @@ -0,0 +1,83 @@ +#include "h5test.h" + +int +main(int argc, char **argv) +{ + H5R_ref_t write_ref, read_ref; + hid_t fid; + hid_t did; + hid_t sid; + int i; + + if ((fid = H5Fcreate("HDFFV-10992.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + HDfprintf(stderr, "H5Fcreate failed\n"); + return 1; + } + + if ((sid = H5Screate(H5S_SCALAR)) < 0) { + HDfprintf(stderr, "H5Screate failed\n"); + return 1; + } + + /* Create a dataset of object references */ + if ((did = H5Dcreate2(fid, "dset", H5T_STD_REF, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + HDfprintf(stderr, "H5Dcreate failed\n"); + return 1; + } + + for (i = 0; i < 100; i++) { + /* Create reference to the root group */ + if (H5Rcreate_object(fid, "/dset", H5P_DEFAULT, &write_ref) < 0) { + HDfprintf(stderr, "H5Rcreate_object failed\n"); + return 1; + } + } + + /* Write reference to dataset */ + if (H5Dwrite(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, &write_ref) < 0) { + HDfprintf(stderr, "H5Dwrite failed\n"); + return 1; + } + + for (i = 0; i < 500; i++) { + /* Read reference back into different reference buffer */ + if (H5Dread(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, &read_ref) < 0) { + HDfprintf(stderr, "H5Dread failed\n"); + return 1; + } + } + + /* + * "Forget" to call H5Rdestroy on reference objects. If H5Rdestroy + * is called at least once on either reference object, or both + * objects, the infinite loop goes away. If H5Rdestroy is never + * called, the infinite loop will appear. + */ +#if 0 + if (H5Rdestroy(&write_ref) < 0) { + HDfprintf(stderr, "H5Rdestroy on reference write buffer failed\n"); + return 1; + } + if (H5Rdestroy(&read_ref) < 0) { + HDfprintf(stderr, "H5Rdestroy on reference read buffer failed\n"); + return 1; + } +#endif + + if (H5Sclose(sid) < 0) { + HDfprintf(stderr, "H5Sclose failed\n"); + return 1; + } + + if (H5Dclose(did) < 0) { + HDfprintf(stderr, "H5Dclose failed\n"); + return 1; + } + + if (H5Fclose(fid) < 0) { + HDfprintf(stderr, "H5Fclose failed\n"); + return 1; + } + + return 0; +} diff --git a/test/tselect.c b/test/tselect.c index 27bc36b..390f61f 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -25,7 +25,6 @@ #define H5S_TESTING #include "testhdf5.h" -#include "hdf5.h" #include "H5Spkg.h" /* Dataspaces */ #define FILENAME "tselect.h5" @@ -1613,7 +1612,7 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) ****************************************************************/ static void verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, - size_t cube_size, unsigned edge_size, unsigned cube_rank) + size_t H5_ATTR_NDEBUG_UNUSED cube_size, unsigned edge_size, unsigned cube_rank) { const uint16_t *cube_ptr; /* Pointer into the cube buffer */ uint16_t expected_value; /* Expected value in dataset */ diff --git a/test/tsohm.c b/test/tsohm.c index a064940..f39b5e5 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -743,7 +743,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_ */ static h5_stat_size_t getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, - hbool_t test_file_closing, H5O_info_t *oinfo) + hbool_t test_file_closing, H5O_native_info_t *ninfo) { hid_t fid = H5I_INVALID_HID; herr_t ret; @@ -758,8 +758,8 @@ getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, fid = size1_helper(fid, filename, fapl_id, test_file_closing); CHECK(fid, H5I_INVALID_HID, "size1_helper"); - ret = H5Oget_info_by_name2(fid, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(fid, DSETNAME[0], ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_native_info_by_name"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); @@ -807,7 +807,7 @@ test_sohm_size1(void) h5_stat_size_t sohm_final_filesize2; h5_stat_size_t sohm_btree_final_filesize2; - H5O_info_t oinfo; + H5O_native_info_t ninfo; unsigned num_indexes = 1; unsigned index_flags = H5O_SHMESG_DTYPE_FLAG; unsigned min_mesg_size = 50; @@ -866,10 +866,10 @@ test_sohm_size1(void) /* size of populated file, with different populating behaviors */ test_open_close = TRUE; - file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &ninfo); test_open_close = FALSE; - file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); - oh_sizes[oh_size_index++] = oinfo.hdr.space.total; + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &ninfo); + oh_sizes[oh_size_index++] = ninfo.hdr.space.total; ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); @@ -974,7 +974,7 @@ test_sohm_size_consistency_open_create(void) unsigned use_btree; hsize_t oh_size_open; hsize_t oh_size_create; - H5O_info_t oinfo; + H5O_native_info_t oinfo; unsigned num_indexes = 1; unsigned index_flags = H5O_SHMESG_DTYPE_FLAG; unsigned min_mesg_size = 50; @@ -1024,8 +1024,8 @@ test_sohm_size_consistency_open_create(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, DSETNAME[0], &oinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_native_info_by_name"); oh_size_open = oinfo.hdr.space.total; ret = H5Fclose(file); @@ -1039,8 +1039,8 @@ test_sohm_size_consistency_open_create(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); + ret = H5Oget_native_info_by_name(file, DSETNAME[0], &oinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); + CHECK_I(ret, "H5Oget_native_info_by_name"); oh_size_create = oinfo.hdr.space.total; ret = H5Fclose(file); @@ -3342,11 +3342,11 @@ test_sohm_extlink(void) static int verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) { - hid_t file_id = -1; - hid_t orig_space_id = -1; + hid_t file_id = H5I_INVALID_HID; + hid_t orig_space_id = H5I_INVALID_HID; hid_t space1_id, space2_id, space3_id; - hid_t dcpl_id = -1; - hid_t dset1_id, dset2_id, dset3_id; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t dset1_id, dset2_id = H5I_INVALID_HID, dset3_id = H5I_INVALID_HID; hsize_t dims1[] = {1, 2}; hsize_t max_dims[] = {H5S_UNLIMITED, 2}; hsize_t dims2[] = {5, 2}; diff --git a/test/tvlstr.c b/test/tvlstr.c index 731270c..b93d646 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -861,13 +861,12 @@ static void test_write_same_element(void) hid_t file1, dataset1; hid_t mspace, fspace, dtype; hsize_t fdim[] = {SPACE1_DIM1}; - char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"}; + const char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."}; + const char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"}; hsize_t marray[] = {NUMP}; hsize_t coord[SPACE1_RANK][NUMP]; herr_t ret; - char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."}; - file1 = H5Fcreate(DATAFILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fcreate"); diff --git a/test/tvltypes.c b/test/tvltypes.c index acfd0a2..a6ed60e 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -465,15 +465,15 @@ test_vltypes_vlen_atomic(void) ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); + /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */ + VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size"); + /* Try to call H5Dvlen_get_buf with bad dataspace */ H5E_BEGIN_TRY { ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_get_buf_size"); - /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */ - VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size"); - /* Read dataset from disk */ ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata); CHECK(ret, FAIL, "H5Dread"); diff --git a/test/unlink.c b/test/unlink.c index 6825dec..48dd79d 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -433,32 +433,35 @@ test_new_move(hid_t fapl) static int check_new_move(hid_t fapl) { - hid_t file; - H5O_info_t oi_hard1, oi_hard2; - char filename[1024]; - char linkval[1024]; + H5O_info2_t oi_hard1, oi_hard2; + hid_t file; + char filename[1024]; + char linkval[1024]; + int token_cmp; TESTING("check new move function"); /* Open file */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name3(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check hard links */ if(H5O_TYPE_GROUP != oi_hard1.type || H5O_TYPE_GROUP != oi_hard2.type) FAIL_PUTS_ERROR(" Unexpected object type, should have been a group") - if(H5F_addr_ne(oi_hard1.addr, oi_hard2.addr)) + if(H5Otoken_cmp(file, &oi_hard1.token, &oi_hard2.token, &token_cmp) < 0) + FAIL_PUTS_ERROR(" H5Otoken_cmp failed") + if(token_cmp) FAIL_PUTS_ERROR(" Hard link test failed. Link seems not to point to the expected file location.") /* Check soft links */ - if(H5Lget_val(file, "group2/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) + if(H5Lget_val(file, "group2/soft", linkval, sizeof(linkval), H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(linkval, "/group1/group_move")) FAIL_PUTS_ERROR(" Soft link test failed. Wrong link value") @@ -2156,7 +2159,7 @@ test_full_group_compact(hid_t fapl) { hid_t file_id = -1; hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oi; /* Stat buffer for object */ + H5O_info2_t oi; /* Stat buffer for object */ char objname[128]; /* Buffer for name of objects to create */ char objname2[128]; /* Buffer for name of objects to create */ char filename[1024]; /* Buffer for filename */ @@ -2228,7 +2231,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2245,7 +2248,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ @@ -2290,7 +2293,7 @@ test_full_group_dense(hid_t fapl) hid_t file_id = -1; hid_t gcpl = (-1); /* Group creation property list ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oi; /* Stat buffer for object */ + H5O_info2_t oi; /* Stat buffer for object */ char objname[128]; /* Buffer for name of objects to create */ char objname2[128]; /* Buffer for name of objects to create */ char filename[1024]; /* Buffer for filename */ @@ -2374,7 +2377,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2391,7 +2394,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { HDsprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ diff --git a/test/unregister.c b/test/unregister.c index ff116cf..db37f3e 100644 --- a/test/unregister.c +++ b/test/unregister.c @@ -95,11 +95,20 @@ test_unregister_filters(hid_t fapl_id) char filename[FILENAME_BUF_SIZE]; const hsize_t chunk_dims[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ hsize_t dims[2]; - int data[DSET_DIM1][DSET_DIM2]; + int **buf = NULL; + int *buf_data = NULL; herr_t ret; TESTING("Unregistering filter"); + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(DSET_DIM1, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < DSET_DIM1; i++) + buf[i] = buf_data + (i * DSET_DIM2); + /* Create first file */ h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename)); if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) @@ -176,7 +185,7 @@ test_unregister_filters(hid_t fapl_id) /* Initialize the data for writing */ for(i = n = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) - data[i][j] = n++; + buf[i][j] = n++; /* Create the dataspace */ dims[0] = DSET_DIM1; @@ -189,7 +198,7 @@ test_unregister_filters(hid_t fapl_id) goto error; /* Write the data to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) goto error; /* Unregister the filter before closing the dataset. It should fail */ @@ -211,7 +220,7 @@ test_unregister_filters(hid_t fapl_id) goto error; /* Write the data to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) goto error; /* Close the dataset in the second file */ @@ -232,6 +241,9 @@ test_unregister_filters(hid_t fapl_id) if(H5Fclose(fid2) < 0) goto error; + HDfree(buf); + HDfree(buf_data); + PASSED(); return SUCCEED; @@ -247,6 +259,9 @@ error: H5Sclose(sid); } H5E_END_TRY; + HDfree(buf); + HDfree(buf_data); + return FAIL; } @@ -317,7 +317,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, hid_t dset = -1; /* Virtual dataset */ H5D_space_status_t space_status; /* Dataset space status */ void *plist_buf = NULL; /* Serialized property list buffer */ - H5O_info_t oinfo; /* Object info struct */ + H5O_native_info_t ninfo; /* Object info struct */ htri_t tri_ret; HDassert((config >= TEST_API_BASIC) && (config < TEST_API_NTESTS)); @@ -372,23 +372,23 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR /* Test H5Oget_info returns correct metadata size */ - if(H5Oget_info2(dset, &oinfo, H5O_INFO_META_SIZE) < 0) + if(H5Oget_native_info(dset, &ninfo, H5O_NATIVE_INFO_META_SIZE) < 0) TEST_ERROR - if(oinfo.meta_size.obj.index_size != (hsize_t)0) + if(ninfo.meta_size.obj.index_size != (hsize_t)0) TEST_ERROR if(config == TEST_API_REOPEN_FILE) { - if(oinfo.meta_size.obj.heap_size != exp_meta_size) { - HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); + if(ninfo.meta_size.obj.heap_size != exp_meta_size) { + HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)ninfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR } } else - if((oinfo.meta_size.obj.heap_size != exp_meta_size) - && (oinfo.meta_size.obj.heap_size != (hsize_t)0)) + if((ninfo.meta_size.obj.heap_size != exp_meta_size) + && (ninfo.meta_size.obj.heap_size != (hsize_t)0)) TEST_ERROR - if(oinfo.meta_size.attr.index_size != (hsize_t)0) + if(ninfo.meta_size.attr.index_size != (hsize_t)0) TEST_ERROR - if(oinfo.meta_size.attr.index_size != (hsize_t)0) + if(ninfo.meta_size.attr.index_size != (hsize_t)0) TEST_ERROR /* Test H5Dget_space_status */ @@ -1134,11 +1134,11 @@ error: static int test_vds_prefix_first(unsigned config, hid_t fapl) { - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - char vfilename[FILENAME_BUF_SIZE]; - char srcfilenamepct[FILENAME_BUF_SIZE]; - char srcfilenamepct_map[FILENAME_BUF_SIZE]; + char *srcfilename = NULL; + char *srcfilename_map = NULL; + char *vfilename = NULL; + char *srcfilenamepct = NULL; + char *srcfilenamepct_map = NULL; const char *srcfilenamepct_map_orig = "vds%%%%_src"; hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ hid_t vfile = -1; /* File with virtual dset */ @@ -1158,11 +1158,22 @@ test_vds_prefix_first(unsigned config, hid_t fapl) TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection") - h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); - h5_fixname(FILENAME[8], fapl, srcfilename, sizeof srcfilename); - h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, sizeof srcfilename_map); - h5_fixname(FILENAME[10], fapl, srcfilenamepct, sizeof srcfilenamepct); - h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + + h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[8], fapl, srcfilename, FILENAME_BUF_SIZE); + h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[10], fapl, srcfilenamepct, FILENAME_BUF_SIZE); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE); /* create tmp directory and get current working directory path */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) @@ -1346,6 +1357,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl) TEST_ERROR dcpl = -1; + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(vfilename); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + PASSED(); return 0; @@ -1369,6 +1386,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl) if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) TEST_ERROR + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(vfilename); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + return 1; } /* end test_vds_prefix */ @@ -1386,12 +1409,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl) static int test_basic_io(unsigned config, hid_t fapl) { - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - char vfilename[FILENAME_BUF_SIZE]; - char vfilename2[FILENAME_BUF_SIZE]; - char srcfilenamepct[FILENAME_BUF_SIZE]; - char srcfilenamepct_map[FILENAME_BUF_SIZE]; + char *srcfilename = NULL; + char *srcfilename_map = NULL; + char *vfilename = NULL; + char *vfilename2 = NULL; + char *srcfilenamepct = NULL; + char *srcfilenamepct_map = NULL; const char *srcfilenamepct_map_orig = "vds%%%%_src"; hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ hid_t vfile = -1; /* File with virtual dset */ @@ -1419,12 +1442,25 @@ test_basic_io(unsigned config, hid_t fapl) TESTING("basic virtual dataset I/O") - h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); - h5_fixname(FILENAME[1], fapl, vfilename2, sizeof vfilename2); - h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename); - h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map); - h5_fixname(FILENAME[4], fapl, srcfilenamepct, sizeof srcfilenamepct); - h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((vfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + + h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[1], fapl, vfilename2, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[2], fapl, srcfilename, FILENAME_BUF_SIZE); + h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[4], fapl, srcfilenamepct, FILENAME_BUF_SIZE); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE); /* Create DCPL */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) @@ -4227,6 +4263,13 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR dcpl = -1; + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(vfilename); + HDfree(vfilename2); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + PASSED(); return 0; @@ -4247,6 +4290,13 @@ error: H5Pclose(dcpl); } H5E_END_TRY; + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(vfilename); + HDfree(vfilename2); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + return 1; } /* end test_basic_io() */ @@ -7286,15 +7336,15 @@ error: static int test_printf(unsigned config, hid_t fapl) { - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - char srcfilename2[FILENAME_BUF_SIZE]; - char srcfilename2_map[FILENAME_BUF_SIZE]; - char vfilename[FILENAME_BUF_SIZE]; - char printf_srcfilename_map[FILENAME_BUF_SIZE]; + char *srcfilename = NULL; + char *srcfilename_map = NULL; + char *srcfilename2 = NULL; + char *srcfilename2_map = NULL; + char *vfilename = NULL; + char *printf_srcfilename_map = NULL; + char *srcfilenamepct = NULL; + char *srcfilenamepct_map = NULL; const char *printf_srcfilename_map_orig = "vds_src_%b"; - char srcfilenamepct[FILENAME_BUF_SIZE]; - char srcfilenamepct_map[FILENAME_BUF_SIZE]; const char *srcfilenamepct_map_orig = "vds%%%%_src"; hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ hid_t vfile = -1; /* File with virtual dset */ @@ -7322,14 +7372,31 @@ test_printf(unsigned config, hid_t fapl) TESTING("virtual dataset I/O with printf source") - h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); - h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename); - h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map); - h5_fixname(FILENAME[3], fapl, srcfilename2, sizeof srcfilename2); - h5_fixname_printf(FILENAME[2], fapl, srcfilename2_map, sizeof srcfilename2_map); - h5_fixname_printf(printf_srcfilename_map_orig, fapl, printf_srcfilename_map, sizeof printf_srcfilename_map); - h5_fixname(FILENAME[4], fapl, srcfilenamepct, sizeof srcfilenamepct); - h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilename2_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((printf_srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL) + TEST_ERROR; + + h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[2], fapl, srcfilename, FILENAME_BUF_SIZE); + h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[3], fapl, srcfilename2, FILENAME_BUF_SIZE); + h5_fixname_printf(FILENAME[2], fapl, srcfilename2_map, FILENAME_BUF_SIZE); + h5_fixname_printf(printf_srcfilename_map_orig, fapl, printf_srcfilename_map, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[4], fapl, srcfilenamepct, FILENAME_BUF_SIZE); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE); /* Create DCPL */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) @@ -10940,6 +11007,15 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR memspace = -1; + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(srcfilename2); + HDfree(srcfilename2_map); + HDfree(vfilename); + HDfree(printf_srcfilename_map); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + PASSED(); return 0; @@ -10960,6 +11036,15 @@ error: H5Pclose(dapl); } H5E_END_TRY; + HDfree(srcfilename); + HDfree(srcfilename_map); + HDfree(srcfilename2); + HDfree(srcfilename2_map); + HDfree(vfilename); + HDfree(printf_srcfilename_map); + HDfree(srcfilenamepct); + HDfree(srcfilenamepct_map); + return 1; } /* end test_printf() */ diff --git a/test/vds_swmr.h b/test/vds_swmr.h index eb2dcf4..43c78a4 100644 --- a/test/vds_swmr.h +++ b/test/vds_swmr.h @@ -84,7 +84,7 @@ #define N_PLANES_TO_WRITE 25 /* Planes */ -static hsize_t PLANES[N_SOURCES][RANK] = { +H5TEST_DLLVAR hsize_t PLANES[N_SOURCES][RANK] = { {1, SM_HEIGHT, WIDTH}, {1, LG_HEIGHT, WIDTH}, {1, SM_HEIGHT, WIDTH}, @@ -94,7 +94,7 @@ static hsize_t PLANES[N_SOURCES][RANK] = { }; /* File names for source datasets */ -static char FILE_NAMES[N_SOURCES][NAME_LEN] = { +H5TEST_DLLVAR char FILE_NAMES[N_SOURCES][NAME_LEN] = { {"vds_swmr_src_a.h5"}, {"vds_swmr_src_b.h5"}, {"vds_swmr_src_c.h5"}, @@ -104,11 +104,11 @@ static char FILE_NAMES[N_SOURCES][NAME_LEN] = { }; /* VDS file name */ -static char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5"; +H5TEST_DLLVAR char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5"; /* Dataset names */ -static char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; -static char VDS_DSET_NAME[NAME_LEN] = "vds_dset"; +H5TEST_DLLVAR char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset"; +H5TEST_DLLVAR char VDS_DSET_NAME[NAME_LEN] = "vds_dset"; /* Fill values */ #endif /* VDS_SWMR_H */ @@ -842,8 +842,7 @@ error: * * Purpose: Tests the file handle interface for FAMILY driver * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 @@ -861,12 +860,21 @@ test_family(void) char dname[]="dataset"; unsigned int i, j; int *fhandle=NULL, *fhandle2=NULL; - int buf[FAMILY_NUMBER][FAMILY_SIZE]; + int **buf = NULL; + int *buf_data = NULL; hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE}; hsize_t file_size; TESTING("FAMILY file driver"); + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < FAMILY_NUMBER; i++) + buf[i] = buf_data + (i * FAMILY_SIZE); + /* Set property list and file name for FAMILY driver */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR; @@ -890,7 +898,7 @@ test_family(void) | H5FD_FEAT_AGGREGATE_SMALLDATA)) TEST_ERROR - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; if(H5Fclose(file) < 0) @@ -905,7 +913,7 @@ test_family(void) if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR; - if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; /* Check file size API */ @@ -917,7 +925,7 @@ test_family(void) TEST_ERROR; /* Create and write dataset */ - if((space=H5Screate_simple(2, dims, NULL)) < 0) + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Retrieve the access property list... */ @@ -932,14 +940,14 @@ test_family(void) if (H5Pclose(access_fapl) < 0) TEST_ERROR; - if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; for(i = 0; i < FAMILY_NUMBER; i++) for(j = 0; j < FAMILY_SIZE; j++) buf[i][j] = (int)((i * 10000) + j); - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR; /* check file handle API */ @@ -1004,8 +1012,11 @@ test_family(void) if(H5Pclose(fapl) < 0) TEST_ERROR; + HDfree(buf); + HDfree(buf_data); + PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1015,8 +1026,12 @@ error: H5Pclose(fapl2); H5Fclose(file); } H5E_END_TRY; - return -1; -} + + HDfree(buf); + HDfree(buf_data); + + return FAIL; +} /* end test_family() */ /*------------------------------------------------------------------------- @@ -1136,8 +1151,7 @@ error: * * Purpose: Actually use the member fapl input to the member vfd. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Jacob Smith * 21 May 2019 @@ -1147,108 +1161,91 @@ error: static herr_t test_family_member_fapl(void) { - hid_t file = H5I_INVALID_HID; - hid_t fapl_id = H5I_INVALID_HID; - hid_t memb_fapl_id = H5I_INVALID_HID; - hid_t space = H5I_INVALID_HID; - hid_t dset = H5I_INVALID_HID; + hid_t file = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t memb_fapl_id = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; char filename[1024]; - char dname[] = "dataset"; - unsigned i = 0; - unsigned j = 0; - int buf[FAMILY_NUMBER][FAMILY_SIZE]; - hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE}; + char dname[] = "dataset"; + unsigned i = 0; + unsigned j = 0; + int **buf = NULL; + int *buf_data = NULL; + hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE}; TESTING("Family member FAPL"); - fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if (H5I_INVALID_HID == fapl_id) { + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) TEST_ERROR; - } - memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if (H5I_INVALID_HID == memb_fapl_id) { + if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) TEST_ERROR; - } - if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) { + for (i = 0; i < FAMILY_NUMBER; i++) + buf[i] = buf_data + (i * FAMILY_SIZE); + + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) TEST_ERROR; - } - if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) { + + if((memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) TEST_ERROR; - } + + if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) + TEST_ERROR; + if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) + TEST_ERROR; + h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename)); - file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); - if (H5I_INVALID_HID == file) { + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) == H5I_INVALID_HID) TEST_ERROR; - } - space = H5Screate_simple(2, dims, NULL); - if (H5I_INVALID_HID == space) { + if((space = H5Screate_simple(2, dims, NULL)) == H5I_INVALID_HID) TEST_ERROR; - } /* Create and write to dataset, then close file. */ - dset = H5Dcreate2( - file, - dname, - H5T_NATIVE_INT, - space, - H5P_DEFAULT, - H5P_DEFAULT, - H5P_DEFAULT); - if (H5I_INVALID_HID == dset) { + if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID) TEST_ERROR; - } + for (i = 0; i < FAMILY_NUMBER; i++) { for (j = 0; j < FAMILY_SIZE; j++) { buf[i][j] = (int)((i * 10000) + j); } } - if (H5Dwrite(dset, - H5T_NATIVE_INT, - H5S_ALL, - H5S_ALL, - H5P_DEFAULT, - buf) - == FAIL) - { + + if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) == FAIL) TEST_ERROR; - } - if (H5Dclose(dset) == FAIL) { + + if (H5Dclose(dset) == FAIL) TEST_ERROR; - } - if (H5Sclose(space) == FAIL) { + if (H5Sclose(space) == FAIL) TEST_ERROR; - } - if (H5Fclose(file) == FAIL) { + if (H5Fclose(file) == FAIL) TEST_ERROR; - } /* "Close" member FAPL at top level and re-open file. * Should succeed, with library managing reference count properly */ - if (H5Pclose(memb_fapl_id) == FAIL) { + if (H5Pclose(memb_fapl_id) == FAIL) TEST_ERROR; - } - file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); - if (H5I_INVALID_HID == file) { + if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) == H5I_INVALID_HID) TEST_ERROR; - } - if (H5Fclose(file) == FAIL) { + if (H5Fclose(file) == FAIL) TEST_ERROR; - } h5_delete_test_file(FILENAME[2], fapl_id); - if (H5Pclose(fapl_id) == FAIL) { + if (H5Pclose(fapl_id) == FAIL) TEST_ERROR; - } + + HDfree(buf); + HDfree(buf_data); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1259,7 +1256,10 @@ error: H5Fclose(file); } H5E_END_TRY; - return -1; + HDfree(buf); + HDfree(buf_data); + + return FAIL; } /* end test_family_member_fapl() */ @@ -1337,10 +1337,19 @@ test_multi(void) char dname[]="dataset"; char meta[] = "this is some metadata on this file"; int i, j; - int buf[MULTI_SIZE][MULTI_SIZE]; + int **buf = NULL; + int *buf_data = NULL; TESTING("MULTI file driver"); + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < MULTI_SIZE; i++) + buf[i] = buf_data + (i * MULTI_SIZE); + /* Set file access property list for MULTI driver */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR; @@ -1443,7 +1452,7 @@ test_multi(void) for(i=0; i<MULTI_SIZE; i++) for(j=0; j<MULTI_SIZE; j++) buf[i][j] = i*10000+j; - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR; if((fapl2=H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -1521,6 +1530,9 @@ test_multi(void) if(H5Pclose(fapl) < 0) TEST_ERROR; + HDfree(buf); + HDfree(buf_data); + PASSED(); return SUCCEED; @@ -1534,6 +1546,10 @@ error: H5Fclose(file); H5Aclose(attr); } H5E_END_TRY; + + HDfree(buf); + HDfree(buf_data); + return FAIL; } /* end test_multi() */ @@ -1572,10 +1588,19 @@ test_multi_compat(void) char sv[H5FD_MEM_NTYPES][32]; hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE}; int i, j; - int buf[MULTI_SIZE][MULTI_SIZE]; + int **buf = NULL; + int *buf_data = NULL; TESTING("MULTI file driver backward compatibility"); + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < MULTI_SIZE; i++) + buf[i] = buf_data + (i * MULTI_SIZE); + /* Set file access property list for MULTI driver */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR; @@ -1659,7 +1684,7 @@ test_multi_compat(void) for(i=0; i<MULTI_SIZE; i++) for(j=0; j<MULTI_SIZE; j++) buf[i][j] = i*10000+j; - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR; if(H5Dclose(dset) < 0) @@ -1697,9 +1722,12 @@ test_multi_compat(void) if(H5Pclose(fapl) < 0) TEST_ERROR; + HDfree(buf); + HDfree(buf_data); + PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1708,8 +1736,12 @@ error: H5Pclose(fapl); H5Fclose(file); } H5E_END_TRY; - return -1; -} + + HDfree(buf); + HDfree(buf_data); + + return FAIL; +} /* end test_multi_compat() */ /*------------------------------------------------------------------------- @@ -123,6 +123,10 @@ static const H5VL_class_t fake_vol_g = { NULL, /* specific */ NULL /* optional */ }, + { /* introspect_cls */ + NULL, /* get_conn_cls */ + NULL, /* opt_query */ + }, { /* request_cls */ NULL, /* wait */ NULL, /* notify */ @@ -137,6 +141,11 @@ static const H5VL_class_t fake_vol_g = { NULL, /* specific */ NULL /* optional */ }, + { /* token_cls */ + NULL, /* cmp */ + NULL, /* to_str */ + NULL /* from_str */ + }, NULL /* optional */ }; @@ -224,7 +233,7 @@ test_vol_registration(void) TEST_ERROR; /* Try to unregister the native VOL connector (should fail) */ - if (H5I_INVALID_HID == (native_id = H5VLget_connector_id(H5VL_NATIVE_NAME))) + if (H5I_INVALID_HID == (native_id = H5VLget_connector_id_by_name(H5VL_NATIVE_NAME))) TEST_ERROR; H5E_BEGIN_TRY { ret = H5VLunregister_connector(native_id); @@ -866,7 +875,7 @@ test_basic_object_operation(void) hid_t oid = H5I_INVALID_HID; char filename[1024]; - H5O_info_t object_info; + H5O_info2_t object_info; TESTING("Basic VOL object operations"); @@ -880,11 +889,11 @@ test_basic_object_operation(void) TEST_ERROR; /* H5Oget_info */ - if (H5Oget_info2(fid, &object_info, H5O_INFO_ALL) < 0) + if (H5Oget_info3(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) + if (H5Oget_info_by_name3(fid, NATIVE_VOL_TEST_GROUP_NAME, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0) TEST_ERROR; /* H5Oexists_by_name */ diff --git a/test/vol_plugin.c b/test/vol_plugin.c index 236a67e..e4f171b 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -233,7 +233,7 @@ test_getters(void) TEST_ERROR; /* Get the connector's ID */ - if((vol_id_out = H5VLget_connector_id(NULL_VOL_CONNECTOR_NAME)) < 0) + if((vol_id_out = H5VLget_connector_id_by_name(NULL_VOL_CONNECTOR_NAME)) < 0) TEST_ERROR; if(vol_id != vol_id_out) FAIL_PUTS_ERROR("VOL connector IDs don't match"); diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 9795c65..3e4957d 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -79,4 +79,6 @@ foreach (h5_testp ${H5P_TESTS}) ADD_H5P_EXE(${h5_testp}) endforeach () -include (CMakeTests.cmake) +if (HDF5_TEST_PARALLEL) + include (CMakeTests.cmake) +endif () diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index d48dfca..a49fefe 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -552,7 +552,7 @@ dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[] #define H5FILE_NAME "hugefile.h5" #define DATASETNAME "dataset" -int MpioTest2G( MPI_Comm comm ) +static int MpioTest2G( MPI_Comm comm ) { /* * HDF5 APIs definitions @@ -3891,8 +3891,6 @@ actual_io_mode_tests(void) { * 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) diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index 12c1023..b681a2a 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -27,7 +27,6 @@ const char *FILENAME[3]={ "bigio_test.h5", #define DATASET2 "DSET2" #define DATASET3 "DSET3" #define DATASET4 "DSET4" -#define DATASET5 "DSET5" #define DXFER_COLLECTIVE_IO 0x1 /* Collective IO*/ #define DXFER_INDEPENDENT_IO 0x2 /* Independent IO collectively */ #define DXFER_BIGCOUNT (1 < 29) diff --git a/testpar/t_cache.c b/testpar/t_cache.c index ebb8e33..058cde6 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -28,7 +28,7 @@ #include "H5Fpkg.h" #include "H5Iprivate.h" #include "H5MFprivate.h" - +#include "H5private.h" #define BASE_ADDR (haddr_t)1024 @@ -38,7 +38,6 @@ int failures = 0; hbool_t verbose = TRUE; /* used to control error messages */ #define NFILENAME 2 -#define PARATESTFILE filenames[0] const char *FILENAME[NFILENAME]={"CacheTestDummy", NULL}; #ifndef PATH_MAX #define PATH_MAX 512 @@ -219,7 +218,9 @@ struct datum data[NUM_DATA_ENTRIES]; #define STD_VIRT_NUM_DATA_ENTRIES NUM_DATA_ENTRIES #define EXPRESS_VIRT_NUM_DATA_ENTRIES (NUM_DATA_ENTRIES / 10) /* Use a smaller test size to avoid creating huge MPE logfiles. */ +#ifdef H5_HAVE_MPE #define MPE_VIRT_NUM_DATA_ENTIES (NUM_DATA_ENTRIES / 100) +#endif int virt_num_data_entries = NUM_DATA_ENTRIES; @@ -2378,7 +2379,7 @@ datum_get_initial_load_size(void *udata_ptr, size_t *image_len_ptr) *------------------------------------------------------------------------- */ static void * -datum_deserialize(const void * image_ptr, +datum_deserialize(const void H5_ATTR_NDEBUG_UNUSED *image_ptr, H5_ATTR_UNUSED size_t len, void * udata_ptr, hbool_t * dirty_ptr) @@ -2491,14 +2492,13 @@ datum_image_len(const void *thing, size_t *image_len) */ static herr_t datum_serialize(const H5F_t *f, - void *image_ptr, + void H5_ATTR_NDEBUG_UNUSED *image_ptr, size_t len, void *thing_ptr) { herr_t ret_value = SUCCEED; int idx; struct datum * entry_ptr; - H5C_t * cache_ptr; struct H5AC_aux_t * aux_ptr; HDassert( thing_ptr ); @@ -2509,11 +2509,8 @@ datum_serialize(const H5F_t *f, HDassert( f ); HDassert( f->shared ); HDassert( f->shared->cache ); - - cache_ptr = f->shared->cache; - - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->aux_ptr ); + HDassert( f->shared->cache->magic == H5C__H5C_T_MAGIC ); + HDassert( f->shared->cache->aux_ptr ); aux_ptr = (H5AC_aux_t *)(f->shared->cache->aux_ptr); diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 40cc1ca..2d758ba 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -620,7 +620,6 @@ coll_chunktest(const char* filename, size_t num_points; /* for point selection */ hsize_t *coords = NULL; /* for point selection */ hsize_t current_dims; /* for point selection */ - int i; /* set up MPI parameters */ MPI_Comm_size(comm,&mpi_size); diff --git a/testpar/t_coll_md_read.c b/testpar/t_coll_md_read.c index 912388c..c0fe04b 100644 --- a/testpar/t_coll_md_read.c +++ b/testpar/t_coll_md_read.c @@ -34,7 +34,6 @@ #define MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS 2 -#define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_NO_SEL_PROCESS (mpi_rank == mpi_size - 1) #define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DATASET_NAME "linked_chunk_io_sort_chunk_issue" #define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_Y_DIM_SCALE 20000 #define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE 1 diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 6c91a41..87782d0 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -567,7 +567,6 @@ dataset_writeAll(void) 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 */ int mpi_size, mpi_rank; @@ -1098,7 +1097,6 @@ dataset_readAll(void) 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 */ @@ -3470,8 +3468,9 @@ actual_io_mode_tests(void) { * Programmer: Jonathan Kim * Date: Aug, 2012 */ +#ifdef LATER #define DSET_NOCOLCAUSE "nocolcause" -#define NELM 2 +#endif #define FILE_EXTERNAL "nocolcause_extern.data" static void test_no_collective_cause_mode(int selection_mode) @@ -3482,7 +3481,6 @@ test_no_collective_cause_mode(int selection_mode) uint32_t no_collective_cause_global_write = 0; uint32_t no_collective_cause_global_read = 0; uint32_t no_collective_cause_global_expected = 0; - hsize_t coord[NELM][RANK]; const char * filename; const char * test_name; @@ -3797,6 +3795,7 @@ test_no_collective_cause_mode(int selection_mode) * Programmer: Jonathan Kim * Date: Aug, 2012 */ +#ifdef LATER static void test_no_collective_cause_mode_filter(int selection_mode) { @@ -3806,7 +3805,7 @@ test_no_collective_cause_mode_filter(int selection_mode) uint32_t no_collective_cause_global_expected = 0; const char * filename; - const char * test_name; + const char * test_name = "I/O"; hbool_t is_chunked=1; int mpi_size = -1; int mpi_rank = -1; @@ -4008,6 +4007,7 @@ test_no_collective_cause_mode_filter(int selection_mode) HDfree(buffer); return; } +#endif /* Function: no_collective_cause_tests * diff --git a/testpar/t_filter_read.c b/testpar/t_filter_read.c index 28baed5..cabb51e 100644 --- a/testpar/t_filter_read.c +++ b/testpar/t_filter_read.c @@ -215,7 +215,9 @@ test_filter_read(void) unsigned disable_partial_chunk_filters; /* Whether filters are disabled on partial chunks */ herr_t hrc; const char *filename; +#ifdef H5_HAVE_FILTER_FLETCHER32 hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */ +#endif #ifdef H5_HAVE_FILTER_DEFLATE hsize_t deflate_size; /* Size of dataset with deflate filter */ diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 63ac8d3..ee868ee 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -13,6 +13,7 @@ #include "testphdf5.h" #include "H5Dprivate.h" +#include "H5private.h" #define DIM 2 #define SIZE 32 @@ -332,7 +333,7 @@ void compact_dataset(void) /* Verify data value */ for(i = 0; i < size; i++) for(j = 0; j < size; j++) - if(inme[(i * size) + j] != outme[(i * size) + j]) + if(!H5_DBL_ABS_EQUAL(inme[(i * size) + j], outme[(i * size) + j])) if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) HDprintf("Dataset Verify failed at [%d][%d]: expect %f, got %f\n", i, j, outme[(i * size) + j], inme[(i * size) + j]); @@ -1959,7 +1960,7 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) /* private communicator size and rank */ int mpi_size; int mpi_rank; - int mrc; /* mpi error code */ + int mrc; /* mpi error code */ /* steps to verify and have been verified */ int steps = 0; int steps_done = 0; @@ -2477,7 +2478,7 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) /* compare read data with expected data */ for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) - if (data_read[j] != data[j]){ + if (!H5_DBL_ABS_EQUAL(data_read[j], data[j])){ HDfprintf(stdout, "%0d:%s: Reading datasets value failed in " "Dataset %d, at position %d: expect %f, got %f.\n", @@ -2540,7 +2541,7 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) VRFY((err >= 0), "H5Aread failed.\n"); /* compare read attribute data with expected data */ for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) - if (att_read[j] != att[j]){ + if (!H5_DBL_ABS_EQUAL(att_read[j], att[j])){ HDfprintf(stdout, "%0d:%s: Mismatched attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", mpi_rank, fcn_name, i, j, att[j], att_read[j]); @@ -2592,7 +2593,7 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) VRFY((err >= 0), "H5Aread failed.\n"); /* compare read attribute data with expected data */ for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) - if (lg_att_read[j] != lg_att[j]){ + if (!H5_DBL_ABS_EQUAL(lg_att_read[j], lg_att[j])){ HDfprintf(stdout, "%0d:%s: Mismatched large attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", mpi_rank, fcn_name, i, j, lg_att[j], lg_att_read[j]); diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 890a918..fe78317 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -303,7 +303,7 @@ static int test_mpio_gb_file(char *filename) { mpi_rank, mpi_off, mpi_off); /* set data to some trivial pattern for easy verification */ for (j = 0; j < MB; j++) - *(buf + j) = i * mpi_size + mpi_rank; + *(buf + j) = (int8_t)(i * mpi_size + mpi_rank); if (VERBOSE_MED) HDfprintf(stdout, "proc %d: writing %d bytes at offset %lld\n", @@ -351,7 +351,7 @@ static int test_mpio_gb_file(char *filename) { mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); INFO((mrc == MPI_SUCCESS), "GB size file read"); - expected = i * mpi_size + (mpi_size - mpi_rank - 1); + expected = (int8_t)(i * mpi_size + (mpi_size - mpi_rank - 1)); vrfyerrs = 0; for (j = 0; j < MB; j++) { if ((*(buf + j) != expected) @@ -526,7 +526,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { * ==================================================*/ irank = 0; for (i = 0; i < DIMSIZE; i++) - writedata[i] = irank * DIMSIZE + i; + H5_CHECKED_ASSIGN(writedata[i], uint8_t, irank * DIMSIZE + i, int) mpi_off = irank * DIMSIZE; /* Only one process writes */ @@ -597,7 +597,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { return 1; }; for (i = 0; i < DIMSIZE; i++) { - expect_val = irank * DIMSIZE + i; + H5_CHECKED_ASSIGN(expect_val, uint8_t, irank * DIMSIZE + i, int); if (readdata[i] != expect_val) { PRINTID; HDprintf("read data[%d:%d] got %02x, expect %02x\n", irank, i, @@ -697,7 +697,7 @@ static int test_mpio_derived_dtype(char *filename) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); retcode = 0; for (i = 0; i < 3; i++) - buf[i] = i + 1; + H5_CHECKED_ASSIGN(buf[i], int8_t, i + 1, int); if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index abbfbb3..c12cf5a 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -1981,7 +1981,6 @@ contig_hs_dr_pio_test__run_test(const int test_num, #if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG const char *fcnName = "contig_hs_dr_pio_test__run_test()"; #endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */ - int mpi_rank; struct hs_dr_pio_test_vars_t test_vars = { /* int mpi_size = */ -1, @@ -2049,9 +2048,6 @@ contig_hs_dr_pio_test__run_test(const int test_num, small_rank, large_rank, use_collective_io, dset_type, express_test, tv_ptr); - /* initialize the local copy of mpi_rank */ - mpi_rank = tv_ptr->mpi_rank; - /* initialize skips & max_skips */ tv_ptr->skips = *skips_ptr; tv_ptr->max_skips = max_skips; @@ -3520,7 +3516,6 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) const char *fcnName = "ckrbrd_hs_dr_pio_test__m2d_l2s()"; #endif /* CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG */ hbool_t data_ok = FALSE; - hbool_t mis_match = FALSE; int i, j, k, l; size_t u; size_t start_index; @@ -3768,8 +3763,6 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) /* verify that expected data is retrieved */ - mis_match = FALSE; - expected_value = (uint32_t)( (i * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) + @@ -3878,7 +3871,6 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) const char *fcnName = "ckrbrd_hs_dr_pio_test__m2d_s2l()"; #endif /* CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG */ hbool_t data_ok = FALSE; - hbool_t mis_match = FALSE; int i, j, k, l; size_t u; size_t start_index; @@ -4138,8 +4130,6 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) HDassert( stop_index < tv_ptr->large_ds_size ); - mis_match = FALSE; - data_ok = TRUE; ptr_1 = tv_ptr->large_ds_buf_1; @@ -4235,7 +4225,6 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, #if CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG const char *fcnName = "ckrbrd_hs_dr_pio_test__run_test()"; #endif /* CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG */ - int mpi_rank; /* needed by VRFY */ struct hs_dr_pio_test_vars_t test_vars = { /* int mpi_size = */ -1, @@ -4305,10 +4294,6 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, tv_ptr); - /* initialize the local copy of mpi_rank */ - mpi_rank = tv_ptr->mpi_rank; - - /* initialize skips & max_skips */ tv_ptr->skips = *skips_ptr; tv_ptr->max_skips = max_skips; diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index 9a4ac4d..c3cc7b5 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -37,7 +37,7 @@ static void coll_write_test(int chunk_factor); -static void coll_read_test(int chunk_factor); +static void coll_read_test(void); /*------------------------------------------------------------------------- @@ -84,7 +84,7 @@ void coll_irregular_cont_read(void) { - coll_read_test(0); + coll_read_test(); } @@ -133,7 +133,7 @@ void coll_irregular_simple_chunk_read(void) { - coll_read_test(1); + coll_read_test(); } @@ -181,7 +181,7 @@ void coll_irregular_complex_chunk_read(void) { - coll_read_test(4); + coll_read_test(); } @@ -662,7 +662,7 @@ void coll_write_test(int chunk_factor) *------------------------------------------------------------------------- */ static void -coll_read_test(int chunk_factor) +coll_read_test(void) { const char *filename; @@ -923,7 +923,9 @@ coll_read_test(int chunk_factor) ****************************************************************/ #define LDSCT_DS_RANK 5 +#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG #define LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK 0 +#endif #define LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG 0 @@ -1558,7 +1560,9 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, size_t small_ds_size; size_t small_ds_slice_size; size_t large_ds_size; +#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG size_t large_ds_slice_size; +#endif uint32_t expected_value; uint32_t * small_ds_buf_0 = NULL; uint32_t * small_ds_buf_1 = NULL; @@ -1612,9 +1616,10 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, small_ds_size = (size_t)((mpi_size + 1) * 1 * 1 * 10 * 10); small_ds_slice_size = (size_t) ( 1 * 1 * 10 * 10); large_ds_size = (size_t)((mpi_size + 1) * 10 * 10 * 10 * 10); - large_ds_slice_size = (size_t) (10 * 10 * 10 * 10); #if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG + large_ds_slice_size = (size_t) (10 * 10 * 10 * 10); + if ( mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK ) { HDfprintf(stdout, "%s:%d: small ds size / slice size = %d / %d.\n", fcnName, mpi_rank, diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index f46eb23..2acfab0 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -39,6 +39,7 @@ if (NOT ONLY_SHARED_LIBS) INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5_TOOLS_DEBUG) + #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG) TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC) target_link_libraries (${HDF5_TOOLS_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET} @@ -59,6 +60,7 @@ if (BUILD_SHARED_LIBS) target_compile_definitions(${HDF5_TOOLS_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" #PRIVATE H5_TOOLS_DEBUG + #PRIVATE H5DIFF_DEBUG ) TARGET_C_PROPERTIES (${HDF5_TOOLS_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index b22af18..870c256 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -143,20 +143,19 @@ is_valid_options(diff_opt_t *opts) * no -q(quiet) with -v (verbose) or -r (report) */ if(opts->m_quiet && (opts->m_verbose || opts->m_report)) { parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n"); - opts->err_stat = 1; - HGOTO_DONE(0); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_DONE(0); } /* ------------------------------------------------------- * only allow --no-dangling-links along with --follow-symlinks */ if(opts->no_dangle_links && !opts->follow_links) { parallel_print("Error: --no-dangling-links must be used along with --follow-symlinks option.\n"); - opts->err_stat = 1; - HGOTO_DONE(0); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_DONE(0); } done: - return ret_value; } @@ -178,7 +177,7 @@ is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *opts) /* check if exclude path option is given */ if (!opts->exclude_path) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /* assign to local exclude list pointer */ exclude_path_ptr = opts->exclude; @@ -274,15 +273,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"); + H5TOOLS_DEBUG("build_match_list start - errstat:%d", opts->err_stat); /* init */ - trav_table_init(&table); + trav_table_init(info1->fid, &table); if (table == NULL) { - H5TOOLS_INFO(H5E_tools_min_info_id_g, "Cannot create traverse table"); - HGOTO_DONE(-1); + H5TOOLS_INFO("Cannot create traverse table"); + H5TOOLS_GOTO_DONE_NO_RET(); } + /* * This is necessary for the case that given objects are group and * have different names (ex: obj1 is /grp1 and obj2 is /grp5). @@ -315,10 +314,20 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table); /* if the two point to the same target object, * mark that in table */ - if (info1->paths[curr1].fileno == info2->paths[curr2].fileno && - info1->paths[curr1].objno == info2->paths[curr2].objno) { - idx = table->nobjs - 1; - table->objs[idx].is_same_trgobj = 1; + if(info1->paths[curr1].fileno == info2->paths[curr2].fileno) { + int token_cmp; + + if(H5Otoken_cmp(info1->fid, &info1->paths[curr1].obj_token, + &info2->paths[curr2].obj_token, &token_cmp) < 0) { + H5TOOLS_INFO("Failed to compare object tokens"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_DONE_NO_RET(); + } + + if(!token_cmp) { + idx = table->nobjs - 1; + table->objs[idx].is_same_trgobj = 1; + } } } curr1++; @@ -372,7 +381,8 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 done: *table_out = table; - h5difftrace("build_match_list finish\n"); + + H5TOOLS_ENDDEBUG("exit"); } @@ -382,7 +392,7 @@ done: * Purpose: Call back function from h5trav_visit(). *------------------------------------------------------------------------*/ static herr_t -trav_grp_objs(const char *path, const H5O_info_t *oinfo, +trav_grp_objs(const char *path, const H5O_info2_t *oinfo, const char *already_visited, void *udata) { trav_info_visit_obj(path, oinfo, already_visited, udata); @@ -397,82 +407,82 @@ trav_grp_objs(const char *path, const H5O_info_t *oinfo, * Track and extra checkings while visiting all symbolic-links. *------------------------------------------------------------------------*/ static herr_t -trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) +trav_grp_symlinks(const char *path, const H5L_info2_t *linfo, void *udata) { - herr_t ret_value = 0; trav_info_t *tinfo = (trav_info_t *)udata; diff_opt_t *opts = (diff_opt_t *)tinfo->opts; h5tool_link_info_t lnk_info; const char *ext_fname; const char *ext_path; + herr_t ret_value = SUCCEED; /* init linkinfo struct */ HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t)); if (!opts->follow_links) { trav_info_visit_lnk(path, linfo, tinfo); - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(SUCCEED); } switch(linfo->type) { case H5L_TYPE_SOFT: if((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) { - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } else if (ret_value == 0) { - /* no dangling link option given and detect dangling link */ - tinfo->symlink_visited.dangle_link = TRUE; + /* no dangling link option given and detect dangling link */ + tinfo->symlink_visited.dangle_link = TRUE; trav_info_visit_lnk(path, linfo, tinfo); if (opts->no_dangle_links) - opts->err_stat = 1; /* make dangling link is error */ - HGOTO_DONE(0); + opts->err_stat = H5DIFF_ERR; /* make dangling link is error */ + H5TOOLS_GOTO_DONE(SUCCEED); } /* check if already visit the target object */ if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path)) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(SUCCEED); /* add this link as visited link */ if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path) < 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(SUCCEED); if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, trav_grp_objs,trav_grp_symlinks, tinfo, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); - opts->err_stat = 1; - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_ERROR(FAIL, "Error: Could not get file contents"); } break; case H5L_TYPE_EXTERNAL: if ((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) { - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } else if (ret_value == 0) { /* no dangling link option given and detect dangling link */ tinfo->symlink_visited.dangle_link = TRUE; trav_info_visit_lnk(path, linfo, tinfo); if (opts->no_dangle_links) - opts->err_stat = 1; /* make dangling link is error */ - HGOTO_DONE(0); + opts->err_stat = H5DIFF_ERR; /* make dangling link is error */ + H5TOOLS_GOTO_DONE(SUCCEED); } if(H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(SUCCEED); /* check if already visit the target object */ if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path)) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(SUCCEED); /* add this link as visited link */ if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path) < 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(SUCCEED); if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, trav_grp_objs,trav_grp_symlinks, tinfo, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); - opts->err_stat = 1; - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents\n"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_ERROR(FAIL, "Error: Could not get file contents\n"); } break; @@ -481,14 +491,15 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) case H5L_TYPE_ERROR: default: parallel_print("Error: Invalid link type\n"); - opts->err_stat = 1; - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Invalid link type"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_ERROR(FAIL, "Error: Invalid link type"); break; } /* end of switch */ done: if (lnk_info.trg_path) HDfree(lnk_info.trg_path); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -509,9 +520,8 @@ h5diff(const char *fname1, const char *objname2, diff_opt_t *opts) { - int ret_value = 0; - hid_t file1_id = -1; - hid_t file2_id = -1; + hid_t file1_id = H5I_INVALID_HID; + hid_t file2_id = H5I_INVALID_HID; char filenames[2][MAX_FILENAME]; hsize_t nfound = 0; int l_ret1 = -1; @@ -523,7 +533,7 @@ h5diff(const char *fname1, h5trav_type_t obj1type = H5TRAV_TYPE_GROUP; h5trav_type_t obj2type = H5TRAV_TYPE_GROUP; /* for single object */ - H5O_info_t oinfo1, oinfo2; /* object info */ + H5O_info2_t oinfo1, oinfo2; /* object info */ trav_info_t *info1_obj = NULL; trav_info_t *info2_obj = NULL; /* for group object */ @@ -533,15 +543,16 @@ h5diff(const char *fname1, trav_info_t *info1_lp = NULL; trav_info_t *info2_lp = NULL; /* link info from specified object */ - H5L_info_t src_linfo1; - H5L_info_t src_linfo2; + H5L_info2_t src_linfo1; + H5L_info2_t src_linfo2; /* link info from member object */ h5tool_link_info_t trg_linfo1; h5tool_link_info_t trg_linfo2; /* list for common objects */ trav_table_t *match_list = NULL; + diff_err_t ret_value = H5DIFF_NO_ERR; - h5difftrace("h5diff start\n"); + H5TOOLS_DEBUG("h5diff start"); /* init filenames */ HDmemset(filenames, 0, MAX_FILENAME * 2); /* init link info struct */ @@ -552,10 +563,10 @@ h5diff(const char *fname1, * check invalid combination of options *-----------------------------------------------------------------------*/ if(!is_valid_options(opts)) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); opts->cmn_objs = 1; /* eliminate warning */ - opts->err_stat = 0; /* initialize error status */ + opts->err_stat = H5DIFF_NO_ERR; /* initialize error status */ /*------------------------------------------------------------------------- * open the files first; if they are not valid, no point in continuing @@ -564,15 +575,16 @@ h5diff(const char *fname1, /* open file 1 */ if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname1); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "<%s>: unable to open file\n", fname1); } /* end if */ - + H5TOOLS_DEBUG("file1_id = %s", fname1); /* open file 2 */ if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname2); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname2); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "<%s>: unable to open file\n", fname2); } /* end if */ + H5TOOLS_DEBUG("file2_id = %s", fname2); /*------------------------------------------------------------------------- * Initialize the info structs @@ -581,7 +593,7 @@ h5diff(const char *fname1, trav_info_init(fname1, file1_id, &info1_obj); trav_info_init(fname2, file2_id, &info2_obj); - h5difftrace("trav_info_init initialized\n"); + H5TOOLS_DEBUG("trav_info_init initialized"); /* if any object is specified */ if (objname1) { /* make the given object1 fullpath, start with "/" */ @@ -589,11 +601,11 @@ h5diff(const char *fname1, #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj1fullname, "/%s", objname1) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed"); #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ if ((obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2)) == NULL) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed"); HDstrcpy(obj1fullname, "/"); HDstrcat(obj1fullname, objname1); @@ -607,11 +619,11 @@ h5diff(const char *fname1, #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj2fullname, "/%s", objname2) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed"); #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ if ((obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2)) == NULL) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed"); HDstrcpy(obj2fullname, "/"); HDstrcat(obj2fullname, objname2); #endif /* H5_HAVE_ASPRINTF */ @@ -622,7 +634,7 @@ h5diff(const char *fname1, /*---------------------------------------------------------- * check if obj1 is root, group, single object or symlink */ - h5difftrace("h5diff check if obj1 is root, group, single object or symlink\n"); + H5TOOLS_DEBUG("h5diff check if obj1=%s is root, group, single object or symlink", obj1fullname); if(!HDstrcmp(obj1fullname, "/")) { obj1type = H5TRAV_TYPE_GROUP; } @@ -630,12 +642,12 @@ h5diff(const char *fname1, /* check if link itself exist */ if(H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0) { parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Error: Object could not be found"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Object could not be found"); } /* get info from link */ - if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) { + if(H5Lget_info2(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) { parallel_print("Unable to get link info from <%s>\n", obj1fullname); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Lget_info failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Lget_info failed"); } info1_lp = info1_obj; @@ -649,14 +661,14 @@ h5diff(const char *fname1, /* optional data pass */ info1_obj->opts = (diff_opt_t*)opts; - if(H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Could not get file contents"); } obj1type = (h5trav_type_t)oinfo1.type; trav_info_add(info1_obj, obj1fullname, obj1type); idx = info1_obj->nused - 1; - info1_obj->paths[idx].objno = oinfo1.addr; + HDmemcpy(&info1_obj->paths[idx].obj_token, &oinfo1.token, sizeof(H5O_token_t)); info1_obj->paths[idx].fileno = oinfo1.fileno; } else if (src_linfo1.type == H5L_TYPE_SOFT) { @@ -672,7 +684,7 @@ h5diff(const char *fname1, /*---------------------------------------------------------- * check if obj2 is root, group, single object or symlink */ - h5difftrace("h5diff check if obj2 is root, group, single object or symlink\n"); + H5TOOLS_DEBUG("h5diff check if obj2=%s is root, group, single object or symlink", obj2fullname); if(!HDstrcmp(obj2fullname, "/")) { obj2type = H5TRAV_TYPE_GROUP; } @@ -680,12 +692,12 @@ h5diff(const char *fname1, /* check if link itself exist */ if(H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0) { parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Error: Object could not be found"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Object could not be found"); } /* get info from link */ - if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) { + if(H5Lget_info2(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) { parallel_print("Unable to get link info from <%s>\n", obj2fullname); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Lget_info failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Lget_info failed"); } info2_lp = info2_obj; @@ -699,14 +711,14 @@ h5diff(const char *fname1, /* optional data pass */ info2_obj->opts = (diff_opt_t*)opts; - if(H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Error: Could not get file contents"); } obj2type = (h5trav_type_t)oinfo2.type; trav_info_add(info2_obj, obj2fullname, obj2type); idx = info2_obj->nused - 1; - info2_obj->paths[idx].objno = oinfo2.addr; + HDmemcpy(&info2_obj->paths[idx].obj_token, &oinfo2.token, sizeof(H5O_token_t)); info2_obj->paths[idx].fileno = oinfo2.fileno; } else if (src_linfo2.type == H5L_TYPE_SOFT) { @@ -721,7 +733,7 @@ h5diff(const char *fname1, } /* if no object specified */ else { - h5difftrace("h5diff no object specified\n"); + H5TOOLS_DEBUG("h5diff no object specified"); /* set root group */ obj1fullname = (char*)HDstrdup("/"); obj1type = H5TRAV_TYPE_GROUP; @@ -729,7 +741,7 @@ h5diff(const char *fname1, obj2type = H5TRAV_TYPE_GROUP; } - h5diffdebug2("get any symbolic links info - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("get any symbolic links info - errstat:%d", opts->err_stat); /* get any symbolic links info */ l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, opts->follow_links); l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, opts->follow_links); @@ -745,15 +757,15 @@ h5diff(const char *fname1, /*------------------------------- * check symbolic link (object1) */ - h5difftrace("h5diff check symbolic link (object1)\n"); + H5TOOLS_DEBUG("h5diff check symbolic link (object1)"); /* dangling link */ if (l_ret1 == 0) { - h5difftrace("h5diff ... dangling link\n"); + H5TOOLS_DEBUG("h5diff ... dangling link"); if (opts->no_dangle_links) { /* treat dangling link as error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "treat dangling link as error"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "treat dangling link as error"); } else { if(opts->m_verbose) @@ -761,40 +773,40 @@ h5diff(const char *fname1, if (l_ret1 != 0 || l_ret2 != 0) { nfound++; print_found(nfound); - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR); } } } else if(l_ret1 < 0) { /* fail */ parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Object could not be found"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Object could not be found"); } else if(l_ret1 != 2) { /* symbolic link */ obj1type = (h5trav_type_t)trg_linfo1.trg_type; - h5difftrace("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD\n"); + H5TOOLS_DEBUG("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD"); if (info1_lp != NULL) { size_t idx = info1_lp->nused - 1; - h5difftrace("h5diff ... ... ... info1_obj not null\n"); + H5TOOLS_DEBUG("h5diff ... ... ... info1_obj not null"); + HDmemcpy(&info1_lp->paths[idx].obj_token, &trg_linfo1.obj_token, sizeof(H5O_token_t)); info1_lp->paths[idx].type = (h5trav_type_t)trg_linfo1.trg_type; - info1_lp->paths[idx].objno = trg_linfo1.objno; info1_lp->paths[idx].fileno = trg_linfo1.fileno; } - h5difftrace("h5diff check symbolic link (object1) finished\n"); + H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished"); } /*------------------------------- * check symbolic link (object2) */ - h5difftrace("h5diff check symbolic link (object2)\n"); + H5TOOLS_DEBUG("h5diff check symbolic link (object2)"); /* dangling link */ if (l_ret2 == 0) { - h5difftrace("h5diff ... dangling link\n"); + H5TOOLS_DEBUG("h5diff ... dangling link"); if (opts->no_dangle_links) { /* treat dangling link as error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "treat dangling link as error"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "treat dangling link as error"); } else { if(opts->m_verbose) @@ -802,25 +814,25 @@ h5diff(const char *fname1, if (l_ret1 != 0 || l_ret2 != 0) { nfound++; print_found(nfound); - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR); } } } else if(l_ret2 < 0) { /* fail */ parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Object could not be found"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Object could not be found"); } else if(l_ret2 != 2) { /* symbolic link */ obj2type = (h5trav_type_t)trg_linfo2.trg_type; if (info2_lp != NULL) { size_t idx = info2_lp->nused - 1; - h5difftrace("h5diff ... ... ... info2_obj not null\n"); + H5TOOLS_DEBUG("h5diff ... ... ... info2_obj not null"); + HDmemcpy(&info2_lp->paths[idx].obj_token, &trg_linfo2.obj_token, sizeof(H5O_token_t)); info2_lp->paths[idx].type = (h5trav_type_t)trg_linfo2.trg_type; - info2_lp->paths[idx].objno = trg_linfo2.objno; info2_lp->paths[idx].fileno = trg_linfo2.fileno; } - h5difftrace("h5diff check symbolic link (object1) finished\n"); + H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished"); } } /* end of if follow symlinks */ @@ -832,16 +844,16 @@ h5diff(const char *fname1, */ if(!(opts->m_verbose || opts->m_report)) { - h5difftrace("h5diff NOT (opts->m_verbose || opts->m_report)\n"); + H5TOOLS_DEBUG("h5diff NOT (opts->m_verbose || opts->m_report)"); /* if no danglink links */ if (l_ret1 > 0 && l_ret2 > 0) if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname) != 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR); } both_objs_grp = (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP); if (both_objs_grp) { - h5difftrace("h5diff both_objs_grp TRUE\n"); + H5TOOLS_DEBUG("h5diff both_objs_grp TRUE"); /* * traverse group1 */ @@ -852,7 +864,7 @@ h5diff(const char *fname1, if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE, trav_grp_objs, trav_grp_symlinks, info1_grp, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not get file contents"); } info1_lp = info1_grp; @@ -866,11 +878,11 @@ h5diff(const char *fname1, if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE, trav_grp_objs, trav_grp_symlinks, info2_grp, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not get file contents"); } /* end if */ info2_lp = info2_grp; } - h5diffdebug2("groups traversed - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("groups traversed - errstat:%d", opts->err_stat); #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -890,8 +902,10 @@ h5diff(const char *fname1, } /* end if */ #endif + H5TOOLS_DEBUG("build_match_list next - errstat:%d", opts->err_stat); /* process the objects */ build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp, &match_list, opts); + H5TOOLS_DEBUG("build_match_list finished - errstat:%d", opts->err_stat); if (both_objs_grp) { /*------------------------------------------------------ * print the list @@ -907,7 +921,7 @@ h5diff(const char *fname1, parallel_print("file1 file2\n"); parallel_print("---------------------------------------\n"); for(u = 0; u < match_list->nobjs; u++) { - char c1, c2; + int c1, c2; c1 = (match_list->objs[u].flags[0]) ? 'x' : ' '; c2 = (match_list->objs[u].flags[1]) ? 'x' : ' '; parallel_print("%5c %6c %-15s\n", c1, c2, match_list->objs[u].name); @@ -915,6 +929,7 @@ h5diff(const char *fname1, parallel_print ("\n"); } /* end if */ } + H5TOOLS_DEBUG("diff_match next - errstat:%d", opts->err_stat); nfound = diff_match(file1_id, obj1fullname, info1_lp, file2_id, obj2fullname, info2_lp, match_list, opts); @@ -957,8 +972,9 @@ done: H5Fclose(file2_id); } H5E_END_TRY; - h5difftrace("h5diff finish\n"); + H5TOOLS_DEBUG("h5diff finish - errstat:%d", opts->err_stat); + H5TOOLS_ENDDEBUG("exit"); return nfound; } @@ -987,7 +1003,6 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, { hsize_t nfound = 0; unsigned i; - int ret_value = opts->err_stat; const char *grp1_path = ""; const char *grp2_path = ""; char *obj1_fullpath = NULL; @@ -995,8 +1010,9 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, diff_args_t argdata; size_t idx1 = 0; size_t idx2 = 0; + diff_err_t ret_value = opts->err_stat; - h5difftrace("diff_match start\n"); + H5TOOLS_DEBUG("diff_match start - errstat:%d", opts->err_stat); /* * if not root, prepare object name to be pre-appended to group path to * make full path @@ -1049,41 +1065,41 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, #endif for(i = 0; i < table->nobjs; i++) { - h5diffdebug3("diff for common objects[%d] - errstat:%d\n", i, opts->err_stat); + H5TOOLS_DEBUG("diff for common objects[%d] - errstat:%d", i, opts->err_stat); if(table->objs[i].flags[0] && table->objs[i].flags[1]) { /* make full path for obj1 */ #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0) { - H5TOOLS_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed"); } #else /* H5_HAVE_ASPRINTF */ if((obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) { - H5TOOLS_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed"); } else { HDstrcpy(obj1_fullpath, grp1_path); HDstrcat(obj1_fullpath, table->objs[i].name); } #endif /* H5_HAVE_ASPRINTF */ - h5diffdebug2("diff_match path1 - %s\n", obj1_fullpath); + H5TOOLS_DEBUG("diff_match path1 - %s", obj1_fullpath); /* make full path for obj2 */ #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0) { - H5TOOLS_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed"); } #else /* H5_HAVE_ASPRINTF */ if((obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) { - H5TOOLS_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed"); } else { HDstrcpy(obj2_fullpath, grp2_path); HDstrcat(obj2_fullpath, table->objs[i].name); } #endif /* H5_HAVE_ASPRINTF */ - h5diffdebug2("diff_match path2 - %s\n", obj2_fullpath); + H5TOOLS_DEBUG("diff_match path2 - %s", obj2_fullpath); /* get index to figure out type of the object in file1 */ while(info1->paths[idx1].path && (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0)) @@ -1099,6 +1115,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, opts->cmn_objs = 1; if(!g_Parallel) { + H5TOOLS_DEBUG("diff paths - errstat:%d", opts->err_stat); nfound += diff(file1_id, obj1_fullpath, file2_id, obj2_fullpath, opts, &argdata); @@ -1107,7 +1124,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, else { int workerFound = 0; - h5difftrace("Beginning of big else block\n"); + H5TOOLS_DEBUG("Beginning of big else block"); /* We're in parallel mode */ /* Since the data type of diff value is hsize_t which can * be arbitary large such that there is no MPI type that @@ -1261,7 +1278,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, HDfree(obj2_fullpath); } /* end if */ } /* end for */ - h5diffdebug2("done with for loop - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("done with for loop - errstat:%d", opts->err_stat); #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -1338,7 +1355,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, /* Print any final data waiting in our queue */ print_incoming_data(); } /* end if */ - h5difftrace("done with if block\n"); + H5TOOLS_DEBUG("done with if block"); HDfree(workerTasks); } @@ -1346,11 +1363,13 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, opts->err_stat = opts->err_stat | ret_value; -/* free table */ + /* free table */ if (table) trav_table_free(table); - h5diffdebug2("diff_match finish:%d\n", nfound); + H5TOOLS_DEBUG("diff_match finish diffs=%d - errstat:%d", nfound, opts->err_stat); + + H5TOOLS_ENDDEBUG("exit"); return nfound; } @@ -1376,25 +1395,25 @@ diff(hid_t file1_id, diff_opt_t * opts, diff_args_t *argdata) { - int ret_value = opts->err_stat; int status = -1; - hid_t dset1_id = -1; - hid_t dset2_id = -1; - hid_t type1_id = -1; - hid_t type2_id = -1; - hid_t grp1_id = -1; - hid_t grp2_id = -1; + hid_t dset1_id = H5I_INVALID_HID; + hid_t dset2_id = H5I_INVALID_HID; + hid_t type1_id = H5I_INVALID_HID; + hid_t type2_id = H5I_INVALID_HID; + hid_t grp1_id = H5I_INVALID_HID; + hid_t grp2_id = H5I_INVALID_HID; hbool_t is_dangle_link1 = FALSE; hbool_t is_dangle_link2 = FALSE; hbool_t is_hard_link = FALSE; hsize_t nfound = 0; h5trav_type_t object_type; + diff_err_t ret_value = opts->err_stat; /* to get link info */ h5tool_link_info_t linkinfo1; h5tool_link_info_t linkinfo2; - h5difftrace("diff start\n"); + H5TOOLS_DEBUG("diff start - errstat:%d", opts->err_stat); /*init link info struct */ HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t)); @@ -1414,9 +1433,10 @@ diff(hid_t file1_id, * check dangling links for path1 and path2 */ + H5TOOLS_DEBUG("diff links"); /* target object1 - get type and name */ if ((status = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, opts->follow_links)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5tools_get_symlink_info failed"); /* dangling link */ if (status == 0) { @@ -1424,7 +1444,7 @@ diff(hid_t file1_id, /* dangling link is error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "dangling link is error"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "dangling link is error"); } else is_dangle_link1 = TRUE; @@ -1432,14 +1452,14 @@ diff(hid_t file1_id, /* target object2 - get type and name */ if ((status = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, opts->follow_links)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5tools_get_symlink_info failed"); /* dangling link */ if (status == 0) { if (opts->no_dangle_links) { /* dangling link is error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path2); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "dangling link is error"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "dangling link is error"); } else is_dangle_link2 = TRUE; @@ -1447,7 +1467,7 @@ diff(hid_t file1_id, /* found dangling link */ if (is_dangle_link1 || is_dangle_link2) { - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR); } /* follow symbolic link option */ @@ -1462,6 +1482,7 @@ diff(hid_t file1_id, } /* if objects are not the same type */ if (argdata->type[0] != argdata->type[1]) { + H5TOOLS_DEBUG("diff objects are not the same"); if (opts->m_verbose||opts->m_list_not_cmp) { parallel_print("Not comparable: <%s> is of type %s and <%s> is of type %s\n", path1, get_type(argdata->type[0]), @@ -1471,7 +1492,7 @@ diff(hid_t file1_id, /* TODO: will need to update non-comparable is different * opts->contents = 0; */ - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR); } else /* now both object types are same */ object_type = argdata->type[0]; @@ -1485,7 +1506,7 @@ diff(hid_t file1_id, * Perform this to match the outputs as bypassing. */ if (argdata->is_same_trgobj) { - h5difftrace("argdata->is_same_trgobj\n"); + H5TOOLS_DEBUG("argdata->is_same_trgobj"); is_hard_link = (object_type == H5TRAV_TYPE_DATASET || object_type == H5TRAV_TYPE_NAMED_DATATYPE || object_type == H5TRAV_TYPE_GROUP); @@ -1523,7 +1544,7 @@ diff(hid_t file1_id, } /* if(opts->m_verbose || opts->m_report) */ /* exact same, so comparison is done */ - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR); } } @@ -1533,13 +1554,15 @@ diff(hid_t file1_id, *---------------------------------------------------------------------- */ case H5TRAV_TYPE_DATASET: + H5TOOLS_DEBUG("diff object type H5TRAV_TYPE_DATASET - errstat:%d", opts->err_stat); if((dset1_id = H5Dopen2(file1_id, path1, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 failed"); if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 failed"); /* verbose (-v) and report (-r) mode */ if(opts->m_verbose || opts->m_report) { do_print_objname("dataset", path1, path2, opts); + H5TOOLS_DEBUG("call diff_dataset 1:%s 2:%s ", path1, path2); nfound = diff_dataset(file1_id, file2_id, path1, path2, opts); print_found(nfound); } @@ -1556,7 +1579,7 @@ diff(hid_t file1_id, print_found(nfound); } } - h5diffdebug2("diff after dataset:%d\n", nfound); + H5TOOLS_DEBUG("diff after dataset:%d - errstat:%d", nfound, opts->err_stat); /*--------------------------------------------------------- * compare attributes @@ -1564,14 +1587,15 @@ diff(hid_t file1_id, * referenced object *--------------------------------------------------------- */ - if(path1) + if(path1) { + H5TOOLS_DEBUG( "call diff_attr 1:%s 2:%s ", path1, path2); nfound += diff_attr(dset1_id, dset2_id, path1, path2, opts); - + } if(H5Dclose(dset1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dclose failed"); if(H5Dclose(dset2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dclose failed"); break; /*---------------------------------------------------------------------- @@ -1579,13 +1603,14 @@ diff(hid_t file1_id, *---------------------------------------------------------------------- */ case H5TRAV_TYPE_NAMED_DATATYPE: + H5TOOLS_DEBUG("H5TRAV_TYPE_NAMED_DATATYPE 1:%s 2:%s ", path1, path2); if((type1_id = H5Topen2(file1_id, path1, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Topen2 failed"); if((type2_id = H5Topen2(file2_id, path2, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Topen2 failed"); if((status = H5Tequal(type1_id, type2_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tequal failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tequal failed"); /* if H5Tequal is > 0 then the datatypes refer to the same datatype */ nfound = (status > 0) ? 0 : 1; @@ -1603,13 +1628,15 @@ diff(hid_t file1_id, * referenced object *----------------------------------------------------------------- */ - if(path1) + if(path1) { + H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2); nfound += diff_attr(type1_id, type2_id, path1, path2, opts); + } if(H5Tclose(type1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose failed"); if(H5Tclose(type2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose failed"); break; /*---------------------------------------------------------------------- @@ -1617,6 +1644,7 @@ diff(hid_t file1_id, *---------------------------------------------------------------------- */ case H5TRAV_TYPE_GROUP: + H5TOOLS_DEBUG("H5TRAV_TYPE_GROUP 1:%s 2:%s ", path1, path2); if(print_objname(opts, nfound)) do_print_objname("group", path1, path2, opts); @@ -1625,9 +1653,9 @@ diff(hid_t file1_id, print_found(nfound); if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Gclose failed"); if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Gclose failed"); /*----------------------------------------------------------------- * compare attributes @@ -1635,13 +1663,15 @@ diff(hid_t file1_id, * referenced object *----------------------------------------------------------------- */ - if(path1) + if(path1) { + H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2); nfound += diff_attr(grp1_id, grp2_id, path1, path2, opts); + } if(H5Gclose(grp1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Gclose failed"); if(H5Gclose(grp2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Gclose failed"); break; @@ -1651,6 +1681,7 @@ diff(hid_t file1_id, */ case H5TRAV_TYPE_LINK: { + H5TOOLS_DEBUG("H5TRAV_TYPE_LINK 1:%s 2:%s ", path1, path2); status = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path); /* if the target link name is not same then the links are "different" */ @@ -1662,7 +1693,6 @@ diff(hid_t file1_id, /* always print the number of differences found in verbose mode */ if(opts->m_verbose) print_found(nfound); - } break; @@ -1672,6 +1702,7 @@ diff(hid_t file1_id, */ case H5TRAV_TYPE_UDLINK: { + H5TOOLS_DEBUG("H5TRAV_TYPE_UDLINK 1:%s 2:%s ", path1, path2); /* Only external links will have a query function registered */ if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) { /* If the buffers are the same size, compare them */ @@ -1772,8 +1803,9 @@ done: /* enable error reporting */ } H5E_END_TRY; - h5diffdebug3("diff finish:%d - errstat:%d\n", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff finish:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG("exit"); return nfound; } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 26bcd95..b04ec23 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -57,28 +57,35 @@ struct exclude_path_list { struct exclude_path_list * next; }; +/* Enumeration value for keeping track of whether an error occurred or differences were found */ +typedef enum { + H5DIFF_NO_ERR, /* No error occurred */ + H5DIFF_ERR_DIFF, /* Differences were found */ + H5DIFF_ERR /* An error occurred */ +} diff_err_t; + typedef struct { - int m_quiet; /* quiet mide: no output at all */ - int m_report; /* report mode: print the data */ - int m_verbose; /* verbose mode: print the data, list of objcets, warnings */ - int m_verbose_level; /* control verbose details */ - int d; /* delta, absolute value to compare */ - double delta; /* delta value */ - int p; /* relative error to compare*/ - int use_system_epsilon; /* flag to use system epsilon (1 or 0) */ - double percent; /* relative error value */ - int n; /* count, compare up to count */ - hsize_t count; /* count value */ - hbool_t follow_links; /* follow symbolic links */ - int no_dangle_links; /* return error when find dangling link */ - int err_stat; /* an error ocurred (1, error, 0, no error) */ - int cmn_objs; /* do we have common objects */ - int not_cmp; /* are the objects comparable */ - int contents; /* equal contents */ - int do_nans; /* consider Nans while diffing floats */ - int m_list_not_cmp; /* list not comparable messages */ - int exclude_path; /* exclude path to an object */ - struct exclude_path_list * exclude; /* keep exclude path list */ + int m_quiet; /* quiet mode: no output at all */ + int m_report; /* report mode: print the data */ + int m_verbose; /* verbose mode: print the data, list of objcets, warnings */ + int m_verbose_level; /* control verbose details */ + int d; /* delta, absolute value to compare */ + double delta; /* delta value */ + int p; /* relative error to compare*/ + int use_system_epsilon; /* flag to use system epsilon (1 or 0) */ + double percent; /* relative error value */ + int n; /* count, compare up to count */ + hsize_t count; /* count value */ + hbool_t follow_links; /* follow symbolic links */ + int no_dangle_links; /* return error when find dangling link */ + diff_err_t err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */ + int cmn_objs; /* do we have common objects */ + int not_cmp; /* are the objects comparable */ + int contents; /* equal contents */ + int do_nans; /* consider Nans while diffing floats */ + int m_list_not_cmp; /* list not comparable messages */ + int exclude_path; /* exclude path to an object */ + struct exclude_path_list * exclude; /* keep exclude path list */ } diff_opt_t; @@ -165,6 +172,13 @@ int diff_can_type( hid_t f_type1, /* file data type */ diff_opt_t *opts, int is_compound); +hsize_t diff_attr_data(hid_t attr1_id, + hid_t attr2_id, + const char *attr1_name, + const char *attr2_name, + const char *path1, + const char *path2, + diff_opt_t *opts); hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index c83b88d..e99b2cc 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -17,6 +17,8 @@ #include "h5diff.h" #include "ph5diff.h" +#define ATTR_NAME_MAX 255 + /*------------------------------------------------------------------------- * printf formatting *------------------------------------------------------------------------- @@ -285,7 +287,7 @@ hsize_t diff_array( mcomp_t members; H5T_class_t type_class; - h5diffdebug2("diff_array start - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("diff_array start - errstat:%d", opts->err_stat); /* get the size. */ size = H5Tget_size(m_type); type_class = H5Tget_class(m_type); @@ -310,6 +312,7 @@ hsize_t diff_array( pos[j] = 0; } + H5TOOLS_DEBUG("diff_array type_class:%d", type_class); switch (type_class) { case H5T_NO_CLASS: case H5T_TIME: @@ -370,6 +373,7 @@ hsize_t diff_array( case H5T_REFERENCE: HDmemset(&members, 0, sizeof(mcomp_t)); get_member_types(m_type, &members); + H5TOOLS_DEBUG("call diff_datum nelmts:%d - errstat:%d", nelmts, opts->err_stat); for (i = 0; i < nelmts; i++) { nfound += diff_datum(mem1 + i * size, mem2 + i * size, m_type, i, rank, dims, acc, pos, opts, name1, name2, container1_id, container2_id, &ph, &members); @@ -378,8 +382,9 @@ hsize_t diff_array( } /* i */ close_member_types(&members); } /* switch */ - h5diffdebug3("diff_array finish:%d - errstat:%d\n", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff_array finish:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG("exit: %d", nfound); return nfound; } @@ -447,11 +452,11 @@ static hsize_t diff_datum( hbool_t iszero1; hbool_t iszero2; hsize_t nfound = 0; /* differences found */ - hsize_t ret_value = opts->err_stat; double per; hbool_t both_zero; + diff_err_t ret_value = opts->err_stat; - h5difftrace("diff_datum start\n"); + H5TOOLS_DEBUG("diff_datum start - errstat:%d", opts->err_stat); type_size = H5Tget_size(m_type); type_class = H5Tget_class(m_type); @@ -465,14 +470,14 @@ static hsize_t diff_datum( type_class != H5T_STRING && type_class != H5T_VLEN && HDmemcmp(mem1, mem2, type_size) == 0) - HGOTO_DONE(opts->err_stat); + H5TOOLS_GOTO_DONE(opts->err_stat); switch (H5Tget_class(m_type)) { case H5T_NO_CLASS: case H5T_TIME: case H5T_NCLASSES: default: - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Invalid type class"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Invalid type class"); break; /*------------------------------------------------------------------------- @@ -480,9 +485,9 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_COMPOUND: - h5difftrace("diff_datum H5T_COMPOUND\n"); + H5TOOLS_DEBUG("diff_datum H5T_COMPOUND"); { - hid_t memb_type = -1; + hid_t memb_type = H5I_INVALID_HID; nmembs = members->n; for (j = 0; j < nmembs; j++) { @@ -500,7 +505,7 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_STRING: - h5difftrace("diff_datum H5T_STRING\n"); + H5TOOLS_DEBUG("diff_datum H5T_STRING"); { char *s = NULL; char *sx = NULL; @@ -514,7 +519,7 @@ static hsize_t diff_datum( /* if variable length string */ if (H5Tis_variable_str(m_type)) { - h5difftrace("diff_datum H5T_STRING variable\n"); + H5TOOLS_DEBUG("diff_datum H5T_STRING variable"); /* Get pointer to first string */ s1 = *(char **)((void *)mem1); if (s1) @@ -530,7 +535,7 @@ static hsize_t diff_datum( size2 = 0; } else if (H5T_STR_NULLTERM == pad) { - h5difftrace("diff_datum H5T_STRING null term\n"); + H5TOOLS_DEBUG("diff_datum H5T_STRING null term"); /* Get pointer to first string */ s1 = (char*) mem1; if (s1) @@ -567,10 +572,10 @@ static hsize_t diff_datum( * of length of strings. * For now mimic the previous way. */ - h5diffdebug2("diff_datum string size:%d\n", size1); - h5diffdebug2("diff_datum string size:%d\n", size2); + H5TOOLS_DEBUG("diff_datum string size:%d", size1); + H5TOOLS_DEBUG("diff_datum string size:%d", size2); if (size1 != size2) { - h5difftrace("diff_datum string sizes\n"); + H5TOOLS_DEBUG("diff_datum string sizes difference"); nfound++; } if (size1 < size2) { @@ -607,7 +612,7 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_BITFIELD: - h5difftrace("diff_datum H5T_BITFIELD\n"); + H5TOOLS_DEBUG("diff_datum H5T_BITFIELD"); /* byte-by-byte comparison */ for (u = 0; u < type_size; u++) nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph); @@ -618,7 +623,7 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_OPAQUE: - h5difftrace("diff_datum H5T_OPAQUE\n"); + H5TOOLS_DEBUG("diff_datum H5T_OPAQUE"); /* byte-by-byte comparison */ for (u = 0; u < type_size; u++) nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph); @@ -634,7 +639,7 @@ static hsize_t diff_datum( * compared, we convert both bit patterns to their corresponding * enumeration constant and do a string comparison */ - h5difftrace("diff_datum H5T_ENUM\n"); + H5TOOLS_DEBUG("diff_datum H5T_ENUM"); { char enum_name1[1024]; char enum_name2[1024]; @@ -693,10 +698,11 @@ static hsize_t diff_datum( */ case H5T_ARRAY: { - hid_t memb_type = -1; + hid_t memb_type = H5I_INVALID_HID; hsize_t adims[H5S_MAX_RANK]; int ndims; + H5TOOLS_DEBUG("diff_datum H5T_ARRAY"); /* get the array's base datatype for each element */ memb_type = H5Tget_super(m_type); size = H5Tget_size(memb_type); @@ -720,45 +726,324 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_REFERENCE: + H5TOOLS_DEBUG("diff_datum H5T_REFERENCE"); iszero1 = all_zero(_mem1, H5Tget_size(m_type)); iszero2 = all_zero(_mem2, H5Tget_size(m_type)); if (iszero1 != iszero2) { nfound++; - HGOTO_DONE (opts->err_stat); + H5TOOLS_GOTO_DONE(opts->err_stat); } else if (!iszero1 && !iszero2) { + hid_t obj1_id = H5I_INVALID_HID; + hid_t obj2_id = H5I_INVALID_HID; + /*------------------------------------------------------------------------- - * H5T_STD_REF_DSETREG - * Dataset region reference + * H5T_STD_REF + * Reference *------------------------------------------------------------------------- */ - hid_t obj1_id = -1; - hid_t obj2_id = -1; - if (H5Tequal(m_type, H5T_STD_REF)) { /* if (type_size == H5R_STD_REF_SIZE) */ - H5TOOLS_INFO(H5E_tools_min_info_id_g, "NEW reference type"); + hid_t region1_id = H5I_INVALID_HID; + hid_t region2_id = H5I_INVALID_HID; + H5R_ref_t *ref1_buf = (H5R_ref_t *)_mem1; + H5R_ref_t *ref2_buf = (H5R_ref_t *)_mem2; + H5O_type_t obj1_type = -1; /* Object type */ + H5O_type_t obj2_type = -1; /* Object type */ + H5R_type_t ref_type; /* Reference type */ + + H5TOOLS_DEBUG("diff_datum H5T_REFERENCE - H5T_STD_REF"); + ref_type = H5Rget_type(ref1_buf); + switch (ref_type) { + case H5R_OBJECT1: + H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); + if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed"); + } + if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed"); + } + + /* check object type */ + if (obj1_type != obj2_type) { + parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); + opts->not_cmp = 1; + H5TOOLS_GOTO_DONE(opts->err_stat); + } + + if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 1 failed"); + } + if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 2 failed"); + } + + switch (obj1_type) { + case H5O_TYPE_DATASET: + nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts); + break; + + case H5O_TYPE_GROUP: + case H5O_TYPE_NAMED_DATATYPE: + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + if (opts->m_verbose) + parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2); + opts->not_cmp = 1; + break; + } /* end switch */ + if(obj1_id >= 0) + if(H5Oclose(obj1_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Oclose H5R_OBJECT1 failed"); + } + if(obj2_id >= 0) + if(H5Oclose(obj2_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Oclose H5R_OBJECT1 failed"); + } + if(H5Rdestroy(ref2_buf) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT1 failed"); + if(H5Rdestroy(ref1_buf) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT1 failed"); + break; + case H5R_DATASET_REGION1: + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); + if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts); + if(H5Sclose(region2_id) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION1 failed"); + } + if(H5Sclose(region1_id) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION1 failed"); + } + if(H5Oclose(obj2_id) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Oclose H5R_DATASET_REGION1 failed"); + } + else { + H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_object H5R_DATASET_REGION1 failed"); + } + if(H5Oclose(obj1_id) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Oclose H5R_DATASET_REGION1 failed"); + } + else { + H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_object H5R_DATASET_REGION1 failed"); + } + if(H5Rdestroy(ref2_buf) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION1 failed"); + if(H5Rdestroy(ref1_buf) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION1 failed"); + break; + case H5R_OBJECT2: + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); + if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed"); + } + if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed"); + } + + /* check object type */ + if (obj1_type != obj2_type) { + parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); + opts->not_cmp = 1; + H5TOOLS_GOTO_DONE(opts->err_stat); + } + + if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 1 failed"); + } + if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 2 failed"); + } + + switch (obj1_type) { + case H5O_TYPE_DATASET: + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : DATASET"); + nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts); + break; + + case H5O_TYPE_GROUP: + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : GROUP"); + if (opts->m_verbose) + parallel_print("Warning: Comparison not possible of group object types referenced: <%s> and <%s>\n", obj1, obj2); + opts->not_cmp = 1; + break; + + case H5O_TYPE_NAMED_DATATYPE: + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : NAMED"); + if (opts->m_verbose) + parallel_print("Warning: Comparison not possible of named datatypes object types referenced: <%s> and <%s>\n", obj1, obj2); + opts->not_cmp = 1; + break; + + case H5O_TYPE_MAP: + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + if (opts->m_verbose) + parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2); + opts->not_cmp = 1; + break; + } /* end switch */ + if(obj1_id >= 0) + if(H5Oclose(obj1_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); + } + if(obj2_id >= 0) + if(H5Oclose(obj2_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); + } + if(H5Rdestroy(ref2_buf) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT2 failed"); + if(H5Rdestroy(ref1_buf) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT2 failed"); + break; + case H5R_DATASET_REGION2: + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); + + /* if (obj_id < 0) - could mean that no reference was written do not throw failure */ + obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT); + obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT); + if((obj1_id < 0) || (obj2_id < 0)) { + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed"); + } + else { + H5TOOLS_DEBUG("open_region - H5R_DATASET_REGION2"); + if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (h5tools_is_zero(ref1_buf, H5Tget_size(H5T_STD_REF))) { + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); + } + else { + if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if (h5tools_is_zero(ref2_buf, H5Tget_size(H5T_STD_REF))) { + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); + } + else { + nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts); + } + if(H5Sclose(region2_id) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION2 failed"); + } + else + H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_region H5R_DATASET_REGION2 failed"); + } /* end else to if (h5tools_is_zero(... */ + if(H5Sclose(region1_id) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION2 failed"); + } + else + H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_region H5R_DATASET_REGION2 failed"); + if (obj1_id >= 0) + if(H5Dclose(obj1_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); + } + if (obj2_id >= 0) + if(H5Dclose(obj2_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); + } + if(H5Rdestroy(ref1_buf) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION2 failed"); + if(H5Rdestroy(ref2_buf) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION2 failed"); + } + break; + case H5R_ATTR: + { + char name1[ATTR_NAME_MAX]; + char name2[ATTR_NAME_MAX]; + + H5TOOLS_DEBUG("ref_type is H5R_ATTR"); + if((obj1_id = H5Ropen_attr(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + parallel_print("Warning: Cannot open referenced attribute: attribute 1\n"); + H5TOOLS_INFO("H5Ropen_attr object 1 failed"); + } + if((obj2_id = H5Ropen_attr(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + parallel_print("Warning: Cannot open referenced attribute: attribute 2\n"); + H5TOOLS_INFO("H5Ropen_attr object 2 failed"); + } + + if((obj1_id < 0) || (obj2_id < 0)) { + H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed"); + } + else { + /* get name */ + if(H5Aget_name(obj1_id, (size_t)ATTR_NAME_MAX, name1) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_name first attribute failed"); + /* get name */ + if(H5Aget_name(obj2_id, (size_t)ATTR_NAME_MAX, name2) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_name second attribute failed"); + + H5TOOLS_DEBUG("H5R_ATTR diff_attr_data - name1=%s, name2=%s", name1, name2); + nfound = diff_attr_data(obj1_id, obj2_id, name1, name2, NULL, NULL, opts); + } + + if(obj1_id >= 0) + if(H5Aclose(obj1_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); + } + if(obj2_id >= 0) + if(H5Aclose(obj2_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); + } + if(H5Rdestroy(ref2_buf) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_ATTR failed"); + if(H5Rdestroy(ref1_buf) < 0) + H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_ATTR failed"); + } + break; + case H5R_BADTYPE: + case H5R_MAXTYPE: + default: + break; + } /* end switch */ + H5TOOLS_DEBUG("diff_datum H5T_REFERENCE - H5T_STD_REF complete nfound:%d - errstat:%d", nfound, opts->err_stat); } + /*------------------------------------------------------------------------- + * H5T_STD_REF_DSETREG + * Dataset region reference + *------------------------------------------------------------------------- + */ else if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) { /* if (type_size == H5R_DSET_REG_REF_BUF_SIZE) */ - hid_t region1_id = -1; - hid_t region2_id = -1; + hid_t region1_id = H5I_INVALID_HID; + hid_t region2_id = H5I_INVALID_HID; + + H5TOOLS_INFO("H5T_STD_REF_DSETREG reference type"); if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rdereference2 object 1 failed"); } if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rdereference2 object 2 failed"); } if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_region object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_region object 1 failed"); } if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_region object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_region object 2 failed"); } nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts); @@ -779,29 +1064,31 @@ static hsize_t diff_datum( H5O_type_t obj1_type; H5O_type_t obj2_type; + H5TOOLS_INFO("H5T_STD_REF_OBJ reference type"); + if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type2 object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type2 object 1 failed"); } if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type2 object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type2 object 2 failed"); } /* check object type */ if (obj1_type != obj2_type) { parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); opts->not_cmp = 1; - HGOTO_DONE (opts->err_stat); + H5TOOLS_GOTO_DONE(opts->err_stat); } if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rdereference2 object 1 failed"); } if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rdereference2 object 2 failed"); } /* compare */ @@ -809,9 +1096,7 @@ static hsize_t diff_datum( nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts); else { if (opts->m_verbose) - parallel_print( - "Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", - obj1, obj2); + parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2); opts->not_cmp = 1; } @@ -819,6 +1104,7 @@ static hsize_t diff_datum( H5Oclose(obj2_id); }/*object reference*/ }/*is zero*/ + H5TOOLS_DEBUG("diff_datum H5T_REFERENCE complete"); break; /*------------------------------------------------------------------------- @@ -827,8 +1113,9 @@ static hsize_t diff_datum( */ case H5T_VLEN: { - hid_t memb_type = -1; + hid_t memb_type = H5I_INVALID_HID; + H5TOOLS_DEBUG("diff_datum H5T_VLEN"); /* get the VL sequences's base datatype for each element */ memb_type = H5Tget_super(m_type); size = H5Tget_size(memb_type); @@ -849,6 +1136,7 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_INTEGER: + H5TOOLS_DEBUG("diff_datum H5T_INTEGER"); type_sign = H5Tget_sign(m_type); /*------------------------------------------------------------------------- * H5T_NATIVE_SCHAR @@ -859,7 +1147,7 @@ static hsize_t diff_datum( char temp2_char; if(type_size != sizeof(char)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not char size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not char size"); HDmemcpy(&temp1_char, mem1, sizeof(char)); HDmemcpy(&temp2_char, mem2, sizeof(char)); /* -d and !-p */ @@ -934,7 +1222,7 @@ static hsize_t diff_datum( unsigned char temp2_uchar; if(type_size != sizeof(unsigned char)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned char size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned char size"); HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); @@ -1010,7 +1298,7 @@ static hsize_t diff_datum( short temp2_short; if(type_size != sizeof(short)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not short size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not short size"); HDmemcpy(&temp1_short, mem1, sizeof(short)); HDmemcpy(&temp2_short, mem2, sizeof(short)); @@ -1086,7 +1374,7 @@ static hsize_t diff_datum( unsigned short temp2_ushort; if(type_size != sizeof(unsigned short)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned short size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned short size"); HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); @@ -1162,7 +1450,7 @@ static hsize_t diff_datum( int temp2_int; if(type_size != sizeof(int)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not int size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not int size"); HDmemcpy(&temp1_int, mem1, sizeof(int)); HDmemcpy(&temp2_int, mem2, sizeof(int)); @@ -1238,7 +1526,7 @@ static hsize_t diff_datum( unsigned int temp2_uint; if(type_size != sizeof(unsigned int)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned int size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned int size"); HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); @@ -1314,7 +1602,7 @@ static hsize_t diff_datum( long temp2_long; if(type_size != sizeof(long)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long size"); HDmemcpy(&temp1_long, mem1, sizeof(long)); HDmemcpy(&temp2_long, mem2, sizeof(long)); @@ -1390,7 +1678,7 @@ static hsize_t diff_datum( unsigned long temp2_ulong; if(type_size != sizeof(unsigned long)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned long size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned long size"); HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); @@ -1467,6 +1755,7 @@ static hsize_t diff_datum( * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- */ + H5TOOLS_DEBUG("diff_datum H5T_FLOAT"); if (type_size == 4) { float temp1_float; float temp2_float; @@ -1474,7 +1763,7 @@ static hsize_t diff_datum( hbool_t isnan2 = FALSE; if(type_size != sizeof(float)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not float size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not float size"); HDmemcpy(&temp1_float, mem1, sizeof(float)); HDmemcpy(&temp2_float, mem2, sizeof(float)); @@ -1633,7 +1922,7 @@ static hsize_t diff_datum( hbool_t isnan2 = FALSE; if(type_size != sizeof(double)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not double size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not double size"); HDmemcpy(&temp1_double, mem1, sizeof(double)); HDmemcpy(&temp2_double, mem2, sizeof(double)); @@ -1792,7 +2081,7 @@ static hsize_t diff_datum( hbool_t isnan2 = FALSE; if(type_size != sizeof(long double)) { - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long double size"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long double size"); } HDmemcpy(&temp1_double, mem1, sizeof(long double)); @@ -1947,8 +2236,9 @@ static hsize_t diff_datum( done: opts->err_stat = opts->err_stat | ret_value; - h5diffdebug3("diff_datum finish:%d - errstat:%d\n", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff_datum finish:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG("exit"); return nfound; } @@ -2025,7 +2315,6 @@ void print_points(int i, hsize_t *ptdata, int ndims) { static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *opts) { - hsize_t ret_value = 0; hssize_t nblocks1, npoints1; hssize_t nblocks2, npoints2; hsize_t alloc_size; @@ -2036,6 +2325,9 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t int i, j; hsize_t nfound_b = 0; /* block differences found */ hsize_t nfound_p = 0; /* point differences found */ + hsize_t ret_value = 0; + + H5TOOLS_DEBUG("diff_region start"); ndims1 = H5Sget_simple_extent_ndims(region1_id); ndims2 = H5Sget_simple_extent_ndims(region2_id); @@ -2052,10 +2344,12 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t npoints1 = H5Sget_select_elem_npoints(region1_id); npoints2 = H5Sget_select_elem_npoints(region2_id); } H5E_END_TRY; + H5TOOLS_DEBUG("diff_region blocks: 1=%ld-2=%ld", nblocks1, nblocks2); + H5TOOLS_DEBUG("diff_region points: 1=%ld-2=%ld", npoints1, npoints2); if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) { opts->not_cmp = 1; - HGOTO_DONE (0); + H5TOOLS_GOTO_DONE(0); } /*------------------------------------------------------------------------- @@ -2063,21 +2357,22 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t *------------------------------------------------------------------------- */ if (nblocks1 > 0) { + H5TOOLS_DEBUG("region compare blocks"); HDassert(ndims1 > 0); alloc_size = (hsize_t) nblocks1 * (unsigned) ndims1 * 2 * sizeof(ptdata1[0]); HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/ if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t); H5Sget_select_hyper_blocklist(region1_id, (hsize_t) 0, (hsize_t) nblocks1, ptdata1); if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t); @@ -2099,14 +2394,22 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t /* print differences if found */ if (nfound_b && opts->m_verbose) { - H5O_info_t oi1, oi2; + H5O_info2_t oi1, oi2; + char *obj1_str = NULL, *obj2_str = NULL; + + H5Oget_info3(obj1_id, &oi1, H5O_INFO_BASIC); + H5Oget_info3(obj2_id, &oi2, H5O_INFO_BASIC); - H5Oget_info2(obj1_id, &oi1, H5O_INFO_BASIC); - H5Oget_info2(obj2_id, &oi2, H5O_INFO_BASIC); + /* Convert object tokens into printable output */ + H5Otoken_to_str(obj1_id, &oi1.token, &obj1_str); + H5Otoken_to_str(obj2_id, &oi2.token, &obj2_str); - parallel_print("Referenced dataset %lu %lu\n", (unsigned long) oi1.addr, (unsigned long) oi2.addr); + parallel_print("Referenced dataset %s %s\n", obj1_str, obj2_str); parallel_print( "------------------------------------------------------------\n"); + H5free_memory(obj1_str); + H5free_memory(obj2_str); + parallel_print("Region blocks\n"); for (i = 0; i < nblocks1; i++) { parallel_print("block #%d", i); @@ -2127,20 +2430,21 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t *------------------------------------------------------------------------- */ if (npoints1 > 0) { + H5TOOLS_DEBUG("region compare points"); alloc_size = (hsize_t) npoints1 * (unsigned) ndims1 * sizeof(ptdata1[0]); HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/ if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t); H5Sget_select_elem_pointlist(region1_id, (hsize_t) 0, (hsize_t) npoints1, ptdata1); if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t); @@ -2191,6 +2495,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t parallel_print(")"); } + parallel_print("\n"); #endif HDfree(ptdata1); @@ -2203,6 +2508,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t ret_value = nfound_p + nfound_b; done: + H5TOOLS_ENDDEBUG("exit with diffs:%d", ret_value); return ret_value; } @@ -2224,7 +2530,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u, HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - h5diffdebug3("character_compare start %d=%d\n",temp1_uchar,temp2_uchar); + H5TOOLS_DEBUG("character_compare start %d=%d",temp1_uchar,temp2_uchar); if (temp1_uchar != temp2_uchar) { if (print_data(opts)) { @@ -2237,8 +2543,9 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u, } nfound++; } - h5difftrace("character_compare finish\n"); + H5TOOLS_DEBUG("character_compare finish"); + H5TOOLS_ENDDEBUG("exit: %d", nfound); return nfound; } @@ -2263,7 +2570,6 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - h5difftrace("character_compare_opt start\n"); /* -d and !-p */ if (opts->d && !opts->p) { @@ -2307,7 +2613,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar)); } nfound++; - } h5difftrace("character_compare_opt finish\n"); + } return nfound; } @@ -2335,8 +2641,6 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2, hbool_t isnan1 = FALSE; hbool_t isnan2 = FALSE; - h5difftrace("diff_float start\n"); - /*------------------------------------------------------------------------- * -d and !-p *------------------------------------------------------------------------- @@ -2520,7 +2824,6 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_float finish\n"); return nfound; } @@ -2548,7 +2851,6 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2, hbool_t isnan1 = FALSE; hbool_t isnan2 = FALSE; - h5difftrace("diff_double start\n"); /*------------------------------------------------------------------------- * -d and !-p *------------------------------------------------------------------------- @@ -2731,7 +3033,6 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_double finish\n"); return nfound; } @@ -2769,8 +3070,6 @@ static hsize_t diff_ldouble(unsigned char *mem1, hbool_t isnan1 = FALSE; hbool_t isnan2 = FALSE; - h5difftrace("diff_ldouble start\n"); - /*------------------------------------------------------------------------- * -d and !-p *------------------------------------------------------------------------- @@ -2949,7 +3248,6 @@ static hsize_t diff_ldouble(unsigned char *mem1, return nfound; } /* nelmts */ } - h5difftrace("diff_ldouble finish\n"); return nfound; } @@ -2976,7 +3274,6 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2, double per; hbool_t both_zero; - h5difftrace("diff_schar start\n"); /* -d and !-p */ if (opts->d && !opts->p) { for (i = 0; i < nelmts; i++) { @@ -3077,7 +3374,6 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_schar finish\n"); return nfound; } @@ -3102,7 +3398,6 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2, double per; hbool_t both_zero; - h5difftrace("diff_uchar start\n"); /* -d and !-p */ if (opts->d && !opts->p) { for (i = 0; i < nelmts; i++) { @@ -3203,7 +3498,6 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_uchar finish\n"); return nfound; } @@ -3228,7 +3522,6 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2, double per; hbool_t both_zero; - h5difftrace("diff_short start\n"); /* -d and !-p */ if (opts->d && !opts->p) { for (i = 0; i < nelmts; i++) { @@ -3329,7 +3622,6 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_short finish\n"); return nfound; } @@ -3355,7 +3647,6 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2, double per; hbool_t both_zero; - h5difftrace("diff_ushort start\n"); /* -d and !-p */ if (opts->d && !opts->p) { for (i = 0; i < nelmts; i++) { @@ -3456,7 +3747,6 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_ushort finish\n"); return nfound; } @@ -3481,7 +3771,6 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2, double per; hbool_t both_zero; - h5difftrace("diff_int start\n"); /* -d and !-p */ if (opts->d && !opts->p) { for (i = 0; i < nelmts; i++) { @@ -3583,7 +3872,6 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2, } /* nelmts */ } - h5difftrace("diff_int finish\n"); return nfound; } @@ -3607,7 +3895,6 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2, double per; hbool_t both_zero; - h5difftrace("diff_uint start\n"); /* -d and !-p */ if (opts->d && !opts->p) { for (i = 0; i < nelmts; i++) { @@ -3709,7 +3996,6 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_uint finish\n"); return nfound; } @@ -3734,7 +4020,6 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2, double per; hbool_t both_zero; - h5difftrace("diff_long start\n"); /* -d and !-p */ if (opts->d && !opts->p) { for (i = 0; i < nelmts; i++) { @@ -3837,7 +4122,6 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_long finish\n"); return nfound; } @@ -3862,8 +4146,6 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2, double per; hbool_t both_zero; - h5difftrace("diff_ulong start\n"); - /* -d and !-p */ if (opts->d && !opts->p) { for (i = 0; i < nelmts; i++) { @@ -3967,7 +4249,6 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_ulong finish\n"); return nfound; } @@ -3992,7 +4273,6 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2, double per; hbool_t both_zero; - h5difftrace("diff_llong start\n"); /* -d and !-p */ if (opts->d && !opts->p) { for (i = 0; i < nelmts; i++) { @@ -4094,7 +4374,6 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_llong finish\n"); return nfound; } @@ -4120,7 +4399,6 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2, double per; hbool_t both_zero; - h5difftrace("diff_ullong start\n"); /* -d and !-p */ if (opts->d && !opts->p) { for (i = 0; i < nelmts; i++) { @@ -4226,7 +4504,6 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2, return nfound; } /* nelmts */ } - h5difftrace("diff_ullong finish\n"); return nfound; } @@ -4240,26 +4517,26 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2, static int ull2float(unsigned long long ull_value, float *f_value) { - int ret_value = SUCCEED; - hid_t dxpl_id = -1; + hid_t dxpl_id = H5I_INVALID_HID; unsigned char *buf = NULL; size_t src_size; size_t dst_size; + int ret_value = 0; - h5difftrace("ull2float start\n"); + H5TOOLS_DEBUG("ull2float start"); if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed"); src_size = H5Tget_size(H5T_NATIVE_ULLONG); dst_size = H5Tget_size(H5T_NATIVE_FLOAT); if((buf = (unsigned char*) HDcalloc((size_t )1, MAX(src_size, dst_size))) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for dims"); HDmemcpy(buf, &ull_value, src_size); /* do conversion */ if (H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t) 1, buf, NULL, dxpl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tconvert failed"); HDmemcpy(f_value, buf, dst_size); @@ -4271,8 +4548,9 @@ done: if (buf) HDfree(buf); - h5difftrace("ull2float finish\n"); + H5TOOLS_DEBUG("ull2float finish"); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -4283,7 +4561,6 @@ done: *------------------------------------------------------------------------- */ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) { - h5difftrace("equal_double start\n"); if (opts->do_nans) { /*------------------------------------------------------------------------- * detect NaNs @@ -4307,15 +4584,13 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) { return FALSE; } - if (value == expected) + if (H5_DBL_ABS_EQUAL(value, expected)) return TRUE; if (opts->use_system_epsilon) if (ABS((value-expected)) < DBL_EPSILON) return TRUE; - h5difftrace("equal_double finish\n"); - return FALSE; } @@ -4330,7 +4605,6 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) { static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts) { - h5difftrace("equal_ldouble start\n"); if (opts->do_nans) { /*------------------------------------------------------------------------- * detect NaNs @@ -4354,15 +4628,13 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts) return FALSE; } - if (value == expected) + if (H5_DBL_ABS_EQUAL(value, expected)) return TRUE; if (opts->use_system_epsilon) if (ABS((value-expected)) < DBL_EPSILON) return TRUE; - h5difftrace("equal_ldouble finish\n"); - return FALSE; } @@ -4375,7 +4647,6 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts) *------------------------------------------------------------------------- */ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) { - h5difftrace("equal_float start\n"); if (opts->do_nans) { /*------------------------------------------------------------------------- * detect NaNs @@ -4399,15 +4670,13 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) { return FALSE; } - if (value == expected) + if (H5_FLT_ABS_EQUAL(value, expected)) return TRUE; if (opts->use_system_epsilon) if (ABS( (value-expected) ) < FLT_EPSILON) return TRUE; - h5difftrace("equal_float finish\n"); - return FALSE; } @@ -4423,7 +4692,6 @@ static hbool_t my_isnan(dtype_t type, void *val) { hbool_t retval = FALSE; char s[256]; - h5difftrace("my_isnan start\n"); if (FLT_FLOAT == type) { float x; @@ -4483,8 +4751,6 @@ static hbool_t my_isnan(dtype_t type, void *val) { } } - h5difftrace("my_isnan finish\n"); - return retval; } diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index cd906af..d1b4697 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -139,52 +139,57 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta *------------------------------------------------------------------------*/ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts) { - int ret_value = 0; - H5O_info_t oinfo1, oinfo2; /* Object info */ - hid_t attr1_id = -1; /* attr ID */ - hid_t attr2_id = -1; /* attr ID */ - size_t curr1 = 0; - size_t curr2 = 0; - unsigned infile[2]; - char name1[ATTR_NAME_MAX]; - char name2[ATTR_NAME_MAX]; - int cmp; - unsigned i; table_attrs_t *table_lp = NULL; - - h5difftrace("build_match_list_attrs start\n"); - - if(H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info first object failed"); - if(H5Oget_info2(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info second object failed"); + H5O_info2_t oinfo1, oinfo2; /* Object info */ + hid_t attr1_id = H5I_INVALID_HID; /* attr ID */ + hid_t attr2_id = H5I_INVALID_HID; /* attr ID */ + size_t curr1 = 0; + size_t curr2 = 0; + unsigned infile[2]; + char name1[ATTR_NAME_MAX]; + char name2[ATTR_NAME_MAX]; + int cmp; + unsigned i; + herr_t ret_value = SUCCEED; + + + H5TOOLS_DEBUG("build_match_list_attrs start - errstat:%d", opts->err_stat); + + if(H5Oget_info3(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) { + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info first object failed"); + } + H5TOOLS_DEBUG("H5Oget_info3 loc1id=%d", oinfo1.num_attrs); + if(H5Oget_info3(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) { + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info second object failed"); + } + H5TOOLS_DEBUG("H5Oget_info3 loc2id=%d", oinfo2.num_attrs); table_attrs_init(&table_lp); if (table_lp == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Table allocation failed"); + H5TOOLS_GOTO_ERROR(FAIL, "Table allocation failed"); /*-------------------------------------------------- * build the list */ while(curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) { - h5diffdebug3("build_match_list_attrs 1: %ld - %ld\n", curr1, oinfo1.num_attrs); - h5diffdebug3("build_match_list_attrs 2: %ld - %ld\n", curr2, oinfo2.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); /*------------------ * open attribute1 */ if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx first attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx first attribute failed"); /* get name */ if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed"); /*------------------ * open attribute2 */ if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx second attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx second attribute failed"); /* get name */ if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed"); /* criteria is string compare */ cmp = HDstrcmp(name1, name2); @@ -213,25 +218,25 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t /* close for next turn */ H5Aclose(attr1_id); - attr1_id = -1; + attr1_id = H5I_INVALID_HID; H5Aclose(attr2_id); - attr2_id = -1; + attr2_id = H5I_INVALID_HID; } /* end while */ /* list1 did not end */ infile[0] = 1; infile[1] = 0; while(curr1 < oinfo1.num_attrs) { - h5diffdebug3("build_match_list_attrs 1: %ld - %ld\n", curr1, oinfo1.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); /*------------------ * open attribute1 */ if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx first attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx first attribute failed"); /* get name */ if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed"); - h5diffdebug2("build_match_list_attrs #1 name - %s\n", name1); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed"); + H5TOOLS_DEBUG("build_match_list_attrs #1 name - %s", name1); table_attr_mark_exist(infile, name1, table_lp); table_lp->nattrs_only1++; @@ -239,22 +244,22 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t /* close for next turn */ H5Aclose(attr1_id); - attr1_id = -1; + attr1_id = H5I_INVALID_HID; } /* list2 did not end */ infile[0] = 0; infile[1] = 1; while(curr2 < oinfo2.num_attrs) { - h5diffdebug3("build_match_list_attrs 2: %ld - %ld\n", curr2, oinfo2.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); /*------------------ * open attribute2 */ if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx second attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx second attribute failed"); /* get name */ if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed"); - h5diffdebug2("build_match_list_attrs #2 name - %s\n", name2); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed"); + H5TOOLS_DEBUG("build_match_list_attrs #2 name - %s", name2); table_attr_mark_exist(infile, name2, table_lp); table_lp->nattrs_only2++; @@ -262,7 +267,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t /* close for next turn */ H5Aclose(attr2_id); - attr2_id = -1; + attr2_id = H5I_INVALID_HID; } /*------------------------------------------------------ @@ -273,7 +278,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t parallel_print(" obj1 obj2\n"); parallel_print(" --------------------------------------\n"); for(i = 0; i < (unsigned int) table_lp->nattrs; i++) { - char c1, c2; + int c1, c2; c1 = (table_lp->attrs[i].exist[0]) ? 'x' : ' '; c2 = (table_lp->attrs[i].exist[1]) ? 'x' : ' '; parallel_print("%5c %6c %-15s\n", c1, c2, table_lp->attrs[i].name); @@ -294,43 +299,34 @@ done: H5Aclose(attr2_id); } H5E_END_TRY; - h5diffdebug2("build_match_list_attrs end - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("build_match_list_attrs end - errstat:%d", opts->err_stat); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } /*------------------------------------------------------------------------- - * Function: diff_attr + * Function: diff_attr_data * - * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are - * obtained either from - * loc_id = H5Gopen2(fid, name, H5P_DEFAULT); - * loc_id = H5Dopen2(fid, name); - * loc_id = H5Topen2(fid, name, H5P_DEFAULT); + * Purpose: compare attribute data located in attr1_id and attr2_id, which are + * obtained from open attributes * * Return: number of differences found *------------------------------------------------------------------------- */ -hsize_t diff_attr(hid_t loc1_id, - hid_t loc2_id, - const char *path1, - const char *path2, - diff_opt_t *opts) +hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2, const char *path1, const char *path2, diff_opt_t *opts) { - int ret_value = opts->err_stat; - hid_t attr1_id = -1; /* attr ID */ - hid_t attr2_id = -1; /* attr ID */ - hid_t space1_id = -1; /* space ID */ - hid_t space2_id = -1; /* space ID */ - hid_t ftype1_id = -1; /* file data type ID */ - hid_t ftype2_id = -1; /* file data type ID */ - hid_t mtype1_id = -1; /* memory data type ID */ - hid_t mtype2_id = -1; /* memory data type ID */ + hid_t space1_id = H5I_INVALID_HID; /* space ID */ + hid_t space2_id = H5I_INVALID_HID; /* space ID */ + hid_t ftype1_id = H5I_INVALID_HID; /* file data type ID */ + hid_t ftype2_id = H5I_INVALID_HID; /* file data type ID */ + hid_t mtype1_id = H5I_INVALID_HID; /* memory data type ID */ + hid_t mtype2_id = H5I_INVALID_HID; /* memory data type ID */ size_t msize1; /* memory size of memory type */ size_t msize2; /* memory size of memory type */ - void *buf1 = NULL; /* data buffer */ - void *buf2 = NULL; /* data buffer */ + void *buf1 = NULL; /* data buffer */ + void *buf2 = NULL; /* data buffer */ hbool_t buf1hasdata = FALSE; /* buffer has data */ hbool_t buf2hasdata = FALSE; /* buffer has data */ hsize_t nelmts1; /* number of elements in dataset */ @@ -338,208 +334,257 @@ hsize_t diff_attr(hid_t loc1_id, int rank2; /* rank of dataset */ hsize_t dims1[H5S_MAX_RANK]; /* dimensions of dataset */ hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */ - char *name1 = NULL; - char *name2 = NULL; char np1[512]; char np2[512]; - unsigned u; /* Local index variable */ hsize_t nfound = 0; - hsize_t nfound_total = 0; - int j; + int j; + diff_err_t ret_value = opts->err_stat; + + H5TOOLS_DEBUG("diff_attr_data start - errstat:%d", opts->err_stat); + + /* get the datatypes */ + if((ftype1_id = H5Aget_type(attr1_id)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); + if((ftype2_id = H5Aget_type(attr2_id)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed"); + + if (H5Tget_class(ftype1_id) == H5T_REFERENCE) { + if((mtype1_id = H5Tcopy(H5T_STD_REF)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tcopy(H5T_STD_REF) first attribute ftype failed"); + } + else { + if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type first attribute ftype failed"); + } + if (H5Tget_class(ftype2_id) == H5T_REFERENCE) { + if((mtype2_id = H5Tcopy(H5T_STD_REF)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tcopy(H5T_STD_REF) second attribute ftype failed"); + } + else { + if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type second attribute ftype failed"); + } + if((msize1 = H5Tget_size(mtype1_id)) == 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_size first attribute mtype failed"); + if((msize2 = H5Tget_size(mtype2_id)) == 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_size second attribute mtype failed"); + + /* get the dataspace */ + if((space1_id = H5Aget_space(attr1_id)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_space first attribute failed"); + if((space2_id = H5Aget_space(attr2_id)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_space second attribute failed"); + + /* get dimensions */ + if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims first attribute failed"); + if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims second attribute failed"); + + /*---------------------------------------------------------------------- + * check for comparable TYPE and SPACE + *---------------------------------------------------------------------- + */ + H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE"); + + /* pass dims1 and dims2 for maxdims as well since attribute's maxdims + * are always same */ + if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, dims1, dims2, name1, name2, opts, 0) == 1) { + /*----------------------------------------------------------------- + * "upgrade" the smaller memory size + *------------------------------------------------------------------ + */ + if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2)) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed"); + + H5TOOLS_DEBUG("diff_attr_data read"); + /*--------------------------------------------------------------------- + * read + *---------------------------------------------------------------------- + */ + nelmts1 = 1; + for(j = 0; j < rank1; j++) + nelmts1 *= dims1[j]; + + buf1 = (void *)HDcalloc((size_t)(nelmts1), msize1); + buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2); + if(buf1 == NULL || buf2 == NULL) { + parallel_print("cannot read into memory\n"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "buffer allocation failed"); + } + if(H5Aread(attr1_id, mtype1_id, buf1) < 0) { + parallel_print("Failed reading attribute1 %s\n", name1); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); + } + else + buf1hasdata = TRUE; + + if(H5Aread(attr2_id, mtype2_id, buf2) < 0) { + parallel_print("Failed reading attribute2 %s\n", name2); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed"); + } + else + buf2hasdata = TRUE; + + /* format output string */ + HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1); + HDsnprintf(np2, sizeof(np1), "%s of <%s>", name2, path2); + + /*--------------------------------------------------------------------- + * array compare + *---------------------------------------------------------------------- + */ + H5TOOLS_DEBUG("diff_attr_data array compare %s - %s", name1, name1); + + /* always print name */ + /* verbose (-v) and report (-r) mode */ + if(opts->m_verbose || opts->m_report) { + do_print_attrname("attribute", np1, np2); + + nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1, + dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id); + print_found(nfound); + } + /* quiet mode (-q), just count differences */ + else if(opts->m_quiet) { + nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1, + dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id); + } + /* the rest (-c, none, ...) */ + else { + nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1, + dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id); + /* print info if compatible and difference found */ + if (nfound) { + do_print_attrname("attribute", np1, np2); + print_found(nfound); + } /* end if */ + } /* end else */ + } + H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat); + + /*---------------------------------------------------------------------- + * close + *---------------------------------------------------------------------- + */ + + /* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any + * VLEN memory first */ + if(TRUE == h5tools_detect_vlen(mtype1_id)) + H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1); + HDfree(buf1); + buf1 = NULL; + + if(TRUE == h5tools_detect_vlen(mtype2_id)) + H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2); + HDfree(buf2); + buf2 = NULL; + + if(H5Tclose(ftype1_id) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); + if(H5Tclose(ftype2_id) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed"); + if(H5Sclose(space1_id) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); + if(H5Sclose(space2_id) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed"); + if(H5Tclose(mtype1_id) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose first attribute mtype failed"); + if(H5Tclose(mtype2_id) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose second attribute mtype failed"); + +done: + opts->err_stat = opts->err_stat | ret_value; + + H5E_BEGIN_TRY { + if(buf1) { + if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id)) + H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1); + HDfree(buf1); + } /* end if */ + if(buf2) { + if(buf2hasdata && TRUE == h5tools_detect_vlen(mtype2_id)) + H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2); + HDfree(buf2); + } /* end if */ + + H5Tclose(ftype1_id); + H5Tclose(ftype2_id); + H5Tclose(mtype1_id); + H5Tclose(mtype2_id); + H5Sclose(space1_id); + H5Sclose(space2_id); + } H5E_END_TRY; + + H5TOOLS_DEBUG("diff_attr_data end - errstat:%d", opts->err_stat); + + H5TOOLS_ENDDEBUG("exit"); + return nfound; +} + +/*------------------------------------------------------------------------- + * Function: diff_attr + * + * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are + * obtained either from + * loc_id = H5Gopen2(fid, name, H5P_DEFAULT); + * loc_id = H5Dopen2(fid, name); + * loc_id = H5Topen2(fid, name, H5P_DEFAULT); + * + * Return: number of differences found + *------------------------------------------------------------------------- + */ + +hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *path2, diff_opt_t *opts) +{ table_attrs_t *match_list_attrs = NULL; - h5difftrace("diff_attr start\n"); + hid_t attr1_id = H5I_INVALID_HID; /* attr ID */ + hid_t attr2_id = H5I_INVALID_HID; /* attr ID */ + char *name1 = NULL; + char *name2 = NULL; + unsigned u; /* Local index variable */ + hsize_t nfound = 0; + hsize_t nfound_total = 0; + diff_err_t ret_value = opts->err_stat; + + H5TOOLS_DEBUG("diff_attr start - errstat:%d", opts->err_stat); if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) { - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "build_match_list_attrs failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "build_match_list_attrs failed"); } - h5diffdebug2("build_match_list_attrs - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("build_match_list_attrs - errstat:%d", opts->err_stat); /* if detect any unique extra attr */ if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) { - h5difftrace("diff_attr attributes only in one file\n"); + H5TOOLS_DEBUG("diff_attr attributes only in one file"); /* exit will be 1 */ opts->contents = 0; } - h5diffdebug2("match_list_attrs info - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("match_list_attrs info - errstat:%d", opts->err_stat); for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) { - h5diffdebug3("match_list_attrs loop[%d] - errstat:%d\n", u, opts->err_stat); + H5TOOLS_DEBUG("match_list_attrs loop[%d] - errstat:%d", u, opts->err_stat); if((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) { name1 = name2 = match_list_attrs->attrs[u].name; - h5diffdebug2("diff_attr name - %s\n", name1); + H5TOOLS_DEBUG("diff_attr name - %s", name1); /*-------------- * attribute 1 */ if((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen first attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aopen first attribute failed"); /*-------------- * attribute 2 */ if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen second attribute failed"); - - h5difftrace("diff_attr got attributes\n"); - /* get the datatypes */ - if((ftype1_id = H5Aget_type(attr1_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); - if((ftype2_id = H5Aget_type(attr2_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); - - if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first attribute ftype failed"); - if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type second attribute ftype failed"); - if((msize1 = H5Tget_size(mtype1_id)) == 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size first attribute mtype failed"); - if((msize2 = H5Tget_size(mtype2_id)) == 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size second attribute mtype failed"); - - /* get the dataspace */ - if((space1_id = H5Aget_space(attr1_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space first attribute failed"); - if((space2_id = H5Aget_space(attr2_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space second attribute failed"); - - /* get dimensions */ - if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims first attribute failed"); - if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims second attribute failed"); - - /*---------------------------------------------------------------------- - * check for comparable TYPE and SPACE - *---------------------------------------------------------------------- - */ - - /* pass dims1 and dims2 for maxdims as well since attribute's maxdims - * are always same */ - if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, - dims1, dims2, name1, name2, opts, 0) != 1) { - if(H5Tclose(ftype1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed"); - if(H5Tclose(ftype2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed"); - if(H5Sclose(space1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose first attribute failed"); - if(H5Sclose(space2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose second attribute failed"); - if(H5Aclose(attr1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed"); - if(H5Aclose(attr2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed"); - if(H5Tclose(mtype1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed"); - if(H5Tclose(mtype2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed"); - - continue; - } - - /*----------------------------------------------------------------- - * "upgrade" the smaller memory size - *------------------------------------------------------------------ - */ - if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, - &mtype2_id, &msize1, &msize2)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed"); - - /*--------------------------------------------------------------------- - * read - *---------------------------------------------------------------------- - */ - nelmts1 = 1; - for(j = 0; j < rank1; j++) - nelmts1 *= dims1[j]; - - buf1 = (void *)HDcalloc((size_t)(nelmts1), msize1); - buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2); - if(buf1 == NULL || buf2 == NULL) { - parallel_print("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "buffer allocation failed"); - } - if(H5Aread(attr1_id, mtype1_id, buf1) < 0) { - parallel_print("Failed reading attribute1 %s/%s\n", path1, name1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); - } - else - buf1hasdata = TRUE; - - if(H5Aread(attr2_id, mtype2_id, buf2) < 0) { - parallel_print("Failed reading attribute2 %s/%s\n", path2, name2); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); - } - else - buf2hasdata = TRUE; - - /* format output string */ - HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1); - HDsnprintf(np2, sizeof(np1), "%s of <%s>", name2, path2); - - /*--------------------------------------------------------------------- - * array compare - *---------------------------------------------------------------------- - */ - - /* always print name */ - /* verbose (-v) and report (-r) mode */ - if(opts->m_verbose || opts->m_report) { - do_print_attrname("attribute", np1, np2); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aopen second attribute failed"); - nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1, - dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id); - print_found(nfound); - } - /* quiet mode (-q), just count differences */ - else if(opts->m_quiet) { - nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1, - dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id); - } - /* the rest (-c, none, ...) */ - else { - nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1, - dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id); - - /* print info if compatible and difference found */ - if (nfound) { - do_print_attrname("attribute", np1, np2); - print_found(nfound); - } /* end if */ - } /* end else */ - - /*---------------------------------------------------------------------- - * close - *---------------------------------------------------------------------- - */ - - /* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any - * VLEN memory first */ - if(TRUE == h5tools_detect_vlen(mtype1_id)) - H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1); - HDfree(buf1); - buf1 = NULL; - - if(TRUE == h5tools_detect_vlen(mtype2_id)) - H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2); - HDfree(buf2); - buf2 = NULL; - - if(H5Tclose(ftype1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); - if(H5Tclose(ftype2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); - if(H5Sclose(space1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); - if(H5Sclose(space2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_DEBUG("diff_attr got attributes"); + nfound = diff_attr_data(attr1_id, attr2_id, name1, name2, path1, path2, opts); if(H5Aclose(attr1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed"); if(H5Aclose(attr2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); - if(H5Tclose(mtype1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed"); - if(H5Tclose(mtype2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed"); nfound_total += nfound; } @@ -549,30 +594,14 @@ done: opts->err_stat = opts->err_stat | ret_value; H5E_BEGIN_TRY { - if(buf1) { - if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id)) - H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1); - HDfree(buf1); - } /* end if */ - if(buf2) { - if(buf2hasdata && TRUE == h5tools_detect_vlen(mtype2_id)) - H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2); - HDfree(buf2); - } /* end if */ - table_attrs_free(match_list_attrs); - H5Tclose(ftype1_id); - H5Tclose(ftype2_id); - H5Tclose(mtype1_id); - H5Tclose(mtype2_id); - H5Sclose(space1_id); - H5Sclose(space2_id); H5Aclose(attr1_id); H5Aclose(attr2_id); } H5E_END_TRY; - h5diffdebug2("diff_attr end - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("diff_attr end - errstat:%d", opts->err_stat); + H5TOOLS_ENDDEBUG("exit"); return nfound_total; } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 56c4f0b..f757f92 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -33,15 +33,15 @@ hsize_t diff_dataset(hid_t file1_id, const char *obj2_name, diff_opt_t *opts) { - int ret_value = opts->err_stat; - int status = -1; - hid_t did1 = -1; - hid_t did2 = -1; - hid_t dcpl1 = -1; - hid_t dcpl2 = -1; - hsize_t nfound = 0; - - h5difftrace("diff_dataset start\n"); + int status = -1; + hid_t did1 = H5I_INVALID_HID; + hid_t did2 = H5I_INVALID_HID; + hid_t dcpl1 = H5I_INVALID_HID; + hid_t dcpl2 = H5I_INVALID_HID; + hsize_t nfound = 0; + diff_err_t ret_value = opts->err_stat; + + H5TOOLS_DEBUG("diff_dataset start - errstat:%d", opts->err_stat); /*------------------------------------------------------------------------- * open the handles *------------------------------------------------------------------------- @@ -49,17 +49,17 @@ hsize_t diff_dataset(hid_t file1_id, /* Open the datasets */ if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) { parallel_print("Cannot open dataset <%s>\n", obj1_name); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 first dataset failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 first dataset failed"); } if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) { parallel_print("Cannot open dataset <%s>\n", obj2_name); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 second dataset failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 second dataset failed"); } if((dcpl1 = H5Dget_create_plist(did1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist first dataset failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist first dataset failed"); if((dcpl2 = H5Dget_create_plist(did2)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist second dataset failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist second dataset failed"); /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that @@ -68,11 +68,12 @@ hsize_t diff_dataset(hid_t file1_id, * 2) the internal filters might be turned off *------------------------------------------------------------------------- */ + H5TOOLS_DEBUG("diff_dataset h5tools_canreadf then diff_datasetid"); if ((status = h5tools_canreadf((opts->m_verbose ? obj1_name : NULL), dcpl1) == 1) && (status = h5tools_canreadf((opts->m_verbose ? obj2_name : NULL), dcpl2) == 1)) nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, opts); else if (status < 0) { - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "h5tools_canreadf failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "h5tools_canreadf failed"); } else { ret_value = 1; @@ -91,7 +92,8 @@ done: /* enable error reporting */ } H5E_END_TRY; - h5diffdebug3("diff_dataset finish:%d - errstat:%d\n", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff_dataset finish:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG("exit"); return nfound; } @@ -152,16 +154,15 @@ hsize_t diff_datasetid(hid_t did1, const char *obj2_name, diff_opt_t *opts) { - int ret_value = opts->err_stat; - hid_t sid1 = -1; - hid_t sid2 = -1; - hid_t f_tid1 = -1; - hid_t f_tid2 = -1; - hid_t dam_tid = -1; /* m_tid for diff_array function */ - hid_t m_tid1 = -1; - hid_t m_tid2 = -1; - hid_t dcpl1 = -1; - hid_t dcpl2 = -1; + hid_t sid1 = H5I_INVALID_HID; + hid_t sid2 = H5I_INVALID_HID; + hid_t f_tid1 = H5I_INVALID_HID; + hid_t f_tid2 = H5I_INVALID_HID; + hid_t dam_tid = H5I_INVALID_HID; /* m_tid for diff_array function */ + hid_t m_tid1 = H5I_INVALID_HID; + hid_t m_tid2 = H5I_INVALID_HID; + hid_t dcpl1 = H5I_INVALID_HID; + hid_t dcpl2 = H5I_INVALID_HID; H5D_layout_t stl1 = -1; H5D_layout_t stl2 = -1; size_t dam_size; /* m_size for diff_array function */ @@ -189,37 +190,38 @@ hsize_t diff_datasetid(hid_t did1, void *buf2 = NULL; void *sm_buf1 = NULL; void *sm_buf2 = NULL; - hid_t sm_space = -1; /*stripmine data space */ + hid_t sm_space = H5I_INVALID_HID; /*stripmine data space */ size_t need; /* bytes needed for malloc */ int i; unsigned int vl_data1 = 0; /*contains VL datatypes */ unsigned int vl_data2 = 0; /*contains VL datatypes */ + diff_err_t ret_value = opts->err_stat; - h5difftrace("diff_datasetid start\n"); + H5TOOLS_DEBUG("diff_datasetid start - errstat:%d", opts->err_stat); /* Get the dataspace handle */ if((sid1 = H5Dget_space(did1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_space failed"); /* Get rank */ if((rank1 = H5Sget_simple_extent_ndims(sid1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_ndims failed"); /* Get the dataspace handle */ if((sid2 = H5Dget_space(did2)) < 0 ) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_space failed"); /* Get rank */ if((rank2 = H5Sget_simple_extent_ndims(sid2)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_ndims failed"); /* Get dimensions */ if(H5Sget_simple_extent_dims(sid1, dims1, maxdim1) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims failed"); /* Get dimensions */ if(H5Sget_simple_extent_dims(sid2, dims2, maxdim2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - h5diffdebug3("rank: %ld - %ld\n", rank1, rank2); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims failed"); + H5TOOLS_DEBUG("rank: %ld - %ld", rank1, rank2); /*------------------------------------------------------------------------- * get the file data type @@ -228,35 +230,35 @@ hsize_t diff_datasetid(hid_t did1, /* Get the data type */ if((f_tid1 = H5Dget_type(did1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_type failed"); /* Get the data type */ if((f_tid2 = H5Dget_type(did2)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_type failed"); /*------------------------------------------------------------------------- * get the storage layout type *------------------------------------------------------------------------- */ if((dcpl1 = H5Dget_create_plist(did1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist failed"); if((dcpl2 = H5Dget_create_plist(did2)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist failed"); if((stl1 = H5Pget_layout(dcpl1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Pget_layout failed"); if((stl2 = H5Pget_layout(dcpl2)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Pget_layout failed"); /*------------------------------------------------------------------------- * check for empty datasets *------------------------------------------------------------------------- */ - h5difftrace("check for empty datasets\n"); + H5TOOLS_DEBUG("check for empty datasets"); storage_size1 = H5Dget_storage_size(did1); storage_size2 = H5Dget_storage_size(did2); - h5diffdebug3("storage size: %ld - %ld\n", storage_size1, storage_size2); + H5TOOLS_DEBUG("storage size: %ld - %ld", storage_size1, storage_size2); if(storage_size1 == 0 || storage_size2 == 0) { if(stl1 == H5D_VIRTUAL || stl2 == H5D_VIRTUAL) { @@ -280,33 +282,45 @@ hsize_t diff_datasetid(hid_t did1, obj1_name, obj2_name, opts, 0) != 1) can_compare = 0; - h5diffdebug2("diff_can_type - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("diff_can_type - errstat:%d", opts->err_stat); /*------------------------------------------------------------------------- * memory type and sizes *------------------------------------------------------------------------- */ - h5difftrace("check for memory type and sizes\n"); - if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_DEBUG("check for memory type and sizes"); + if (H5Tget_class(f_tid1) == H5T_REFERENCE) { + if((m_tid1 = H5Tcopy(H5T_STD_REF)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tcopy(H5T_STD_REF) first ftype failed"); + } + else { + if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type first ftype failed"); + } - if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed"); + if (H5Tget_class(f_tid2) == H5T_REFERENCE) { + if((m_tid2 = H5Tcopy(H5T_STD_REF)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tcopy(H5T_STD_REF) second ftype failed"); + } + else { + if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0) + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type second ftype failed"); + } m_size1 = H5Tget_size(m_tid1); m_size2 = H5Tget_size(m_tid2); - h5diffdebug3("type size: %ld - %ld\n", m_size1, m_size2); + H5TOOLS_DEBUG("type size: %ld - %ld", m_size1, m_size2); /*------------------------------------------------------------------------- * check for different signed/unsigned types *------------------------------------------------------------------------- */ if(can_compare) { - h5difftrace("can_compare for sign\n"); + H5TOOLS_DEBUG("can_compare for sign"); sign1 = H5Tget_sign(m_tid1); sign2 = H5Tget_sign(m_tid2); if(sign1 != sign2) { - h5difftrace("sign1 != sign2\n"); + H5TOOLS_DEBUG("sign1 != sign2"); if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) { parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); @@ -315,6 +329,7 @@ hsize_t diff_datasetid(hid_t did1, can_compare = 0; opts->not_cmp = 1; } + H5TOOLS_DEBUG("can_compare for sign - can_compare=%d opts->not_cmp=%d", can_compare, opts->not_cmp); } /* Check if type is either VLEN-data or VLEN-string to reclaim any @@ -324,7 +339,7 @@ hsize_t diff_datasetid(hid_t did1, vl_data1 = TRUE; if(TRUE == h5tools_detect_vlen(m_tid2)) vl_data2 = TRUE; - h5diffdebug2("h5tools_detect_vlen - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("h5tools_detect_vlen %d:%d - errstat:%d", vl_data1, vl_data2, opts->err_stat); /*------------------------------------------------------------------------ * only attempt to compare if possible @@ -332,7 +347,7 @@ hsize_t diff_datasetid(hid_t did1, */ if(can_compare) { /* it is possible to compare */ H5T_class_t tclass = H5Tget_class(f_tid1); - h5difftrace("can_compare attempt\n"); + H5TOOLS_DEBUG("can_compare attempt"); /*----------------------------------------------------------------- * get number of elements @@ -346,19 +361,19 @@ hsize_t diff_datasetid(hid_t did1, for(i = 0; i < rank2; i++) nelmts2 *= dims2[i]; - h5diffdebug3("nelmts: %ld - %ld\n", nelmts1, nelmts2); + H5TOOLS_DEBUG("nelmts: %ld - %ld", nelmts1, nelmts2); if(tclass != H5T_ARRAY) { /*----------------------------------------------------------------- * "upgrade" the smaller memory size *------------------------------------------------------------------ */ - h5difftrace("upgrade the smaller memory size?\n"); + H5TOOLS_DEBUG("NOT H5T_ARRAY, upgrade the smaller memory size?"); if (FAIL == match_up_memsize (f_tid1, f_tid2, &m_tid1, &m_tid2, &m_size1, &m_size2)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed"); - h5diffdebug3("m_size: %ld - %ld\n", m_size1, m_size2); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed"); + H5TOOLS_DEBUG("m_size: %ld - %ld", m_size1, m_size2); dadims = dims1; dam_size = m_size1; dam_tid = m_tid1; @@ -366,7 +381,7 @@ hsize_t diff_datasetid(hid_t did1, need = (size_t)(nelmts1 * m_size1); /* bytes needed */ } else { - h5diffdebug3("Array dims: %d - %d\n", dims1[0], dims2[0]); + H5TOOLS_DEBUG("Array dims: %d - %d", dims1[0], dims2[0]); /* Compare the smallest array, but create the largest buffer */ if(m_size1 <= m_size2) { dadims = dims1; @@ -388,9 +403,10 @@ hsize_t diff_datasetid(hid_t did1, name1 = diff_basename(obj1_name); if(obj2_name) name2 = diff_basename(obj2_name); - h5diffdebug3("obj_names: %s - %s\n", name1, name2); + H5TOOLS_DEBUG("obj_names: %s - %s", name1, name2); + H5TOOLS_DEBUG("read/compare"); /*---------------------------------------------------------------- * read/compare *----------------------------------------------------------------- @@ -401,23 +417,24 @@ hsize_t diff_datasetid(hid_t did1, } /* end if */ if(buf1 != NULL && buf2 != NULL) { - h5difftrace("buf1 != NULL && buf2 != NULL\n"); + H5TOOLS_DEBUG("buf1 != NULL && buf2 != NULL"); + H5TOOLS_DEBUG("H5Dread did1"); if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); - h5difftrace("H5Dread did2\n"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed"); + H5TOOLS_DEBUG("H5Dread did2"); if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed"); /* array diff */ nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims, opts, name1, name2, dam_tid, did1, did2); - h5diffdebug2("diff_array nfound:%d\n", nfound); + H5TOOLS_DEBUG("diff_array nfound:%d - errstat:%d", nfound, opts->err_stat); /* reclaim any VL memory, if necessary */ - h5diffdebug2("check vl_data1:%d\n", vl_data1); + H5TOOLS_DEBUG("check vl_data1:%d", vl_data1); if(vl_data1) H5Treclaim(m_tid1, sid1, H5P_DEFAULT, buf1); - h5diffdebug2("check vl_data2:%d\n", vl_data2); + H5TOOLS_DEBUG("check vl_data2:%d", vl_data2); if(vl_data2) H5Treclaim(m_tid2, sid2, H5P_DEFAULT, buf2); if(buf1 != NULL) { @@ -459,7 +476,7 @@ hsize_t diff_datasetid(hid_t did1, size = 1; sm_size[i - 1] = MIN(dadims[i - 1], size); sm_nbytes *= sm_size[i - 1]; - h5diffdebug2("sm_nbytes: %ld\n", sm_nbytes); + H5TOOLS_DEBUG("sm_nbytes: %ld", sm_nbytes); } /* end for */ /* malloc return code should be verified. @@ -470,9 +487,9 @@ hsize_t diff_datasetid(hid_t did1, * E.g., sm_space. */ if((sm_buf1 = HDmalloc((size_t)sm_nbytes)) == NULL) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "HDmalloc failed"); if((sm_buf2 = HDmalloc((size_t)sm_nbytes)) == NULL) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "HDmalloc failed"); sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); @@ -489,19 +506,19 @@ hsize_t diff_datasetid(hid_t did1, hs_nelmts *= hs_size[i]; } /* end for */ if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed"); if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed"); if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed"); } /* end if */ else hs_nelmts = 1; if(H5Dread(did1, m_tid1, sm_space, sid1, H5P_DEFAULT, sm_buf1) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed"); if(H5Dread(did2, m_tid2, sm_space, sid2, H5P_DEFAULT, sm_buf2) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed"); /* get array differences. in the case of hyperslab read, increment the number of differences found in each hyperslab and pass the position at the beginning for printing */ @@ -534,6 +551,7 @@ hsize_t diff_datasetid(hid_t did1, H5Sclose(sm_space); } /* hyperslab read */ + H5TOOLS_DEBUG("can_compare complete"); } /*can_compare*/ @@ -541,7 +559,7 @@ hsize_t diff_datasetid(hid_t did1, * close *------------------------------------------------------------------------- */ - h5diffdebug2("reclaim any VL memory - errstat:%d\n", opts->err_stat); + H5TOOLS_DEBUG("reclaim any VL memory - errstat:%d", opts->err_stat); done: opts->err_stat = opts->err_stat | ret_value; @@ -588,7 +606,8 @@ done: /* enable error reporting */ } H5E_END_TRY; - h5diffdebug3("diff_datasetid return:%d with nfound:%d\n", ret_value, nfound); + H5TOOLS_DEBUG("diff_datasetid return:%d with nfound:%d", ret_value, nfound); + H5TOOLS_ENDDEBUG("exit"); return nfound; } @@ -617,22 +636,22 @@ int diff_can_type(hid_t f_tid1, /* file data type */ diff_opt_t *opts, int is_compound) { - int ret_value = 1; /* can_compare value */ H5T_class_t tclass1; H5T_class_t tclass2; int maxdim_diff = 0; /* maximum dimensions are different */ int dim_diff = 0; /* current dimensions are different */ int i; + int ret_value = 1; - h5difftrace("diff_can_type start\n"); + H5TOOLS_DEBUG("diff_can_type start"); /*------------------------------------------------------------------------- * check for the same class *------------------------------------------------------------------------- */ if((tclass1 = H5Tget_class(f_tid1)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_class first object failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_class first object failed"); if((tclass2 = H5Tget_class(f_tid2)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_class second object failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_class second object failed"); if(tclass1 != tclass2) { if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) { @@ -648,7 +667,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ } } opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } /*------------------------------------------------------------------------- @@ -662,7 +681,8 @@ int diff_can_type(hid_t f_tid1, /* file data type */ obj1_name, obj2_name, get_class(tclass2)); } /* end if */ opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); + break; case H5T_INTEGER: case H5T_FLOAT: @@ -677,7 +697,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ case H5T_NO_CLASS: case H5T_NCLASSES: default: - h5diffdebug2("diff_can_type class - %s\n", get_class(tclass1)); + H5TOOLS_DEBUG("diff_can_type class - %s", get_class(tclass1)); break; } /* end switch */ @@ -717,7 +737,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ parallel_print("\n"); } opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } /*------------------------------------------------------------------------- @@ -753,7 +773,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ } } opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } /*------------------------------------------------------------------------- @@ -775,7 +795,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ if(tclass1 == H5T_STRING) { htri_t vstrtype1 = -1; htri_t vstrtype2 = -1; - h5difftrace("diff_can_type end - H5T_STRING\n"); + H5TOOLS_DEBUG("diff_can_type end - H5T_STRING"); vstrtype1 = H5Tis_variable_str(f_tid1); vstrtype2 = H5Tis_variable_str(f_tid2); @@ -786,7 +806,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ parallel_print("Not comparable: <%s> or <%s> is of mixed string type\n", obj1_name, obj2_name); opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } } @@ -794,9 +814,9 @@ int diff_can_type(hid_t f_tid1, /* file data type */ int nmembs1; int nmembs2; int j; - hid_t memb_type1 = -1; - hid_t memb_type2 = -1; - h5difftrace("diff_can_type end - H5T_COMPOUND\n"); + hid_t memb_type1 = H5I_INVALID_HID; + hid_t memb_type2 = H5I_INVALID_HID; + H5TOOLS_DEBUG("diff_can_type end - H5T_COMPOUND"); nmembs1 = H5Tget_nmembers(f_tid1); nmembs2 = H5Tget_nmembers(f_tid2); @@ -808,7 +828,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ parallel_print("\n"); } opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } for (j = 0; j < nmembs1; j++) { @@ -821,7 +841,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ opts->not_cmp = 1; H5Tclose(memb_type1); H5Tclose(memb_type2); - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } H5Tclose(memb_type1); H5Tclose(memb_type2); @@ -829,9 +849,10 @@ int diff_can_type(hid_t f_tid1, /* file data type */ } done: if (ret_value < 0) - opts->err_stat = 1; + opts->err_stat = H5DIFF_ERR; - h5diffdebug2("diff_can_type end - %d\n", ret_value); + H5TOOLS_DEBUG("diff_can_type end - %d", ret_value); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 6b5ca2f..8da995a 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -346,7 +346,7 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id, H5Tclose(*m_tid1); if(((*m_tid1) = H5Tget_native_type(f_tid2_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_native_type failed"); *m_size1 = H5Tget_size(*m_tid1); } /* end if */ @@ -354,15 +354,16 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id, H5Tclose(*m_tid2); if(((*m_tid2) = H5Tget_native_type(f_tid1_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_native_type failed"); *m_size2 = H5Tget_size(*m_tid2); } /* end else */ } /* end if */ if((*m_size1) != (*m_size2)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "native type sizes do not compare"); + H5TOOLS_GOTO_ERROR(FAIL, "native type sizes do not compare"); done: + H5TOOLS_ENDDEBUG("exit"); return ret_value; } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 727e493..cb9b92c 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -24,11 +24,11 @@ /* global variables */ hid_t H5tools_ERR_STACK_g = 0; -hid_t H5tools_ERR_CLS_g = -1; -hid_t H5E_tools_g = -1; -hid_t H5E_tools_min_id_g = -1; -hid_t H5E_tools_min_info_id_g = -1; -hid_t H5E_tools_min_dbg_id_g = -1; +hid_t H5tools_ERR_CLS_g = H5I_INVALID_HID; +hid_t H5E_tools_g = H5I_INVALID_HID; +hid_t H5E_tools_min_id_g = H5I_INVALID_HID; +hid_t H5E_tools_min_info_id_g = H5I_INVALID_HID; +hid_t H5E_tools_min_dbg_id_g = H5I_INVALID_HID; int compound_data; FILE *rawattrstream = NULL; /* should initialize to stdout but gcc moans about it */ FILE *rawdatastream = NULL; /* should initialize to stdout but gcc moans about it */ @@ -91,14 +91,8 @@ typedef enum { void h5tools_init(void) { - char lib_str[256]; - if (!h5tools_init_g) { - /* register the error class */ - HDsnprintf(lib_str, sizeof(lib_str), "%d.%d.%d",H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); - - H5tools_ERR_STACK_g = H5Ecreate_stack(); - H5TOOLS_INIT_ERROR() + H5TOOLS_INIT_ERROR(); if (!rawattrstream) rawattrstream = stdout; @@ -175,8 +169,8 @@ h5tools_close(void) /* Clean up the reference path table, if it's been used */ term_ref_path_table(); - H5TOOLS_CLOSE_ERROR() - H5Eclose_stack(H5tools_ERR_STACK_g); + H5TOOLS_CLOSE_ERROR(); + /* Shut down the library */ H5close(); @@ -436,17 +430,17 @@ h5tools_set_error_file(const char *fname, int is_bin) static hid_t h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) { - hid_t new_fapl = -1; /* Copy of file access property list passed in, or new property list */ - int ret_value = SUCCEED; + hid_t new_fapl = H5I_INVALID_HID; /* Copy of file access property list passed in, or new property list */ + herr_t ret_value = SUCCEED; /* Make a copy of the FAPL, for the file open call to use, eventually */ if (fapl == H5P_DEFAULT) { if ((new_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed"); } /* end if */ else { if ((new_fapl = H5Pcopy(fapl)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcopy failed"); } /* end else */ /* Determine which driver the user wants to open the file with. Try @@ -454,7 +448,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) if (!HDstrcmp(driver, drivernames[SEC2_IDX])) { /* SEC2 driver */ if (H5Pset_fapl_sec2(new_fapl) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_sec2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_sec2 failed"); if (drivernum) *drivernum = SEC2_IDX; @@ -466,7 +460,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) * is the member size. */ if (H5Pset_fapl_family(new_fapl, (hsize_t) 0, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_family failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_family failed"); if (drivernum) *drivernum = FAMILY_IDX; @@ -474,7 +468,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) else if (!HDstrcmp(driver, drivernames[SPLIT_IDX])) { /* SPLIT Driver */ if (H5Pset_fapl_split(new_fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_split failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_split failed"); if (drivernum) *drivernum = SPLIT_IDX; @@ -482,10 +476,10 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) else if (!HDstrcmp(driver, drivernames[MULTI_IDX])) { /* MULTI Driver */ if (H5Pset_fapl_multi(new_fapl, NULL, NULL, NULL, NULL, TRUE) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_multi failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_multi failed"); if(drivernum) - *drivernum = MULTI_IDX; + *drivernum = MULTI_IDX; } #ifdef H5_HAVE_PARALLEL else if(!HDstrcmp(driver, drivernames[MPIO_IDX])) { @@ -498,7 +492,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) if(mpi_initialized && !mpi_finalized) { if(H5Pset_fapl_mpio(new_fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_mpio failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_mpio failed"); if(drivernum) *drivernum = MPIO_IDX; } /* end if */ @@ -510,7 +504,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) done: if((new_fapl != H5P_DEFAULT) && (ret_value < 0)) { H5Pclose(new_fapl); - new_fapl = -1; + new_fapl = H5I_INVALID_HID; } return(new_fapl); @@ -736,7 +730,6 @@ void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hsize_t elmtno, int secnum) { - H5TOOLS_ERR_INIT(int, SUCCEED) h5tools_str_t prefix; h5tools_str_t str; /*temporary for indentation */ size_t templength = 0; @@ -748,24 +741,23 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, if (!ctx->need_prefix) return; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); HDmemset(&prefix, 0, sizeof(h5tools_str_t)); HDmemset(&str, 0, sizeof(h5tools_str_t)); /* Terminate previous line, if any */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "before CR elmtno=%ld, ctx->cur_column=%d, info->idx_fmt=%s, info->line_suf=%s", elmtno, ctx->cur_column, info->idx_fmt, info->line_suf); + H5TOOLS_DEBUG("before CR elmtno=%ld, ctx->cur_column=%d, info->idx_fmt=%s, info->line_suf=%s", elmtno, ctx->cur_column, info->idx_fmt, info->line_suf); if (ctx->cur_column) { PUTSTREAM(OPT(info->line_suf, ""), stream); HDputc('\n', stream); PUTSTREAM(OPT(info->line_sep, ""), stream); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "after CR elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); + H5TOOLS_DEBUG("after CR elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); /* Calculate new prefix */ h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "prefix=%s - str=%s", prefix.s, str.s); + H5TOOLS_DEBUG("prefix=%s - str=%s", prefix.s, str.s); /* Write new prefix to output */ if (ctx->indent_level > 0) @@ -793,7 +785,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); templength = h5tools_str_len(&prefix); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "prefix=%s - templength=%d", prefix.s, templength); + H5TOOLS_DEBUG("prefix=%s - templength=%d", prefix.s, templength); for (u = 0; u < indentlevel; u++) { /*we already made the indent for the array indices case */ @@ -806,19 +798,18 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, templength += h5tools_str_len(&str); } } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "prefix=%s - templength=%d", prefix.s, templength); + H5TOOLS_DEBUG("prefix=%s - templength=%d", prefix.s, templength); ctx->cur_column = ctx->prev_prefix_len = templength; ctx->cur_elmt = 0; ctx->need_prefix = 0; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "prefix=%s - str=%s", prefix.s, str.s); + H5TOOLS_DEBUG("prefix=%s - str=%s", prefix.s, str.s); /* Free string */ h5tools_str_close(&prefix); h5tools_str_close(&str); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); } /*------------------------------------------------------------------------- @@ -934,7 +925,6 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter) { - H5TOOLS_ERR_INIT(hbool_t, TRUE) hbool_t dimension_break = TRUE; char *s = NULL; char *section = NULL; /* a section of output */ @@ -944,12 +934,11 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, if (stream == NULL) return dimension_break; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter need_prefix=%d", ctx->need_prefix); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter); + H5TOOLS_DEBUG("enter need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter); s = h5tools_str_fmt(buffer, (size_t)0, "%s"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "s=%s", s); + H5TOOLS_DEBUG("s=%s", s); /* * If the element would split on multiple lines if printed at our @@ -976,7 +965,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, */ ctx->need_prefix = TRUE; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); } /* @@ -992,9 +981,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, ctx->need_prefix = TRUE; dimension_break = FALSE; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "elmt_counter=%ld - ctx->size_last_dim=%ld info->line_suf=%s", elmt_counter, ctx->size_last_dim, info->line_suf); + H5TOOLS_DEBUG("elmt_counter=%ld - ctx->size_last_dim=%ld info->line_suf=%s", elmt_counter, ctx->size_last_dim, info->line_suf); /* * If the previous element occupied multiple lines and this element @@ -1008,7 +997,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, HDstrlen(OPT(info->elmt_suf2, " ")) + HDstrlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); /* * If too many elements have already been printed then we need to @@ -1016,7 +1005,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, */ if (info->line_per_line > 0 && ctx->cur_elmt >= info->line_per_line) ctx->need_prefix = TRUE; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); /* * Each OPTIONAL_LINE_BREAK embedded in the rendered string can cause @@ -1045,7 +1034,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * Print the prefix or separate the beginning of this element * from the previous element. */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); if (ctx->need_prefix) { if (secnum) multiline++; @@ -1055,7 +1044,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * this is necessary to print the array indices */ *curr_pos = ctx->sm_pos + local_elmt_counter; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "curr_pos=%ld - ctx->sm_pos=%ld - ctx->ndims=%ld", *curr_pos, ctx->sm_pos, ctx->ndims); + H5TOOLS_DEBUG("curr_pos=%ld - ctx->sm_pos=%ld - ctx->ndims=%ld", *curr_pos, ctx->sm_pos, ctx->ndims); h5tools_simple_prefix(stream, info, ctx, *curr_pos, secnum); } @@ -1063,7 +1052,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, PUTSTREAM(OPT(info->elmt_suf2, " "), stream); ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " ")); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "section=%s", section); + H5TOOLS_DEBUG("section=%s", section); /* Print the section */ PUTSTREAM(section, stream); @@ -1072,8 +1061,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, ctx->prev_multiline = multiline; - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return dimension_break; } @@ -1108,16 +1096,14 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter) { - H5TOOLS_ERR_INIT(hbool_t, TRUE) hbool_t dimension_break = TRUE; char *s = NULL; char *section = NULL; /* a section of output */ int secnum; /* section sequence number */ int multiline; /* datum was multiline */ - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter); + H5TOOLS_DEBUG("enter"); + H5TOOLS_DEBUG("elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter); s = h5tools_str_fmt(buffer, (size_t)0, "%s"); @@ -1210,7 +1196,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * this is necessary to print the array indices */ *curr_pos = ctx->sm_pos + local_elmt_counter; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "curr_pos=%ld - ctx->sm_pos=%ld", *curr_pos, ctx->sm_pos); + H5TOOLS_DEBUG("curr_pos=%ld - ctx->sm_pos=%ld", *curr_pos, ctx->sm_pos); h5tools_region_simple_prefix(stream, info, ctx, local_elmt_counter, ptdata, secnum); } @@ -1226,8 +1212,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, ctx->prev_multiline = multiline; - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return dimension_break; } @@ -1243,25 +1228,22 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) { - H5TOOLS_ERR_INIT(int, SUCCEED) int i; unsigned j; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); if(ctx->ndims > 0) { ctx->acc[ctx->ndims - 1] = 1; for (i = ((int)ctx->ndims - 2); i >= 0; i--) { ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1]; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->acc[%d]=%ld", i, ctx->acc[i]); + H5TOOLS_DEBUG("ctx->acc[%d]=%ld", i, ctx->acc[i]); } for (j = 0; j < ctx->ndims; j++) ctx->pos[j] = 0; } - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); } /*------------------------------------------------------------------------- @@ -1276,26 +1258,26 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts) { - H5TOOLS_ERR_INIT(int, SUCCEED) - unsigned char *mem = (unsigned char*)_mem; - size_t size; /* datum size */ - hsize_t block_index; - H5T_class_t type_class; - - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + unsigned char *mem = (unsigned char*)_mem; + size_t size; /* datum size */ + hsize_t block_index; + H5T_class_t type_class; + hbool_t past_catch = FALSE; + int ret_value = 0; + + H5TOOLS_DEBUG("enter"); if((size = H5Tget_size(tid)) == 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_THROW((-1), "H5Tget_size failed"); if((type_class = H5Tget_class(tid)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); + H5TOOLS_THROW((-1), "H5Tget_class failed"); switch (type_class) { case H5T_INTEGER: case H5T_FLOAT: case H5T_ENUM: case H5T_BITFIELD: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "numbers"); + H5TOOLS_DEBUG("numbers"); block_index = block_nelmts * size; while(block_index > 0) { size_t bytes_in = 0; /* # of bytes to write */ @@ -1309,7 +1291,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))) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); + H5TOOLS_THROW((-1), "fwrite failed"); block_index -= (hsize_t)bytes_wrote; mem = mem + bytes_wrote; @@ -1322,7 +1304,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t char *s = NULL; unsigned char tempuchar; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_STRING"); + H5TOOLS_DEBUG("H5T_STRING"); pad = H5Tget_strpad(tid); for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -1333,7 +1315,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t if (s != NULL) size = HDstrlen(s); else - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "NULL string"); + H5TOOLS_THROW((-1), "NULL string"); } else { s = (char *) mem; @@ -1341,7 +1323,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)) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); + H5TOOLS_THROW((-1), "fwrite failed"); } /* i */ } /* for (block_index = 0; block_index < block_nelmts; block_index++) */ } @@ -1351,9 +1333,9 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t int snmembs; unsigned nmembs; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_COMPOUND"); + H5TOOLS_DEBUG("H5T_COMPOUND"); if((snmembs = H5Tget_nmembers(tid)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed"); + H5TOOLS_THROW((-1), "H5Tget_nmembers of compound failed"); nmembs = (unsigned)snmembs; for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -1361,7 +1343,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t mem = ((unsigned char*)_mem) + block_index * size; for (j = 0; j < nmembs; j++) { - hid_t memb = -1; + hid_t memb = H5I_INVALID_HID; size_t offset; offset = H5Tget_member_offset(tid, j); @@ -1369,7 +1351,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); - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed"); + H5TOOLS_THROW((-1), "render_bin_output of compound member failed"); } H5Tclose(memb); @@ -1381,9 +1363,9 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t { int k, ndims; hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts; - hid_t memb = -1; + hid_t memb = H5I_INVALID_HID; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_ARRAY"); + H5TOOLS_DEBUG("H5T_ARRAY"); /* get the array's base datatype for each element */ memb = H5Tget_super(tid); ndims = H5Tget_array_ndims(tid); @@ -1398,7 +1380,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } else { H5Tclose(memb); - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed"); + H5TOOLS_THROW((-1), "calculate the number of array elements failed"); } for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -1406,7 +1388,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); - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + H5TOOLS_THROW((-1), "render_bin_output failed"); } } H5Tclose(memb); @@ -1415,9 +1397,9 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t case H5T_VLEN: { hsize_t nelmts; - hid_t memb = -1; + hid_t memb = H5I_INVALID_HID; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_VLEN"); + H5TOOLS_DEBUG("H5T_VLEN"); /* get the VL sequences's base datatype for each element */ memb = H5Tget_super(tid); @@ -1429,7 +1411,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 *)((void *)mem))->p)), nelmts) < 0) { H5Tclose(memb); - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); + H5TOOLS_THROW((-1), "render_bin_output failed"); } } H5Tclose(memb); @@ -1437,9 +1419,9 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t break; case H5T_REFERENCE: { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference class type"); + H5TOOLS_DEBUG("reference class type"); if (H5Tequal(tid, H5T_STD_REF)) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_STD_REF"); + H5TOOLS_DEBUG("H5T_STD_REF"); if (region_output) { /* region data */ hid_t region_id = H5I_INVALID_HID; @@ -1449,8 +1431,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((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5T_STD_REF failed"); + H5TOOLS_INFO("H5Ropen_object H5T_STD_REF failed"); else { if((region_space = H5Ropen_region((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (!h5tools_is_zero(mem, H5Tget_size(H5T_STD_REF))) { @@ -1461,8 +1442,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t render_bin_output_region_blocks(region_space, region_id, stream, container); } else { - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5T_STD_REF NULL"); + H5TOOLS_INFO("H5Ropen_object H5T_STD_REF NULL"); } H5Sclose(region_space); } /* end if (region_space >= 0) */ @@ -1473,22 +1453,22 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { /* if (size == H5R_DSET_REG_REF_BUF_SIZE) */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_STD_REF_DSETREG"); + H5TOOLS_DEBUG("H5T_STD_REF_DSETREG"); } else if (H5Tequal(tid, H5T_STD_REF_OBJ)) { /* if (size == H5R_OBJ_REF_BUF_SIZE) */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_STD_REF_OBJ"); + H5TOOLS_DEBUG("H5T_STD_REF_OBJ"); } } break; case H5T_TIME: case H5T_OPAQUE: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_OPAQUE"); + H5TOOLS_DEBUG("H5T_OPAQUE"); 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)) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); + H5TOOLS_THROW((-1), "fwrite failed"); } /* end for */ break; @@ -1496,13 +1476,12 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t case H5T_NCLASSES: default: /* Badness */ - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "bad type class"); + H5TOOLS_THROW((-1), "bad type class"); break; } /* end switch */ CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1521,7 +1500,6 @@ int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata) { - H5TOOLS_ERR_INIT(int, SUCCEED) hsize_t *dims1 = NULL; hsize_t *start = NULL; hsize_t *count = NULL; @@ -1529,18 +1507,20 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hsize_t total_size[H5S_MAX_RANK]; unsigned jndx; size_t type_size; - hid_t mem_space = -1; + hid_t mem_space = H5I_INVALID_HID; void *region_buf = NULL; + hbool_t past_catch = FALSE; hsize_t blkndx; - hid_t sid1 = -1; + hid_t sid1 = H5I_INVALID_HID; + int ret_value = -1; /* Get the dataspace of the dataset */ if((sid1 = H5Dget_space(region_id)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_THROW((-1), "H5Dget_space failed"); /* Allocate space for the dimension array */ if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + H5TOOLS_THROW((-1), "Could not allocate buffer for dims"); /* find the dimensions of each data space from the block coordinates */ numelem = 1; @@ -1551,21 +1531,21 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, /* Create dataspace for reading buffer */ if((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + H5TOOLS_THROW((-1), "H5Screate_simple failed"); if((type_size = H5Tget_size(type_id)) == 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_THROW((-1), "H5Tget_size failed"); if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer"); + H5TOOLS_THROW((-1), "Could not allocate region buffer"); /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ /* 1 2 n 1 2 n */ if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for start"); + H5TOOLS_THROW((-1), "Could not allocate buffer for start"); if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for count"); + H5TOOLS_THROW((-1), "Could not allocate buffer for count"); for (blkndx = 0; blkndx < nblocks; blkndx++) { for (jndx = 0; jndx < ndims; jndx++) { @@ -1574,16 +1554,16 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, } if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed"); if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed"); if(render_bin_output(stream, container, type_id, (char*)region_buf, numelem) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "render_bin_output of data region failed"); + H5TOOLS_GOTO_ERROR((-1), "render_bin_output of data region failed"); /* Render the region data element end */ done: ; @@ -1596,10 +1576,11 @@ CATCH HDfree(dims1); if(H5Sclose(mem_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR((-1), "H5Sclose failed"); if(H5Sclose(sid1) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR((-1), "H5Sclose failed"); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1617,51 +1598,53 @@ hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container) { - H5TOOLS_ERR_INIT(hbool_t, TRUE) hssize_t snblocks; hsize_t nblocks; hsize_t alloc_size; hsize_t *ptdata = NULL; int sndims; unsigned ndims; - hid_t dtype = -1; - hid_t type_id = -1; + hid_t dtype = H5I_INVALID_HID; + hid_t type_id = H5I_INVALID_HID; + hbool_t past_catch = FALSE; + hbool_t ret_value = TRUE; if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) - H5TOOLS_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); + H5TOOLS_THROW(FALSE, "H5Sget_select_hyper_nblocks failed"); nblocks = (hsize_t)snblocks; /* Print block information */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5TOOLS_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_THROW(FALSE, "H5Sget_simple_extent_ndims failed"); ndims = (unsigned)sndims; alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + H5TOOLS_GOTO_ERROR(FALSE, "Could not allocate buffer for ptdata"); if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, nblocks, ptdata) < 0) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); + H5TOOLS_GOTO_ERROR(FALSE, "H5Rget_select_hyper_blocklist failed"); if((dtype = H5Dget_type(region_id)) < 0) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(FALSE, "H5Dget_type failed"); if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(FALSE, "H5Tget_native_type failed"); render_bin_output_region_data_blocks(region_id, stream, container, ndims, type_id, nblocks, ptdata); - done: +done: HDfree(ptdata); if(type_id > 0 && H5Tclose(type_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(FALSE, "H5Tclose failed"); if(dtype > 0 && H5Tclose(dtype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(FALSE, "H5Tclose failed"); H5_LEAVE(TRUE) - CATCH +CATCH + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1687,41 +1670,42 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container, unsigned ndims, hid_t type_id, hsize_t npoints) { - H5TOOLS_ERR_INIT(int, SUCCEED) hsize_t *dims1 = NULL; size_t type_size; - hid_t mem_space = -1; + hid_t mem_space = H5I_INVALID_HID; void *region_buf = NULL; + int ret_value = 0; if((type_size = H5Tget_size(type_id)) == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed"); if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region"); + H5TOOLS_GOTO_ERROR((-1), "Could not allocate buffer for region"); /* Allocate space for the dimension array */ if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + H5TOOLS_GOTO_ERROR((-1), "Could not allocate buffer for dims"); dims1[0] = npoints; if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Screate_simple failed"); if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); if(H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed"); if(render_bin_output(stream, container, type_id, (char*)region_buf, npoints) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "render_bin_output of data points failed"); + H5TOOLS_GOTO_ERROR((-1), "render_bin_output of data points failed"); - done: +done: HDfree(region_buf); HDfree(dims1); if(H5Sclose(mem_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR((-1), "H5Sclose failed"); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1739,40 +1723,42 @@ hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container) { - H5TOOLS_ERR_INIT(hbool_t, TRUE) hssize_t snpoints; hsize_t npoints; int sndims; unsigned ndims; - hid_t dtype = -1; - hid_t type_id = -1; + hid_t dtype = H5I_INVALID_HID; + hid_t type_id = H5I_INVALID_HID; + hbool_t past_catch = FALSE; + hbool_t ret_value = TRUE; if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) - H5TOOLS_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + H5TOOLS_THROW(FALSE, "H5Sget_select_elem_npoints failed"); npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5TOOLS_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_THROW(FALSE, "H5Sget_simple_extent_ndims failed"); ndims = (unsigned)sndims; if((dtype = H5Dget_type(region_id)) < 0) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(FALSE, "H5Dget_type failed"); if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(FALSE, "H5Tget_native_type failed"); render_bin_output_region_data_points(region_space, region_id, stream, container, ndims, type_id, npoints); - done: +done: if(type_id > 0 && H5Tclose(type_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(FALSE, "H5Tclose failed"); if(dtype > 0 && H5Tclose(dtype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(FALSE, "H5Tclose failed"); H5_LEAVE(ret_value) CATCH + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1816,23 +1802,29 @@ h5tools_is_zero(const void *_mem, size_t size) */ hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, - hid_t loc_id2, const char *name2) + hid_t loc_id2, const char *name2) { - H5O_info_t oinfo1, oinfo2; - hbool_t ret_val = 0; + H5O_info2_t oinfo1, oinfo2; + hbool_t ret_val = FALSE; if ( name1 && HDstrcmp(name1, ".")) - H5Oget_info_by_name2(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); + H5Oget_info_by_name3(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); else - H5Oget_info2(loc_id1, &oinfo1, H5O_INFO_BASIC); + H5Oget_info3(loc_id1, &oinfo1, H5O_INFO_BASIC); if ( name2 && HDstrcmp(name2, ".")) - H5Oget_info_by_name2(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + H5Oget_info_by_name3(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); else - H5Oget_info2(loc_id2, &oinfo2, H5O_INFO_BASIC); + H5Oget_info3(loc_id2, &oinfo2, H5O_INFO_BASIC); + + if (oinfo1.fileno == oinfo2.fileno) { + int token_cmp_val; - if (oinfo1.fileno == oinfo2.fileno && oinfo1.addr==oinfo2.addr) - ret_val = 1; + H5Otoken_cmp(loc_id1, &oinfo1.token, &oinfo2.token, &token_cmp_val); + + if(!token_cmp_val) + ret_val = TRUE; + } return ret_val; } diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index dad4af7..9440e7a 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -581,6 +581,7 @@ H5TOOLS_DLLVAR int enable_error_stack; /* re-enable error stack; disable=0 e #define H5_TOOLS_DATASET "DATASET" #define H5_TOOLS_DATATYPE "DATATYPE" #define H5_TOOLS_ATTRIBUTE "ATTRIBUTE" +#define H5_TOOLS_UNKNOWN "UNKNOWN" /* Definitions of useful routines */ H5TOOLS_DLL void h5tools_init(void); diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 4a18785..7f29c6b 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -257,7 +257,6 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai h5tools_context_t *ctx, /* in,out */ unsigned flags, hsize_t nelmts, hid_t type, void *_mem) { - H5TOOLS_ERR_INIT(int, SUCCEED) unsigned char *mem = (unsigned char*) _mem; hsize_t i; /* element counter */ size_t size; /* size of each datum */ @@ -272,13 +271,13 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai * this var to count elements and * break after we see a number equal * to the ctx->size_last_dim. */ + int ret_value = 0; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter file=%p", (void*)stream); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "rawdata file=%p", (void*)rawdatastream); + H5TOOLS_DEBUG("enter file=%p", (void*)stream); + H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream); /* binary dump */ if (bin_output && (rawdatastream != NULL)) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "render_bin_output"); + H5TOOLS_DEBUG("render_bin_output"); if (render_bin_output(rawdatastream, container, type, _mem, nelmts) < 0) { PRINTVALSTREAM(rawoutstream, "\nError in writing binary stream\n"); } @@ -287,7 +286,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); size = H5Tget_size(type); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "type size is %ld", size); + H5TOOLS_DEBUG("type size is %ld", size); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -298,7 +297,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai */ curr_pos = ctx->sm_pos; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "data render start:%ld", nelmts); + H5TOOLS_DEBUG("data render start:%ld", nelmts); for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) { void* memref = mem + i * size; @@ -315,13 +314,12 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai if(FALSE == dimension_break) elmt_counter = 0; } /* end for (i = 0; i < nelmts... */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "data render finish"); + H5TOOLS_DEBUG("data render finish"); h5tools_str_close(&buffer); }/* else bin */ - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -357,27 +355,26 @@ h5tools_dump_region_attribute(hid_t region_id, size_t ncols, hsize_t region_elmt_counter, /* element counter */ hsize_t elmt_counter) { - H5TOOLS_ERR_INIT(hbool_t, TRUE) - hbool_t dimension_break = TRUE; - hid_t atype = H5I_INVALID_HID; - hid_t type_id = H5I_INVALID_HID; - hid_t region_space = H5I_INVALID_HID; - h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */ + hbool_t dimension_break = TRUE; + hid_t atype = H5I_INVALID_HID; + hid_t type_id = H5I_INVALID_HID; + hid_t region_space = H5I_INVALID_HID; + h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */ + hbool_t past_catch = FALSE; + hbool_t ret_value = TRUE; HDassert(info); HDassert(ctx); HDassert(buffer); - H5TOOLS_PUSH_STACK(); - outputformat = *info; outputformat.idx_fmt = ""; outputformat.idx_n_fmt = ""; outputformat.idx_sep = ""; outputformat.line_pre = ""; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter file=%p", (void*)stream); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "rawdata file=%p", (void*)rawdatastream); + H5TOOLS_DEBUG("enter file=%p", (void*)stream); + H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream); /* Render the region { element begin */ h5tools_str_reset(buffer); @@ -387,11 +384,11 @@ h5tools_dump_region_attribute(hid_t region_id, /* Render the region { element end */ if((region_space = H5Aget_space(region_id)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Aget_space failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Aget_space failed"); if((atype = H5Aget_type(region_id)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Aget_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Aget_type failed"); if((type_id = H5Tget_native_type(atype, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Tget_native_type failed"); ctx->indent_level++; ctx->need_prefix = TRUE; @@ -442,13 +439,13 @@ h5tools_dump_region_attribute(hid_t region_id, h5tools_dump_data(stream, &outputformat, ctx, region_id, FALSE); } - done: +done: if(H5Tclose(type_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); if(H5Tclose(atype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); ctx->indent_level--; ctx->need_prefix = TRUE; @@ -463,8 +460,7 @@ h5tools_dump_region_attribute(hid_t region_id, CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -493,7 +489,6 @@ h5tools_print_region_data_blocks(hid_t region_id, h5tools_str_t *buffer, /* string into which to render */ size_t ncols, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata) { - H5TOOLS_ERR_INIT(int, SUCCEED) hbool_t dimension_break = TRUE; hsize_t *dims1 = NULL; hsize_t *start = NULL; @@ -507,11 +502,13 @@ h5tools_print_region_data_blocks(hid_t region_id, hsize_t numindex; unsigned indx; unsigned jndx; + hbool_t past_catch = FALSE; size_t type_size; - hid_t mem_space = -1; - hid_t sid1 = -1; + hid_t mem_space = H5I_INVALID_HID; + hid_t sid1 = H5I_INVALID_HID; h5tools_context_t ctx; void *region_buf = NULL; + int ret_value = 0; HDassert(info); HDassert(cur_ctx); @@ -520,19 +517,18 @@ h5tools_print_region_data_blocks(hid_t region_id, HDmemset(&ctx, 0, sizeof(ctx)); - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); if((type_size = H5Tget_size(type_id)) == 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_THROW(FAIL, "H5Tget_size failed"); /* Get the dataspace of the dataset */ if((sid1 = H5Dget_space(region_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed"); /* Allocate space for the dimension array */ if((dims1 = (hsize_t *) HDmalloc((size_t)(sizeof(hsize_t) * ndims))) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for dims"); /* find the dimensions of each data space from the block coordinates */ numelem = 1; @@ -543,18 +539,18 @@ h5tools_print_region_data_blocks(hid_t region_id, /* Create dataspace for reading buffer */ if((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Screate_simple failed"); if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate region buffer"); /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ /* 1 2 n 1 2 n */ if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for start"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for start"); if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for count"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for count"); curr_pos = 0; ctx.indent_level = cur_ctx->indent_level; @@ -592,7 +588,7 @@ h5tools_print_region_data_blocks(hid_t region_id, h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "data render start:%ld", numelem); + H5TOOLS_DEBUG("data render start:%ld", numelem); elmtno = 0; for (numindex = 0; numindex < numelem; numindex++, elmtno++, ctx.cur_elmt++) { /* Render the region data element begin */ @@ -614,33 +610,32 @@ h5tools_print_region_data_blocks(hid_t region_id, } /* end for (numindex = 0; numindex < numelem; numindex++, elmtno++, ctx.cur_elmt++) */ } else { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); } ctx.indent_level--; } else { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_ERROR(FAIL, "H5Dread failed"); } } else { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_ERROR(FAIL, "H5Sselect_hyperslab failed"); } } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ - done: +done: HDfree(start); HDfree(count); HDfree(region_buf); HDfree(dims1); if(H5Sclose(mem_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); if(H5Sclose(sid1) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -677,7 +672,6 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, size_t ncols, hsize_t region_elmt_counter, /* element counter */ hsize_t elmt_counter) { - H5TOOLS_ERR_INIT(hbool_t, TRUE) hbool_t dimension_break = TRUE; hssize_t snblocks; hsize_t nblocks; @@ -689,13 +683,13 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, hid_t dtype = H5I_INVALID_HID; hid_t type_id = H5I_INVALID_HID; h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */ + hbool_t past_catch = FALSE; + hbool_t ret_value = TRUE; HDassert(info); HDassert(ctx); HDassert(buffer); - H5TOOLS_PUSH_STACK(); - outputformat = *info; outputformat.idx_fmt = ""; outputformat.idx_n_fmt = ""; @@ -703,15 +697,15 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, outputformat.line_pre = ""; if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) - H5TOOLS_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); + H5TOOLS_THROW(dimension_break, "H5Sget_select_hyper_nblocks failed"); nblocks = (hsize_t)snblocks; /* Print block information */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5TOOLS_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_THROW(dimension_break, "H5Sget_simple_extent_ndims failed"); ndims = (unsigned)sndims; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter ndims=%d", ndims); + H5TOOLS_DEBUG("enter ndims=%d", ndims); /* Render the region { element begin */ h5tools_str_reset(buffer); @@ -730,10 +724,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + H5TOOLS_GOTO_ERROR(dimension_break, "Could not allocate buffer for ptdata"); if(H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, nblocks, ptdata) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Rget_select_hyper_blocklist failed"); for(indx = 0; indx < nblocks; indx++) { unsigned loop_indx; @@ -759,9 +753,9 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, ctx->need_prefix = TRUE; if((dtype = H5Dget_type(region_id)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Dget_type failed"); if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Tget_native_type failed"); /* Render the datatype element begin */ h5tools_str_reset(buffer); @@ -818,14 +812,15 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, h5tools_print_region_data_blocks(region_id, rawdatastream, info, ctx, buffer, ncols, ndims, type_id, nblocks, ptdata); } - done: + +done: HDfree(ptdata); if(type_id > 0 && H5Tclose(type_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); if(dtype > 0 && H5Tclose(dtype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); if (region_output) { ctx->need_prefix = TRUE; @@ -858,8 +853,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -888,7 +882,6 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, h5tools_str_t *buffer, size_t ncols, unsigned ndims, hid_t type_id, hsize_t npoints, hsize_t *ptdata) { - H5TOOLS_ERR_INIT(int, SUCCEED) hbool_t dimension_break = TRUE; hsize_t *dims1 = NULL; hsize_t elmtno; /* elemnt index */ @@ -901,6 +894,8 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, hid_t mem_space = H5I_INVALID_HID; void *region_buf = NULL; h5tools_context_t ctx; + hbool_t past_catch = FALSE; + int ret_value = 0; HDassert(info); HDassert(cur_ctx); @@ -908,25 +903,24 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, HDassert(ptdata); HDassert(ndims > 0); - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); HDmemset(&ctx, 0, sizeof(ctx)); /* Allocate space for the dimension array */ if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + H5TOOLS_THROW((-1), "Could not allocate buffer for dims"); dims1[0] = npoints; /* Create dataspace for reading buffer */ if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + H5TOOLS_THROW((-1), "H5Screate_simple failed"); if((type_size = H5Tget_size(type_id)) == 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_THROW((-1), "H5Tget_size failed"); if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region"); + H5TOOLS_THROW((-1), "Could not allocate buffer for region"); curr_pos = 0; ctx.indent_level = cur_ctx->indent_level; @@ -935,9 +929,9 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, ctx.ndims = ndims; if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "data render start:%ld", npoints); + H5TOOLS_DEBUG("data render start:%ld", npoints); elmtno = 0; for (jndx = 0; jndx < npoints; jndx++, elmtno++) { ctx.need_prefix = TRUE; @@ -984,7 +978,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, elmtno = 0; } else { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_ERROR((-1), "H5Sget_simple_extent_dims failed"); } ctx.indent_level--; } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ @@ -995,10 +989,9 @@ CATCH HDfree(dims1); if(H5Sclose(mem_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR((-1), "H5Sclose failed"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1032,7 +1025,6 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter) { - H5TOOLS_ERR_INIT(hbool_t, TRUE) hbool_t dimension_break = TRUE; hssize_t snpoints; hsize_t npoints; @@ -1044,13 +1036,13 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, hid_t dtype = H5I_INVALID_HID; hid_t type_id = H5I_INVALID_HID; h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */ + hbool_t past_catch = FALSE; + hbool_t ret_value = TRUE; HDassert(info); HDassert(ctx); HDassert(buffer); - H5TOOLS_PUSH_STACK(); - outputformat = *info; outputformat.idx_fmt = ""; outputformat.idx_n_fmt = ""; @@ -1058,15 +1050,15 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, outputformat.line_pre = ""; if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) - H5TOOLS_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + H5TOOLS_THROW(dimension_break, "H5Sget_select_elem_npoints failed"); npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5TOOLS_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_THROW(dimension_break, "H5Sget_simple_extent_ndims failed"); ndims = (unsigned)sndims; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter ndims=%d", ndims); + H5TOOLS_DEBUG("enter ndims=%d", ndims); /* Render the region { element begin */ h5tools_str_reset(buffer); @@ -1085,10 +1077,10 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, alloc_size = npoints * ndims * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + H5TOOLS_GOTO_ERROR(dimension_break, "Could not allocate buffer for ptdata"); if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, npoints, ptdata) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Sget_select_elem_pointlist failed"); for (indx = 0; indx < npoints; indx++) { unsigned loop_indx; @@ -1109,9 +1101,9 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, ctx->need_prefix = TRUE; if((dtype = H5Dget_type(region_id)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Dget_type failed"); if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Tget_native_type failed"); /* Render the datatype element begin */ h5tools_str_reset(buffer); @@ -1170,14 +1162,14 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, h5tools_print_region_data_points(region_space, region_id, rawdatastream, info, ctx, buffer, ncols, ndims, type_id, npoints, ptdata); } - done: +done: HDfree(ptdata); if(type_id > 0 && H5Tclose(type_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); if(dtype > 0 && H5Tclose(dtype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); if (region_output) { ctx->need_prefix = TRUE; @@ -1210,8 +1202,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, H5_LEAVE(dimension_break) CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1259,7 +1250,6 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c hsize_t *total_size, /* total size of dataset */ unsigned int row_dim) /* index of row_counter dimension */ { - H5TOOLS_ERR_INIT(herr_t, SUCCEED) size_t i; /* counters */ size_t j; /* counters */ hsize_t zero[1] = {0}; /* vector of zeros */ @@ -1276,12 +1266,13 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */ hsize_t size_row_block; /* size for blocks along rows */ hsize_t row_counter = 0; - + hbool_t past_catch = FALSE; /* VL data special information */ - unsigned int vl_data = 0; /* contains VL datatypes */ + unsigned int vl_data = 0; /* contains VL datatypes */ + herr_t ret_value = SUCCEED; if ((size_t) ctx->ndims > NELMTS(sm_size)) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed"); + H5TOOLS_THROW(FAIL, "ndims and sm_size comparision failed"); if (ctx->ndims > 0) init_acc_pos(ctx, total_size); @@ -1309,10 +1300,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) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_THROW(FAIL, "H5Sselect_hyperslab failed"); if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); + H5TOOLS_THROW(FAIL, "H5Sget_select_npoints failed"); sm_nelmts = (hsize_t)ssm_nelmts; if (sm_nelmts > 0) { @@ -1321,7 +1312,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) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_THROW(FAIL, "H5Tget_size failed"); if (ctx->ndims > 0) for (i = ctx->ndims; i > 0; --i) { @@ -1335,17 +1326,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))) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); + H5TOOLS_THROW(FAIL, "Could not allocate buffer for strip-mine"); if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + H5TOOLS_THROW(FAIL, "H5Screate_simple failed"); if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_THROW(FAIL, "H5Sselect_hyperslab failed"); /* read the data */ if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_THROW(FAIL, "H5Dread failed"); /* print the data */ flags = START_OF_DATA; @@ -1359,7 +1350,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) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); + H5TOOLS_THROW(FAIL, "H5Sget_select_bounds failed"); elmtno = 0; for (i = 0; i < (size_t) ctx->ndims - 1; i++) { @@ -1377,20 +1368,20 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c ctx->need_prefix = TRUE; if(h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_dump_simple_data failed"); + H5TOOLS_THROW(FAIL, "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ if (vl_data) H5Treclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); if(H5Sclose(sm_space) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_THROW(FAIL, "H5Sclose failed"); if(sm_buf) HDfree(sm_buf); sm_buf = NULL; } else - H5TOOLS_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print"); + H5TOOLS_THROW(SUCCEED, "nothing to print"); ctx->continuation++; @@ -1400,6 +1391,7 @@ CATCH if(sm_buf) HDfree(sm_buf); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1579,17 +1571,18 @@ static herr_t h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type) { - H5TOOLS_ERR_INIT(herr_t, SUCCEED) - int sndims; - hid_t f_space = H5I_INVALID_HID; /* file data space */ - size_t i; /* counters */ - hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ + int sndims; + hid_t f_space = H5I_INVALID_HID; /* file data space */ + size_t i; /* counters */ + hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ + hbool_t past_catch = FALSE; + herr_t ret_value = SUCCEED; if((f_space = H5Dget_space(dset)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_THROW(FAIL, "H5Dget_space failed"); if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_THROW(FAIL, "H5Sget_simple_extent_ndims failed"); ctx->ndims = (unsigned)sndims; /* assume entire data space to be printed */ @@ -1598,7 +1591,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) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_THROW(FAIL, "H5Sget_simple_extent_dims failed"); ctx->size_last_dim = total_size[ctx->ndims - 1]; /* Set the compound datatype field list for display */ @@ -1608,8 +1601,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co CATCH if(f_space >= 0 && H5Sclose(f_space) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_THROW(FAIL, "H5Sclose failed"); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1632,7 +1626,6 @@ static int h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type) { - H5TOOLS_ERR_INIT(herr_t, SUCCEED) hid_t f_space = H5I_INVALID_HID; /* file data space */ hsize_t elmtno; /* counter */ size_t i; /* counter */ @@ -1641,6 +1634,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont hsize_t zero[8]; /* vector of zeros */ unsigned int flags; /* buffer extent flags */ hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ + hbool_t past_catch = FALSE; /* Print info */ size_t p_type_nbytes; /* size of memory type */ @@ -1660,20 +1654,20 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont /* VL data special information */ unsigned int vl_data = 0; /* contains VL datatypes */ + int ret_value = 0; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); - if (FAIL == (f_space = H5Dget_space(dset))) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_DEBUG("enter"); + if (H5I_INVALID_HID == (f_space = H5Dget_space(dset))) + H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed"); sndims = H5Sget_simple_extent_ndims(f_space); if(sndims < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_simple_extent_ndims failed"); ctx->ndims = (unsigned)sndims; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "sndims:%d", sndims); + H5TOOLS_DEBUG("sndims:%d", sndims); if ((size_t)ctx->ndims > NELMTS(sm_size)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed"); + H5TOOLS_GOTO_ERROR((-1), "ctx->ndims > NELMTS(sm_size) failed"); /* Assume entire data space to be printed */ if (ctx->ndims > 0) @@ -1720,22 +1714,22 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont HDassert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ if (NULL != (sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes))) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "stripmine size:%ld", sm_nbytes); + H5TOOLS_DEBUG("stripmine size:%ld", sm_nbytes); sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "sm_nelmts size:%ld", sm_nelmts); + H5TOOLS_DEBUG("sm_nelmts size:%ld", sm_nelmts); if (ctx->ndims > 0) init_acc_pos(ctx, total_size); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->ndims:%d", ctx->ndims); + H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims); /* The stripmine loop */ HDmemset(hs_offset, 0, sizeof hs_offset); HDmemset(zero, 0, sizeof zero); for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "stripmine read loop:%d", i); + H5TOOLS_DEBUG("stripmine read loop:%d", i); /* Calculate the hyperslab size */ if (ctx->ndims > 0) { for (i = 0, hs_nelmts = 1; i < ctx->ndims; i++) { @@ -1745,19 +1739,19 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont } if (H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab hs_offset failed"); + H5TOOLS_ERROR((-1), "H5Sselect_hyperslab hs_offset failed"); if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab zero failed"); + H5TOOLS_ERROR((-1), "H5Sselect_hyperslab zero failed"); } else { if (H5Sselect_all(f_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_all f_space failed"); + H5TOOLS_ERROR((-1), "H5Sselect_all f_space failed"); if (H5Sselect_all(sm_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_all sm_space failed"); + H5TOOLS_ERROR((-1), "H5Sselect_all sm_space failed"); hs_nelmts = 1; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Read the data"); + H5TOOLS_DEBUG("Read the data"); /* Read the data */ if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) >= 0) { /* Print the data */ @@ -1769,13 +1763,13 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont ctx->sm_pos = elmtno; if(h5tools_dump_simple_data(stream, info, dset, ctx, flags, hs_nelmts, p_type, sm_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_dump_simple_data failed"); + H5TOOLS_ERROR((-1), "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ if (vl_data) H5Treclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Calculate the next hyperslab offset"); + H5TOOLS_DEBUG("Calculate the next hyperslab offset"); /* Calculate the next hyperslab offset */ for (i = ctx->ndims, carry = 1; i > 0 && carry; --i) { ctx->p_min_idx[i - 1] = ctx->p_max_idx[i - 1]; @@ -1788,21 +1782,21 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont } } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_ERROR((-1), "H5Dread failed"); ctx->continuation++; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "stripmine read loop:%d complete", i); + H5TOOLS_DEBUG("stripmine read loop:%d complete", i); } HDfree(sm_buf); } /* if (NULL != (sm_buf...)) */ + done: if(sm_space >= 0 && H5Sclose(sm_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR((-1), "H5Sclose failed"); if(f_space >= 0 && H5Sclose(f_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR((-1), "H5Sclose failed"); CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1820,31 +1814,31 @@ static int h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t attr_id, hid_t p_type) { - H5TOOLS_ERR_INIT(herr_t, SUCCEED) hid_t f_space = H5I_INVALID_HID; /* file data space */ hsize_t alloc_size; int sndims; /* rank of dataspace */ unsigned i; /* counters */ hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ hsize_t p_nelmts; /* total selected elmts */ - unsigned char *buf = NULL; /* buffer for raw data */ + hbool_t past_catch = FALSE; + unsigned char *buf = NULL; /* buffer for raw data */ + int ret_value = 0; /* VL data special information */ unsigned int vl_data = 0; /* contains VL datatypes */ - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); - if (FAIL == (f_space = H5Aget_space(attr_id))) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_DEBUG("enter"); + if (H5I_INVALID_HID == (f_space = H5Aget_space(attr_id))) + H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed"); sndims = H5Sget_simple_extent_ndims(f_space); if(sndims < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + H5TOOLS_THROW((-1), "H5Dget_simple_extent_ndims failed"); ctx->ndims = (unsigned)sndims; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "sndims:%d", sndims); + H5TOOLS_DEBUG("sndims:%d", sndims); if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx)) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed"); + H5TOOLS_THROW((-1), "ctx->ndims > NELMTS(ctx->p_min_idx) failed"); /* Assume entire data space to be printed */ if (ctx->ndims > 0) @@ -1876,28 +1870,27 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte if (NULL != (buf = (unsigned char *)HDmalloc((size_t)alloc_size))) { if (ctx->ndims > 0) init_acc_pos(ctx, total_size); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->ndims:%d", ctx->ndims); + H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Read the data"); + H5TOOLS_DEBUG("Read the data"); /* Read the data */ if (H5Aread(attr_id, p_type, buf) >= 0) { if(h5tools_dump_simple_data(stream, info, attr_id, ctx, START_OF_DATA | END_OF_DATA, p_nelmts, p_type, buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_dump_simple_data failed"); + H5TOOLS_ERROR((-1), "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ if (vl_data) H5Treclaim(p_type, f_space, H5P_DEFAULT, buf); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_ERROR((-1), "H5Aread failed"); HDfree(buf); } /* if (NULL != (buf...)) */ done: if(f_space >= 0 && H5Sclose(f_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR((-1), "H5Sclose failed"); CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1922,12 +1915,13 @@ CATCH int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset) { - H5TOOLS_ERR_INIT(int, SUCCEED) hid_t f_space = H5I_INVALID_HID; hid_t p_type = H5I_INVALID_HID; hid_t f_type = H5I_INVALID_HID; H5S_class_t space_type; h5tool_format_t info_dflt; + int ret_value = 0; + /* Use default values */ if (!stream) stream = rawoutstream; @@ -1979,6 +1973,7 @@ done: if (f_space > 0) H5Sclose(f_space); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -1996,11 +1991,11 @@ done: int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t attr_id) { - H5TOOLS_ERR_INIT(int, SUCCEED) hid_t f_space = H5I_INVALID_HID; hid_t p_type = H5I_INVALID_HID; hid_t f_type = H5I_INVALID_HID; h5tool_format_t info_dflt; + int ret_value = 0; /* Use default values */ if (!stream) @@ -2034,7 +2029,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c /* Check the data space */ if (H5Sis_simple(f_space) <= 0) { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sis_simple failed"); + H5TOOLS_ERROR((-1), "H5Sis_simple failed"); } else { ret_value = h5tools_dump_simple_mem(rawattrstream, info, ctx, attr_id, p_type); @@ -2047,6 +2042,7 @@ done: if (f_space > 0) H5Sclose(f_space); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -2065,12 +2061,11 @@ int h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t type, int object_search) { - H5TOOLS_ERR_INIT(int, SUCCEED) char *mname; - hid_t mtype = -1; - hid_t str_type = -1; - hid_t super = -1; - hid_t tmp_type = -1; + hid_t mtype = H5I_INVALID_HID; + hid_t str_type = H5I_INVALID_HID; + hid_t super = H5I_INVALID_HID; + hid_t tmp_type = H5I_INVALID_HID; int snmembers; int sndims; unsigned nmembers; @@ -2085,21 +2080,28 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ H5T_class_t type_class; H5T_sign_t sign; /* sign scheme value */ htri_t is_vlstr = FALSE; + hbool_t past_catch = FALSE; const char *sign_s = NULL; /* sign scheme string */ const char *order_s = NULL; /* byte order string */ + int ret_value = 0; if((type_class = H5Tget_class(type)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); + H5TOOLS_THROW((-1), "H5Tget_class failed"); if (object_search && H5Tcommitted(type) > 0) { - H5O_info_t oinfo; - obj_t *obj = NULL; /* Found object */ + H5O_info2_t oinfo; + obj_t *obj = NULL; /* Found object */ - H5Oget_info2(type, &oinfo, H5O_INFO_BASIC); - obj = search_obj(h5dump_type_table, oinfo.addr); + H5Oget_info3(type, &oinfo, H5O_INFO_BASIC); + obj = search_obj(h5dump_type_table, &oinfo.token); if(obj) { - if(!obj->recorded) - h5tools_str_append(buffer,"\"/#"H5_PRINTF_HADDR_FMT"\"", obj->objno); + if(!obj->recorded) { + char *obj_addr_str = NULL; + + H5Otoken_to_str(type, &oinfo.token, &obj_addr_str); + h5tools_str_append(buffer,"\"/#%s\"", obj_addr_str); + H5free_memory(obj_addr_str); + } else h5tools_str_append(buffer, "\"%s\"", obj->objname); } @@ -2379,11 +2381,11 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ order = H5Tget_order(tmp_type); if(order == H5T_ORDER_LE) { if(H5Tset_order(str_type, H5T_ORDER_LE) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tset_order failed"); + H5TOOLS_ERROR((-1), "H5Tset_order failed"); } /* end if */ else if(order == H5T_ORDER_BE) { if(H5Tset_order(str_type, H5T_ORDER_BE) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tset_order failed"); + H5TOOLS_ERROR((-1), "H5Tset_order failed"); } /* end if */ if(H5Tequal(tmp_type, str_type)) { @@ -2393,7 +2395,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ /* If not equal to C variable-length string, check Fortran type. */ if(H5Tclose(str_type) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR((-1), "H5Tclose failed"); str_type = H5Tcopy(H5T_FORTRAN_S1); H5Tset_cset(str_type, cset); @@ -2410,11 +2412,11 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ order = H5Tget_order(tmp_type); if(order == H5T_ORDER_LE) { if(H5Tset_order(str_type, H5T_ORDER_LE) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tset_order failed"); + H5TOOLS_ERROR((-1), "H5Tset_order failed"); } /* end if */ else if(order == H5T_ORDER_BE) { if(H5Tset_order(str_type, H5T_ORDER_BE) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tset_order failed"); + H5TOOLS_ERROR((-1), "H5Tset_order failed"); } /* end if */ if(H5Tequal(tmp_type, str_type)) { @@ -2433,9 +2435,9 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_reset(buffer); if(H5Tclose(str_type) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR((-1), "H5Tclose failed"); if(H5Tclose(tmp_type) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR((-1), "H5Tclose failed"); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend); break; @@ -2469,7 +2471,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ char *ttag; if(NULL == (ttag = H5Tget_tag(type))) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed"); + H5TOOLS_THROW((-1), "H5Tget_tag failed"); ctx->need_prefix = TRUE; @@ -2497,7 +2499,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_COMPOUND: if((snmembers = H5Tget_nmembers(type)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + H5TOOLS_THROW((-1), "H5Tget_nmembers failed"); nmembers = (unsigned)snmembers; h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin); @@ -2515,10 +2517,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, " \"%s\";", mname); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(H5Tclose(mtype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR((-1), "H5Tclose failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_member_type failed"); + H5TOOLS_ERROR((-1), "H5Tget_member_type failed"); H5free_memory(mname); } ctx->indent_level--; @@ -2547,7 +2549,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_ENUM: if((super = H5Tget_super(type)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + H5TOOLS_THROW((-1), "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); @@ -2559,7 +2561,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); if(H5Tclose(super) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR((-1), "H5Tclose failed"); h5tools_str_append(buffer, ";"); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -2577,14 +2579,14 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_VLEN: if((super = H5Tget_super(type)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + H5TOOLS_THROW((-1), "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) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR((-1), "H5Tclose failed"); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend); @@ -2605,10 +2607,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, " "); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_dims2 failed"); + H5TOOLS_ERROR((-1), "H5Tget_array_dims2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_ndims failed"); + H5TOOLS_ERROR((-1), "H5Tget_array_ndims failed"); /* Get array base type */ if((super = H5Tget_super(type)) >= 0) { @@ -2616,10 +2618,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); /* Close array base type */ if(H5Tclose(super) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR((-1), "H5Tclose failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_super failed"); + H5TOOLS_ERROR((-1), "H5Tget_super failed"); h5tools_str_append(buffer, " }"); @@ -2633,6 +2635,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ } CATCH + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -2650,18 +2653,19 @@ CATCH int h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) { - H5TOOLS_ERR_INIT(int, SUCCEED) hsize_t size[H5TOOLS_DUMP_MAX_RANK]; hsize_t maxsize[H5TOOLS_DUMP_MAX_RANK]; int ndims = -1; H5S_class_t space_type = -1; + hbool_t past_catch = FALSE; int i; + int ret_value = 0; if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_THROW((-1), "H5Sget_simple_extent_dims failed"); if((space_type = H5Sget_simple_extent_type(space)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed"); + H5TOOLS_THROW((-1), "H5Sget_simple_extent_type failed"); switch(space_type) { case H5S_SCALAR: @@ -2708,6 +2712,7 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) } /* end switch */ CATCH + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -2726,34 +2731,35 @@ CATCH int h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t type) { - H5TOOLS_ERR_INIT(int, SUCCEED) char **name = NULL; /*member names */ unsigned char *value = NULL; /*value array */ unsigned char *copy = NULL; /*a pointer to value array */ unsigned i; unsigned nmembs = 0; /*number of members */ int snmembs; - hid_t super = -1; /*enum base integer type */ - hid_t native = -1; /*native integer datatype */ + hid_t super = H5I_INVALID_HID; /*enum base integer type */ + hid_t native = H5I_INVALID_HID; /*native integer datatype */ H5T_sign_t sign_type; /*sign of value type */ size_t type_size; /*value type size */ size_t dst_size; /*destination value type size */ size_t ncols = 80; /*available output width */ hsize_t curr_pos = 0; /* total data element position */ + hbool_t past_catch = FALSE; + int ret_value = 0; if (info->line_ncols > 0) ncols = info->line_ncols; if((snmembs = H5Tget_nmembers(type)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + H5TOOLS_THROW((-1), "H5Tget_nmembers failed"); nmembs = (unsigned)snmembs; HDassert(nmembs > 0); if((super = H5Tget_super(type)) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); + H5TOOLS_THROW((-1), "H5Tget_super failed"); if((type_size = H5Tget_size(type)) <= 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); + H5TOOLS_THROW((-1), "H5Tget_size(type) failed"); /* * Determine what datatype to use for the native values. To simplify @@ -2766,7 +2772,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) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed"); + H5TOOLS_THROW((-1), "H5Tget_sign failed"); if(H5T_SGN_NONE == sign_type) native = H5T_NATIVE_ULLONG; else @@ -2777,20 +2783,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 *)))) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); + H5TOOLS_THROW((-1), "Could not allocate buffer for member name"); if(NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size)))) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); + H5TOOLS_THROW((-1), "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) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed"); + H5TOOLS_THROW((-1), "H5Tget_member_value failed"); } /* Convert values to native datatype */ if (native > 0) if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); + H5TOOLS_THROW((-1), "H5Tconvert failed"); /* * Sort members by increasing value @@ -2847,11 +2853,12 @@ CATCH HDfree(value); if(super >= 0 && H5Tclose(super) < 0) - H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class"); + H5TOOLS_THROW((-1), "Could not close datatype's super class"); if(0 == nmembs) h5tools_str_append(buffer, "\n<empty>"); + H5TOOLS_ENDDEBUG("exit"); return ret_value; } @@ -3070,7 +3077,7 @@ h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id) { size_t size; - hid_t n_type = -1; + hid_t n_type = H5I_INVALID_HID; void *buf = NULL; n_type = H5Tget_native_type(type_id, H5T_DIR_DEFAULT); @@ -3305,7 +3312,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, if (vmaps) { size_t next; - ssize_t ssize_out; + ssize_t H5_ATTR_NDEBUG_UNUSED ssize_out; ctx->indent_level++; for (next = 0; next < (unsigned) vmaps; next++) { @@ -3772,8 +3779,8 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_contex error_msg("unable to open attribute \"%s\"\n", attr_name); } else { - hid_t type = -1; - hid_t space = -1; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; ctx->indent_level++; @@ -3966,7 +3973,6 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tool void h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t obj_id, int obj_data) { - H5TOOLS_ERR_INIT(int, SUCCEED) H5S_class_t space_type; int ndims; size_t i; @@ -3977,6 +3983,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * hsize_t total_size[H5S_MAX_RANK]; hsize_t elmt_counter = 0; /*counts the # elements printed. */ int status = -1; + h5tools_context_t datactx; /* print context */ h5tools_str_t buffer; /* string into which to render */ hsize_t curr_pos = 0; /* total data element position */ size_t ncols = 80; /* available output width */ @@ -3984,9 +3991,8 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tool_format_t outputformat; H5R_ref_t *ref_buf = NULL; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter file=%p", (void*)stream); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "rawdata file=%p", (void*)rawdatastream); + H5TOOLS_DEBUG("enter file=%p", (void*)stream); + H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); if (info->line_ncols > 0) @@ -3998,12 +4004,12 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * string_dataformat.pindex = ctx->display_index; if(obj_data) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "dataset"); + H5TOOLS_DEBUG("dataset"); f_type = H5Dget_type(obj_id); space = H5Dget_space(obj_id); } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "attribute"); + H5TOOLS_DEBUG("attribute"); f_type = H5Aget_type(obj_id); space = H5Aget_space(obj_id); } @@ -4030,14 +4036,14 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * if (H5Tget_class(f_type) == H5T_REFERENCE) { ctx->indent_level++; - h5tools_context_t datactx = *ctx; /* print context */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference class type"); + datactx = *ctx; + H5TOOLS_DEBUG("reference class type"); if (!H5Tequal(f_type, H5T_STD_REF) && !H5Tequal(f_type, H5T_STD_REF_DSETREG) && !H5Tequal(f_type, H5T_STD_REF_OBJ)) { - HGOTO_DONE(SUCCEED); + H5TOOLS_GOTO_DONE_NO_RET(); } ndims = (int)H5Sget_simple_extent_npoints(space); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ndims=%d - datactx.ndims=%d", ndims, datactx.ndims); + H5TOOLS_DEBUG("ndims=%d - datactx.ndims=%d", ndims, datactx.ndims); /* Assume entire data space to be printed */ if (datactx.ndims > 0) @@ -4049,35 +4055,37 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * init_acc_pos(&datactx, total_size); datactx.need_prefix = TRUE; - if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), ndims))) { + if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) { if(obj_data) { if(H5Dread(obj_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_buf) < 0) { HDfree(ref_buf); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread reference failed"); + H5TOOLS_INFO("H5Dread reference failed"); + H5TOOLS_GOTO_DONE_NO_RET(); } } else { if(H5Aread(obj_id, H5T_STD_REF, ref_buf) < 0) { HDfree(ref_buf); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread reference failed"); + H5TOOLS_INFO("H5Aread reference failed"); + H5TOOLS_GOTO_DONE_NO_RET(); } } - for(i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) { - H5O_type_t obj_type; /* Object type */ + for(i = 0; i < (size_t)ndims; i++, datactx.cur_elmt++, elmt_counter++) { + H5O_type_t obj_type = -1; /* Object type */ H5R_type_t ref_type; /* Reference type */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference loop:%d with curr_pos=%ld", i, curr_pos); + H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos); datactx.need_prefix = TRUE; h5tools_str_reset(&buffer); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); + H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); h5tools_str_sprint(&buffer, &outputformat, obj_id, H5T_STD_REF, &ref_buf[i], &datactx); h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims); ref_type = H5Rget_type((const H5R_ref_t *)&ref_buf[i]); switch (ref_type) { case H5R_OBJECT1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT1"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_DATASET: @@ -4086,12 +4094,10 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); datactx.indent_level--; if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_INFO("H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_INFO("H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); break; case H5O_TYPE_GROUP: @@ -4104,24 +4110,22 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * } /* end switch */ } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_obj_type3 H5R_OBJECT1 failed"); + H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT1 failed"); break; case H5R_DATASET_REGION1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION1"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { datactx.indent_level++; h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); datactx.indent_level--; if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION1 failed"); - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION1 failed"); + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION1 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_DATASET_REGION1 failed"); + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed"); break; case H5R_OBJECT2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_GROUP: @@ -4133,12 +4137,10 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); datactx.indent_level--; if(H5Oclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT2 failed"); - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT2 failed"); + H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_OBJECT2 failed"); + H5TOOLS_INFO("H5Ropen_object H5R_OBJECT2 failed"); break; case H5O_TYPE_NAMED_DATATYPE: @@ -4152,22 +4154,21 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * } /* end switch */ } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_obj_type3 H5R_OBJECT2 failed"); + H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT2 failed"); break; case H5R_DATASET_REGION2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); if (outputformat.line_ncols > 0) ncols = outputformat.line_ncols; /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */ if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5R_DATASET_REGION2 failed"); + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed"); else { if((new_obj_sid = H5Ropen_region((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " {"); @@ -4193,42 +4194,38 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * region_type = H5Sget_select_type(new_obj_sid); if(region_type == H5S_SEL_POINTS) { /* Print point information */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5S_SEL_POINTS H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2"); h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, &outputformat, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); } else if(region_type == H5S_SEL_HYPERSLABS) { /* Print block information */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, &outputformat, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "invalid region type"); + H5TOOLS_INFO("invalid region type"); } /* end else to if (h5tools_is_zero(... */ if(H5Sclose(new_obj_sid) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION2 failed"); + H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_region H5R_DATASET_REGION2 failed"); + H5TOOLS_INFO("H5Ropen_region H5R_DATASET_REGION2 failed"); if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION2 failed"); - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION2 failed"); + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); } break; case H5R_ATTR: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_ATTR"); + H5TOOLS_DEBUG("ref_type is H5R_ATTR"); if((new_obj_id = H5Ropen_attr((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { h5tools_dump_region_attribute(new_obj_id, stream, &outputformat, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); if(H5Aclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose H5R_ATTR failed"); - if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_ATTR failed"); + H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_ATTR"); + H5TOOLS_DEBUG("NULL H5R_ATTR"); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " {"); @@ -4250,7 +4247,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_str_append(&buffer, "}"); h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_attr H5R_ATTR failed"); + H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed"); } break; case H5R_BADTYPE: @@ -4259,18 +4256,21 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * break; } /* end switch */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "finished reference loop:%d",i); - } /* end for(i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) */ + if(H5Rdestroy(&ref_buf[i]) < 0) + H5TOOLS_INFO("H5Rdestroy failed"); + + H5TOOLS_DEBUG("finished reference loop:%d",i); + } /* end for(i = 0; i < ndims; i++, datactx->cur_elmt++, elmt_counter++) */ HDfree(ref_buf); } ctx->indent_level--; } else { - h5tools_context_t datactx = *ctx; /* print context */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Print all the values"); + H5TOOLS_DEBUG("Print all the values"); + datactx = *ctx; string_dataformat = *info; if((datactx.display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Print 1-byte integer data as an ASCII character string"); + H5TOOLS_DEBUG("Print 1-byte integer data as an ASCII character string"); /* * Print 1-byte integer data as an ASCII character string * instead of integers if the `-r' or `--string' command-line @@ -4297,7 +4297,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * /* Print all the values. */ if(obj_data) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5tools_dump_dset"); + H5TOOLS_DEBUG("h5tools_dump_dset"); status = h5tools_dump_dset(stream, &string_dataformat, &datactx, obj_id); } else { @@ -4307,12 +4307,12 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * status = SUCCEED; } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call h5tools_dump_mem"); + H5TOOLS_DEBUG("call h5tools_dump_mem"); status = h5tools_dump_mem(stream, &string_dataformat, &datactx, obj_id); } } if (datactx.display_char && H5Tget_size(f_type) == 1 && H5Tget_class(f_type) == H5T_INTEGER) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Print 1-byte integer data as an ASCII character string eol=%s",string_dataformat.line_suf); + H5TOOLS_DEBUG("Print 1-byte integer data as an ASCII character string eol=%s",string_dataformat.line_suf); datactx.need_prefix = FALSE; string_dataformat.arr_linebreak = 0; string_dataformat.idx_fmt = ""; @@ -4322,7 +4322,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_str_append(&buffer, "\""); h5tools_render_element(stream, &string_dataformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Print all the values Complete"); + H5TOOLS_DEBUG("Print all the values Complete"); if (status == FAIL) { error_msg("unable to print data\n"); @@ -4365,7 +4365,6 @@ done: } h5tools_str_close(&buffer); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); } diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index 2c5e6c9..784b86a 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -22,7 +22,9 @@ /* tools-HDF5 Error variables */ H5TOOLS_DLLVAR hid_t H5tools_ERR_STACK_g; +H5TOOLS_DLLVAR hid_t H5tools_DBG_ERR_STACK_g; H5TOOLS_DLLVAR hid_t H5tools_ERR_CLS_g; +H5TOOLS_DLLVAR hid_t H5tools_DBG_ERR_CLS_g; H5TOOLS_DLLVAR hid_t H5E_tools_g; H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g; H5TOOLS_DLLVAR hid_t H5E_tools_min_info_id_g; @@ -40,89 +42,194 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; /* * H5TOOLS_INIT_ERROR macro, used to initialize error reporting. */ -#define H5TOOLS_INIT_ERROR() { \ - H5tools_ERR_CLS_g = H5Eregister_class("H5tools", "HDF5:tools", lib_str); \ - H5E_tools_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MAJOR, "Failure in tools library"); \ - H5E_tools_min_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "error in function"); \ - H5E_tools_min_info_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function info"); \ - H5E_tools_min_dbg_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function debug"); \ -} +#define H5TOOLS_INIT_ERROR() \ +do { \ + char lib_str[256]; \ + \ + /* Initialize library version string for error class */ \ + HDsnprintf(lib_str, sizeof(lib_str), "%d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); \ + \ + /* Create new HDF5 error stack for the tools to use */ \ + if ((H5tools_ERR_STACK_g = H5Ecreate_stack()) < 0) \ + HDfprintf(stderr, "Failed to create HDF5 tools error stack\n"); \ + \ + /* Create new HDF5 error stack for debugging, if tools debugging is enabled */ \ + H5TOOLS_CREATE_DEBUG_STACK(); \ + \ + /* Register errors from the HDF5 tools as a new error class */ \ + if ((H5tools_ERR_CLS_g = H5Eregister_class("H5tools", "HDF5:tools", lib_str)) < 0) \ + HDfprintf(stderr, "Failed to register HDF5 tools error class\n"); \ + \ + /* Create a new HDF5 major error message for errors from the tools library */ \ + if ((H5E_tools_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MAJOR, "Failure in tools library")) < 0) \ + HDfprintf(stderr, "Failed to register major error message for tools library errors\n"); \ + \ + /* Create a new HDF5 minor error message for errors from the tools library */ \ + if ((H5E_tools_min_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "error in function")) < 0) \ + HDfprintf(stderr, "Failed to register minor error message for tools library errors\n"); \ + \ + /* Create a new HDF5 minor error message for info messages from the tools library */ \ + if ((H5E_tools_min_info_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function info")) < 0) \ + HDfprintf(stderr, "Failed to register minor error message for tools library info messages\n"); \ + \ + /* Create a new HDF5 minor error message for debug messages from the tools library */ \ + if ((H5E_tools_min_dbg_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function debug")) < 0) \ + HDfprintf(stderr, "Failed to register minor error message for tools library debug messages\n"); \ +} while(0) /* - * H5TOOLS_CLOSE_ERROR macro, used to initialize error reporting. + * H5TOOLS_CLOSE_ERROR macro, used to terminate error reporting. */ -#define H5TOOLS_CLOSE_ERROR() { \ - H5Eclose_msg(H5E_tools_min_dbg_id_g); \ - H5Eclose_msg(H5E_tools_min_info_id_g); \ - H5Eclose_msg(H5E_tools_min_id_g); \ - H5Eclose_msg(H5E_tools_g); \ - H5Eunregister_class(H5tools_ERR_CLS_g); \ -} +#define H5TOOLS_CLOSE_ERROR() \ +do { \ + /* Close all error messages created by H5TOOLS_INIT_ERROR() */ \ + if (H5Eclose_msg(H5E_tools_min_dbg_id_g) < 0) \ + HDfprintf(stderr, "Failed to close minor error message for tools library debug messages\n"); \ + if (H5Eclose_msg(H5E_tools_min_info_id_g) < 0) \ + HDfprintf(stderr, "Failed to close minor error message for tools library info messages\n"); \ + if (H5Eclose_msg(H5E_tools_min_id_g) < 0) \ + HDfprintf(stderr, "Failed to close minor error message for tools library errors\n"); \ + if (H5Eclose_msg(H5E_tools_g) < 0) \ + HDfprintf(stderr, "Failed to close major error message for tools library errors\n"); \ + \ + /* Unregister the HDF5 tools error class */ \ + if (H5Eunregister_class(H5tools_ERR_CLS_g) < 0) \ + HDfprintf(stderr, "Failed to unregister the HDF5 tools error class\n"); \ + \ + /* Close the tools debugging error stack, if it was created */ \ + H5TOOLS_CLOSE_DEBUG_STACK(); \ + \ + /* Close the tools error stack */ \ + if (H5Eclose_stack(H5tools_ERR_STACK_g) < 0) \ + HDfprintf(stderr, "Failed to close HDF5 tools error stack\n"); \ +} while(0) /* - * H5TOOLS_ERR_INIT macro, used to facilitate error reporting. Declaration and assignments of error variables. - * Use at the beginning of a function using error handling macros. + * H5TOOLS_PUSH_ERROR macro, used to push an error to an error stack. Not meant to + * be called directly. */ -#define H5TOOLS_ERR_INIT(ret_typ, ret_init) \ - hid_t pstack_id = H5I_INVALID_HID; \ - hid_t estack_id = H5tools_ERR_STACK_g; \ - hbool_t past_catch = FALSE; \ - ret_typ ret_value = ret_init; +#define H5TOOLS_PUSH_ERROR(estack_id, err_cls, maj_err_id, min_err_id, ...) \ +do { \ + if (estack_id >= 0 && err_cls >= 0) \ + H5Epush2(estack_id, __FILE__, FUNC, __LINE__, err_cls, maj_err_id, min_err_id, __VA_ARGS__); \ + else { \ + HDfprintf(stderr, __VA_ARGS__); \ + HDfprintf(stderr, "\n"); \ + } \ +} while(0) /* - * H5TOOLS_PUSH_STACK macro, used to create a new error stack. + * H5TOOLS_ERROR macro, used to facilitate error reporting within a function body. + * The arguments are the return value and an error string. The return value is assigned + * to a variable `ret_value'. This macro is meant to be used for reporting an error without + * having control branch to the `done' label. This is often used when an error occurs + * after the `done' label, in which case an infinite loop would ensue if control branched + * backwards. */ -#define H5TOOLS_PUSH_STACK() { \ - pstack_id = estack_id; \ - estack_id = H5Ecreate_stack(); \ -} +#define H5TOOLS_ERROR(ret_val, ...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, __VA_ARGS__); \ + ret_value = ret_val; \ +} while(0) /* - * H5TOOLS_POP_STACK macro, used to release a new error stack. + * H5TOOLS_GOTO_ERROR macro, used to facilitate error reporting within a function body. + * The arguments are the return value and an error string. The return value is assigned + * to a variable `ret_value' and control branches to the `done' label. */ -#define H5TOOLS_POP_STACK() { \ - if (H5I_INVALID_HID != pstack_id) { \ - H5Eclose_stack(estack_id); \ - estack_id = pstack_id; \ - pstack_id = H5I_INVALID_HID; \ - } \ -} +#define H5TOOLS_GOTO_ERROR(ret_val, ...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, __VA_ARGS__); \ + H5TOOLS_GOTO_DONE(ret_val); \ +} while(0) /* - * H5TOOLS_DEBUG macro, used to facilitate error reporting. The arguments are the minor error number, and a description of the error. + * H5TOOLS_GOTO_DONE macro, used to facilitate normal return within a function body. + * The argument is the return value which is assigned to the `ret_value' + * variable. Control branches to the `done' label. */ -#ifdef H5_TOOLS_DEBUG -#define H5TOOLS_DEBUG(min_id, ...) { \ - H5Epush2(estack_id, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \ -} -#define H5TOOLS_ENDDEBUG(min_id, ...) { \ - H5Epush2(estack_id, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \ - H5Eprint2(estack_id, stderr); \ -} -#else -#define H5TOOLS_DEBUG(min_id, ...) { \ - ; \ -} -#define H5TOOLS_ENDDEBUG(min_id, ...) { \ - ; \ -} -#endif +#define H5TOOLS_GOTO_DONE(ret_val) \ +do { \ + ret_value = ret_val; \ + goto done; \ +} while(0) /* - * H5TOOLS_INFO macro, used to facilitate error reporting . The arguments are the minor error number, and a description of the error. + * H5TOOLS_GOTO_DONE_NO_RET macro, used to facilitate normal return within a function body. + * Control simply branches to the `done' label without setting any return value. */ -#define H5TOOLS_INFO(min_id, ...) { \ - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \ -} +#define H5TOOLS_GOTO_DONE_NO_RET() \ +do { \ + goto done; \ +} while(0) /* - * H5TOOLS_ERROR macro, used to facilitate error reporting . The arguments are the major - * error number, the minor error number, and a description of the error. + * H5TOOLS_INFO macro, used to facilitate error reporting. The arguments are + * a description of the error. */ -#define H5TOOLS_ERROR(maj_id, min_id, ...) { \ - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, __VA_ARGS__); \ - ret_value = FAIL; \ -} +#define H5TOOLS_INFO(...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_info_id_g, __VA_ARGS__); \ +} while(0) + +#ifdef H5_TOOLS_DEBUG + +#define H5TOOLS_CREATE_DEBUG_STACK() \ +do { \ + /* Create new HDF5 error stack for debugging */ \ + if ((H5tools_DBG_ERR_STACK_g = H5Ecreate_stack()) < 0) \ + HDfprintf(stderr, "Failed to create HDF5 tools debugging error stack\n"); \ + \ + /* Register debugging output from the HDF5 tools as a new error class */ \ + if ((H5tools_DBG_ERR_CLS_g = H5Eregister_class("H5tools-debug", "HDF5:tools", lib_str)) < 0) \ + HDfprintf(stderr, "Failed to register HDF5 tools debugging error class\n"); \ +} while(0) + +#define H5TOOLS_CLOSE_DEBUG_STACK() \ +do { \ + /* Unregister the HDF5 tools debugging error class */ \ + if (H5Eunregister_class(H5tools_DBG_ERR_CLS_g) < 0) \ + HDfprintf(stderr, "Failed to unregister the HDF5 tools debugging error class\n"); \ + \ + /* Close the tools debugging error stack */ \ + if (H5Eclose_stack(H5tools_DBG_ERR_STACK_g) < 0) \ + HDfprintf(stderr, "Failed to close HDF5 tools debugging error stack\n"); \ +} while(0) + +#define H5TOOLS_DEBUG(...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_DBG_ERR_STACK_g, H5tools_DBG_ERR_CLS_g, H5E_tools_g, H5E_tools_min_dbg_id_g, __VA_ARGS__); \ +} while(0) + +#define H5TOOLS_ENDDEBUG(...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_DBG_ERR_STACK_g, H5tools_DBG_ERR_CLS_g, H5E_tools_g, H5E_tools_min_dbg_id_g, __VA_ARGS__); \ + H5Eprint2(H5tools_DBG_ERR_STACK_g, stderr); \ +} while(0) + +#else + +#define H5TOOLS_CREATE_DEBUG_STACK() \ +do { \ + ; \ +} while(0) + +#define H5TOOLS_CLOSE_DEBUG_STACK() \ +do { \ + ; \ +} while(0) + +#define H5TOOLS_DEBUG(...) \ +do { \ + ; \ +} while(0) + +#define H5TOOLS_ENDDEBUG(...) \ +do { \ + ; \ +} while(0) + +#endif /* Macro for "catching" flow of control when an error occurs. Note that the @@ -151,28 +258,11 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; * The return value is assigned to a variable `ret_value' and control branches * to the `catch_except' label, if we're not already past it. */ -#define H5TOOLS_THROW(fail_value, min_id, ...) { \ - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \ - H5_LEAVE(fail_value) \ -} - -/* - * H5TOOLS_GOTO_ERROR macro, used to facilitate error reporting within a function body. The arguments are - * the major error number, the minor error number, the return value, and an - * error string. The return value is assigned to a variable `ret_value' and - * control branches to the `done' label. - */ -#define H5TOOLS_GOTO_ERROR(fail_value, min_id, ...) { \ - H5TOOLS_ERROR(H5E_tools_g, min_id, __VA_ARGS__); \ - HGOTO_DONE(fail_value) \ -} - -/* - * HGOTO_DONE macro, used to facilitate normal return within a function body. - * The argument is the return value which is assigned to the `ret_value' - * variable. Control branches to the `done' label. - */ -/* #define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;} defined in H5Eprivate.h */ +#define H5TOOLS_THROW(ret_val, ...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, __VA_ARGS__); \ + H5_LEAVE(ret_val) \ +} while(0) #endif /* H5TOOLS_ERROR_H_ */ diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index aafc7ba..0e4c476 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -43,24 +43,24 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean print */ hid_t dcpl_id) /* dataset creation property list */ { - int ret_value = 1; int nfilters; /* number of filters */ H5Z_filter_t filtn; /* filter identification number */ int i; /* index */ int udfilter_avail; /* index */ + int ret_value = 1; /* get information about filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_nfilters failed"); /* if we do not have filters, we can read the dataset safely */ if (!nfilters) - HGOTO_DONE(1); + H5TOOLS_GOTO_DONE(1); /* check availability of filters */ for (i = 0; i < nfilters; i++) { if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, 0, 0, 0, (size_t) 0, 0, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_filter2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_filter2 failed"); switch (filtn) { /*------------------------------------------------------------------------- @@ -69,7 +69,7 @@ h5tools_canreadf(const char* name, /* object name, serves also as boolean pr */ default: if ((udfilter_avail = H5Zfilter_avail(filtn)) < 0) { - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Zfilter_avail failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Zfilter_avail failed"); } else if (!udfilter_avail) { if (name) @@ -149,41 +149,42 @@ h5tools_can_encode(H5Z_filter_t filtn) switch (filtn) { /* user defined filter */ default: - HGOTO_DONE(0) + H5TOOLS_GOTO_DONE(0); + break; case H5Z_FILTER_DEFLATE: #ifndef H5_HAVE_FILTER_DEFLATE - HGOTO_DONE(0) + H5TOOLS_GOTO_DONE(0); #endif break; case H5Z_FILTER_SZIP: #ifndef H5_HAVE_FILTER_SZIP - HGOTO_DONE(0) + H5TOOLS_GOTO_DONE(0); #else { unsigned int filter_config_flags; if (H5Zget_filter_info(filtn, &filter_config_flags) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Zget_filter_info failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Zget_filter_info failed"); if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { /* filter present but neither encode nor decode is supported (???) */ - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "neither encode nor decode is supported"); + H5TOOLS_GOTO_ERROR(FAIL, "neither encode nor decode is supported"); } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) { /* decoder only: read but not write */ - HGOTO_DONE(0) + H5TOOLS_GOTO_DONE(0); } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) { /* encoder only: write but not read (???) */ - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "encoder only: write but not read"); + H5TOOLS_GOTO_ERROR(FAIL, "encoder only: write but not read"); } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) { - HGOTO_DONE(1) + H5TOOLS_GOTO_DONE(1); } } #endif diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index e98a8e2..0e1fa03 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -17,6 +17,7 @@ #include "h5tools.h" #include "h5tools_utils.h" #include "h5trav.h" +#include "H5VLnative_private.h" /* @@ -34,14 +35,14 @@ */ typedef struct { - haddr_t objno; /* Object ID (i.e. address) */ - char *path; /* Object path */ + H5O_token_t obj_token; /* Object token */ + char *path; /* Object path */ } ref_path_node_t; static H5SL_t *ref_path_table = NULL; /* the "table" (implemented with a skip list) */ static hid_t thefile = (-1); -static int ref_path_table_put(const char *, haddr_t objno); +static int ref_path_table_put(const char *, const H5O_token_t *token); /*------------------------------------------------------------------------- * Function: free_ref_path_info @@ -80,19 +81,47 @@ free_ref_path_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op *------------------------------------------------------------------------- */ static herr_t -init_ref_path_cb(const char *obj_name, const H5O_info_t *oinfo, +init_ref_path_cb(const char *obj_name, const H5O_info2_t *oinfo, const char *already_seen, void H5_ATTR_UNUSED *_udata) { /* Check if the object is already in the path table */ if(NULL == already_seen) { /* Insert the object into the path table */ - ref_path_table_put(obj_name, oinfo->addr); + ref_path_table_put(obj_name, &oinfo->token); } /* end if */ return 0; } /*------------------------------------------------------------------------- + * Function: ref_path_table_cmp + * + * Purpose: Skip list key comparison function which compares two + * H5O_token_t objects. + * + * Return: Negative (if token2 is greater than token1) + * 0 (if tokens are equal) + * or + * Positive (if token1 is greater than token2) + * + *------------------------------------------------------------------------- + */ +static int +ref_path_table_cmp(const void *key1, const void *key2) +{ + const H5O_token_t *token1 = (const H5O_token_t *)key1; + const H5O_token_t *token2 = (const H5O_token_t *)key2; + int cmp_value = 0; + + if(thefile > 0) + H5Otoken_cmp(thefile, token1, token2, &cmp_value); + else + cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t)); + + return cmp_value; +} + +/*------------------------------------------------------------------------- * Function: init_ref_path_table * * Purpose: Initalize the reference path table @@ -109,7 +138,7 @@ init_ref_path_table(void) /* Sanity check */ if(thefile > 0) { /* Create skip list to store reference path information */ - if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, NULL))==NULL) + if((ref_path_table = H5SL_create(H5SL_TYPE_GENERIC, ref_path_table_cmp)) == NULL) return (-1); /* Iterate over objects in this file */ @@ -153,8 +182,10 @@ term_ref_path_table(void) * Purpose: Looks up a table entry given a path name. * Used during construction of the table. * - * Return: The table entre (pte) or NULL if not in the - * table. + * Return: Negative on failure, Non-negative on success. The object + * token for the table entry is returned through the token + * parameter if the table entry is found by the given path + * name. * * Programmer: REMcG * @@ -162,33 +193,35 @@ term_ref_path_table(void) * *------------------------------------------------------------------------- */ -haddr_t -ref_path_table_lookup(const char *thepath) +int +ref_path_table_lookup(const char *thepath, H5O_token_t *token) { - H5O_info_t oi; + H5O_info2_t oi; if((thepath == NULL) || (HDstrlen(thepath) == 0)) - return HADDR_UNDEF; + return -1; /* Allow lookups on the root group, even though it doesn't have any link info */ if(HDstrcmp(thepath, "/")) { - H5L_info_t li; + H5L_info2_t li; /* Check for external link first, so we don't return the OID of an object in another file */ - if(H5Lget_info(thefile, thepath, &li, H5P_DEFAULT) < 0) - return HADDR_UNDEF; + if(H5Lget_info2(thefile, thepath, &li, H5P_DEFAULT) < 0) + return -1; /* UD links can't be followed, so they always "dangle" like soft links. */ if(li.type >= H5L_TYPE_UD_MIN) - return HADDR_UNDEF; + return -1; } /* end if */ /* Get the object info now */ /* (returns failure for dangling soft links) */ - if(H5Oget_info_by_name2(thefile, thepath, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - return HADDR_UNDEF; + if(H5Oget_info_by_name3(thefile, thepath, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + return -1; - /* Return OID */ - return(oi.addr); + /* Return object token through parameter */ + HDmemcpy(token, &oi.token, sizeof(H5O_token_t)); + + return 0; } /*------------------------------------------------------------------------- @@ -211,7 +244,7 @@ ref_path_table_lookup(const char *thepath) *------------------------------------------------------------------------- */ static int -ref_path_table_put(const char *path, haddr_t objno) +ref_path_table_put(const char *path, const H5O_token_t *token) { ref_path_node_t *new_node; @@ -219,10 +252,10 @@ ref_path_table_put(const char *path, haddr_t objno) if((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL) return(-1); - new_node->objno = objno; + HDmemcpy(&new_node->obj_token, token, sizeof(H5O_token_t)); new_node->path = HDstrdup(path); - return(H5SL_insert(ref_path_table, new_node, &(new_node->objno))); + return(H5SL_insert(ref_path_table, new_node, &(new_node->obj_token))); } else return (-1); @@ -239,46 +272,50 @@ int get_next_xid(void) { /* * This counter is used to create fake object ID's - * The idea is to set it to the largest possible offest, which + * The idea is to set it to the largest possible offset, which * minimizes the chance of collision with a real object id. * */ haddr_t fake_xid = HADDR_MAX; -haddr_t -get_fake_xid (void) { - return (fake_xid--); + +void +get_fake_token(H5O_token_t *token) { + if(thefile > 0) { + /* TODO: potential for this to be called with non-native connector objects */ + if(H5VLnative_addr_to_token(thefile, fake_xid, token) < 0) + *token = H5O_TOKEN_UNDEF; + fake_xid--; + } + else + *token = H5O_TOKEN_UNDEF; } /* - * for an object that does not have an object id (e.g., soft link), - * create a table entry with a fake object id as the key. + * for an object that does not have an object token (e.g., soft link), + * create a table entry with a fake object token as the key. * * Assumes 'path' is for an object that is not in the table. * */ -haddr_t -ref_path_table_gen_fake(const char *path) +void +ref_path_table_gen_fake(const char *path, H5O_token_t *token) { - haddr_t fake_objno; - - /* Generate fake ID for string */ - fake_objno = get_fake_xid(); + /* Generate fake object token for string */ + get_fake_token(token); /* Create ref path table, if it hasn't already been created */ if(ref_path_table == NULL) init_ref_path_table(); /* Insert "fake" object into table */ - ref_path_table_put(path, fake_objno); - - return(fake_objno); + ref_path_table_put(path, token); } /*------------------------------------------------------------------------- * Function: lookup_ref_path * - * Purpose: Lookup the path to the object with refernce 'ref'. + * Purpose: Lookup the path to the object with the reference 'refbuf'. * * Return: Return a path to the object, or NULL if not found. * @@ -289,19 +326,48 @@ ref_path_table_gen_fake(const char *path) *------------------------------------------------------------------------- */ const char * -lookup_ref_path(haddr_t ref) +lookup_ref_path(H5R_ref_t refbuf) { + H5O_info2_t oinfo; + H5R_type_t ref_type; + hid_t ref_object; ref_path_node_t *node; /* Be safer for h5ls */ if(thefile < 0) return(NULL); + /* Retrieve reference type */ + if(H5R_BADTYPE == (ref_type = H5Rget_type(&refbuf))) + return(NULL); + + /* Open the referenced object */ + switch (ref_type) { + case H5R_OBJECT1: + case H5R_OBJECT2: + if((ref_object = H5Ropen_object(&refbuf, H5P_DEFAULT, H5P_DEFAULT)) < 0) + return(NULL); + break; + + /* Invalid referenced object type */ + case H5R_DATASET_REGION1: + case H5R_DATASET_REGION2: + case H5R_ATTR: + case H5R_MAXTYPE: + case H5R_BADTYPE: + default: + return(NULL); + } + + /* Retrieve info about the referenced object */ + if(H5Oget_info3(ref_object, &oinfo, H5O_INFO_ALL) < 0) + return(NULL); + /* Create ref path table, if it hasn't already been created */ if(ref_path_table == NULL) init_ref_path_table(); - node = (ref_path_node_t *)H5SL_search(ref_path_table, &ref); + node = (ref_path_node_t *)H5SL_search(ref_path_table, &oinfo.token); return(node ? node->path : NULL); } diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h index b7bd9a3..debbea1 100644 --- a/tools/lib/h5tools_ref.h +++ b/tools/lib/h5tools_ref.h @@ -21,11 +21,11 @@ extern "C" { #endif H5TOOLS_DLL herr_t fill_ref_path_table(hid_t fid); -H5TOOLS_DLL const char *lookup_ref_path(haddr_t ref); +H5TOOLS_DLL const char *lookup_ref_path(H5R_ref_t refbuf); H5TOOLS_DLL int get_next_xid(void); -H5TOOLS_DLL haddr_t get_fake_xid(void); -H5TOOLS_DLL haddr_t ref_path_table_lookup(const char *); -H5TOOLS_DLL haddr_t ref_path_table_gen_fake(const char *); +H5TOOLS_DLL void get_fake_token(H5O_token_t *token); +H5TOOLS_DLL int ref_path_table_lookup(const char *thepath, H5O_token_t *token); +H5TOOLS_DLL void ref_path_table_gen_fake(const char *path, H5O_token_t *token); H5TOOLS_DLL int term_ref_path_table(void); #ifdef __cplusplus diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index f35fdab..c9e7e94 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -289,27 +289,25 @@ char * h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx) { - H5TOOLS_ERR_INIT(int, SUCCEED) size_t i = 0; hsize_t curr_pos = elmtno; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); + H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); h5tools_str_reset(str); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ndims=%d", ndims); + H5TOOLS_DEBUG("ndims=%d", ndims); if(ndims > 0) { /* * Calculate the number of elements represented by a unit change in a * certain index position. */ for(i = 0; i < (size_t) ndims; i++) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "curr_pos=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->acc[i]); + H5TOOLS_DEBUG("curr_pos=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->acc[i]); ctx->pos[i] = curr_pos / ctx->acc[i]; curr_pos -= ctx->acc[i] * ctx->pos[i]; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "curr_pos=%ld - ctx->pos[%d]=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->pos[i], i, ctx->acc[i]); + H5TOOLS_DEBUG("curr_pos=%ld - ctx->pos[%d]=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->pos[i], i, ctx->acc[i]); } HDassert(curr_pos == 0); @@ -325,10 +323,9 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, } else /* Scalar */ h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)elmtno); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "str=%s", str->s); + H5TOOLS_DEBUG("str=%s", str->s); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); /* Add prefix and suffix to the index */ return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: ")); @@ -684,7 +681,6 @@ char * h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, hid_t type, void *vp, h5tools_context_t *ctx) { - H5TOOLS_ERR_INIT(char*, NULL) size_t nsize, offset, size=0, nelmts, start; H5T_sign_t nsign; char *name = NULL; @@ -695,9 +691,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai static char fmt_llong[8], fmt_ullong[8]; H5T_str_t pad; H5T_class_t type_class; + char *ret_value = NULL; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); /* Build default formats for long long types */ if(!fmt_llong[0]) { HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH); @@ -726,7 +722,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai return NULL; switch (type_class) { case H5T_FLOAT: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_FLOAT"); + H5TOOLS_DEBUG("H5T_FLOAT"); if(sizeof(float) == nsize) { /* if (H5Tequal(type, H5T_NATIVE_FLOAT)) */ float tempfloat; @@ -758,7 +754,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai char quote = '\0'; char *s; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_STRING"); + H5TOOLS_DEBUG("H5T_STRING"); quote = '\0'; if(H5Tis_variable_str(type)) { /* cp_vp is the pointer into the struct where a `char*' is stored. So we have @@ -833,7 +829,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai break; case H5T_INTEGER: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_INTEGER"); + H5TOOLS_DEBUG("H5T_INTEGER"); if(sizeof(char) == nsize) { if(info->ascii) h5tools_print_char(str, info, (char) (*ucp_vp)); @@ -971,7 +967,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai break; case H5T_COMPOUND: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_COMPOUND"); + H5TOOLS_DEBUG("H5T_COMPOUND"); if(ctx->cmpd_listv) { /* there is <list_of_fields> */ unsigned save_indent_level; /* The indentation level */ size_t curr_field; /* Current field to display */ @@ -1073,7 +1069,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai { char enum_name[1024]; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_ENUM"); + H5TOOLS_DEBUG("H5T_ENUM"); if(H5Tenum_nameof(type, vp, enum_name, sizeof enum_name) >= 0) h5tools_str_append(str, h5tools_escape(enum_name, sizeof(enum_name))); else { @@ -1088,34 +1084,32 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai break; case H5T_REFERENCE: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_REFERENCE"); + H5TOOLS_DEBUG("H5T_REFERENCE"); if(h5tools_str_is_zero(vp, nsize)) h5tools_str_append(str, "NULL"); else { if (H5Tequal(type, H5T_STD_REF)) { - H5O_type_t obj_type; /* Object type */ + H5O_type_t obj_type = -1; /* Object type */ H5R_type_t ref_type; /* Reference type */ - const H5R_ref_t *ref_vp = (const H5R_ref_t *)vp; + H5R_ref_t *ref_vp = (H5R_ref_t *)vp; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_REFERENCE:H5T_STD_REF"); + H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF"); ref_type = H5Rget_type(ref_vp); H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type); switch (ref_type) { case H5R_OBJECT1: { /* Object references -- show the type and OID of the referenced object. */ - H5O_info_t oi; + H5O_info2_t oi; + char *obj_addr_str = NULL; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT1"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); if((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { - H5Oget_info2(obj, &oi, H5O_INFO_BASIC); - if(H5Oclose(obj) < 0) - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Oclose H5R_OBJECT1 failed"); + H5Oget_info3(obj, &oi, H5O_INFO_BASIC); + H5Otoken_to_str(obj, &oi.token, &obj_addr_str); } else - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5R_OBJECT1 failed"); + H5TOOLS_ERROR(NULL, "H5Ropen_object H5R_OBJECT1 failed"); /* Print object type and close object */ switch (obj_type) { @@ -1135,26 +1129,36 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: - h5tools_str_append(str, "%u-", (unsigned) oi.type); + h5tools_str_append(str, "%u-%s", (unsigned) oi.type, H5_TOOLS_UNKNOWN); break; } /* end switch */ - H5Oclose(obj); - h5tools_str_sprint_reference(str, info, container, ref_vp); + + h5tools_str_sprint_reference(str, ref_vp); /* Print OID */ if(info->obj_hidefileno) - h5tools_str_append(str, info->obj_format, oi.addr); + h5tools_str_append(str, info->obj_format, obj_addr_str); else - h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr); + h5tools_str_append(str, info->obj_format, oi.fileno, obj_addr_str); + + if(obj_addr_str) { + H5free_memory(obj_addr_str); + obj_addr_str = NULL; } + + if(obj >= 0) + if(H5Oclose(obj) < 0) + H5TOOLS_ERROR(NULL, "H5Oclose H5R_OBJECT1 failed"); + } + break; case H5R_DATASET_REGION1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION1"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); h5tools_str_append(str, H5_TOOLS_DATASET); - h5tools_str_sprint_reference(str, info, container, ref_vp); + h5tools_str_sprint_reference(str, ref_vp); break; case H5R_OBJECT2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); switch (obj_type) { case H5O_TYPE_GROUP: h5tools_str_append(str, H5_TOOLS_GROUP); @@ -1172,34 +1176,35 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: + h5tools_str_append(str, H5_TOOLS_UNKNOWN); break; } /* end switch */ - h5tools_str_sprint_reference(str, info, container, ref_vp); + h5tools_str_sprint_reference(str, ref_vp); break; case H5R_DATASET_REGION2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); h5tools_str_append(str, H5_TOOLS_DATASET); - h5tools_str_sprint_reference(str, info, container, ref_vp); + h5tools_str_sprint_reference(str, ref_vp); break; case H5R_ATTR: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_ATTR"); + H5TOOLS_DEBUG("ref_type is H5R_ATTR"); h5tools_str_append(str, H5_TOOLS_ATTRIBUTE); - h5tools_str_sprint_reference(str, info, container, ref_vp); + h5tools_str_sprint_reference(str, ref_vp); break; case H5R_BADTYPE: case H5R_MAXTYPE: default: break; } /* end switch */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_REFERENCE:H5T_STD_REF end"); + H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF end"); } else if (H5Tequal(type, H5T_STD_REF_DSETREG)) { /* if(nsize == H5R_DSET_REG_REF_BUF_SIZE) */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_REFERENCE:H5T_STD_REF_DSETREG"); + H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_DSETREG"); } else if (H5Tequal(type, H5T_STD_REF_OBJ)) { /* if (nsize == H5R_OBJ_REF_BUF_SIZE) */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_REFERENCE:H5T_STD_REF_OBJ"); + H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_OBJ"); } /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */ } break; @@ -1210,7 +1215,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai hsize_t i, dims[H5S_MAX_RANK], temp_nelmts; static int is_next_arry_elmt = 0; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_ARRAY"); + H5TOOLS_DEBUG("H5T_ARRAY"); /* Get the array's base datatype for each element */ memb = H5Tget_super(type); size = H5Tget_size(memb); @@ -1272,7 +1277,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai { unsigned int i; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_VLEN"); + H5TOOLS_DEBUG("H5T_VLEN"); /* Get the VL sequences's base datatype for each element */ memb = H5Tget_super(type); size = H5Tget_size(memb); @@ -1319,9 +1324,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai case H5T_BITFIELD: case H5T_OPAQUE: { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "OTHER"); /* All other types get printed as hexadecimal */ size_t i; + + H5TOOLS_DEBUG("OTHER"); if(1 == nsize) h5tools_str_append(str, "0x%02x", ucp_vp[0]); else @@ -1337,11 +1343,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai break; } /* end switch */ } -CATCH + ret_value = h5tools_str_fmt(str, start, OPT(info->elmt_fmt, "%s")); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit with %s", ret_value); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit with %s", ret_value); return ret_value; } @@ -1355,35 +1360,32 @@ CATCH *------------------------------------------------------------------------- */ void -h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info, - hid_t container, H5R_ref_t *ref_vp) +h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *ref_vp) { - H5TOOLS_ERR_INIT(int, SUCCEED) - ssize_t buf_size; + ssize_t buf_size; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); h5tools_str_append(str, " \""); buf_size = H5Rget_file_name(ref_vp, NULL, 0); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "buf_size=%ld", buf_size); + H5TOOLS_DEBUG("buf_size=%ld", buf_size); if (buf_size) { char *file_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); - if (H5Rget_file_name(ref_vp, file_name, buf_size + 1) >= 0) { + if (H5Rget_file_name(ref_vp, file_name, (size_t)buf_size + 1) >= 0) { file_name[buf_size] = '\0'; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "name=%s", file_name); + H5TOOLS_DEBUG("name=%s", file_name); h5tools_str_append(str, "%s", file_name); } HDfree(file_name); } buf_size = H5Rget_obj_name(ref_vp, H5P_DEFAULT, NULL, 0); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "buf_size=%ld", buf_size); + H5TOOLS_DEBUG("buf_size=%ld", buf_size); if (buf_size) { char *obj_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); - if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, obj_name, buf_size + 1) >= 0) { + if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, obj_name, (size_t)buf_size + 1) >= 0) { obj_name[buf_size] = '\0'; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "name=%s", obj_name); + H5TOOLS_DEBUG("name=%s", obj_name); h5tools_str_append(str, "%s", obj_name); } HDfree(obj_name); @@ -1391,12 +1393,12 @@ h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info, if (H5Rget_type(ref_vp) == H5R_ATTR) { buf_size = H5Rget_attr_name(ref_vp, NULL, 0); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "buf_size=%ld", buf_size); + H5TOOLS_DEBUG("buf_size=%ld", buf_size); if (buf_size) { char *attr_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); - if (H5Rget_attr_name(ref_vp, attr_name, buf_size + 1) >= 0) { + if (H5Rget_attr_name(ref_vp, attr_name, (size_t)buf_size + 1) >= 0) { attr_name[buf_size] = '\0'; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "name=%s", attr_name); + H5TOOLS_DEBUG("name=%s", attr_name); h5tools_str_append(str, "/%s", attr_name); } HDfree(attr_name); @@ -1404,9 +1406,7 @@ h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info, } h5tools_str_append(str, "\""); -CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); } /*------------------------------------------------------------------------- diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h index 6fdf36a..02bfe40 100644 --- a/tools/lib/h5tools_str.h +++ b/tools/lib/h5tools_str.h @@ -41,7 +41,7 @@ H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_ H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5tool_format_t *, h5tools_context_t *ctx); H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *); H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *); -H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, H5R_ref_t *vp); +H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *vp); H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, hid_t type, void *vp, h5tools_context_t *ctx); diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c index f63c228..22e4a39 100644 --- a/tools/lib/h5tools_type.c +++ b/tools/lib/h5tools_type.c @@ -26,7 +26,7 @@ hid_t h5tools_get_little_endian_type(hid_t tid) { - hid_t p_type=-1; + hid_t p_type=H5I_INVALID_HID; H5T_class_t type_class; size_t size; H5T_sign_t sign; @@ -106,7 +106,7 @@ h5tools_get_little_endian_type(hid_t tid) hid_t h5tools_get_big_endian_type(hid_t tid) { - hid_t p_type = -1; + hid_t p_type = H5I_INVALID_HID; H5T_class_t type_class; size_t size; H5T_sign_t sign; diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 7b47f4d..45e436c 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -53,11 +53,11 @@ unsigned outBuffOffset; FILE* overflow_file = NULL; /* local functions */ -static void init_table(table_t **tbl); +static void init_table(hid_t fid, table_t **tbl); #ifdef H5DUMP_DEBUG -static void dump_table(char* tablename, table_t *table); +static void dump_table(hid_t fid, char* tablename, table_t *table); #endif /* H5DUMP_DEBUG */ -static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t recorded); +static void add_obj(table_t *table, const H5O_token_t *obj_token, const char *objname, hbool_t recorded); /*------------------------------------------------------------------------- * Function: parallel_print @@ -599,10 +599,11 @@ print_version(const char *progname) *------------------------------------------------------------------------- */ static void -init_table(table_t **tbl) +init_table(hid_t fid, table_t **tbl) { table_t *table = (table_t *)HDmalloc(sizeof(table_t)); + table->fid = fid; table->size = 20; table->nobjs = 0; table->objs = (obj_t *)HDmalloc(table->size * sizeof(obj_t)); @@ -644,15 +645,21 @@ free_table(table_t *table) *------------------------------------------------------------------------- */ static void -dump_table(char* tablename, table_t *table) +dump_table(hid_t fid, char* tablename, table_t *table) { unsigned u; + char *obj_addr_str = NULL; PRINTSTREAM(rawoutstream,"%s: # of entries = %d\n", tablename,table->nobjs); - for (u = 0; u < table->nobjs; u++) - PRINTSTREAM(rawoutstream,"%a %s %d %d\n", table->objs[u].objno, + for (u = 0; u < table->nobjs; u++) { + H5VLconnector_token_to_str(fid, table->objs[u].obj_token, &obj_addr_str); + + PRINTSTREAM(rawoutstream,"%s %s %d %d\n", obj_addr_str, table->objs[u].objname, table->objs[u].displayed, table->objs[u].recorded); + + H5VLfree_token_str(fid, obj_addr_str); + } } @@ -667,9 +674,9 @@ dump_table(char* tablename, table_t *table) void dump_tables(find_objs_t *info) { - dump_table("group_table", info->group_table); - dump_table("dset_table", info->dset_table); - dump_table("type_table", info->type_table); + dump_table(info->fid, "group_table", info->group_table); + dump_table(info->fid, "dset_table", info->dset_table); + dump_table(info->fid, "type_table", info->type_table); } #endif /* H5DUMP_DEBUG */ @@ -685,13 +692,17 @@ dump_tables(find_objs_t *info) *------------------------------------------------------------------------- */ H5_ATTR_PURE obj_t * -search_obj(table_t *table, haddr_t objno) +search_obj(table_t *table, const H5O_token_t *obj_token) { unsigned u; + int token_cmp; - for(u = 0; u < table->nobjs; u++) - if(table->objs[u].objno == objno) + for(u = 0; u < table->nobjs; u++) { + if(H5Otoken_cmp(table->fid, &table->objs[u].obj_token, obj_token, &token_cmp) < 0) + return NULL; + if(!token_cmp) return &(table->objs[u]); + } return NULL; } @@ -708,7 +719,7 @@ search_obj(table_t *table, haddr_t objno) *------------------------------------------------------------------------- */ static herr_t -find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen, void *op_data) +find_objs_cb(const char *name, const H5O_info2_t *oinfo, const char *already_seen, void *op_data) { find_objs_t *info = (find_objs_t*)op_data; herr_t ret_value = 0; @@ -716,26 +727,26 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen switch(oinfo->type) { case H5O_TYPE_GROUP: if(NULL == already_seen) - add_obj(info->group_table, oinfo->addr, name, TRUE); + add_obj(info->group_table, &oinfo->token, name, TRUE); break; case H5O_TYPE_DATASET: if(NULL == already_seen) { - hid_t dset = -1; + hid_t dset = H5I_INVALID_HID; /* Add the dataset to the list of objects */ - add_obj(info->dset_table, oinfo->addr, name, TRUE); + add_obj(info->dset_table, &oinfo->token, name, TRUE); /* Check for a dataset that uses a named datatype */ if((dset = H5Dopen2(info->fid, name, H5P_DEFAULT)) >= 0) { hid_t type = H5Dget_type(dset); if(H5Tcommitted(type) > 0) { - H5O_info_t type_oinfo; + H5O_info2_t type_oinfo; - H5Oget_info2(type, &type_oinfo, H5O_INFO_BASIC); - if(search_obj(info->type_table, type_oinfo.addr) == NULL) - add_obj(info->type_table, type_oinfo.addr, name, FALSE); + H5Oget_info3(type, &type_oinfo, H5O_INFO_BASIC); + if(search_obj(info->type_table, &type_oinfo.token) == NULL) + add_obj(info->type_table, &type_oinfo.token, name, FALSE); } /* end if */ H5Tclose(type); @@ -750,8 +761,8 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen if(NULL == already_seen) { obj_t *found_obj; - if((found_obj = search_obj(info->type_table, oinfo->addr)) == NULL) - add_obj(info->type_table, oinfo->addr, name, TRUE); + if((found_obj = search_obj(info->type_table, &oinfo->token)) == NULL) + add_obj(info->type_table, &oinfo->token, name, TRUE); else { /* Use latest version of name */ HDfree(found_obj->objname); @@ -791,9 +802,9 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, herr_t ret_value = SUCCEED; /* Initialize the tables */ - init_table(group_table); - init_table(dset_table); - init_table(type_table); + init_table(fid, group_table); + init_table(fid, dset_table); + init_table(fid, type_table); /* Init the find_objs_t */ info->fid = fid; @@ -803,7 +814,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, /* Find all shared objects */ if((ret_value = h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "finding shared objects failed") + H5TOOLS_GOTO_ERROR(FAIL, "finding shared objects failed"); done: /* Release resources */ @@ -829,7 +840,7 @@ done: *------------------------------------------------------------------------- */ static void -add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record) +add_obj(table_t *table, const H5O_token_t *obj_token, const char *objname, hbool_t record) { size_t u; @@ -843,7 +854,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record) u = table->nobjs++; /* Set information about object */ - table->objs[u].objno = objno; + HDmemcpy(&table->objs[u].obj_token, obj_token, sizeof(H5O_token_t)); table->objs[u].objname = HDstrdup(objname); table->objs[u].recorded = record; table->objs[u].displayed = 0; @@ -893,7 +904,7 @@ int H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type) { htri_t l_ret; - H5O_info_t trg_oinfo; + H5O_info2_t trg_oinfo; hid_t fapl = H5P_DEFAULT; hid_t lapl = H5P_DEFAULT; int ret_value = -1; /* init to fail */ @@ -904,39 +915,39 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ /* if path is root, return group type */ if(!HDstrcmp(linkpath,"/")) { link_info->trg_type = H5O_TYPE_GROUP; - HGOTO_DONE(2); + H5TOOLS_GOTO_DONE(2); } /* check if link itself exist */ if(H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: link <%s> doesn't exist \n",linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* get info from link */ - if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) { + if(H5Lget_info2(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to get link info from <%s>\n",linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* given path is hard link (object) */ if(link_info->linfo.type == H5L_TYPE_HARD) - HGOTO_DONE(2); + H5TOOLS_GOTO_DONE(2); /* trg_path must be freed out of this function when finished using */ if((link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to allocate buffer for <%s>\n",linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* get link value */ if(H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to get link value from <%s>\n",linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /*----------------------------------------------------- @@ -945,13 +956,13 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ */ if(link_info->linfo.type == H5L_TYPE_EXTERNAL) { if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); if(H5Pset_fapl_sec2(fapl) < 0) - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0) - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); if(H5Pset_elink_fapl(lapl, fapl) < 0) - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* Check for retrieving object info */ @@ -964,29 +975,29 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ /* detect dangling link */ if(l_ret == FALSE) { - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } else if(l_ret < 0) { /* function failed */ - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* get target object info */ - if(H5Oget_info_by_name2(file_id, linkpath, &trg_oinfo, H5O_INFO_BASIC, lapl) < 0) { + if(H5Oget_info_by_name3(file_id, linkpath, &trg_oinfo, H5O_INFO_BASIC, lapl) < 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to get object information for <%s>\n", linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* check unknown type */ if(trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: target object of <%s> is unknown type\n", linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* set target obj type to return */ + HDmemcpy(&link_info->obj_token, &trg_oinfo.token, sizeof(H5O_token_t)); link_info->trg_type = trg_oinfo.type; - link_info->objno = trg_oinfo.addr; link_info->fileno = trg_oinfo.fileno; } /* end if */ else @@ -1049,14 +1060,14 @@ h5tools_getenv_update_hyperslab_bufsize(void) { const char *env_str = NULL; long hyperslab_bufsize_mb; - int ret_value = 1; + int ret_value = 1; /* check if environment variable is set for the hyperslab buffer size */ if (NULL != (env_str = HDgetenv ("H5TOOLS_BUFSIZE"))) { errno = 0; hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10); if (errno != 0 || hyperslab_bufsize_mb <= 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "hyperslab buffer size failed"); + H5TOOLS_GOTO_ERROR(FAIL, "hyperslab buffer size failed"); /* convert MB to byte */ H5TOOLS_BUFSIZE = (hsize_t)hyperslab_bufsize_mb * 1024 * 1024; diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 17c16bf..366800a 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -95,14 +95,15 @@ H5TOOLS_DLL int get_option(int argc, const char **argv, const char *opt, const s /*struct taken from the dumper. needed in table struct*/ typedef struct obj_t { - haddr_t objno; - char *objname; - hbool_t displayed; /* Flag to indicate that the object has been displayed */ - hbool_t recorded; /* Flag for named datatypes to indicate they were found in the group hierarchy */ + H5O_token_t obj_token; + char *objname; + hbool_t displayed; /* Flag to indicate that the object has been displayed */ + hbool_t recorded; /* Flag for named datatypes to indicate they were found in the group hierarchy */ } obj_t; /*struct for the tables that the find_objs function uses*/ typedef struct table_t { + hid_t fid; size_t size; size_t nobjs; obj_t *objs; @@ -131,7 +132,7 @@ H5TOOLS_DLL void free_table(table_t *table); H5TOOLS_DLL void dump_tables(find_objs_t *info) #endif /* H5DUMP_DEBUG */ H5TOOLS_DLL herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table, table_t **dset_table, table_t **type_table); -H5TOOLS_DLL obj_t *search_obj(table_t *temp, haddr_t objno); +H5TOOLS_DLL obj_t *search_obj(table_t *temp, const H5O_token_t *obj_token); #ifndef H5_HAVE_TMPFILE H5TOOLS_DLL FILE *tmpfile(void); #endif @@ -158,9 +159,9 @@ typedef struct { H5O_type_t trg_type; /* OUT: target type */ 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 */ + H5O_token_t obj_token; /* OUT: target object token */ unsigned long fileno; /* OUT: File number that target object is located in */ - H5L_info_t linfo; /* OUT: link info */ + H5L_info2_t linfo; /* OUT: link info */ h5tool_opt_t opt; /* IN: options */ } h5tool_link_info_t; diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 4f4f42a..dc7e27d 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -21,7 +21,7 @@ *------------------------------------------------------------------------- */ typedef struct trav_addr_path_t { - haddr_t addr; + H5O_token_t token; char *path; } trav_addr_path_t; @@ -43,7 +43,7 @@ typedef struct { hbool_t is_absolute; /* Whether the traversal has absolute paths */ const char *base_grp_name; /* Name of the group that serves as the base * for iteration */ - unsigned fields; /* Fields needed in H5O_info_t struct */ + unsigned fields; /* Fields needed in H5O_info2_t struct */ } trav_ud_traverse_t; typedef struct { @@ -65,10 +65,10 @@ typedef struct trav_path_op_data_t { */ static void trav_table_add(trav_table_t *table, const char *objname, - const H5O_info_t *oinfo); + const H5O_info2_t *oinfo); static void trav_table_addlink(trav_table_t *table, - haddr_t objno, + const H5O_token_t *obj_token, const char *path); /*------------------------------------------------------------------------- @@ -114,17 +114,17 @@ h5trav_set_verbose(int print_verbose) *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- - * Function: trav_addr_add + * Function: trav_token_add * - * Purpose: Add a hardlink address to visited data structure + * Purpose: Add an object token to visited data structure * * Return: void *------------------------------------------------------------------------- */ static void -trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path) +trav_token_add(trav_addr_t *visited, H5O_token_t *token, const char *path) { size_t idx; /* Index of address to use */ @@ -136,35 +136,39 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path) /* Append it */ idx = visited->nused++; - visited->objs[idx].addr = addr; + HDmemcpy(&visited->objs[idx].token, token, sizeof(H5O_token_t)); visited->objs[idx].path = HDstrdup(path); -} /* end trav_addr_add() */ +} /* end trav_token_add() */ + - /*------------------------------------------------------------------------- - * Function: trav_addr_visited + * Function: trav_token_visited * - * Purpose: Check if an address has already been visited + * Purpose: Check if an object token has already been seen * * Return: TRUE/FALSE *------------------------------------------------------------------------- */ H5_ATTR_PURE static const char * -trav_addr_visited(trav_addr_t *visited, haddr_t addr) +trav_token_visited(hid_t loc_id, trav_addr_t *visited, H5O_token_t *token) { size_t u; /* Local index variable */ + int token_cmp; /* Look for address */ - for(u = 0; u < visited->nused; u++) + for(u = 0; u < visited->nused; u++) { /* Check for address already in array */ - if(visited->objs[u].addr == addr) + if(H5Otoken_cmp(loc_id, &visited->objs[u].token, token, &token_cmp) < 0) + return NULL; + if(!token_cmp) return(visited->objs[u].path); + } - /* Didn't find address */ + /* Didn't find object token */ return(NULL); -} /* end trav_addr_visited() */ +} /* end trav_token_visited() */ + - /*------------------------------------------------------------------------- * Function: traverse_cb * @@ -172,7 +176,7 @@ trav_addr_visited(trav_addr_t *visited, haddr_t addr) *------------------------------------------------------------------------- */ static herr_t -traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, +traverse_cb(hid_t loc_id, const char *path, const H5L_info2_t *linfo, void *_udata) { trav_ud_traverse_t *udata = (trav_ud_traverse_t *)_udata; /* User data */ @@ -199,10 +203,10 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, /* Perform the correct action for different types of links */ if(linfo->type == H5L_TYPE_HARD) { - H5O_info_t oinfo; + H5O_info2_t oinfo; /* Get information about the object */ - if(H5Oget_info_by_name2(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) { if(new_name) HDfree(new_name); return(H5_ITER_ERROR); @@ -212,8 +216,8 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, * already visited, if it isn't there already */ if(oinfo.rc > 1) - if(NULL == (already_visited = trav_addr_visited(udata->seen, oinfo.addr))) - trav_addr_add(udata->seen, oinfo.addr, full_name); + if(NULL == (already_visited = trav_token_visited(loc_id, udata->seen, &oinfo.token))) + trav_token_add(udata->seen, &oinfo.token, full_name); /* Make 'visit object' callback */ if(udata->visitor->visit_obj) @@ -239,7 +243,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, return(H5_ITER_CONT); } /* end traverse_cb() */ - + /*------------------------------------------------------------------------- * Function: traverse * @@ -254,12 +258,12 @@ static int traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, hbool_t recurse, const trav_visitor_t *visitor, unsigned fields) { - H5O_info_t oinfo; /* Object info for starting group */ - int ret_value = SUCCEED; + H5O_info2_t oinfo; /* Object info for starting group */ + int ret_value = 0; /* Get info for starting object */ - if(H5Oget_info_by_name2(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info_by_name failed"); + if(H5Oget_info_by_name3(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Oget_info_by_name failed"); /* Visit the starting object */ if(visit_start && visitor->visit_obj) @@ -276,7 +280,7 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, /* Check for multiple links to top group */ if(oinfo.rc > 1) - trav_addr_add(&seen, oinfo.addr, grp_name); + trav_token_add(&seen, &oinfo.token, grp_name); /* Set up user data structure */ udata.seen = &seen; @@ -288,13 +292,13 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, /* Check for iteration of links vs. visiting all links recursively */ if(recurse) { /* Visit all links in group, recursively */ - if(H5Lvisit_by_name(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lvisit_by_name failed"); + if(H5Lvisit_by_name2(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Lvisit_by_name failed"); } /* end if */ else { /* Iterate over links in group */ - if(H5Literate_by_name(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Literate_by_name failed"); + if(H5Literate_by_name2(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Literate_by_name failed"); } /* end else */ /* Free visited addresses table */ @@ -312,7 +316,7 @@ done: return ret_value; } - + /*------------------------------------------------------------------------- * Function: trav_info_add * @@ -338,7 +342,9 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type) info->paths[idx].path = HDstrdup(path); info->paths[idx].type = obj_type; info->paths[idx].fileno = 0; - info->paths[idx].objno = HADDR_UNDEF; + + /* Set token to 'undefined' values */ + info->paths[idx].obj_token = H5O_TOKEN_UNDEF; } } /* end trav_info_add() */ @@ -354,19 +360,19 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type) void trav_fileinfo_add(trav_info_t *info, hid_t loc_id) { - H5O_info_t oinfo; + H5O_info2_t oinfo; size_t idx = info->nused - 1; - if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".")) - H5Oget_info_by_name2(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + if(info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".")) + H5Oget_info_by_name3(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); else - H5Oget_info2(loc_id, &oinfo, H5O_INFO_BASIC); + H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC); - info->paths[idx].objno = oinfo.addr; + HDmemcpy(&info->paths[idx].obj_token, &oinfo.token, sizeof(H5O_token_t)); info->paths[idx].fileno = oinfo.fileno; } /* end trav_fileinfo_add() */ - + /*------------------------------------------------------------------------- * Function: trav_info_visit_obj * @@ -377,7 +383,7 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id) *------------------------------------------------------------------------- */ int -trav_info_visit_obj(const char *path, const H5O_info_t *oinfo, +trav_info_visit_obj(const char *path, const H5O_info2_t *oinfo, const char H5_ATTR_UNUSED *already_visited, void *udata) { size_t idx; @@ -390,13 +396,13 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo, /* set object addr and fileno. These are for checking same object */ info_p = (trav_info_t *) udata; idx = info_p->nused - 1; - info_p->paths[idx].objno = oinfo->addr; + HDmemcpy(&info_p->paths[idx].obj_token, &oinfo->token, sizeof(H5O_token_t)); info_p->paths[idx].fileno = oinfo->fileno; return(0); } /* end trav_info_visit_obj() */ - + /*------------------------------------------------------------------------- * Function: trav_info_visit_lnk * @@ -407,7 +413,7 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo, *------------------------------------------------------------------------- */ int -trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) +trav_info_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata) { /* Add the link to the 'info' struct */ trav_info_add((trav_info_t *)udata, path, ((linfo->type == H5L_TYPE_SOFT) ? H5TRAV_TYPE_LINK : H5TRAV_TYPE_UDLINK)); @@ -415,7 +421,7 @@ trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) return(0); } /* end trav_info_visit_lnk() */ - + /*------------------------------------------------------------------------- * Function: h5trav_getinfo * @@ -430,7 +436,7 @@ int h5trav_getinfo(hid_t file_id, trav_info_t *info) { trav_visitor_t info_visitor; /* Visitor structure for trav_info_t's */ - int ret_value = SUCCEED; + int ret_value = 0; /* Init visitor structure */ info_visitor.visit_obj = trav_info_visit_obj; @@ -439,7 +445,7 @@ h5trav_getinfo(hid_t file_id, trav_info_t *info) /* Traverse all objects in the file, visiting each object & link */ if(traverse(file_id, "/", TRUE, TRUE, &info_visitor, H5O_INFO_BASIC) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); + H5TOOLS_GOTO_ERROR((-1), "traverse failed"); done: return ret_value; @@ -501,7 +507,7 @@ trav_info_init(const char *filename, hid_t fileid, trav_info_t **_info) *_info = info; } /* end trav_info_init() */ - + /*------------------------------------------------------------------------- * Function: trav_info_free * @@ -536,7 +542,7 @@ trav_info_free(trav_info_t *info) *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * Function: trav_table_visit_obj * @@ -547,7 +553,7 @@ trav_info_free(trav_info_t *info) *------------------------------------------------------------------------- */ static int -trav_table_visit_obj(const char *path, const H5O_info_t *oinfo, +trav_table_visit_obj(const char *path, const H5O_info2_t *oinfo, const char *already_visited, void *udata) { trav_table_t *table = (trav_table_t *)udata; @@ -558,12 +564,12 @@ trav_table_visit_obj(const char *path, const H5O_info_t *oinfo, trav_table_add(table, path, oinfo); else /* Add alias for object to table */ - trav_table_addlink(table, oinfo->addr, path); + trav_table_addlink(table, &oinfo->token, path); return 0; } /* end trav_table_visit_obj() */ - + /*------------------------------------------------------------------------- * Function: trav_table_visit_lnk * @@ -574,7 +580,7 @@ trav_table_visit_obj(const char *path, const H5O_info_t *oinfo, *------------------------------------------------------------------------- */ static int -trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, void *udata) +trav_table_visit_lnk(const char *path, const H5L_info2_t H5_ATTR_UNUSED *linfo, void *udata) { /* Add the link to the 'table' struct */ trav_table_add((trav_table_t *)udata, path, NULL); @@ -582,7 +588,7 @@ trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, v return 0; } /* end trav_table_visit_lnk() */ - + /*------------------------------------------------------------------------- * Function: h5trav_gettable * @@ -596,7 +602,7 @@ int h5trav_gettable(hid_t fid, trav_table_t *table) { trav_visitor_t table_visitor; /* Visitor structure for trav_table_t's */ - int ret_value = SUCCEED; + int ret_value = 0; /* Init visitor structure */ table_visitor.visit_obj = trav_table_visit_obj; @@ -605,7 +611,7 @@ h5trav_gettable(hid_t fid, trav_table_t *table) /* Traverse all objects in the file, visiting each object & link */ if(traverse(fid, "/", TRUE, TRUE, &table_visitor, H5O_INFO_BASIC) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); + H5TOOLS_GOTO_ERROR((-1), "traverse failed"); done: return ret_value; @@ -663,9 +669,7 @@ h5trav_getindext(const char *name, const trav_table_t *table) *------------------------------------------------------------------------- */ static void -trav_table_add(trav_table_t *table, - const char *path, - const H5O_info_t *oinfo) +trav_table_add(trav_table_t *table, const char *path, const H5O_info2_t *oinfo) { size_t new_obj; @@ -676,7 +680,11 @@ trav_table_add(trav_table_t *table, } /* end if */ new_obj = table->nobjs++; - table->objs[new_obj].objno = oinfo ? oinfo->addr : HADDR_UNDEF; + if(oinfo) + HDmemcpy(&table->objs[new_obj].obj_token, &oinfo->token, sizeof(H5O_token_t)); + else + /* Set token to 'undefined' values */ + table->objs[new_obj].obj_token = H5O_TOKEN_UNDEF; table->objs[new_obj].flags[0] = table->objs[new_obj].flags[1] = 0; table->objs[new_obj].is_same_trgobj = 0; table->objs[new_obj].name = (char *)HDstrdup(path); @@ -696,13 +704,16 @@ trav_table_add(trav_table_t *table, *------------------------------------------------------------------------- */ static void -trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path) +trav_table_addlink(trav_table_t *table, const H5O_token_t *obj_token, const char *path) { size_t i; /* Local index variable */ + int token_cmp; if(table) { for(i = 0; i < table->nobjs; i++) { - if(table->objs[i].objno == objno) { + if(H5Otoken_cmp(table->fid, &table->objs[i].obj_token, obj_token, &token_cmp) < 0) + return; + if(!token_cmp) { size_t n; /* already inserted? */ @@ -720,9 +731,9 @@ trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path) table->objs[i].links[n].new_name = (char *)HDstrdup(path); return; - } /* end for */ + } /* end if */ } /* end for */ - } + } /* end if */ } @@ -748,7 +759,10 @@ void trav_table_addflags(unsigned *flags, } /* end if */ new_obj = table->nobjs++; - table->objs[new_obj].objno = 0; + + /* Set token to 'undefined' values */ + table->objs[new_obj].obj_token = H5O_TOKEN_UNDEF; + table->objs[new_obj].flags[0] = flags[0]; table->objs[new_obj].flags[1] = flags[1]; table->objs[new_obj].is_same_trgobj = 0; @@ -769,10 +783,11 @@ void trav_table_addflags(unsigned *flags, * Return: void *------------------------------------------------------------------------- */ -void trav_table_init(trav_table_t **tbl) +void trav_table_init(hid_t fid, trav_table_t **tbl) { trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t)); if(table) { + table->fid = fid; table->size = 0; table->nobjs = 0; table->objs = NULL; @@ -834,8 +849,8 @@ trav_attr(hid_t #ifdef H5TRAV_PRINT_SPACE } else { - hid_t attr = -1; - hid_t space = -1; + hid_t attr = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; hsize_t size[H5S_MAX_RANK]; int ndims; int i; @@ -882,7 +897,7 @@ trav_attr(hid_t return(0); } - + /*------------------------------------------------------------------------- * Function: trav_print_visit_obj * @@ -893,8 +908,8 @@ trav_attr(hid_t *------------------------------------------------------------------------- */ static int -trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, - const char *already_visited, void *udata) +trav_print_visit_obj(const char *path, const H5O_info2_t *oinfo, + const char *already_visited, void *udata) { trav_print_udata_t *print_udata = (trav_print_udata_t *)udata; /* Print the name of the object */ @@ -940,7 +955,7 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, return(0); } /* end trav_print_visit_obj() */ - + /*------------------------------------------------------------------------- * Function: trav_print_visit_lnk * @@ -951,7 +966,7 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, *------------------------------------------------------------------------- */ static int -trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) +trav_print_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata) { trav_print_udata_t *print_udata = (trav_print_udata_t *)udata; @@ -1004,7 +1019,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) return(0); } /* end trav_print_visit_lnk() */ - + /*------------------------------------------------------------------------- * Function: h5trav_print * @@ -1019,7 +1034,7 @@ h5trav_print(hid_t fid) { trav_print_udata_t print_udata; /* User data for traversal */ trav_visitor_t print_visitor; /* Visitor structure for printing objects */ - int ret_value = SUCCEED; + int ret_value = 0; /* Init user data for printing */ print_udata.fid = fid; @@ -1031,13 +1046,13 @@ h5trav_print(hid_t fid) /* Traverse all objects in the file, visiting each object & link */ if(traverse(fid, "/", TRUE, TRUE, &print_visitor, H5O_INFO_BASIC) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); + H5TOOLS_GOTO_ERROR(FAIL, "traverse failed"); done: return ret_value; } - + /*------------------------------------------------------------------------- * Function: h5trav_visit * @@ -1053,7 +1068,7 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start, void *udata, unsigned fields) { trav_visitor_t visitor; /* Visitor structure for objects */ - int ret_value = SUCCEED; + int ret_value = 0; /* Init visitor structure */ visitor.visit_obj = visit_obj; @@ -1062,7 +1077,7 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start, /* Traverse all objects in the file, visiting each object & link */ if(traverse(fid, grp_name, visit_start, recurse, &visitor, fields) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); + H5TOOLS_GOTO_ERROR((-1), "traverse failed"); done: return ret_value; @@ -1080,8 +1095,8 @@ done: herr_t symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path) { - herr_t ret_value = SUCCEED; - size_t idx; /* Index of address to use */ + size_t idx; /* Index of address to use */ + herr_t ret_value = SUCCEED; /* Allocate space if necessary */ if(visited->nused == visited->nalloc) { @@ -1089,7 +1104,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co visited->nalloc = MAX(1, visited->nalloc * 2); if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t)))) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure realloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "visited data structure realloc failed"); visited->objs = (symlink_trav_path_t *)tmp_ptr; } /* end if */ @@ -1103,7 +1118,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co if(type == H5L_TYPE_EXTERNAL) { if(NULL == (visited->objs[idx].file = HDstrdup(file))) { visited->nused--; - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure name allocation failed"); + H5TOOLS_GOTO_ERROR(FAIL, "visited data structure name allocation failed"); } /* end if */ } /* end if */ @@ -1111,14 +1126,14 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co visited->nused--; if(visited->objs[idx].file) HDfree (visited->objs[idx].file); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure path allocation failed"); + H5TOOLS_GOTO_ERROR(FAIL, "visited data structure path allocation failed"); } /* end if */ done: return ret_value; } /* end symlink_visit_add() */ - + /*------------------------------------------------------------------------- * Function: symlink_is_visited * diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index a1d33b7..88473ad 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -17,9 +17,9 @@ #include "hdf5.h" /* Typedefs for visiting objects */ -typedef herr_t (*h5trav_obj_func_t)(const char *path_name, const H5O_info_t *oinfo, +typedef herr_t (*h5trav_obj_func_t)(const char *path_name, const H5O_info2_t *oinfo, const char *first_seen, void *udata); -typedef herr_t (*h5trav_lnk_func_t)(const char *path_name, const H5L_info_t *linfo, +typedef herr_t (*h5trav_lnk_func_t)(const char *path_name, const H5L_info2_t *linfo, void *udata); /*------------------------------------------------------------------------- @@ -65,7 +65,7 @@ typedef struct symlink_trav_t { typedef struct trav_path_t { char *path; h5trav_type_t type; - haddr_t objno; /* object address */ + H5O_token_t obj_token; /* object token */ unsigned long fileno; /* File number that object is located in */ } trav_path_t; @@ -95,7 +95,7 @@ typedef struct trav_link_t { */ typedef struct trav_obj_t { - haddr_t objno; /* object address */ + H5O_token_t obj_token; /* object token */ unsigned flags[2]; /* h5diff.object is present or not in both files*/ hbool_t is_same_trgobj; /* same target object? no need to compare */ char *name; /* name */ @@ -112,6 +112,7 @@ typedef struct trav_obj_t { */ typedef struct trav_table_t { + hid_t fid; size_t size; size_t nobjs; trav_obj_t *objs; @@ -144,8 +145,8 @@ H5TOOLS_DLL hbool_t symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, */ H5TOOLS_DLL int h5trav_getinfo(hid_t file_id, trav_info_t *info); H5TOOLS_DLL ssize_t h5trav_getindex(const trav_info_t *info, const char *obj); -H5TOOLS_DLL int trav_info_visit_obj (const char *path, const H5O_info_t *oinfo, const char *already_visited, void *udata); -H5TOOLS_DLL int trav_info_visit_lnk (const char *path, const H5L_info_t *linfo, void *udata); +H5TOOLS_DLL int trav_info_visit_obj(const char *path, const H5O_info2_t *oinfo, const char *already_visited, void *udata); +H5TOOLS_DLL int trav_info_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata); /*------------------------------------------------------------------------- * "h5trav table" public functions @@ -184,7 +185,7 @@ H5TOOLS_DLL void trav_fileinfo_add(trav_info_t *info, hid_t loc_id); *------------------------------------------------------------------------- */ -H5TOOLS_DLL void trav_table_init(trav_table_t **table); +H5TOOLS_DLL void trav_table_init(hid_t fid, trav_table_t **table); H5TOOLS_DLL void trav_table_free(trav_table_t *table); diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index cb89019..472824b 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -138,43 +138,43 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop) switch(pt->type){ #ifdef H5_HAVE_PARALLEL case MPI_CLOCK: - if (start_stop == TSTART) { - pt->mpi_timer[t] = MPI_Wtime(); - - /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS - * we compute the time it took to only open the file */ - if(t == HDF5_FINE_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_WRITE_FIXED_DIMS]; - else if(t == HDF5_FINE_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS]; - - } else { - pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t]; - pt->mpi_timer[t] = MPI_Wtime(); - - /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS - * we compute the time it took to close the file after the last read/write finished */ - if(t == HDF5_GROSS_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_WRITE_FIXED_DIMS]; - else if(t == HDF5_GROSS_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS]; - } - break; + if (start_stop == TSTART) { + pt->mpi_timer[t] = MPI_Wtime(); + + /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS + * we compute the time it took to only open the file */ + if(t == HDF5_FINE_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_WRITE_FIXED_DIMS]; + else if(t == HDF5_FINE_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS]; + + } else { + pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t]; + pt->mpi_timer[t] = MPI_Wtime(); + + /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS + * we compute the time it took to close the file after the last read/write finished */ + if(t == HDF5_GROSS_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_WRITE_FIXED_DIMS]; + else if(t == HDF5_GROSS_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS]; + } + break; #else case MPI_CLOCK: - HDfprintf(stderr, "MPI clock set in serial library\n"); - return NULL; + HDfprintf(stderr, "MPI clock set in serial library\n"); + return NULL; #endif /* H5_HAVE_PARALLEL */ case SYS_CLOCK: if (start_stop == TSTART) { HDgettimeofday(&pt->sys_timer[t], NULL); - /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS - * we compute the time it took to only open the file */ - if(t == HDF5_FINE_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS])); - else if(t == HDF5_FINE_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS])); + /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS + * we compute the time it took to only open the file */ + if(t == HDF5_FINE_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS])); + else if(t == HDF5_FINE_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS])); } else { @@ -183,19 +183,19 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop) HDgettimeofday(&sys_t, NULL); pt->total_time[t] += sub_time(&sys_t, &(pt->sys_timer[t])); - /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS - * we compute the time it took to close the file after the last read/write finished */ - if(t == HDF5_GROSS_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS])); - else if(t == HDF5_GROSS_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS])); + /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS + * we compute the time it took to close the file after the last read/write finished */ + if(t == HDF5_GROSS_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS])); + else if(t == HDF5_GROSS_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS])); } - break; + break; default: - HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type); - return NULL; + HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type); + return NULL; } /* end switch */ #if 0 @@ -221,10 +221,3 @@ io_time_get(io_time_t *pt, timer_type t) return pt->total_time[t]; } - -#if 0 -/* standalone is not working yet. Need fix later. -AKC- */ -#ifdef STANDALONE -#include "pio_standalone.c" -#endif -#endif diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h index 78bf676..c1fa58e 100644 --- a/tools/lib/io_timer.h +++ b/tools/lib/io_timer.h @@ -28,6 +28,7 @@ #ifdef H5_HAVE_WINSOCK2_H # include <winsock2.h> #endif /* H5_HAVE_WINSOCK2_H */ + /* The different types of timers we can have */ typedef enum timer_type_ { HDF5_FILE_OPENCLOSE, @@ -70,10 +71,19 @@ typedef struct io_time_t { #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ + +#ifdef STANDALONE +io_time_t *io_time_new(clock_type t); +void io_time_destroy(io_time_t *pt); +io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop); +double io_time_get(io_time_t *pt, timer_type t); +#else H5TOOLS_DLL io_time_t *io_time_new(clock_type t); H5TOOLS_DLL void io_time_destroy(io_time_t *pt); H5TOOLS_DLL io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop); H5TOOLS_DLL double io_time_get(io_time_t *pt, timer_type t); +#endif + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index f3d28da..5f53272 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -15,4 +15,6 @@ else () endif () set_target_properties (h5tools_test_utils PROPERTIES FOLDER tools) -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 120f803..726f4c4 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -1000,7 +1000,7 @@ test_set_configured_fapl(void) * TEST-LOCAL VARIABLES * ************************/ - hid_t fapl_id = -1; + hid_t fapl_id = H5I_INVALID_HID; other_fa_t wrong_fa = {0x432, 0xf82, 0x9093}; H5FD_ros3_fapl_t ros3_anon_fa = {1, FALSE, "", "", ""}; H5FD_ros3_fapl_t ros3_auth_fa = { @@ -1150,7 +1150,7 @@ test_set_configured_fapl(void) int result; testcase C = cases[i]; - fapl_id = -1; + fapl_id = H5I_INVALID_HID; #if UTIL_TEST_DEBUG HDfprintf(stderr, "setup test %d\t%s\n", i, C.message); fflush(stderr); @@ -1183,7 +1183,7 @@ test_set_configured_fapl(void) if (fapl_id > 0) { FAIL_IF( FAIL == H5Pclose(fapl_id) ) } - fapl_id = -1; + fapl_id = H5I_INVALID_HID; #if UTIL_TEST_DEBUG HDfprintf(stderr, "after cleanup\n"); fflush(stderr); diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index ffcd2b9..e1370e2 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -207,13 +207,12 @@ static int parse_flag(const char* s_flag, unsigned *flag) int main (int argc, const char *argv[]) { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ H5E_auto2_t func; H5E_auto2_t tools_func; void *edata; void *tools_edata; - hid_t fid_src = -1; - hid_t fid_dst = -1; + hid_t fid_src = H5I_INVALID_HID; + hid_t fid_dst = H5I_INVALID_HID; unsigned flag = 0; unsigned verbose = 0; unsigned parents = 0; @@ -222,6 +221,7 @@ main (int argc, const char *argv[]) int opt; int li_ret; h5tool_link_info_t linkinfo; + int ret_value = 0; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); @@ -394,19 +394,19 @@ main (int argc, const char *argv[]) *-------------------------------------------------------------------------*/ /* create property to pass copy options */ - if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed"); + if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pcreate failed"); /* set options for object copy */ if (flag) { if ( H5Pset_copy_object(ocpl_id, flag) < 0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_copy_object failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pset_copy_object failed"); } /* Create link creation property list */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) { error_msg("Could not create link creation property list\n"); - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pcreate failed"); } /* end if */ /* Check for creating intermediate groups */ @@ -414,7 +414,7 @@ main (int argc, const char *argv[]) /* Set the intermediate group creation property */ if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) { error_msg("Could not set property for creating parent groups\n"); - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_create_intermediate_group failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pset_create_intermediate_group failed"); } /* end if */ /* Display some output if requested */ @@ -438,7 +438,7 @@ main (int argc, const char *argv[]) if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0) { error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr); HDfree(str_ptr); - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lexists failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Lexists failed"); } HDfree(str_ptr); } @@ -458,7 +458,7 @@ main (int argc, const char *argv[]) if(H5Lcopy(fid_src, oname_src, fid_dst, oname_dst, H5P_DEFAULT, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lcopy failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Lcopy failed"); } else { /* valid link */ @@ -468,7 +468,7 @@ main (int argc, const char *argv[]) oname_dst, /* Name of the destination object */ ocpl_id, /* Object copy property list */ lcpl_id)<0) /* Link creation property list */ - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Ocopy failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Ocopy failed"); } /* free link info path */ @@ -477,15 +477,15 @@ main (int argc, const char *argv[]) /* close propertis */ if(H5Pclose(ocpl_id)<0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pclose failed"); if(H5Pclose(lcpl_id)<0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pclose failed"); /* close files */ if (H5Fclose(fid_src)<0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Fclose failed"); if (H5Fclose(fid_dst)<0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Fclose failed"); leave(EXIT_SUCCESS); diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index 96ed6ad..c1021e4 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -10,6 +10,7 @@ if (NOT ONLY_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + #target_compile_definitions(h5diff PRIVATE H5_TOOLS_DEBUG) TARGET_C_PROPERTIES (h5diff STATIC) target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5diff PROPERTIES FOLDER tools) @@ -23,6 +24,7 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + #target_compile_definitions(h5diff-shared PRIVATE H5_TOOLS_DEBUG) TARGET_C_PROPERTIES (h5diff-shared SHARED) target_link_libraries (h5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5diff-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 362e3f2..e05a8e3 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -302,30 +302,29 @@ void parse_command_line(int argc, * *------------------------------------------------------------------------- */ +void print_info(diff_opt_t* opts) +{ + if (opts->m_quiet || opts->err_stat) + return; + + if (opts->cmn_objs == 0) { + HDprintf("No common objects found. Files are not comparable.\n"); + if (!opts->m_verbose) + HDprintf("Use -v for a list of objects.\n"); + } - void print_info(diff_opt_t* opts) - { - if (opts->m_quiet || opts->err_stat) - return; - - if (opts->cmn_objs == 0) { - HDprintf("No common objects found. Files are not comparable.\n"); - if (!opts->m_verbose) - HDprintf("Use -v for a list of objects.\n"); - } - - if (opts->not_cmp == 1) { - if (opts->m_list_not_cmp == 0) { - HDprintf("--------------------------------\n"); - HDprintf("Some objects are not comparable\n"); - HDprintf("--------------------------------\n"); - if (opts->m_verbose) - HDprintf("Use -c for a list of objects without details of differences.\n"); - else - HDprintf("Use -c for a list of objects.\n"); - } - } - } + if (opts->not_cmp == 1) { + if (opts->m_list_not_cmp == 0) { + HDprintf("--------------------------------\n"); + HDprintf("Some objects are not comparable\n"); + HDprintf("--------------------------------\n"); + if (opts->m_verbose) + HDprintf("Use -c for a list of objects without details of differences.\n"); + else + HDprintf("Use -c for a list of objects.\n"); + } + } +} /*------------------------------------------------------------------------- * Function: check_n_input diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c index 380ab3b..5ba5fb3 100644 --- a/tools/src/h5diff/ph5diff_main.c +++ b/tools/src/h5diff/ph5diff_main.c @@ -126,7 +126,8 @@ int main(int argc, const char *argv[]) static void ph5diff_worker(int nID) { - hid_t file1_id = -1, file2_id = -1; + hid_t file1_id = H5I_INVALID_HID; + hid_t file2_id = H5I_INVALID_HID; while(1) { diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 0222c8b..d97fdc0 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1393,12 +1393,12 @@ error: int main(int argc, const char *argv[]) { - hid_t fid = -1; - hid_t gid = -1; + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; hid_t fapl_id = H5P_DEFAULT; H5E_auto2_t func; H5E_auto2_t tools_func; - H5O_info_t oi; + H5O_info2_t oi; struct handler_t *hand = NULL; int i; unsigned u; @@ -1567,7 +1567,7 @@ main(int argc, const char *argv[]) } /* Get object info for root group */ - if(H5Oget_info_by_name2(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); goto done; diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index bc426f2..a410fda 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -31,7 +31,7 @@ typedef struct { } trav_attr_udata_t; /* callback function used by H5Literate() */ -static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data); +static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void *op_data); static int dump_extlink(hid_t group, const char *linkname, const char *objname); /*------------------------------------------------------------------------- @@ -152,7 +152,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * *------------------------------------------------------------------------- */ static herr_t -dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data) +dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATTR_UNUSED *op_data) { hid_t obj; hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ @@ -200,10 +200,10 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR HDstrcat(obj_path, name); if(linfo->type == H5L_TYPE_HARD) { - H5O_info_t oinfo; + H5O_info2_t oinfo; /* Stat the object */ - if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { error_msg("unable to get object information for \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -259,7 +259,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ - found_obj = search_obj(dset_table, oinfo.addr); + found_obj = search_obj(dset_table, &oinfo.token); if(found_obj == NULL) { ctx.indent_level++; @@ -596,9 +596,9 @@ link_iteration(hid_t gid, unsigned crt_order_flags) /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set in the group, then, sort by creation order, otherwise by name */ if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); + H5Literate2(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); } /*------------------------------------------------------------------------- @@ -612,9 +612,9 @@ link_iteration(hid_t gid, unsigned crt_order_flags) void dump_named_datatype(hid_t tid, const char *name) { - H5O_info_t oinfo; + H5O_info2_t oinfo; unsigned attr_crt_order_flags; - hid_t tcpl_id = -1; /* datatype creation property list ID */ + hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */ hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ @@ -670,7 +670,7 @@ dump_named_datatype(hid_t tid, const char *name) h5tools_dump_header_format->datatypeblockbegin); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC); + H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC); /* Must check for uniqueness of all objects if we've traversed an elink, * otherwise only check if the reference count > 1. @@ -678,7 +678,7 @@ dump_named_datatype(hid_t tid, const char *name) if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ - found_obj = search_obj(type_table, oinfo.addr); + found_obj = search_obj(type_table, &oinfo.token); if (found_obj == NULL) { error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); @@ -739,7 +739,7 @@ done: void dump_group(hid_t gid, const char *name) { - H5O_info_t oinfo; + H5O_info2_t oinfo; hid_t dset; hid_t type; hid_t gcpl_id; @@ -816,9 +816,15 @@ dump_group(hid_t gid, const char *name) /* dump unamed type in root group */ for(u = 0; u < type_table->nobjs; u++) if(!type_table->objs[u].recorded) { + char *obj_addr_str = NULL; + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); - HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + + H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str); + HDsprintf(type_name, "#%s", obj_addr_str); + H5free_memory(obj_addr_str); + dump_function_table->dump_named_datatype_function(type, type_name); H5Tclose(type); H5Dclose(dset); @@ -830,7 +836,7 @@ dump_group(hid_t gid, const char *name) h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid); - H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC); + H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC); /* Must check for uniqueness of all objects if we've traversed an elink, * otherwise only check if the reference count > 1. @@ -838,7 +844,7 @@ dump_group(hid_t gid, const char *name) if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ - found_obj = search_obj(group_table, oinfo.addr); + found_obj = search_obj(group_table, &oinfo.token); if (found_obj == NULL) { error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); @@ -1251,8 +1257,13 @@ dump_fcontents(hid_t fid) unsigned u; for (u = 0; u < type_table->nobjs; u++) { - if (!type_table->objs[u].recorded) - PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno); + if (!type_table->objs[u].recorded) { + char *obj_addr_str = NULL; + + H5Otoken_to_str(fid, &type_table->objs[u].obj_token, &obj_addr_str); + PRINTSTREAM(rawoutstream, " %-10s /#%s\n", "datatype", obj_addr_str); + H5free_memory(obj_addr_str); + } } } @@ -1319,7 +1330,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a } /* end attr_search() */ static herr_t -obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data) +obj_search(const char *path, const H5O_info2_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data) { trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; const char *op_name = handle_data->op_name; @@ -1356,7 +1367,7 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al } /* end obj_search() */ static herr_t -lnk_search(const char *path, const H5L_info_t *li, void *_op_data) +lnk_search(const char *path, const H5L_info2_t *li, void *_op_data) { size_t search_len; size_t k; @@ -1415,7 +1426,7 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data) void handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name) { - hid_t gid = -1; + hid_t gid = H5I_INVALID_HID; if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) { error_msg("unable to open root group\n"); @@ -1469,8 +1480,8 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H void handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name) { - hid_t oid = -1; - hid_t attr_id = -1; + hid_t oid = H5I_INVALID_HID; + hid_t attr_id = H5I_INVALID_HID; char *obj_name = NULL; char *attr_name = NULL; int j; @@ -1608,7 +1619,7 @@ error: void handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name) { - H5O_info_t oinfo; + H5O_info2_t oinfo; hid_t dsetid; hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ struct subset_t *sset = (struct subset_t *)data; @@ -1719,11 +1730,11 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis } /* end if */ - H5Oget_info2(dsetid, &oinfo, H5O_INFO_BASIC); + H5Oget_info3(dsetid, &oinfo, H5O_INFO_BASIC); if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ - found_obj = search_obj(dset_table, oinfo.addr); + found_obj = search_obj(dset_table, &oinfo.token); if(found_obj) { if (found_obj->displayed) { @@ -1812,9 +1823,9 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c void handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name) { - H5L_info_t linfo; + H5L_info2_t linfo; - if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { + if(H5Lget_info2(fid, links, &linfo, H5P_DEFAULT) < 0) { error_msg("unable to get link info from \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); } @@ -1903,8 +1914,12 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe char name[128]; if(!type_table->objs[idx].recorded) { + char *obj_addr_string = NULL; + /* unamed datatype */ - HDsprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno); + H5Otoken_to_str(fid, &type_table->objs[idx].obj_token, &obj_addr_string); + HDsprintf(name, "/#%s", obj_addr_string); + H5free_memory(obj_addr_string); if(!HDstrcmp(name, real_name)) break; @@ -1962,7 +1977,7 @@ static int dump_extlink(hid_t group, const char *linkname, const char *objname) { hid_t oid; - H5O_info_t oi; + H5O_info2_t oi; table_t *old_group_table = group_table; table_t *old_dset_table = dset_table; table_t *old_type_table = type_table; @@ -1974,7 +1989,7 @@ dump_extlink(hid_t group, const char *linkname, const char *objname) goto fail; /* Get object info */ - if (H5Oget_info2(oid, &oi, H5O_INFO_BASIC) < 0) { + if (H5Oget_info3(oid, &oi, H5O_INFO_BASIC) < 0) { H5Oclose(oid); goto fail; } diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index b78cf00..d9f1f67 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -106,7 +106,7 @@ static h5tool_format_t xml_dataformat = { /* internal functions */ -static int xml_name_to_XID(const char *, char *, int , int ); +static int xml_name_to_XID(hid_t, const char *, char *, int, int); /* internal functions used by XML option */ static void xml_print_datatype(hid_t, unsigned); @@ -130,7 +130,7 @@ static char *xml_escape_the_name(const char *); *------------------------------------------------------------------------- */ static herr_t -xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data) +xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATTR_UNUSED *op_data) { hid_t obj; herr_t ret = SUCCEED; @@ -177,10 +177,10 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ HDstrcat(obj_path, name); if(linfo->type == H5L_TYPE_HARD) { - H5O_info_t oinfo; + H5O_info2_t oinfo; /* Stat the object */ - if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name3(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { error_msg("unable to get object information for \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -225,7 +225,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ - found_obj = search_obj(dset_table, oinfo.addr); + found_obj = search_obj(dset_table, &oinfo.token); if(found_obj == NULL) { ctx.indent_level++; @@ -272,8 +272,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ char pointerxid[100]; /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1); - xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); + xml_name_to_XID(obj, obj_path, dsetxid, (int)sizeof(dsetxid), 1); + xml_name_to_XID(obj, prefix, parentxid, (int)sizeof(parentxid), 1); ctx.need_prefix = TRUE; @@ -290,7 +290,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ t_prefix); /* H5ParentPaths */ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); + xml_name_to_XID(obj, found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); ctx.indent_level++; @@ -393,11 +393,11 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ } /* end else */ /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); + xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1); + xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1); /* Try to create an OBJ-XID for the object pointed to */ - res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0); + res = xml_name_to_XID(group, t_link_path, targetxid, (int)sizeof(targetxid), 0); if (res == 0) { /* target obj found */ ctx.need_prefix = TRUE; @@ -482,8 +482,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ char *t_targname = xml_escape_the_name(targname); /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); + xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1); + xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1); ctx.need_prefix = TRUE; @@ -528,8 +528,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ char *t_obj_path = xml_escape_the_name(obj_path); /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1); + xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1); + xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1); ctx.need_prefix = TRUE; @@ -575,20 +575,26 @@ done: * 1 - generate a fake entry and return fake id. */ int -xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) +xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen) { - haddr_t objno; /* Object ID for object at path */ + H5O_token_t obj_token; + char *obj_addr_str = NULL; + int lookup_ret; if (outlen < 22) return 1; - objno = ref_path_table_lookup(str); - if (objno == HADDR_UNDEF) { + lookup_ret = ref_path_table_lookup(str, &obj_token); + if (lookup_ret < 0) { if (HDstrlen(str) == 0) { - objno = ref_path_table_lookup("/"); - if (objno == HADDR_UNDEF) { + lookup_ret = ref_path_table_lookup("/", &obj_token); + if (lookup_ret < 0) { if (gen) { - objno = ref_path_table_gen_fake(str); - HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + ref_path_table_gen_fake(str, &obj_token); + + H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str); + HDsprintf(outstr, "xid_%s", obj_addr_str); + H5free_memory(obj_addr_str); + return 0; } else { @@ -598,8 +604,12 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) } else { if (gen) { - objno = ref_path_table_gen_fake(str); - HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + ref_path_table_gen_fake(str, &obj_token); + + H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str); + HDsprintf(outstr, "xid_%s", obj_addr_str); + H5free_memory(obj_addr_str); + return 0; } else { @@ -608,9 +618,11 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) } } - HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str); + HDsprintf(outstr, "xid_%s", obj_addr_str); + H5free_memory(obj_addr_str); - return(0); + return 0; } static const char *quote = """; @@ -878,12 +890,12 @@ xml_print_datatype(hid_t type, unsigned in_group) outputformat = &string_dataformat; if(!in_group && H5Tcommitted(type) > 0) { - H5O_info_t oinfo; + H5O_info2_t oinfo; obj_t *found_obj; /* Found object */ /* detect a shared datatype, output only once */ - H5Oget_info2(type, &oinfo, H5O_INFO_BASIC); - found_obj = search_obj(type_table, oinfo.addr); + H5Oget_info3(type, &oinfo, H5O_INFO_BASIC); + found_obj = search_obj(type_table, &oinfo.token); if(found_obj) { /* This should be defined somewhere else */ @@ -891,7 +903,7 @@ xml_print_datatype(hid_t type, unsigned in_group) probably will have something different eventually */ char * dtxid = (char *)HDmalloc((size_t)100); - xml_name_to_XID(found_obj->objname, dtxid, 100, 1); + xml_name_to_XID(type, found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { /* 'anonymous' NDT. Use it's object num. as it's name. */ @@ -1531,19 +1543,19 @@ xml_dump_datatype(hid_t type) dump_indent += COL; if(H5Tcommitted(type) > 0) { - H5O_info_t oinfo; + H5O_info2_t oinfo; obj_t *found_obj; /* Found object */ /* Datatype is a shared or named datatype */ - H5Oget_info2(type, &oinfo, H5O_INFO_BASIC); - found_obj = search_obj(type_table, oinfo.addr); + H5Oget_info3(type, &oinfo, H5O_INFO_BASIC); + found_obj = search_obj(type_table, &oinfo.token); if(found_obj) { /* Shared datatype, must be entered as an object */ /* These 2 cases are the same now, but may change */ char *dtxid = (char *)HDmalloc((size_t)100); - xml_name_to_XID(found_obj->objname, dtxid, 100, 1); + xml_name_to_XID(type, found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { /* anonymous stored datatype: following the dumper's current @@ -1783,15 +1795,10 @@ xml_dump_dataspace(hid_t space) void xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset, int H5_ATTR_UNUSED pindex) { - hid_t space = -1; - hid_t type = -1; - hid_t p_type = -1; - hsize_t size[64]; - hsize_t nelmts = 1; - int ndims; - int i; + hid_t space = H5I_INVALID_HID; + hid_t type = H5I_INVALID_HID; + hid_t p_type = H5I_INVALID_HID; int status = -1; - void *buf = NULL; hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ @@ -1950,9 +1957,9 @@ herr_t xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED * op_data) { - hid_t attr_id = -1; - hid_t type = -1; - hid_t space = -1; + hid_t attr_id = H5I_INVALID_HID; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; H5S_class_t space_type; hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ @@ -2293,8 +2300,8 @@ xml_dump_named_datatype(hid_t type, const char *name) t_prefix = xml_escape_the_name(prefix); t_name = xml_escape_the_name(name); - xml_name_to_XID(tmp, dtxid, 100, 1); - xml_name_to_XID(prefix, parentxid, 100, 1); + xml_name_to_XID(type, tmp, dtxid, 100, 1); + xml_name_to_XID(type, prefix, parentxid, 100, 1); if(HDstrncmp(name, "#", (size_t)1) == 0) { /* Special: this is an 'anonymous' NDT, deleted but still in use. @@ -2317,7 +2324,7 @@ xml_dump_named_datatype(hid_t type, const char *name) h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } else { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ ctx.need_prefix = TRUE; @@ -2331,12 +2338,12 @@ xml_dump_named_datatype(hid_t type, const char *name) h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* Check uniqueness of named datatype */ - H5Oget_info2(type, &oinfo, H5O_INFO_BASIC); + H5Oget_info3(type, &oinfo, H5O_INFO_BASIC); if(oinfo.rc > 1) { obj_t *found_obj; /* Found object */ /* Group with more than one link to it... */ - found_obj = search_obj(type_table, oinfo.addr); + found_obj = search_obj(type_table, &oinfo.token); if (found_obj == NULL) { indentation(dump_indent); @@ -2353,7 +2360,7 @@ xml_dump_named_datatype(hid_t type, const char *name) ctx.indent_level++; - xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); + xml_name_to_XID(type, found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1); ctx.need_prefix = TRUE; @@ -2436,7 +2443,7 @@ done: void xml_dump_group(hid_t gid, const char *name) { - H5O_info_t oinfo; + H5O_info2_t oinfo; hid_t gcpl_id; hid_t dset, type; unsigned crt_order_flags; @@ -2517,13 +2524,13 @@ xml_dump_group(hid_t gid, const char *name) } } - H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC); + H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC); if(oinfo.rc > 1) { obj_t *found_obj; /* Found object */ /* Group with more than one link to it... */ - found_obj = search_obj(group_table, oinfo.addr); + found_obj = search_obj(group_table, &oinfo.token); if (found_obj == NULL) { indentation(dump_indent); @@ -2541,7 +2548,7 @@ xml_dump_group(hid_t gid, const char *name) /* already seen: enter a groupptr */ if(isRoot) { /* probably can't happen! */ - xml_name_to_XID("/", grpxid, 100, 1); + xml_name_to_XID(gid, "/", grpxid, 100, 1); ctx.need_prefix = TRUE; @@ -2554,8 +2561,8 @@ xml_dump_group(hid_t gid, const char *name) else { t_objname = xml_escape_the_name(found_obj->objname); par_name = xml_escape_the_name(par); - xml_name_to_XID(tmp, grpxid, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); + xml_name_to_XID(gid, tmp, grpxid, 100, 1); + xml_name_to_XID(gid, par, parentxid, 100, 1); ctx.need_prefix = TRUE; @@ -2573,8 +2580,8 @@ xml_dump_group(hid_t gid, const char *name) t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */ par_name = xml_escape_the_name(par); - xml_name_to_XID(found_obj->objname, ptrstr, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); + xml_name_to_XID(gid, found_obj->objname, ptrstr, 100, 1); + xml_name_to_XID(gid, par, parentxid, 100, 1); ctx.need_prefix = TRUE; @@ -2597,7 +2604,7 @@ xml_dump_group(hid_t gid, const char *name) /* first time this group has been seen -- describe it */ if(isRoot) { - xml_name_to_XID("/", grpxid, 100, 1); + xml_name_to_XID(gid, "/", grpxid, 100, 1); ctx.need_prefix = TRUE; @@ -2611,8 +2618,8 @@ xml_dump_group(hid_t gid, const char *name) char *t_tmp = xml_escape_the_name(tmp); par_name = xml_escape_the_name(par); - xml_name_to_XID(tmp, grpxid, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); + xml_name_to_XID(gid, tmp, grpxid, 100, 1); + xml_name_to_XID(gid, par, parentxid, 100, 1); ctx.need_prefix = TRUE; @@ -2652,9 +2659,15 @@ xml_dump_group(hid_t gid, const char *name) /* Very special case: dump unamed type in root group */ for(u = 0; u < type_table->nobjs; u++) { if(!type_table->objs[u].recorded) { + char *obj_addr_str = NULL; + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); - HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + + H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str); + HDsprintf(type_name, "#%s", obj_addr_str); + H5free_memory(obj_addr_str); + dump_function_table->dump_named_datatype_function(type, type_name); H5Tclose(type); H5Dclose(dset); @@ -2665,9 +2678,9 @@ xml_dump_group(hid_t gid, const char *name) /* iterate through all the links */ if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); + H5Literate2(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); + H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); dump_indent -= COL; ctx.indent_level--; @@ -2689,15 +2702,15 @@ xml_dump_group(hid_t gid, const char *name) h5tools_str_reset(&buffer); if(isRoot) { - xml_name_to_XID("/", grpxid, 100, 1); + xml_name_to_XID(gid, "/", grpxid, 100, 1); h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/"); } else { char *t_tmp = xml_escape_the_name(tmp); par_name = xml_escape_the_name(par); - xml_name_to_XID(tmp, grpxid, 100, 1); - xml_name_to_XID(par, parentxid, 100, 1); + xml_name_to_XID(gid, tmp, grpxid, 100, 1); + xml_name_to_XID(gid, par, parentxid, 100, 1); h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" >", xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name); @@ -2734,9 +2747,15 @@ xml_dump_group(hid_t gid, const char *name) /* Very special case: dump unamed type in root group */ for(u = 0; u < type_table->nobjs; u++) { if(!type_table->objs[u].recorded) { + char *obj_addr_str = NULL; + dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); - HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + + H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str); + HDsprintf(type_name, "#%s", obj_addr_str); + H5free_memory(obj_addr_str); + dump_function_table->dump_named_datatype_function(type, type_name); H5Tclose(type); H5Dclose(dset); @@ -2747,9 +2766,9 @@ xml_dump_group(hid_t gid, const char *name) /* iterate through all the links */ if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) - H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); + H5Literate2(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL); else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); + H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL); dump_indent -= COL; ctx.indent_level--; @@ -2787,12 +2806,11 @@ static int xml_print_refs(hid_t did, int source) { herr_t e; - hid_t type = -1; - hid_t space = -1; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; hssize_t ssiz = -1; hsize_t i; - size_t tsiz; - hobj_ref_t *refbuf = NULL; + H5R_ref_t *refbuf = NULL; char *buf = NULL; h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ @@ -2823,13 +2841,11 @@ xml_print_refs(hid_t did, int source) space = H5Dget_space(did); if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) goto error; - if ((tsiz = H5Tget_size(type)) == 0) - goto error; - buf = (char *) HDcalloc((size_t)ssiz, tsiz); + buf = (char *) HDcalloc((size_t)ssiz, sizeof(H5R_ref_t)); if (buf == NULL) goto error; - e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + e = H5Dread(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); /* need to check result here */ if (e < 0) goto error; @@ -2838,19 +2854,17 @@ xml_print_refs(hid_t did, int source) space = H5Aget_space(did); if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) goto error; - if ((tsiz = H5Tget_size(type)) == 0) - goto error; - buf = (char *) HDcalloc((size_t)ssiz, tsiz); + buf = (char *) HDcalloc((size_t)ssiz, sizeof(H5R_ref_t)); if (buf == NULL) goto error; - e = H5Aread(did, H5T_STD_REF_OBJ, buf); + e = H5Aread(did, H5T_STD_REF, buf); /* need to check the result here */ if (e < 0) goto error; } - refbuf = (hobj_ref_t *)((void *)buf); + refbuf = (H5R_ref_t *)((void *)buf); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -2901,6 +2915,8 @@ xml_print_refs(hid_t did, int source) } ctx.indent_level--; + H5Rdestroy(refbuf); + refbuf++; } @@ -2936,8 +2952,8 @@ static int xml_print_strs(hid_t did, int source) { herr_t e; - hid_t type = -1; - hid_t space = -1; + hid_t type = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; hssize_t ssiz = -1; htri_t is_vlstr = FALSE; size_t tsiz = 0; @@ -3290,7 +3306,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) H5Pget_fill_value(dcpl, type, buf); if (H5Tget_class(type) == H5T_REFERENCE) { - const char * path = lookup_ref_path(*(hobj_ref_t *) buf); + const char * path = lookup_ref_path(*(H5R_ref_t *) buf); ctx.need_prefix = TRUE; @@ -3324,6 +3340,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + + H5Rdestroy((H5R_ref_t *) buf); } else if (H5Tget_class(type) == H5T_STRING) { /* ????? */ @@ -3610,8 +3628,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - xml_name_to_XID(tmp, rstr, 100, 1); - xml_name_to_XID(prefix, pstr, 100, 1); + xml_name_to_XID(did, tmp, rstr, 100, 1); + xml_name_to_XID(did, prefix, pstr, 100, 1); ctx.need_prefix = TRUE; @@ -4121,7 +4139,7 @@ xml_print_enum(hid_t type) unsigned char *value = NULL; /*value array */ unsigned nmembs; /*number of members */ hid_t super; /*enum base integer type */ - hid_t native = -1; /*native integer datatype */ + hid_t native = H5I_INVALID_HID; /*native integer datatype */ size_t dst_size; /*destination value type size */ unsigned i; /*miscellaneous counters */ size_t j; diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index 257a047..bb606ac 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -219,8 +219,8 @@ leave(int ret) static int convert(hid_t fid, const char *dname) { - hid_t dcpl = -1; - hid_t did = -1; + hid_t dcpl = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; H5D_layout_t layout_type; H5D_chunk_index_t idx_type; @@ -362,7 +362,7 @@ error: *------------------------------------------------------------------------- */ static int -convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_visited, void *_fid) +convert_dsets_cb(const char *path, const H5O_info2_t *oi, const char *already_visited, void *_fid) { hid_t fid = *(hid_t *)_fid; @@ -399,7 +399,7 @@ main(int argc, const char *argv[]) { H5E_auto2_t func; void *edata; - hid_t fid = -1; + hid_t fid = H5I_INVALID_HID; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 1eef5ab..0c0e0fb 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -72,7 +72,7 @@ uint64_t swap_uint64(uint64_t val); int main(int argc, char *argv[]) { - struct Options opt; + struct Options *opt; int outfile_named = FALSE; int token; int i; @@ -99,8 +99,8 @@ 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((opt = (struct Options *)HDcalloc(1, sizeof(struct Options))) == NULL) + goto err; if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) { print_version(PROGRAMNAME); @@ -130,12 +130,12 @@ int main(int argc, char *argv[]) switch (state) { case 1: /* counting input files */ - if (opt.fcount < 29) { - (void) HDstrcpy(opt.infiles[opt.fcount].datafile, argv[i]); - in = &(opt.infiles[opt.fcount].in); - opt.infiles[opt.fcount].config = 0; - setDefaultValues(in, opt.fcount); - opt.fcount++; + if (opt->fcount < 29) { + (void) HDstrcpy(opt->infiles[opt->fcount].datafile, argv[i]); + in = &(opt->infiles[opt->fcount].in); + opt->infiles[opt->fcount].config = 0; + setDefaultValues(in, opt->fcount); + opt->fcount++; } else { (void) HDfprintf(stderr, err9, argv[i]); @@ -148,8 +148,8 @@ int main(int argc, char *argv[]) break; case 3: /* get configfile name */ - (void) HDstrcpy(opt.infiles[opt.fcount-1].configfile, argv[i]); - opt.infiles[opt.fcount - 1].config = 1; + (void) HDstrcpy(opt->infiles[opt->fcount-1].configfile, argv[i]); + opt->infiles[opt->fcount - 1].config = 1; break; case 4: /* -o found; look for outfile */ @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) (void) HDfprintf(stderr, err10, argv[i]); goto err; } - (void) HDstrcpy(opt.outfile, argv[i]); + (void) HDstrcpy(opt->outfile, argv[i]); outfile_named = TRUE; break; @@ -232,11 +232,11 @@ int main(int argc, char *argv[]) goto err; } - if (process(&opt) == -1) + if (process(opt) == -1) goto err; - for (i = 0; i < opt.fcount; i++) { - in = &(opt.infiles[i].in); + for (i = 0; i < opt->fcount; i++) { + in = &(opt->infiles[i].in); if (in->sizeOfDimension) HDfree(in->sizeOfDimension); if (in->sizeOfChunk) @@ -248,12 +248,13 @@ int main(int argc, char *argv[]) if (in->data) HDfree(in->data); } + HDfree(opt); - return (EXIT_SUCCESS); + return EXIT_SUCCESS; err: (void) HDfprintf(stderr, "%s", err4); - for (i = 0; i < opt.fcount; i++) { - in = &(opt.infiles[i].in); + for (i = 0; i < opt->fcount; i++) { + in = &(opt->infiles[i].in); if (in->sizeOfDimension) HDfree(in->sizeOfDimension); if (in->sizeOfChunk) @@ -265,7 +266,9 @@ err: if (in->data) HDfree(in->data); } - return (EXIT_FAILURE); + HDfree(opt); + + return EXIT_FAILURE; } static int gtoken(char *s) @@ -1086,12 +1089,12 @@ out: */ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id) { - hid_t group_id = -1; - hid_t dset_id = -1; - hid_t space_id = -1; - hid_t mspace_id = -1; - hid_t type_id = -1; - hid_t handle = -1; + hid_t group_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t mspace_id = H5I_INVALID_HID; + hid_t type_id = H5I_INVALID_HID; + hid_t handle = H5I_INVALID_HID; char *str1 = NULL; char *str2 = NULL; char *str3 = NULL; @@ -4707,14 +4710,14 @@ static int process(struct Options *opt) return (0); } -uint16_t swap_uint16( uint16_t val) +uint16_t swap_uint16(uint16_t val) { - return (val << 8) | (val >> 8); + return (uint16_t)((val << 8) | (val >> 8)); } int16_t swap_int16(int16_t val) { - return (val << 8) | ((val >> 8) & 0xFF); + return (int16_t)((val << 8) | ((val >> 8) & 0xFF)); } uint32_t swap_uint32(uint32_t val) diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 8222e06..07797c8 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -197,8 +197,8 @@ main (int argc, const char *argv[]) int ofid = -1; void *edata; H5E_auto2_t func; - hid_t ifile = -1; - hid_t plist = -1; + hid_t ifile = H5I_INVALID_HID; + hid_t plist = H5I_INVALID_HID; herr_t status; htri_t testval; hsize_t usize; diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index aa893f9..203522b 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -199,8 +199,8 @@ main(int argc, const char *argv[]) { void *edata; H5E_auto2_t func; - hid_t ifile = -1; - hid_t plist = -1; + hid_t ifile = H5I_INVALID_HID; + hid_t plist = H5I_INVALID_HID; off_t fsize; hsize_t usize; htri_t testval; diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 6c21782..8f8272c 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -879,7 +879,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) if (nmembs > 0) { char **name; /* member names */ unsigned char *value; /* value array */ - hid_t native = -1; /* native integer data type */ + hid_t native = H5I_INVALID_HID; /* native integer data type */ size_t dst_size; /* destination value type size */ unsigned i; /* miscellaneous counters */ @@ -1260,10 +1260,17 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) /* Shared? If so then print the type's OID */ if (H5Tcommitted(type)) { - H5O_info_t oi; + H5O_info2_t oi; - if (H5Oget_info2(type, &oi, H5O_INFO_BASIC) >= 0) - h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr); + if (H5Oget_info3(type, &oi, H5O_INFO_BASIC) >= 0) { + char *type_string = NULL; + + H5Otoken_to_str(type, &oi.token, &type_string); + + h5tools_str_append(buffer,"shared-%lu:%s", oi.fileno, type_string); + + H5free_memory(type_string); + } /* end if */ else h5tools_str_append(buffer,"shared "); } /* end if */ @@ -1291,7 +1298,6 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) static void dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t container, H5R_ref_t *ref_buf, int ndims) { - H5TOOLS_ERR_INIT(int, SUCCEED) hid_t new_obj_id = H5I_INVALID_HID; hid_t new_obj_sid = H5I_INVALID_HID; hsize_t elmt_counter = 0; /*counts the # elements printed. */ @@ -1301,8 +1307,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx h5tools_str_t buffer; /* string into which to render */ h5tools_context_t datactx; /* print context */ - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); datactx = *ctx; /* print context */ /* Assume entire data space to be printed */ @@ -1313,21 +1318,21 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx HDmemset(&buffer, 0, sizeof(h5tools_str_t)); for(i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) { - H5O_type_t obj_type; /* Object type */ + H5O_type_t obj_type = -1; /* Object type */ H5R_type_t ref_type; /* Reference type */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference loop:%d with curr_pos=%ld", i, curr_pos); + H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos); datactx.need_prefix = TRUE; h5tools_str_reset(&buffer); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); + H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); h5tools_str_sprint(&buffer, info, container, H5T_STD_REF, &ref_buf[i], &datactx); h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims); ref_type = H5Rget_type((const H5R_ref_t *)&ref_buf[i]); switch (ref_type) { case H5R_OBJECT1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT1"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_DATASET: @@ -1336,12 +1341,12 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx h5tools_dump_dset(stream, info, &datactx, new_obj_id); datactx.indent_level--; if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_INFO("H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1:H5O_TYPE_DATASET failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_INFO("H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); break; case H5O_TYPE_GROUP: @@ -1354,24 +1359,24 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx } /* end switch */ } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_obj_type3 H5R_OBJECT1 failed"); + H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT1 failed"); break; case H5R_DATASET_REGION1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION1"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { datactx.indent_level++; h5tools_dump_dset(stream, info, &datactx, new_obj_id); datactx.indent_level--; if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION1 failed"); + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION1 failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION1 failed"); + H5TOOLS_INFO("H5Rdestroy H5R_DATASET_REGION1 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_DATASET_REGION1 failed"); + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed"); break; case H5R_OBJECT2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_GROUP: @@ -1383,12 +1388,12 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx h5tools_dump_dset(stream, info, &datactx, new_obj_id); datactx.indent_level--; if(H5Oclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT2 failed"); + H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT2 failed"); + H5TOOLS_INFO("H5Rdestroy H5R_OBJECT2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_OBJECT2 failed"); + H5TOOLS_INFO("H5Ropen_object H5R_OBJECT2 failed"); break; case H5O_TYPE_NAMED_DATATYPE: @@ -1402,22 +1407,21 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx } /* end switch */ } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_obj_type3 H5R_OBJECT2 failed"); + H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT2 failed"); break; case H5R_DATASET_REGION2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); if (info->line_ncols > 0) ncols = info->line_ncols; /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */ if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5R_DATASET_REGION2 failed"); + H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed"); else { if((new_obj_sid = H5Ropen_region((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " {"); @@ -1441,41 +1445,41 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx region_type = H5Sget_select_type(new_obj_sid); if(region_type == H5S_SEL_POINTS) { /* Print point information */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5S_SEL_POINTS H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2"); h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, info, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); } else if(region_type == H5S_SEL_HYPERSLABS) { /* Print block information */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, info, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "invalid region type"); + H5TOOLS_INFO("invalid region type"); } /* end else to if (h5tools_is_zero(... */ if(H5Sclose(new_obj_sid) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION2 failed"); + H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_region H5R_DATASET_REGION2 failed"); + H5TOOLS_INFO("H5Ropen_region H5R_DATASET_REGION2 failed"); if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION2 failed"); + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION2 failed"); + H5TOOLS_INFO("H5Rdestroy H5R_DATASET_REGION2 failed"); } break; case H5R_ATTR: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_ATTR"); + H5TOOLS_DEBUG("ref_type is H5R_ATTR"); if((new_obj_id = H5Ropen_attr((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { h5tools_dump_region_attribute(new_obj_id, stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(H5Aclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose H5R_ATTR failed"); + H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_ATTR failed"); + H5TOOLS_INFO("H5Rdestroy H5R_ATTR failed"); } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_ATTR"); + H5TOOLS_DEBUG("NULL H5R_ATTR"); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " {"); @@ -1493,7 +1497,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx h5tools_str_append(&buffer, "}"); h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_attr H5R_ATTR failed"); + H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed"); } break; case H5R_BADTYPE: @@ -1502,15 +1506,14 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx break; } /* end switch */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "finished reference loop:%d",i); + H5TOOLS_DEBUG("finished reference loop:%d",i); } /* end for(i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) */ -done: + h5tools_str_close(&buffer); PRINTVALSTREAM(stream, "\n"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); } /*------------------------------------------------------------------------- @@ -1524,7 +1527,6 @@ done: static void dump_dataset_values(hid_t dset) { - H5TOOLS_ERR_INIT(herr_t, SUCCEED) hid_t f_type = H5I_INVALID_HID; hid_t space = H5I_INVALID_HID; hsize_t total_size[H5S_MAX_RANK]; @@ -1540,8 +1542,7 @@ dump_dataset_values(hid_t dset) h5tool_format_t *info = &ls_dataformat; H5R_ref_t *ref_buf = NULL; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); f_type = H5Dget_type(dset); space = H5Dget_space(dset); @@ -1637,13 +1638,13 @@ dump_dataset_values(hid_t dset) ctx.need_prefix = TRUE; ctx.cur_column = (size_t)curr_pos; if (H5Tget_class(f_type) == H5T_REFERENCE) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference class type"); + H5TOOLS_DEBUG("reference class type"); if (!H5Tequal(f_type, H5T_STD_REF) && !H5Tequal(f_type, H5T_STD_REF_DSETREG) && !H5Tequal(f_type, H5T_STD_REF_OBJ)) { - HGOTO_DONE(SUCCEED); + H5TOOLS_GOTO_DONE_NO_RET(); } ndims = (int)H5Sget_simple_extent_npoints(space); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ndims=%d - ctx.ndims=%d", ndims, ctx.ndims); + H5TOOLS_DEBUG("ndims=%d - ctx.ndims=%d", ndims, ctx.ndims); /* Assume entire data space to be printed */ if (ctx.ndims > 0) @@ -1656,10 +1657,11 @@ dump_dataset_values(hid_t dset) ctx.need_prefix = TRUE; if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), ndims))) { - H5TOOLS_DEBUG(H5E_tools_min_id_g, "H5Dread reference read"); + H5TOOLS_DEBUG("H5Dread reference read"); if(H5Dread(dset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_buf) < 0) { HDfree(ref_buf); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread reference failed"); + H5TOOLS_INFO("H5Dread reference failed"); + H5TOOLS_GOTO_DONE_NO_RET(); } dump_reference(rawoutstream, info, &ctx, dset, ref_buf, ndims); HDfree(ref_buf); @@ -1680,8 +1682,7 @@ done: PRINTVALSTREAM(rawoutstream, "\n"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); } @@ -1694,9 +1695,8 @@ done: *------------------------------------------------------------------------- */ static void -dump_attribute_values(hid_t attr, const char *attr_name) +dump_attribute_values(hid_t attr) { - H5TOOLS_ERR_INIT(herr_t, SUCCEED) hid_t f_type = H5I_INVALID_HID; hid_t space = H5I_INVALID_HID; hsize_t total_size[H5S_MAX_RANK]; @@ -1712,8 +1712,7 @@ dump_attribute_values(hid_t attr, const char *attr_name) h5tool_format_t *info = &ls_dataformat; H5R_ref_t *ref_buf = NULL; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); f_type = H5Aget_type(attr); space = H5Aget_space(attr); @@ -1810,13 +1809,13 @@ dump_attribute_values(hid_t attr, const char *attr_name) ctx.need_prefix = TRUE; ctx.cur_column = (size_t)curr_pos; if (H5Tget_class(f_type) == H5T_REFERENCE) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference class type"); + H5TOOLS_DEBUG("reference class type"); if (!H5Tequal(f_type, H5T_STD_REF) && !H5Tequal(f_type, H5T_STD_REF_DSETREG) && !H5Tequal(f_type, H5T_STD_REF_OBJ)) { - HGOTO_DONE(SUCCEED); + H5TOOLS_GOTO_DONE_NO_RET(); } ndims = (int)H5Sget_simple_extent_npoints(space); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ndims=%d - ctx.ndims=%d", ndims, ctx.ndims); + H5TOOLS_DEBUG("ndims=%d - ctx.ndims=%d", ndims, ctx.ndims); /* Assume entire data space to be printed */ if (ctx.ndims > 0) @@ -1829,10 +1828,11 @@ dump_attribute_values(hid_t attr, const char *attr_name) ctx.need_prefix = TRUE; if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), ndims))) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Aread reference read"); + H5TOOLS_DEBUG("H5Aread reference read"); if(H5Aread(attr, H5T_STD_REF, ref_buf) < 0) { HDfree(ref_buf); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread reference failed"); + H5TOOLS_INFO("H5Aread reference failed"); + H5TOOLS_GOTO_DONE_NO_RET(); } ctx.indent_level++; dump_reference(rawoutstream, info, &ctx, attr, ref_buf, ndims); @@ -1841,7 +1841,7 @@ dump_attribute_values(hid_t attr, const char *attr_name) } } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Attribute data read"); + H5TOOLS_DEBUG("Attribute data read"); ctx.indent_level++; if (h5tools_dump_mem(rawoutstream, info, &ctx, attr) < 0) { h5tools_str_reset(&buffer); @@ -1849,7 +1849,7 @@ dump_attribute_values(hid_t attr, const char *attr_name) h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Attribute data read complete"); + H5TOOLS_DEBUG("Attribute data read complete"); } done: H5Sclose(space); @@ -1859,8 +1859,7 @@ done: PRINTVALSTREAM(rawoutstream, "\n"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); } /*------------------------------------------------------------------------- @@ -1876,7 +1875,6 @@ static herr_t list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void H5_ATTR_UNUSED *op_data) { - H5TOOLS_ERR_INIT(herr_t, SUCCEED) hid_t attr = H5I_INVALID_HID; hid_t space = H5I_INVALID_HID; hid_t type = H5I_INVALID_HID; @@ -1890,8 +1888,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -1904,7 +1901,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain print_string(&buffer, attr_name, TRUE); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Attribute name:%s", attr_name); + H5TOOLS_DEBUG("Attribute name:%s", attr_name); if ((attr = H5Aopen(obj, attr_name, H5P_DEFAULT)) >= 0) { space = H5Aget_space(attr); type = H5Aget_type(attr); @@ -1912,7 +1909,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain /* Data space */ ndims = H5Sget_simple_extent_dims(space, size, NULL); space_type = H5Sget_simple_extent_type(space); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Attribute ndims:%d", ndims); + H5TOOLS_DEBUG("Attribute ndims:%d", ndims); switch(space_type) { case H5S_SCALAR: /* scalar dataspace */ @@ -1958,15 +1955,14 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain h5tools_str_close(&buffer); if (data_g) - dump_attribute_values(attr, attr_name); + dump_attribute_values(attr); H5Aclose(attr); } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Attribute open failed"); + H5TOOLS_DEBUG("Attribute open failed"); h5tools_str_close(&buffer); } - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return 0; } @@ -2295,9 +2291,8 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name) *------------------------------------------------------------------------- */ static herr_t -list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void *_iter) +list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, void *_iter) { - H5TOOLS_ERR_INIT(herr_t, SUCCEED) H5O_type_t obj_type = oinfo->type; /* Type of the object */ iter_t *iter = (iter_t*)_iter; hsize_t curr_pos = 0; /* total data element position */ @@ -2305,15 +2300,14 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void h5tools_context_t ctx; /* print context */ h5tool_format_t *info = &ls_dataformat; - H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); h5tools_str_reset(&buffer); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Object name:%s", name); + H5TOOLS_DEBUG("Object name:%s", name); /* Print the link's name, either full name or base name */ if (!iter->symlink_target) print_obj_name(&buffer, iter, name, ""); @@ -2345,7 +2339,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void /* Open the object. Not all objects can be opened. If this is the case * then return right away. */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Open object name=%s", name); + H5TOOLS_DEBUG("Open object name=%s", name); if (obj_type >= 0 && (obj = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " *ERROR*\n"); @@ -2354,7 +2348,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void } /* end if */ /* List the first line of information for the object. */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Object type:%d", obj_type); + H5TOOLS_DEBUG("Object type:%d", obj_type); if (obj_type >= 0 && dispatch_g[obj_type].list1) (dispatch_g[obj_type].list1)(obj); if (!iter->symlink_target || (verbose_g > 0)) { @@ -2368,19 +2362,24 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void if (verbose_g > 0) { size_t buf_size = 0; char* comment = NULL; + char* obj_addr_str = NULL; ssize_t cmt_bufsize = -1; /* Display attributes */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Display attributes"); + H5TOOLS_DEBUG("Display attributes"); if (obj_type >= 0) H5Aiterate2(obj, H5_INDEX_NAME, H5_ITER_INC, NULL, list_attr, NULL); /* Object location & reference count */ + H5Otoken_to_str(obj, &oinfo->token, &obj_addr_str); + h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr); + h5tools_str_append(&buffer, " %-10s %lu:%s\n", "Location:", oinfo->fileno, obj_addr_str); h5tools_str_append(&buffer, " %-10s %u\n", "Links:", (unsigned)oinfo->rc); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); + H5free_memory(obj_addr_str); + /* Modification time */ if (oinfo->mtime > 0) { char buf[256]; @@ -2439,8 +2438,7 @@ done: } h5tools_str_close(&buffer); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); - H5TOOLS_POP_STACK(); + H5TOOLS_ENDDEBUG("exit"); return 0; } /* end list_obj() */ @@ -2456,7 +2454,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) +list_lnk(const char *name, const H5L_info2_t *linfo, void *_iter) { char *buf = NULL; iter_t *iter = (iter_t*)_iter; @@ -2642,7 +2640,7 @@ static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter) { int retval = 0; - H5O_info_t oi; /* Information for object */ + H5O_info2_t oi; /* Information for object */ hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ @@ -2654,7 +2652,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) h5tools_str_reset(&buffer); /* Retrieve info for object to list */ - if (H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) { + if (H5Oget_info_by_name3(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) { if (iter->symlink_target) { h5tools_str_append(&buffer, "{**NOT FOUND**}\n"); iter->symlink_target = FALSE; @@ -2835,7 +2833,7 @@ leave(int ret) int main(int argc, const char *argv[]) { - hid_t file = H5I_INVALID_HID; + hid_t file_id = H5I_INVALID_HID; char *fname = NULL, *oname = NULL, *x; const char *s = NULL; char *rest; @@ -3293,24 +3291,24 @@ main(int argc, const char *argv[]) * doesn't exist). */ show_file_name_g = (argc-argno > 1); /*show file names if more than one*/ while(argno < argc) { - H5L_info_t li; + H5L_info2_t li; iter_t iter; symlink_trav_t symlink_list; size_t u; fname = HDstrdup(argv[argno++]); oname = NULL; - file = -1; + file_id = H5I_INVALID_HID; while (fname && *fname) { if (fapl_id != H5P_DEFAULT) { - file = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); + file_id = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); } else { - file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername); + file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername); } - if (file >= 0) { + if (file_id >= 0) { if (verbose_g) PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername); break; /*success*/ @@ -3326,7 +3324,7 @@ main(int argc, const char *argv[]) *oname = '\0'; } /* end while */ - if (file < 0) { + if (file_id < 0) { HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno-1]); HDfree(fname); err_exit = 1; @@ -3361,8 +3359,8 @@ main(int argc, const char *argv[]) /* Remember the file information for later */ iter.fname = fname; - iter.fid = file; - iter.gid = -1; + iter.fid = file_id; + iter.gid = H5I_INVALID_HID; iter.symlink_target = FALSE; iter.symlink_list = &symlink_list; iter.symlink_list->dangle_link = FALSE; @@ -3374,7 +3372,7 @@ main(int argc, const char *argv[]) /* Check for root group as object name */ if (HDstrcmp(oname, root_name)) { /* Check the type of link given */ - if (H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) { + if (H5Lget_info2(file_id, oname, &li, H5P_DEFAULT) < 0) { hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ @@ -3395,18 +3393,18 @@ main(int argc, const char *argv[]) /* Open the object and display it's information */ if (li.type == H5L_TYPE_HARD) { - if (visit_obj(file, oname, &iter) < 0) { + if (visit_obj(file_id, oname, &iter) < 0) { H5Eset_auto2(H5E_DEFAULT, func, edata); leave(EXIT_FAILURE); } } /* end if(li.type == H5L_TYPE_HARD) */ else { /* Specified name is not for object -- list that link */ - /* Use file ID for root group ID */ - iter.gid = file; + /* Use file_id ID for root group ID */ + iter.gid = file_id; list_lnk(oname, &li, &iter); } - H5Fclose(file); + H5Fclose(file_id); HDfree(fname); if (x) HDfree(oname); diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 971589e..8eeaa0e 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -222,18 +222,27 @@ h5repack_addlayout(const char *str, pack_opt_t *options) hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) { - named_dt_t *dt = *named_dt_head_p; /* Stack pointer */ - named_dt_t *dt_ret = NULL; /* Datatype to return */ - H5O_info_t oinfo; /* Object info of input dtype */ - hid_t ret_value = -1; /* The identifier of the named dtype in the out file */ + named_dt_t *dt = *named_dt_head_p; /* Stack pointer */ + named_dt_t *dt_ret = NULL; /* Datatype to return */ + H5O_info2_t oinfo; /* Object info of input dtype */ + int token_cmp; + hid_t ret_value = H5I_INVALID_HID; - if (H5Oget_info2(type_in, &oinfo, H5O_INFO_BASIC) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); + if (H5Oget_info3(type_in, &oinfo, H5O_INFO_BASIC) < 0) + H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "H5Oget_info failed"); if (*named_dt_head_p) { + if (H5Otoken_cmp(type_in, &dt->obj_token, &oinfo.token, &token_cmp) < 0) + H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens"); + /* Stack already exists, search for the datatype */ - while (dt && dt->addr_in != oinfo.addr) + while (dt && token_cmp) { dt = dt->next; + + if (H5Otoken_cmp(type_in, &dt->obj_token, &oinfo.token, &token_cmp) < 0) + H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens"); + } + dt_ret = dt; } else { @@ -244,18 +253,19 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { /* Push onto the stack */ if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed"); + H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed"); dt->next = *named_dt_head_p; *named_dt_head_p = dt; /* Update the address and id */ - dt->addr_in = travt->objs[i].objno; - dt->id_out = -1; + HDmemcpy(&dt->obj_token, &travt->objs[i].obj_token, sizeof(H5O_token_t)); + dt->id_out = H5I_INVALID_HID; /* Check if this type is the one requested */ - if (oinfo.addr == dt->addr_in) { + if (H5Otoken_cmp(type_in, &oinfo.token, &dt->obj_token, &token_cmp) < 0) + H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens"); + if (!token_cmp) dt_ret = dt; - } } /* end if named datatype */ } /* end for each object in traversal table */ } /* end else (create the stack) */ @@ -266,13 +276,13 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t if (!dt_ret) { /* Push the new datatype onto the stack */ if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed"); + H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed"); dt_ret->next = *named_dt_head_p; *named_dt_head_p = dt_ret; /* Update the address and id */ - dt_ret->addr_in = oinfo.addr; - dt_ret->id_out = -1; + HDmemcpy(&dt_ret->obj_token, &oinfo.token, sizeof(H5O_token_t)); + dt_ret->id_out = H5I_INVALID_HID; } /* end if requested datatype not found */ /* If the requested datatype does not yet exist in the output file, copy it @@ -284,9 +294,9 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t else dt_ret->id_out = H5Tcopy(type_in); if (dt_ret->id_out < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type-H5Tcopy failed"); + H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "H5Tget_native_type-H5Tcopy failed"); if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommit_anon failed"); + H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "H5Tcommit_anon failed"); } /* end if named datatype not yet in output file */ /* Set return value */ @@ -296,7 +306,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t * to close it. (TODO: fix scope envy) */ if (H5Iinc_ref(ret_value) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iinc_ref failed"); + H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "H5Iinc_ref failed"); done: return ret_value; @@ -312,12 +322,12 @@ int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) { named_dt_t *dt = *named_dt_head_p; - int ret_value = -1; + int ret_value = -1; while (dt) { /* Pop the datatype off the stack and free it */ if (H5Tclose(dt->id_out) < 0 && !ignore_err) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); dt = dt->next; HDfree(*named_dt_head_p); *named_dt_head_p = dt; @@ -343,12 +353,11 @@ done: int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) { - int ret_value = 0; - hid_t attr_id = -1; /* attr ID */ - hid_t attr_out = -1; /* attr ID */ - hid_t space_id = -1; /* space ID */ - hid_t ftype_id = -1; /* file type ID */ - hid_t wtype_id = -1; /* read/write type ID */ + hid_t attr_id = H5I_INVALID_HID; /* attr ID */ + hid_t attr_out = H5I_INVALID_HID; /* attr ID */ + hid_t space_id = H5I_INVALID_HID; /* space ID */ + hid_t ftype_id = H5I_INVALID_HID; /* file type ID */ + hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */ size_t msize; /* size of type */ void *buf = NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ @@ -356,14 +365,15 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ htri_t is_named; /* Whether the datatype is named */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ char name[255]; - H5O_info_t oinfo; /* object info */ + H5O_info2_t oinfo; /* object info */ int j; unsigned u; hbool_t is_ref = 0; H5T_class_t type_class = -1; + int ret_value = 0; - if (H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); + if (H5Oget_info3(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed"); /*------------------------------------------------------------------------- * copy all attributes @@ -372,33 +382,33 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ for (u = 0; u < (unsigned) oinfo.num_attrs; u++) { /* open attribute */ if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aopen_by_idx failed"); if (H5Aget_name(attr_id, (size_t) 255, name) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); /* get the file datatype */ if ((ftype_id = H5Aget_type(attr_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aget_type failed"); /* Check if the datatype is committed */ if ((is_named = H5Tcommitted(ftype_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tcommitted failed"); if (is_named && travt) { - hid_t fidout = -1; + hid_t fidout = H5I_INVALID_HID; /* Create out file id */ if ((fidout = H5Iget_file_id(loc_out)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iget_file_id failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Iget_file_id failed"); /* Copy named dt */ if ((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, travt, options)) < 0) { H5Fclose(fidout); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed"); } if (H5Fclose(fidout) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Fclose failed"); } /* end if datatype is committed and we have a traversal table */ else { if (options->use_native == 1) @@ -409,18 +419,18 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ /* get the dataspace handle */ if ((space_id = H5Aget_space(attr_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aget_space failed"); /* get dimensions */ if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed"); nelmts = 1; for (j = 0; j < rank; j++) nelmts *= dims[j]; if ((msize = H5Tget_size(wtype_id)) == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed"); /*--------------------------------------------------------------------- * object references are a special case. We cannot just copy the @@ -432,12 +442,12 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ type_class = H5Tget_class(wtype_id); is_ref = (type_class == H5T_REFERENCE); if (type_class == H5T_VLEN || type_class == H5T_ARRAY) { - hid_t base_type = -1; + hid_t base_type = H5I_INVALID_HID; base_type = H5Tget_super(ftype_id); is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE)); if (H5Tclose(base_type) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed"); + H5TOOLS_ERROR((-1), "H5Tclose base_type failed"); } /* end if type_class is variable length or array */ if (type_class == H5T_COMPOUND) { @@ -447,7 +457,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ hid_t mtid = H5Tget_member_type(wtype_id, (unsigned)j); H5T_class_t mtclass = H5Tget_class(mtid); if (H5Tclose(mtid) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtid failed"); + H5TOOLS_ERROR((-1), "H5Tclose mtid failed"); if (mtclass == H5T_REFERENCE) { is_ref = 1; @@ -464,10 +474,10 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ buf = (void *)HDmalloc((size_t)(nelmts * msize)); if (buf == NULL) { - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); } /* end if */ if (H5Aread(attr_id, wtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); /*----------------------------------------------------------------- * copy @@ -475,13 +485,13 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ */ if ((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed on ,%s>", name); + H5TOOLS_GOTO_ERROR((-1), "H5Acreate2 failed on ,%s>", name); if (H5Awrite(attr_out, wtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Awrite failed"); /*close*/ if (H5Aclose(attr_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed"); /* Check if we have VL data and string in the attribute's datatype that must * be reclaimed */ @@ -499,17 +509,17 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ *--------------------------------------------------------------------- */ if (H5Sclose(space_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); - space_id = -1; + H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed"); + space_id = H5I_INVALID_HID; if (H5Tclose(wtype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - wtype_id = -1; + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); + wtype_id = H5I_INVALID_HID; if (H5Tclose(ftype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - ftype_id = -1; + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); + ftype_id = H5I_INVALID_HID; if (H5Aclose(attr_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); - attr_id = -1; + H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed"); + attr_id = H5I_INVALID_HID; } /* for u (each attribute) */ done: @@ -546,10 +556,10 @@ done: static int check_options(pack_opt_t *options) { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ unsigned int i; int k, j, has_cp = 0, has_ck = 0; char slayout[30]; + int ret_value = 0; /*------------------------------------------------------------------------- * Objects to layout @@ -573,10 +583,11 @@ check_options(pack_opt_t *options) break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid layout"); + H5TOOLS_GOTO_ERROR((-1), "invalid layout"); + break; default: strcpy(slayout, "invalid layout\n"); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE((-1)); } HDprintf(" Apply %s layout to all", slayout); if (H5D_CHUNKED == options->layout_g) { @@ -611,7 +622,7 @@ check_options(pack_opt_t *options) } /* end for each object in options */ if (options->all_layout == 1 && has_ck) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid chunking input: 'all' option is present with other objects"); + H5TOOLS_GOTO_ERROR((-1), "invalid chunking input: 'all' option is present with other objects"); /*------------------------------------------------------------------------- * Objects to filter @@ -669,7 +680,7 @@ check_options(pack_opt_t *options) } /* end for each object in options table */ if (options->all_filter == 1 && has_cp) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid compression input: 'all' option is present with other objects"); + H5TOOLS_GOTO_ERROR((-1), "invalid compression input: 'all' option is present with other objects"); /*------------------------------------------------------------------------- * Check options for the latest format @@ -677,14 +688,14 @@ check_options(pack_opt_t *options) */ if (options->grp_compact < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid maximum number of links to store as header messages"); + H5TOOLS_GOTO_ERROR((-1), "invalid maximum number of links to store as header messages"); if (options->grp_indexed < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid minimum number of links to store in the indexed format"); + H5TOOLS_GOTO_ERROR((-1), "invalid minimum number of links to store in the indexed format"); if (options->grp_indexed > options->grp_compact) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "minimum indexed size is greater than the maximum compact size"); + H5TOOLS_GOTO_ERROR((-1), "minimum indexed size is greater than the maximum compact size"); for (i = 0; i < 8; i++) if (options->msg_size[i] < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid shared message size"); + H5TOOLS_GOTO_ERROR((-1), "invalid shared message size"); /*------------------------------------------------------------------------ * Verify new user userblock options; file name must be present @@ -698,7 +709,7 @@ check_options(pack_opt_t *options) } if (options->ublock_filename == NULL && options->ublock_size != 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "file name missing for user block", options->ublock_filename); + H5TOOLS_GOTO_ERROR((-1), "file name missing for user block", options->ublock_filename); /*------------------------------------------------------------------------ * Verify alignment options; threshold is zero default but alignment not @@ -706,7 +717,7 @@ check_options(pack_opt_t *options) */ if (options->alignment == 0 && options->threshold != 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "alignment for H5Pset_alignment missing"); + H5TOOLS_GOTO_ERROR((-1), "alignment for H5Pset_alignment missing"); done: return ret_value; @@ -724,24 +735,24 @@ done: static int check_objects(const char* fname, pack_opt_t *options) { - hid_t fid = -1; - hid_t did = -1; - hid_t sid = -1; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; unsigned int i; - int ifil; + int ifil; trav_table_t *travt = NULL; - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ + int ret_value = 0; /* nothing to do */ if (options->op_tbl->nelems == 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /*------------------------------------------------------------------------- * open the file *------------------------------------------------------------------------- */ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); + H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); /*------------------------------------------------------------------------- * get the list of objects in the file @@ -751,11 +762,11 @@ check_objects(const char* fname, pack_opt_t *options) /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); /* init table */ - trav_table_init(&travt); + trav_table_init(fid, &travt); /* get the list of objects in the file */ if (h5trav_gettable(fid, travt) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); + H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed"); /*------------------------------------------------------------------------- * compare with user supplied list @@ -774,14 +785,14 @@ check_objects(const char* fname, pack_opt_t *options) /* the input object names are present in the file and are valid */ if (h5trav_getindext(name, travt) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "%s Could not find <%s> in file <%s>. Exiting...\n", + H5TOOLS_GOTO_ERROR((-1), "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose ? "\n" : ""), name, fname); if (options->verbose) HDprintf("...Found\n"); for (ifil = 0; ifil < obj.nfilters; ifil++) { if (obj.filter[ifil].filtn < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); + H5TOOLS_GOTO_ERROR((-1), "invalid filter"); /* check for extra filter conditions */ switch (obj.filter[ifil].filtn) { /* chunk size must be smaller than pixels per block */ @@ -800,25 +811,25 @@ check_objects(const char* fname, pack_opt_t *options) } else { if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed"); if ((sid = H5Dget_space(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed"); if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed"); HDmemset(dims, 0, sizeof dims); if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed"); for (j = 0; j < rank; j++) csize *= dims[j]; if (H5Sclose(sid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed"); if (H5Dclose(did) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); } if (csize < ppb) { HDprintf(" <warning: SZIP settings, chunk size is smaller than pixels per block>\n"); - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } } /* end case SZIP */ break; diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h index a0e0387..52ecb0e 100644 --- a/tools/src/h5repack/h5repack.h +++ b/tools/src/h5repack/h5repack.h @@ -131,7 +131,7 @@ typedef struct { typedef struct named_dt_t { - haddr_t addr_in; /* Address of the named dtype in the in file */ + H5O_token_t obj_token; /* Object token for the named dtype in the in file */ hid_t id_out; /* Open identifier for the dtype in the out file */ struct named_dt_t *next; /* Next dtype */ } named_dt_t; diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 5d41908..1044244 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -61,12 +61,11 @@ static void print_user_block(const char *filename, hid_t fid); int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) { - int ret_value = 0; - hid_t fidin = -1; - hid_t fidout = -1; - hid_t fcpl_in = -1; /* file creation property list ID for input file */ - hid_t grp_in = -1; /* group ID */ - hid_t gcpl_in = -1; /* group creation property list */ + hid_t fidin = H5I_INVALID_HID; + hid_t fidout = H5I_INVALID_HID; + hid_t fcpl_in = H5I_INVALID_HID; /* file creation property list ID for input file */ + hid_t grp_in = H5I_INVALID_HID; /* group ID */ + hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */ hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */ hid_t fapl = H5P_DEFAULT; /* file access property list ID */ trav_table_t *travt = NULL; @@ -80,65 +79,66 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) hsize_t in_threshold; /* Free-space section threshold from input file */ hsize_t in_pagesize; /* File space page size from input file */ unsigned crt_order_flags; /* group creation order flag */ + int ret_value = 0; /*------------------------------------------------------------------------- * open input file *------------------------------------------------------------------------- */ if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR); + H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR); /* get user block size and file space strategy/persist/threshold */ { if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Fget_create_plist failed to retrieve file creation property list"); if (H5Pget_userblock(fcpl_in, &ub_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_userblock failed to retrieve userblock size"); /* If the -S option is not set, get "strategy" from the input file */ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy"); /* If the -G option is not set, get "pagesize" from the input file */ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space threshold"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space threshold"); /* open root group */ if ((grp_in = H5Gopen2(fidin, "/", H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed"); /* get root group creation property list */ if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gget_create_plist failed"); /* query and set the group creation properties */ if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_link_creation_order failed"); if (H5Pclose(fcpl_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed to close property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed to close property list"); } if(options->latest) options->low_bound = options->high_bound = H5F_LIBVER_LATEST; /* Create file access property list */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create file access property list"); /* It can be default, latest or other settings by users */ if(H5Pset_libver_bounds(fapl, options->low_bound, options->high_bound) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set format version bounds"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_libver_bounds failed to set format version bounds"); /* Check if we need to create a non-default file creation property list */ if (options->low_bound >= H5F_LIBVER_V18 || ub_size > 0) { /* Create file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create a file creation property list"); if (ub_size > 0) if (H5Pset_userblock(fcpl, ub_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set non-default userblock size"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_userblock failed to set non-default userblock size"); if (options->low_bound >= H5F_LIBVER_V18) { unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; @@ -146,7 +146,7 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) /* Adjust group creation parameters for root group */ /* (So that it is created in "dense storage" form) */ if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed to adjust group creation parameters for root group"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_phase_change failed to adjust group creation parameters for root group"); for (i = 0; i < 5; i++) { if (options->msg_size[i] > 0) { @@ -182,12 +182,12 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) if (nindex > 0) { if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_nindexes failed to set the number of shared object header message indexes"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_nindexes failed to set the number of shared object header message indexes"); /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */ for (i = 0; i < (nindex - 1); i++) if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_index failed to configure the specified shared object header message index"); } /* if (nindex>0) */ } /* end if */ @@ -205,11 +205,11 @@ print_user_block(fnamein, fidin); if (fcpl == H5P_DEFAULT) /* create a file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create a file creation property list"); /* set user block size */ if (H5Pset_userblock(fcpl, options->ublock_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set userblock size"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_userblock failed to set userblock size"); } /*------------------------------------------------------------------------- @@ -221,10 +221,10 @@ print_user_block(fnamein, fidin); if (fapl == H5P_DEFAULT) /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create file access property list"); if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alignment failed to set alignment"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_alignment failed to set alignment"); } /*------------------------------------------------------------------------- @@ -236,10 +236,10 @@ print_user_block(fnamein, fidin); if (fapl == H5P_DEFAULT) /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create file access property list"); if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_meta_block_size failed to set metadata block size"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_meta_block_size failed to set metadata block size"); } /*------------------------------------------------------------------------- @@ -251,10 +251,10 @@ print_user_block(fnamein, fidin); if (fcpl == H5P_DEFAULT) /* create a file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create a file creation property list"); if(H5Pset_link_creation_order(fcpl, crt_order_flags ) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_creation_order failed"); /* Set file space info to those from input file */ set_strategy = in_strategy; @@ -279,7 +279,7 @@ print_user_block(fnamein, fidin); /* Set file space information as specified */ if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_strategy failed to set file space strategy"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_file_space_strategy failed to set file space strategy"); if(options->fs_pagesize == -1) /* A "0" file space page size is specified by user */ set_pagesize = (hsize_t)0; @@ -288,7 +288,7 @@ print_user_block(fnamein, fidin); if(set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */ if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_page_size failed to set file space page size"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_file_space_page_size failed to set file space page size"); /*------------------------------------------------------------------------- * create the output file @@ -298,7 +298,7 @@ print_user_block(fnamein, fidin); HDprintf("Making new file ...\n"); if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fcreate could not create file <%s>:", fnameout); + H5TOOLS_GOTO_ERROR((-1), "H5Fcreate could not create file <%s>:", fnameout); /*------------------------------------------------------------------------- * write a new user block if requested @@ -306,7 +306,7 @@ print_user_block(fnamein, fidin); */ if (options->ublock_size > 0) if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting..."); + H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); /*------------------------------------------------------------------------- * get list of objects @@ -316,19 +316,19 @@ print_user_block(fnamein, fidin); /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); /* init table */ - trav_table_init(&travt); + trav_table_init(fidin, &travt); if (travt) { /* get the list of objects in the file */ if (h5trav_gettable(fidin, travt) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); + H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed"); /*------------------------------------------------------------------------- * do the copy *------------------------------------------------------------------------- */ if (do_copy_objects(fidin, fidout, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout); + H5TOOLS_GOTO_ERROR((-1), "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout); /*------------------------------------------------------------------------- * do the copy of referenced objects @@ -336,7 +336,7 @@ print_user_block(fnamein, fidin); *------------------------------------------------------------------------- */ if (do_copy_refobjs(fidin, fidout, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout); + H5TOOLS_GOTO_ERROR((-1), "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout); } /*------------------------------------------------------------------------- @@ -346,7 +346,7 @@ print_user_block(fnamein, fidin); if (ub_size > 0 && options->ublock_size == 0) if (copy_user_block(fnamein, fnameout, ub_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting..."); + H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting..."); done: H5E_BEGIN_TRY { @@ -402,7 +402,6 @@ int get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) { - int ret_value = 0; int k; H5D_layout_t dset_layout; int rank_chunk; @@ -413,6 +412,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */ hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */ hsize_t hslab_nbytes; /* size of hyperslab in byte */ + int ret_value = 0; /* init to set as size of a data element */ hslab_nbytes = size_datum; @@ -425,7 +425,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], /* get chunk dims */ rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); if (rank_chunk < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_chunk failed"); for (k = rank_dset; k > 0; --k) size_chunk *= dims_chunk[k - 1]; @@ -487,7 +487,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], hslab_nbytes *= dims_hslab[k - 1]; if (hslab_nbytes <= 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "calculate total size for the hyperslab failed"); + H5TOOLS_GOTO_ERROR((-1), "calculate total size for the hyperslab failed"); } } } @@ -511,7 +511,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], hslab_nbytes *= dims_hslab[k - 1]; if (hslab_nbytes <= 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "calculate total size for the hyperslab failed"); + H5TOOLS_GOTO_ERROR((-1), "calculate total size for the hyperslab failed"); } } @@ -580,20 +580,19 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - int ret_value = 0; - hid_t grp_in = -1; /* group ID */ - hid_t grp_out = -1; /* group ID */ - hid_t dset_in = -1; /* read dataset ID */ - hid_t dset_out = -1; /* write dataset ID */ - hid_t gcpl_in = -1; /* group creation property list */ - hid_t gcpl_out = -1; /* group creation property list */ - hid_t type_in = -1; /* named type ID */ - hid_t type_out = -1; /* named type ID */ - hid_t dcpl_in = -1; /* dataset creation property list ID */ - hid_t dcpl_out = -1; /* dataset creation property list ID */ - hid_t f_space_id = -1; /* file space ID */ - hid_t ftype_id = -1; /* file type ID */ - hid_t wtype_id = -1; /* read/write type ID */ + hid_t grp_in = H5I_INVALID_HID; /* group ID */ + hid_t grp_out = H5I_INVALID_HID; /* group ID */ + hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */ + hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */ + hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */ + hid_t gcpl_out = H5I_INVALID_HID; /* group creation property list */ + hid_t type_in = H5I_INVALID_HID; /* named type ID */ + hid_t type_out = H5I_INVALID_HID; /* named type ID */ + hid_t dcpl_in = H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t dcpl_out = H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t f_space_id = H5I_INVALID_HID; /* file space ID */ + hid_t ftype_id = H5I_INVALID_HID; /* file type ID */ + hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */ named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ size_t msize; /* size of type */ hsize_t nelmts; /* number of elements in dataset */ @@ -617,6 +616,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, htri_t is_named; hbool_t limit_maxdims; hsize_t size_dset; + int ret_value = 0; /*------------------------------------------------------------------------- * copy the supplied object list @@ -649,22 +649,22 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* open input group */ if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed"); /* get input group creation property list */ if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gget_create_plist failed"); /* query and set the group creation properties */ if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_link_creation_order failed"); /* set up group creation property list */ if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed"); if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_creation_order failed"); /*------------------------------------------------------------------------- * the root is a special case, we get an ID for the root group @@ -673,15 +673,15 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ if (HDstrcmp(travt->objs[i].name, "/") == 0) { if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed"); } else { if (options->grp_compact > 0 || options->grp_indexed > 0) if (H5Pset_link_phase_change(gcpl_out, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_phase_change failed"); if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gcreate2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gcreate2 failed"); } /*------------------------------------------------------------------------- @@ -689,16 +689,16 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, *------------------------------------------------------------------------- */ if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_attr failed"); if (H5Pclose(gcpl_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if (H5Pclose(gcpl_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if (H5Gclose(grp_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed"); if (H5Gclose(grp_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed"); break; @@ -740,23 +740,23 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* early detection of references */ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed"); if ((ftype_id = H5Dget_type(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed"); if (H5T_REFERENCE == H5Tget_class(ftype_id)) is_ref = 1; /* Check if the datatype is committed */ if ((is_named = H5Tcommitted(ftype_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tcommitted failed"); if (is_named) if ((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed"); if (H5Tclose(ftype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); if (H5Dclose(dset_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); /*------------------------------------------------------------------------- * check if we should use H5Ocopy or not @@ -770,20 +770,20 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, int j; if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed"); if ((f_space_id = H5Dget_space(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed"); if ((ftype_id = H5Dget_type(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed"); if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed"); if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed"); HDmemset(dims, 0, sizeof dims); if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed"); if (H5Dget_space_status(dset_in, &space_status) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space_status failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_space_status failed"); /* If the input dataset has external storage, it must be contiguous. * Accordingly, there would be no filter or chunk properties to preserve, @@ -792,10 +792,10 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ if (H5Pget_external_count(dcpl_in)) { if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed"); } else if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) { - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pcopy failed"); } nelmts = 1; @@ -811,7 +811,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, } if ((msize = H5Tget_size(wtype_id)) == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed"); /* size of current dset */ size_dset = nelmts * msize; @@ -848,7 +848,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* apply the filter */ if (apply_s) if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out, options, &has_filter) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "apply_filters failed"); + H5TOOLS_GOTO_ERROR((-1), "apply_filters failed"); /* only if layout change requested for entire file or * individual obj */ @@ -888,13 +888,13 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, *------------------------------------------------------------------------- */ dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); - if (dset_out == FAIL) { - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); + if (dset_out == H5I_INVALID_HID) { + H5TOOLS_INFO("H5Dcreate2 failed"); if (options->verbose) HDprintf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name); if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed"); apply_f = 0; } /* end if retry dataset create */ @@ -911,15 +911,15 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (buf != NULL) { if(H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); if(H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); /* Check if we have VL data in the dataset's * datatype that must be reclaimed */ if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) if (H5Treclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Treclaim failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Treclaim failed"); if (buf != NULL) { /* TODO: is buf potentially released by H5Dvlen_reclaim()? */ HDfree(buf); @@ -946,7 +946,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, hsize_t zero[8]; /*vector of zeros */ int k; H5D_layout_t dset_layout; - hid_t dcpl_tmp = -1; /* dataset creation property list ID */ + hid_t dcpl_tmp = H5I_INVALID_HID; /* dataset creation property list ID */ /* check if we have VL data in the dataset's datatype */ if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) @@ -965,11 +965,11 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* get hyperslab dims and size in byte */ if (get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "get_hyperslab failed"); + H5TOOLS_GOTO_ERROR((-1), "get_hyperslab failed"); hslab_buf = HDmalloc((size_t)hslab_nbytes); if (hslab_buf == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "can't allocate space for hyperslab"); + H5TOOLS_GOTO_ERROR((-1), "can't allocate space for hyperslab"); hslab_nelmts = hslab_nbytes / p_type_nbytes; hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL); @@ -993,9 +993,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, } if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed"); if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed"); } /* end if rank > 0 */ else { H5Sselect_all(f_space_id); @@ -1004,9 +1004,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, } /* end (else) rank == 0 */ if(H5Dread(dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); if(H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); /* reclaim any VL memory, if necessary */ if (vl_data) @@ -1066,10 +1066,10 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, *------------------------------------------------------------------------- */ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_attr failed"); if (H5Dclose(dset_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); } /* end if not a reference */ } /* end if h5tools_canreadf (filter availability check) */ @@ -1078,32 +1078,32 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, *------------------------------------------------------------------------- */ if (H5Tclose(ftype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); if (H5Tclose(wtype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); if (H5Pclose(dcpl_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if (H5Pclose(dcpl_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if (H5Sclose(f_space_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed"); if (H5Dclose(dset_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); } /*------------------------------------------------------------------------- * We do not have request for filter/chunking; use H5Ocopy instead *------------------------------------------------------------------------- */ else { - hid_t pid = -1; + hid_t pid = H5I_INVALID_HID; /* create property to pass copy options */ if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed"); /* set options for object copy */ if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_copy_object failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed"); if (H5Ocopy(fidin, /* Source file or group identifier */ travt->objs[i].name, /* Name of the source object to be copied */ @@ -1111,25 +1111,25 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, travt->objs[i].name, /* Name of the destination object */ pid, /* Properties which apply to the copy */ H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Ocopy failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed"); if (H5Pclose(pid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); /*------------------------------------------------------------------------- * Copy attrs manually *------------------------------------------------------------------------- */ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed"); if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed"); if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_attr failed"); if (H5Dclose(dset_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); if (H5Dclose(dset_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); if (options->verbose) HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name); @@ -1146,28 +1146,28 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HDprintf(FORMAT_OBJ, "type", travt->objs[i].name); if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Topen2 failed"); /* Copy the datatype anonymously */ if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, travt, options)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed"); /* Link in to group structure */ if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcreate_hard failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Lcreate_hard failed"); /*------------------------------------------------------------------------- * copy attrs *------------------------------------------------------------------------- */ if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_attr failed"); if (H5Tclose(type_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); if (H5Tclose(type_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); - type_out = -1; /* named datatypes stack, named_dt_head, manages allocation */ + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); + type_out = H5I_INVALID_HID; /* named datatypes stack, named_dt_head, manages allocation */ break; @@ -1185,14 +1185,14 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcopy failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed"); if (options->verbose) HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); break; default: - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Object type not found"); + H5TOOLS_GOTO_ERROR((-1), "Object type not found"); } /* switch */ } /* end for each object to traverse */ } /* end if there are objects */ @@ -1203,7 +1203,7 @@ done: * because of reference counting */ if (0 == ret_value && named_dt_head != NULL) { if (named_datatype_free(&named_dt_head, 0) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "named_datatype_free failed"); + H5TOOLS_ERROR((-1), "named_datatype_free failed"); } else H5E_BEGIN_TRY { @@ -1354,16 +1354,16 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) static int copy_user_block(const char *infile, const char *outfile, hsize_t size) { - int ret_value = 0; int infid = -1, outfid = -1; /* File descriptors */ + int ret_value = 0; /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */ /* Open files */ if ((infid = HDopen(infile, O_RDONLY)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed input file <%s>", infile); + H5TOOLS_GOTO_ERROR((-1), "HDopen failed input file <%s>", infile); if ((outfid = HDopen(outfile, O_WRONLY)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed output file <%s>", outfile); + H5TOOLS_GOTO_ERROR((-1), "HDopen failed output file <%s>", outfile); /* Copy the userblock from the input file to the output file */ while (size > 0) { @@ -1377,7 +1377,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) else nread = HDread(infid, rbuf, (size_t)size); if (nread < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDread failed to read userblock"); + H5TOOLS_GOTO_ERROR((-1), "HDread failed to read userblock"); /* Write buffer to destination file */ /* (compensating for interrupted writes & checking for errors, etc.) */ @@ -1390,7 +1390,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) nwritten = HDwrite(outfid, wbuf, (size_t)nbytes); } while (-1 == nwritten && EINTR == errno); if (-1 == nwritten) /* error */ - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDwrite failed"); + H5TOOLS_GOTO_ERROR((-1), "HDwrite failed"); HDassert(nwritten > 0); HDassert(nwritten <= nbytes); @@ -1426,29 +1426,29 @@ static void print_user_block(const char *filename, hid_t fid) { - int ret_value = 0; int fh = -1; /* file handle */ hsize_t ub_size; /* user block size */ hsize_t size; /* size read */ - hid_t fcpl = -1; /* file creation property list ID for HDF5 file */ + hid_t fcpl = H5I_INVALID_HID; /* file creation property list ID for HDF5 file */ int i; + int ret_value = 0; /* get user block size */ if ((fcpl = H5Fget_create_plist(fid)) < 0) { - H5TOOLS_GOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Fget_create_plist failed to retrieve file creation property list"); } if (H5Pget_userblock(fcpl, &ub_size) < 0) { - H5TOOLS_GOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_userblock failed to retrieve userblock size"); } if (H5Pclose(fcpl) < 0) { - H5TOOLS_GOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed to close property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed to close property list"); } /* open file */ if ((fh = HDopen(filename, O_RDONLY)) < 0) { - H5TOOLS_GOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed to open file <%s>", filename); + H5TOOLS_GOTO_ERROR((-1), "HDopen failed to open file <%s>", filename); } size = ub_size; @@ -1472,7 +1472,7 @@ print_user_block(const char *filename, hid_t fid) HDprintf("\n"); if (nread < 0) { - H5TOOLS_GOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "nread < 0"); + H5TOOLS_GOTO_ERROR((-1), "nread < 0"); } /* update size of userblock left to transfer */ diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 891de25..d1179fb 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -36,35 +36,35 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ const char* name, /* object name from traverse list */ pack_info_t *objout /*OUT*/) /* info about object to filter */ { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ int nfilters; /* number of filters in DCPL */ char f_objname[256]; /* filter objname */ H5D_layout_t layout; int rank; /* rank of dataset */ hsize_t chsize[64]; /* chunk size in elements */ - int i; - unsigned u; + int i; + unsigned u; + int ret_value = 0; /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_nfilters failed"); /* copy filter_info_t structure */ for (i = 0; i < nfilters; i++) { if ((objout->filter[i].filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &objout->filter[i].filt_flag, &objout->filter[i].cd_nelmts, objout->filter[i].cd_values, sizeof(f_objname), f_objname, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_filter2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_filter2 failed"); } objout->nfilters = nfilters; HDstrcpy(objout->path, name); if ((layout = H5Pget_layout(dcpl_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_layout failed"); objout->layout = layout; if (layout == H5D_CHUNKED) { if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_chunk failed"); objout->chunk.rank = rank; for (u = 0; u < (unsigned)rank; u++) objout->chunk.chunk_lengths[u] = chsize[u]; @@ -238,18 +238,18 @@ int apply_filters(const char* name, /* object name from traverse list */ pack_opt_t *options, /* repack options */ int *has_filter) /* (OUT) object NAME has a filter */ { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ - int nfilters; /* number of filters in DCPL */ - hsize_t chsize[64]; /* chunk size in elements */ + int nfilters; /* number of filters in DCPL */ + hsize_t chsize[64]; /* chunk size in elements */ H5D_layout_t layout; - int i; - pack_info_t obj; - pack_info_t filtobj; + int i; + pack_info_t obj; + pack_info_t filtobj; + int ret_value = 0; *has_filter = 0; if (rank == 0) /* scalar dataset, do not apply */ - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /*------------------------------------------------------------------------- * initialize the assigment object @@ -263,11 +263,11 @@ int apply_filters(const char* name, /* object name from traverse list */ *------------------------------------------------------------------------- */ if (aux_assign_obj(name, options, &obj) == 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_nfilters failed"); /*------------------------------------------------------------------------- @@ -279,12 +279,12 @@ int apply_filters(const char* name, /* object name from traverse list */ if (nfilters && obj.nfilters) { *has_filter = 1; if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Premove_filter failed"); } else if(nfilters) { *has_filter = 1; if (aux_copy_obj(dcpl_id, name, &filtobj) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "aux_copy_obj failed"); + H5TOOLS_GOTO_ERROR((-1), "aux_copy_obj failed"); } /*------------------------------------------------------------------------- @@ -294,11 +294,11 @@ int apply_filters(const char* name, /* object name from traverse list */ */ if (obj.layout == -1) { if ((layout = H5Pget_layout(dcpl_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_layout failed"); if (layout == H5D_CHUNKED) { if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_chunk failed"); obj.layout = H5D_CHUNKED; obj.chunk.rank = rank; for (i = 0; i < rank; i++) @@ -340,7 +340,7 @@ int apply_filters(const char* name, /* object name from traverse list */ for (i = rank; i > 0; --i) { hsize_t size = 0; if(sm_nbytes == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "number of bytes per stripmine must be > 0"); + H5TOOLS_GOTO_ERROR((-1), "number of bytes per stripmine must be > 0"); size = H5TOOLS_BUFSIZE / sm_nbytes; if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ size = 1; @@ -355,7 +355,7 @@ int apply_filters(const char* name, /* object name from traverse list */ for (i = 0; i < obj.nfilters; i++) { if (obj.filter[i].filtn < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); + H5TOOLS_GOTO_ERROR((-1), "invalid filter"); switch (obj.filter[i].filtn) { /*------------------------------------------------------------------------- @@ -376,9 +376,9 @@ int apply_filters(const char* name, /* object name from traverse list */ aggression = obj.filter[i].cd_values[0]; /* set up for deflated data */ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed"); if (H5Pset_deflate(dcpl_id, aggression) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_deflate failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_deflate failed"); } break; @@ -396,9 +396,9 @@ int apply_filters(const char* name, /* object name from traverse list */ /* set up for szip data */ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed"); if (H5Pset_szip(dcpl_id, options_mask, pixels_per_block) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_szip failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_szip failed"); } break; @@ -408,9 +408,9 @@ int apply_filters(const char* name, /* object name from traverse list */ */ case H5Z_FILTER_SHUFFLE: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed"); if (H5Pset_shuffle(dcpl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shuffle failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_shuffle failed"); break; /*------------------------------------------------------------------------- @@ -419,9 +419,9 @@ int apply_filters(const char* name, /* object name from traverse list */ */ case H5Z_FILTER_FLETCHER32: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed"); if (H5Pset_fletcher32(dcpl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fletcher32 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_fletcher32 failed"); break; /*----------- ------------------------------------------------------------- * H5Z_FILTER_NBIT , NBIT compression @@ -429,9 +429,9 @@ int apply_filters(const char* name, /* object name from traverse list */ */ case H5Z_FILTER_NBIT: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed"); if (H5Pset_nbit(dcpl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_nbit failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_nbit failed"); break; /*----------- ------------------------------------------------------------- * H5Z_FILTER_SCALEOFFSET , scale+offset compression @@ -446,19 +446,19 @@ int apply_filters(const char* name, /* object name from traverse list */ scale_factor = (int) obj.filter[i].cd_values[1]; if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed"); if (H5Pset_scaleoffset(dcpl_id, scale_type, scale_factor) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_scaleoffset failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_scaleoffset failed"); } break; default: { if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed"); if (H5Pset_filter(dcpl_id, obj.filter[i].filtn, obj.filter[i].filt_flag, obj.filter[i].cd_nelmts, obj.filter[i].cd_values) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_filter failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_filter failed"); } break; } /* switch */ @@ -469,10 +469,10 @@ int apply_filters(const char* name, /* object name from traverse list */ if (filtobj.nfilters) { for (i = 0; i < filtobj.nfilters; i++) { if (filtobj.filter[i].filtn < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); + H5TOOLS_GOTO_ERROR((-1), "invalid filter"); if (H5Zfilter_avail(filtobj.filter[i].filtn) <= 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "%d filter unavailable", filtobj.filter[i].filtn); + H5TOOLS_GOTO_ERROR((-1), "%d filter unavailable", filtobj.filter[i].filtn); } /* for */ } /* nfilters */ @@ -484,20 +484,20 @@ int apply_filters(const char* name, /* object name from traverse list */ if (obj.layout >= 0) { /* a layout was defined */ if (H5Pset_layout(dcpl_id, obj.layout) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_layout failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_layout failed"); if (H5D_CHUNKED == obj.layout) { if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed"); } else if (H5D_COMPACT == obj.layout) { if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alloc_time failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pset_alloc_time failed"); } /* remove filters for the H5D_CONTIGUOUS case */ else if (H5D_CONTIGUOUS == obj.layout) { if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Premove_filter failed"); } } diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index c628beb..c0c8a2a 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -281,7 +281,7 @@ int read_info(const char *filename, pack_opt_t *options) char comp_info[1024]; FILE *fp = NULL; char c; - int i, rc = 1; + int i; int ret_value = EXIT_SUCCESS; if (NULL == (fp = HDfopen(filename, "r"))) { diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c index 9d35c4f..56fc12d 100644 --- a/tools/src/h5repack/h5repack_opttable.c +++ b/tools/src/h5repack/h5repack_opttable.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -void init_packobject(pack_info_t *obj) { +void init_packobject(pack_info_t *obj) +{ int j, k; HDstrcpy(obj->path, "\0"); @@ -49,11 +50,12 @@ void init_packobject(pack_info_t *obj) { *------------------------------------------------------------------------- */ -static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt) { +static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt) +{ if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS) table->objs[I].filter[table->objs[I].nfilters++] = filt; else - H5TOOLS_INFO(H5E_tools_min_id_g, "cannot insert the filter in this object. Maximum capacity exceeded"); + H5TOOLS_INFO("cannot insert the filter in this object. Maximum capacity exceeded"); } /*------------------------------------------------------------------------- @@ -64,7 +66,8 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_in * Return: void *------------------------------------------------------------------------- */ -static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack) { +static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack) +{ int k; table->objs[I].layout = pack->layout; @@ -97,18 +100,20 @@ static int aux_inctable(pack_opttbl_t *table, unsigned n_objs) { unsigned u; + int ret_value = 0; table->size += n_objs; table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs == NULL) { - H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table"); - return -1; + H5TOOLS_INFO("not enough memory for options table"); + ret_value = -1; + } + else { + for (u = table->nelems; u < table->size; u++) + init_packobject(&table->objs[u]); } - for (u = table->nelems; u < table->size; u++) - init_packobject(&table->objs[u]); - - return 0; + return ret_value; } @@ -123,25 +128,25 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs) int options_table_init(pack_opttbl_t **tbl) { unsigned int i; pack_opttbl_t *table; + int ret_value = 0; if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) { - H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table"); - return -1; + H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table"); } table->size = 30; table->nelems = 0; if (NULL == (table->objs = (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) { - H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table"); HDfree(table); - return -1; + H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table"); } for (i = 0; i < table->size; i++) init_packobject(&table->objs[i]); *tbl = table; - return 0; +done: + return ret_value; } @@ -174,6 +179,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa unsigned i, j, I; unsigned added = 0; hbool_t found = FALSE; + int ret_value = 0; /* increase the size of the collection by N_OBJS if necessary */ if (table->nelems + n_objs >= table->size) @@ -190,7 +196,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) { /* already chunk info inserted for this one; exit */ if (table->objs[i].chunk.rank > 0) { - H5TOOLS_INFO(H5E_tools_min_info_id_g, "chunk information already inserted for <%s>\n", obj_list[j].obj); + H5TOOLS_INFO("chunk information already inserted for <%s>\n", obj_list[j].obj); HDexit(EXIT_FAILURE); } /* insert the layout info */ @@ -237,7 +243,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa table->nelems += added; - return 0; + return ret_value; } /*------------------------------------------------------------------------- diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index 52917fb..e6a747d 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -42,16 +42,15 @@ int do_copy_refobjs(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ - hid_t grp_in = -1; /* read group ID */ - hid_t grp_out = -1; /* write group ID */ - hid_t dset_in = -1; /* read dataset ID */ - hid_t dset_out = -1; /* write dataset ID */ - hid_t type_in = -1; /* named type ID */ - hid_t dcpl_id = -1; /* dataset creation property list ID */ - hid_t space_id = -1; /* space ID */ - hid_t ftype_id = -1; /* file data type ID */ - hid_t mtype_id = -1; /* memory data type ID */ + hid_t grp_in = H5I_INVALID_HID; /* read group ID */ + hid_t grp_out = H5I_INVALID_HID; /* write group ID */ + hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */ + hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */ + hid_t type_in = H5I_INVALID_HID; /* named type ID */ + hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t space_id = H5I_INVALID_HID; /* space ID */ + hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */ + hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */ size_t msize; /* memory size of memory type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ @@ -59,6 +58,7 @@ int do_copy_refobjs(hid_t fidin, unsigned int i, j; int k; named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */ + int ret_value = 0; /*------------------------------------------------------------------------- * browse @@ -76,18 +76,18 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed"); if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed"); if(copy_refs_attr(grp_in, grp_out, travt, fidout) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_refs_attr failed"); if(H5Gclose(grp_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed"); if(H5Gclose(grp_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed"); /*------------------------------------------------------------------------- * check for hard links @@ -104,26 +104,26 @@ int do_copy_refobjs(hid_t fidin, */ case H5TRAV_TYPE_DATASET: if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed"); if((space_id = H5Dget_space(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed"); if((ftype_id = H5Dget_type(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed"); if((dcpl_id = H5Dget_create_plist(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed"); if((rank = H5Sget_simple_extent_ndims(space_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed"); if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed"); nelmts = 1; for(k = 0; k < rank; k++) nelmts *= dims[k]; if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tget_native_type failed"); if((msize = H5Tget_size(mtype_id)) == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed"); /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that @@ -145,7 +145,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) { - hid_t refobj_id = -1; + hid_t refobj_id = H5I_INVALID_HID; hobj_ref_t *refbuf = NULL; /* buffer for object references */ hobj_ref_t *buf = NULL; const char* refname; @@ -159,15 +159,15 @@ int do_copy_refobjs(hid_t fidin, buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf==NULL) { HDprintf("cannot read into memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); } /* end if */ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); refbuf = (hobj_ref_t*) HDcalloc((unsigned)nelmts, msize); if(refbuf == NULL){ HDprintf("cannot allocate memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); } /* end if */ for(u = 0; u < nelmts; u++) { H5E_BEGIN_TRY { @@ -181,7 +181,7 @@ int do_copy_refobjs(hid_t fidin, if((refname = MapIdToName(refobj_id, travt)) != NULL) { /* create the reference, -1 parameter for objects */ if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed"); if(options->verbose) { HDprintf(FORMAT_OBJ,"dset",travt->objs[i].name ); HDprintf("object <%s> object reference created to <%s>\n", @@ -190,7 +190,7 @@ int do_copy_refobjs(hid_t fidin, } } /*refname*/ if (H5Oclose(refobj_id) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Oclose refob failed"); + H5TOOLS_ERROR((-1), "H5Oclose refob failed"); } /* u */ } /*nelmts*/ @@ -199,10 +199,10 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed"); if(nelmts) if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); if(buf) HDfree(buf); @@ -213,7 +213,7 @@ int do_copy_refobjs(hid_t fidin, * copy attrs *----------------------------------------------------*/ if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_attr failed"); } /*H5T_STD_REF_OBJ*/ /*------------------------------------------------------------------------- @@ -221,7 +221,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) { - hid_t refobj_id = -1; + hid_t refobj_id = H5I_INVALID_HID; hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */ hdset_reg_ref_t *buf = NULL; /* output buffer */ const char* refname; @@ -235,10 +235,10 @@ int do_copy_refobjs(hid_t fidin, buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { HDprintf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); } /* end if */ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); /*------------------------------------------------------------------------- * create output @@ -247,7 +247,7 @@ int do_copy_refobjs(hid_t fidin, refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { HDprintf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); } /* end if */ for(u = 0; u < nelmts; u++) { @@ -260,16 +260,16 @@ int do_copy_refobjs(hid_t fidin, * in the second traversal of the file */ if((refname = MapIdToName(refobj_id, travt)) != NULL) { - hid_t region_id = -1; /* region id of the referenced dataset */ + hid_t region_id = H5I_INVALID_HID; /* region id of the referenced dataset */ if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Rget_region failed"); /* create the reference, we need the space_id */ if(H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION, region_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed"); if(H5Sclose(region_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed"); if(options->verbose) { HDprintf(FORMAT_OBJ,"dset",travt->objs[i].name ); HDprintf("object <%s> region reference created to <%s>\n", @@ -278,7 +278,7 @@ int do_copy_refobjs(hid_t fidin, } } /*refname*/ if (H5Oclose(refobj_id) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Oclose refobj_id failed"); + H5TOOLS_ERROR((-1), "H5Oclose refobj_id failed"); } /* u */ } /*nelmts*/ @@ -287,10 +287,10 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed"); if(nelmts) if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); if(buf) HDfree(buf); @@ -301,7 +301,7 @@ int do_copy_refobjs(hid_t fidin, * copy attrs *----------------------------------------------------*/ if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_attr failed"); } /* H5T_STD_REF_DSETREG */ /*------------------------------------------------------------------------- * not references, open previously created object in 1st traversal @@ -309,7 +309,7 @@ int do_copy_refobjs(hid_t fidin, */ else { if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed"); } /* end else */ /*------------------------------------------------------------------------- @@ -317,7 +317,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if(copy_refs_attr(dset_in, dset_out, travt, fidout) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); + H5TOOLS_GOTO_ERROR((-1), "copy_refs_attr failed"); /*------------------------------------------------------------------------- * check for hard links @@ -328,7 +328,7 @@ int do_copy_refobjs(hid_t fidin, H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT); if(H5Dclose(dset_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); } /*can_read*/ /*------------------------------------------------------------------------- @@ -336,15 +336,15 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if(H5Tclose(ftype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); if(H5Tclose(mtype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); if(H5Pclose(dcpl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if(H5Sclose(space_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed"); if(H5Dclose(dset_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); break; /*------------------------------------------------------------------------- @@ -353,9 +353,9 @@ int do_copy_refobjs(hid_t fidin, */ case H5TRAV_TYPE_NAMED_DATATYPE: if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Topen2 failed"); if(H5Tclose(type_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); break; /*------------------------------------------------------------------------- @@ -368,7 +368,8 @@ int do_copy_refobjs(hid_t fidin, case H5TRAV_TYPE_UNKNOWN: case H5TRAV_TYPE_UDLINK: - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5TRAV invalid type"); + H5TOOLS_GOTO_ERROR((-1), "H5TRAV invalid type"); + break; default: break; @@ -380,7 +381,7 @@ int do_copy_refobjs(hid_t fidin, * in copy_attr(), so need to free. */ if (named_datatype_free(&named_dt_head, 0) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "named_datatype_free failed"); + H5TOOLS_ERROR((-1), "named_datatype_free failed"); return ret_value; @@ -429,17 +430,16 @@ static int copy_refs_attr(hid_t loc_in, trav_table_t *travt, hid_t fidout) /* for saving references */ { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ - hid_t attr_id = -1; /* attr ID */ - hid_t attr_out = -1; /* attr ID */ - hid_t space_id = -1; /* space ID */ - hid_t ftype_id = -1; /* file data type ID */ - hid_t mtype_id = -1; /* memory data type ID */ + hid_t attr_id = H5I_INVALID_HID; /* attr ID */ + hid_t attr_out = H5I_INVALID_HID; /* attr ID */ + hid_t space_id = H5I_INVALID_HID; /* space ID */ + hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */ + hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */ size_t msize; /* memory size of type */ hsize_t nelmts; /* number of elements in dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ char name[255]; - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ unsigned u, i, j; int rank; H5T_class_t type_class = -1; @@ -452,29 +452,29 @@ static int copy_refs_attr(hid_t loc_in, unsigned *ref_comp_index = NULL; size_t *ref_comp_size = NULL; int ref_comp_field_n = 0; + int ret_value = 0; - - if(H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); + if(H5Oget_info3(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed"); for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0; /* open attribute */ if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aopen_by_idx failed"); /* get the file datatype */ if((ftype_id = H5Aget_type(attr_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aget_type failed"); type_class = H5Tget_class(ftype_id); if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tget_native_type failed"); if((msize = H5Tget_size(mtype_id)) == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed"); is_ref = (type_class == H5T_REFERENCE); @@ -484,7 +484,7 @@ static int copy_refs_attr(hid_t loc_in, is_ref_vlen = (H5Tget_class(base_type) == H5T_REFERENCE); msize = H5Tget_size(base_type); if (H5Tclose(base_type) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed"); + H5TOOLS_ERROR((-1), "H5Tclose base_type failed"); } else if(type_class == H5T_ARRAY ) { hid_t base_type = H5Tget_super(ftype_id); @@ -492,13 +492,13 @@ static int copy_refs_attr(hid_t loc_in, is_ref_array = (H5Tget_class(base_type) == H5T_REFERENCE); msize = H5Tget_size(base_type); if (H5Tclose(base_type) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose base_type failed"); } else if(type_class == H5T_COMPOUND) { int nmembers = H5Tget_nmembers(ftype_id) ; if (nmembers < 1) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tget_nmembers failed"); ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers*sizeof(unsigned)); ref_comp_size = (size_t *)HDmalloc((size_t)nmembers*sizeof(ref_comp_size)); @@ -513,7 +513,7 @@ static int copy_refs_attr(hid_t loc_in, ref_comp_field_n++; } if (H5Tclose(mtid) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtid failed"); + H5TOOLS_ERROR((-1), "H5Tclose mtid failed"); } /* if compound don't contain reference type member, free the above @@ -536,25 +536,25 @@ static int copy_refs_attr(hid_t loc_in, if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) { if (H5Tclose(mtype_id) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtype_id failed"); + H5TOOLS_ERROR((-1), "H5Tclose mtype_id failed"); if (H5Tclose(ftype_id) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose ftype_id failed"); + H5TOOLS_ERROR((-1), "H5Tclose ftype_id failed"); if (H5Aclose(attr_id) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Aclose attr_id failed"); + H5TOOLS_ERROR((-1), "H5Aclose attr_id failed"); continue; } /* get name */ if(H5Aget_name(attr_id, 255, name) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aget_name failed"); /* get the dataspace handle */ if((space_id = H5Aget_space(attr_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aget_space failed"); /* get dimensions */ if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed"); /*------------------------------------------------------------------------- @@ -573,7 +573,7 @@ static int copy_refs_attr(hid_t loc_in, msize = H5Tget_size(base_type); if (H5Tclose(base_type) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed"); + H5TOOLS_ERROR((-1), "H5Tclose base_type failed"); array_rank = (unsigned)H5Tget_array_ndims(mtype_id); H5Tget_array_dims2(mtype_id, array_dims); @@ -583,7 +583,7 @@ static int copy_refs_attr(hid_t loc_in, } if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Acreate2 failed"); if (nelmts>0) { /* handle object references */ @@ -591,15 +591,15 @@ static int copy_refs_attr(hid_t loc_in, buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { HDprintf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); if(refbuf == NULL) { HDprintf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); } /* end if */ for(i = 0; i < (unsigned)nelmts; i++) @@ -612,10 +612,10 @@ static int copy_refs_attr(hid_t loc_in, if(buf == NULL) { HDprintf( "cannot read into memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); /*------------------------------------------------------------------------- * create output @@ -624,7 +624,7 @@ static int copy_refs_attr(hid_t loc_in, refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { HDprintf( "cannot allocate memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); } /* end if */ for(i = 0; i < (unsigned)nelmts; i++) @@ -639,11 +639,11 @@ static int copy_refs_attr(hid_t loc_in, if(buf == NULL) { HDprintf( "cannot read into memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); if (H5R_OBJ_REF_BUF_SIZE==msize) { hobj_ref_t ref_out; @@ -680,11 +680,11 @@ static int copy_refs_attr(hid_t loc_in, if(buf == NULL) { HDprintf( "cannot read into memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); for (i=0; i<(unsigned)nelmts; i++) { for (j=0; j<(unsigned)ref_comp_field_n; j++) { @@ -709,7 +709,7 @@ static int copy_refs_attr(hid_t loc_in, } /* else if (is_ref_comp) */ if(H5Awrite(attr_out, mtype_id, refbuf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Awrite failed"); if (is_ref_vlen && buf) H5Treclaim (mtype_id, space_id, H5P_DEFAULT, buf); @@ -739,20 +739,20 @@ static int copy_refs_attr(hid_t loc_in, } if(H5Aclose(attr_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed"); /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ if(H5Tclose(ftype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); if(H5Tclose(mtype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); if(H5Sclose(space_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed"); if(H5Aclose(attr_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed"); } /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */ done: @@ -796,16 +796,19 @@ MapIdToName(hid_t refobj_id, trav_table_t *travt) if(travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET || travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP || travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) { - H5O_info_t ref_oinfo; /* Stat for the refobj id */ + H5O_info2_t ref_oinfo; /* Stat for the refobj id */ + int token_cmp; /* obtain information to identify the referenced object uniquely */ - if(H5Oget_info2(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0) + if(H5Oget_info3(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0) goto out; - if(ref_oinfo.addr == travt->objs[u].objno) { + if(H5Otoken_cmp(refobj_id, &ref_oinfo.token, &travt->objs[u].obj_token, &token_cmp) < 0) + goto out; + if(!token_cmp) { ret = travt->objs[u].name; goto out; - } /* end if */ + } } /* end if */ } /* u */ @@ -822,27 +825,27 @@ out: static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out, trav_table_t *travt) { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ const char *ref_obj_name; - hid_t space_id = -1; - hid_t ref_obj_id = -1; + hid_t space_id = H5I_INVALID_HID; + hid_t ref_obj_id = H5I_INVALID_HID; + herr_t ret_value = SUCCEED; ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); if (ref_obj_id < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rdereference2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Rdereference2 failed"); ref_obj_name = MapIdToName(ref_obj_id, travt); if (ref_obj_name == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "MapIdToName failed"); + H5TOOLS_GOTO_ERROR(FAIL, "MapIdToName failed"); if (ref_type == H5R_DATASET_REGION) { space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); if (space_id < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Rget_region failed"); } if(H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Rcreate failed"); done: H5E_BEGIN_TRY { diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c index 30bd3f6..683988c 100644 --- a/tools/src/h5repack/h5repack_verify.c +++ b/tools/src/h5repack/h5repack_verify.c @@ -39,26 +39,26 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options) { - int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ - hid_t fidin = -1; /* file ID for input file*/ - hid_t fidout = -1; /* file ID for output file*/ - hid_t did = -1; /* dataset ID */ - hid_t pid = -1; /* dataset creation property list ID */ - hid_t sid = -1; /* space ID */ - hid_t tid = -1; /* type ID */ + hid_t fidin = H5I_INVALID_HID; /* file ID for input file*/ + hid_t fidout = H5I_INVALID_HID; /* file ID for output file*/ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t pid = H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t sid = H5I_INVALID_HID; /* space ID */ + hid_t tid = H5I_INVALID_HID; /* type ID */ int ok = 1; /* step results */ unsigned int i; trav_table_t *travt = NULL; - hid_t fcpl_in = -1; /* file creation property for input file */ - hid_t fcpl_out = -1; /* file creation property for output file */ + hid_t fcpl_in = H5I_INVALID_HID; /* file creation property for input file */ + hid_t fcpl_out = H5I_INVALID_HID; /* file creation property for output file */ H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */ hbool_t in_persist, out_persist; /* free-space persist status for in/output file */ hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */ hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */ + int ret_value = 0; /* open the output file */ if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on <%s>", out_fname); + H5TOOLS_GOTO_ERROR((-1), "H5Fopen failed on <%s>", out_fname); for(i = 0; i < options->op_tbl->nelems; i++) { char *name = options->op_tbl->objs[i].path; @@ -69,13 +69,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on <%s>", name); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on <%s>", name); if((sid = H5Dget_space(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed"); if((pid = H5Dget_create_plist(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed"); if((tid = H5Dget_type(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed"); /*------------------------------------------------------------------------- * filter check @@ -95,14 +95,14 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options * close *------------------------------------------------------------------------- */ - if(H5Pclose(pid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + if (H5Pclose(pid) < 0) + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if (H5Sclose(sid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed"); if (H5Dclose(did) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); if (H5Tclose(tid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); } /*------------------------------------------------------------------------- @@ -114,11 +114,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); /* init table */ - trav_table_init(&travt); + trav_table_init(fidout, &travt); /* get the list of objects in the file */ if(h5trav_gettable(fidout, travt) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); + H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed"); for(i = 0; i < travt->nobjs; i++) { char *name = travt->objs[i].name; @@ -129,13 +129,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on <%s>", name); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on <%s>", name); if((sid = H5Dget_space(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed"); if((pid = H5Dget_create_plist(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed"); if((tid = H5Dget_type(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed"); /*------------------------------------------------------------------------- * filter check @@ -165,13 +165,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if (H5Pclose(pid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if (H5Sclose(sid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed"); if (H5Dclose(did) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); if (H5Tclose(tid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); } /* if */ } /* i */ @@ -187,32 +187,32 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options /* open the input file */ if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on file <%s>", in_fname); + H5TOOLS_GOTO_ERROR((-1), "H5Fopen failed on file <%s>", in_fname); /* Get file creation property list for input file */ if((fcpl_in = H5Fget_create_plist(fidin)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Fget_create_plist failed to retrieve file creation property list"); /* Get file space info for input file */ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); /* Get file space page size for input file */ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space page size"); /* Output file is already opened */ /* Get file creation property list for output file */ if((fcpl_out = H5Fget_create_plist(fidout)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); + H5TOOLS_GOTO_ERROR((-1), "H5Fget_create_plist failed to retrieve file creation property list"); /* Get file space info for output file */ if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); /* Get file space page size for output file */ if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space page size"); /* * If -S option is set, the file space handling strategy should be set as specified. @@ -221,11 +221,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_strategy) { if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + H5TOOLS_GOTO_ERROR((-1), "file space strategy not set as unexpected"); } else { if(out_strategy != in_strategy) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + H5TOOLS_GOTO_ERROR((-1), "file space strategy not set as unexpected"); } /* @@ -235,11 +235,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_persist) { if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected"); + H5TOOLS_GOTO_ERROR((-1), "free-space persist status not set as unexpected"); } else { if(out_persist != in_persist) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected"); + H5TOOLS_GOTO_ERROR((-1), "free-space persist status not set as unexpected"); } /* @@ -249,11 +249,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_threshold) { if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected"); + H5TOOLS_GOTO_ERROR((-1), "threshold not set as unexpected"); } else { if(out_threshold != in_threshold) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected"); + H5TOOLS_GOTO_ERROR((-1), "threshold not set as unexpected"); } /* @@ -263,11 +263,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_pagesize) { if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected"); + H5TOOLS_GOTO_ERROR((-1), "file space page size not set as unexpected"); } else { /* "-G" is not set */ if(out_pagesize != in_pagesize) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected"); + H5TOOLS_GOTO_ERROR((-1), "file space page size not set as unexpected"); } @@ -355,19 +355,19 @@ int verify_layout(hid_t pid, pack_info_t *obj) int h5repack_cmp_pl(const char *fname1, const char *fname2) { - int ret_value = 1; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */ - hid_t fid1 =-1; /* file ID */ - hid_t fid2 =-1; /* file ID */ - hid_t dset1 =-1; /* dataset ID */ - hid_t dset2 =-1; /* dataset ID */ - hid_t gid =-1; /* group ID */ - hid_t dcpl1 =-1; /* dataset creation property list ID */ - hid_t dcpl2 =-1; /* dataset creation property list ID */ - hid_t gcplid =-1; /* group creation property list */ + hid_t fid1 =H5I_INVALID_HID; /* file ID */ + hid_t fid2 =H5I_INVALID_HID; /* file ID */ + hid_t dset1 =H5I_INVALID_HID; /* dataset ID */ + hid_t dset2 =H5I_INVALID_HID; /* dataset ID */ + hid_t gid =H5I_INVALID_HID; /* group ID */ + hid_t dcpl1 =H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t dcpl2 =H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t gcplid =H5I_INVALID_HID; /* group creation property list */ unsigned crt_order_flag1; /* group creation order flag */ unsigned crt_order_flag2; /* group creation order flag */ - trav_table_t *trav = NULL; + trav_table_t *trav = NULL; unsigned int i; + int ret_value = 1; /*------------------------------------------------------------------------- * open the files @@ -375,9 +375,9 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2) */ /* Open the files */ if ((fid1 = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR); + H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR); if ((fid2 = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR); + H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR); /*------------------------------------------------------------------------- * get file table list of objects @@ -386,9 +386,9 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2) /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); /* init table */ - trav_table_init(&trav); + trav_table_init(fid1, &trav); if(h5trav_gettable(fid1, trav) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); + H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed"); /*------------------------------------------------------------------------- * traverse the suppplied object list @@ -397,62 +397,62 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2) for(i = 0; i < trav->nobjs; i++) { if(trav->objs[i].type == H5TRAV_TYPE_GROUP) { if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed on first <%s>", trav->objs[i].name); + H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed on first <%s>", trav->objs[i].name); if ((gcplid = H5Gget_create_plist(gid)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gget_create_plist failed"); if (H5Pget_link_creation_order(gcplid, &crt_order_flag1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_link_creation_order failed"); if (H5Pclose(gcplid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if (H5Gclose(gid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed"); if ((gid = H5Gopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed on second <%s>", trav->objs[i].name); + H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed on second <%s>", trav->objs[i].name); if ((gcplid = H5Gget_create_plist(gid)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gget_create_plist failed"); if (H5Pget_link_creation_order(gcplid, &crt_order_flag2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pget_link_creation_order failed"); if (H5Pclose(gcplid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if (H5Gclose(gid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed"); if (crt_order_flag1 != crt_order_flag2) - H5TOOLS_GOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name); + H5TOOLS_GOTO_ERROR(0, "property lists failed for <%s> are different", trav->objs[i].name); } else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) { if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on first <%s>", trav->objs[i].name); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on first <%s>", trav->objs[i].name); if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on second <%s>", trav->objs[i].name); + H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on second <%s>", trav->objs[i].name); if((dcpl1 = H5Dget_create_plist(dset1)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed"); if((dcpl2 = H5Dget_create_plist(dset2)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed"); /*------------------------------------------------------------------------- * compare the property lists *------------------------------------------------------------------------- */ if((ret_value = H5Pequal(dcpl1, dcpl2)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pequal failed"); if(ret_value == 0) - H5TOOLS_GOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name); + H5TOOLS_GOTO_ERROR(0, "property lists failed for <%s> are different", trav->objs[i].name); /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ if(H5Pclose(dcpl1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if(H5Pclose(dcpl2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed"); if(H5Dclose(dset1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); if(H5Dclose(dset2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed"); } /*if*/ } /*for*/ diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 6ff1e8c..adc905a 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -379,13 +379,13 @@ ceil_log10(unsigned long x) *------------------------------------------------------------------------- */ static herr_t -attribute_stats(iter_t *iter, const H5O_info_t *oi) +attribute_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *native_oi) { unsigned bin; /* "bin" the number of objects falls in */ /* Update dataset & attribute metadata info */ - iter->attrs_btree_storage_size += oi->meta_size.attr.index_size; - iter->attrs_heap_storage_size += oi->meta_size.attr.heap_size; + iter->attrs_btree_storage_size += native_oi->meta_size.attr.index_size; + iter->attrs_heap_storage_size += native_oi->meta_size.attr.heap_size; /* Update small # of attribute count & limits */ if(oi->num_attrs <= (hsize_t)sattrs_threshold) @@ -399,7 +399,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) iter->attr_bins = (unsigned long *)HDrealloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); HDassert(iter->attr_bins); - /* Initialize counts for intermediate bins */ + /* Initialize counts for intermediate bins */ while(iter->attr_nbins < bin) iter->attr_bins[iter->attr_nbins++] = 0; iter->attr_nbins++; @@ -440,22 +440,22 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) *------------------------------------------------------------------------- */ static herr_t -group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) +group_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_native_info_t *native_oi) { H5G_info_t ginfo; /* Group information */ unsigned bin; /* "bin" the number of objects falls in */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Gather statistics about this type of object */ iter->uniq_groups++; /* Get object header information */ - iter->group_ohdr_info.total_size += oi->hdr.space.total; - iter->group_ohdr_info.free_size += oi->hdr.space.free; + iter->group_ohdr_info.total_size += native_oi->hdr.space.total; + iter->group_ohdr_info.free_size += native_oi->hdr.space.free; /* Get group information */ if((ret_value = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_info_by_name() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gget_info_by_name() failed"); /* Update link stats */ /* Collect statistics for small groups */ @@ -470,7 +470,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) if((bin + 1) > iter->group_nbins) { /* Allocate more storage for info about dataset's datatype */ if((iter->group_bins = (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long))) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Drealloc() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed"); /* Initialize counts for intermediate bins */ while(iter->group_nbins < bin) @@ -484,12 +484,12 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) (iter->group_bins[bin])++; /* Update group metadata info */ - iter->groups_btree_storage_size += oi->meta_size.obj.index_size; - iter->groups_heap_storage_size += oi->meta_size.obj.heap_size; + iter->groups_btree_storage_size += native_oi->meta_size.obj.index_size; + iter->groups_heap_storage_size += native_oi->meta_size.obj.heap_size; /* Update attribute metadata info */ - if((ret_value = attribute_stats(iter, oi)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats failed"); + if((ret_value = attribute_stats(iter, oi, native_oi)) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats failed"); done: return ret_value; @@ -510,7 +510,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) +dataset_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_native_info_t *native_oi) { unsigned bin; /* "bin" the number of objects falls in */ hid_t did; /* Dataset ID */ @@ -527,25 +527,25 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) int num_ext; /* Number of external files for a dataset */ int nfltr; /* Number of filters for a dataset */ H5Z_filter_t fltr; /* Filter identifier */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Gather statistics about this type of object */ iter->uniq_dsets++; /* Get object header information */ - iter->dset_ohdr_info.total_size += oi->hdr.space.total; - iter->dset_ohdr_info.free_size += oi->hdr.space.free; + iter->dset_ohdr_info.total_size += native_oi->hdr.space.total; + iter->dset_ohdr_info.free_size += native_oi->hdr.space.free; if((did = H5Dopen2(iter->fid, name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen() failed"); /* Update dataset metadata info */ - iter->datasets_index_storage_size += oi->meta_size.obj.index_size; - iter->datasets_heap_storage_size += oi->meta_size.obj.heap_size; + iter->datasets_index_storage_size += native_oi->meta_size.obj.index_size; + iter->datasets_heap_storage_size += native_oi->meta_size.obj.heap_size; /* Update attribute metadata info */ - if((ret_value = attribute_stats(iter, oi)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed"); + if((ret_value = attribute_stats(iter, oi, native_oi)) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed"); /* Get storage info */ /* Failure 0 indistinguishable from no-data-stored 0 */ @@ -553,10 +553,10 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Gather layout statistics */ if((dcpl = H5Dget_create_plist(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_create_plist() failed"); if((lout = H5Pget_layout(dcpl)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_layout() failed"); /* Object header's total size for H5D_COMPACT layout includes raw data size */ /* "storage" also includes H5D_COMPACT raw data size */ @@ -568,7 +568,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Get the number of external files for the dataset */ if((num_ext = H5Pget_external_count(dcpl)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_external_count() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_external_count() failed"); /* Accumulate raw data size accordingly */ if(num_ext) { @@ -580,10 +580,10 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Gather dataspace statistics */ if((sid = H5Dget_space(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_space() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_space() failed"); if((ndims = H5Sget_simple_extent_dims(sid, dims, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims() failed"); /* Check for larger rank of dataset */ if((unsigned)ndims > iter->max_dset_rank) @@ -606,7 +606,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) if((bin + 1) > iter->dset_dim_nbins) { /* Allocate more storage for info about dataset's datatype */ if((iter->dset_dim_bins = (unsigned long *)HDrealloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long))) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Drealloc() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed"); /* Initialize counts for intermediate bins */ while(iter->dset_dim_nbins < bin) @@ -621,11 +621,11 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) } /* end if */ if(H5Sclose(sid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose() failed"); /* Gather datatype statistics */ if((tid = H5Dget_type(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_type() failed"); type_found = FALSE; for(u = 0; u < iter->dset_ntypes; u++) @@ -644,11 +644,11 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Allocate more storage for info about dataset's datatype */ if((iter->dset_type_info = (dtype_info_t *)HDrealloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t))) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Drealloc() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed"); /* Initialize information about datatype */ if((iter->dset_type_info[curr_ntype].tid = H5Tcopy(tid)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcopy() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tcopy() failed"); iter->dset_type_info[curr_ntype].count = 1; iter->dset_type_info[curr_ntype].named = 0; @@ -661,7 +661,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) (iter->dset_type_info[u].named)++; if(H5Tclose(tid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose() failed"); /* Track different filters */ if((nfltr = H5Pget_nfilters(dcpl)) >= 0) { @@ -679,10 +679,10 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) } /* endif nfltr */ if(H5Pclose(dcpl) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose() failed"); if(H5Dclose(did) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose() failed"); done: return ret_value; @@ -702,7 +702,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -datatype_stats(iter_t *iter, const H5O_info_t *oi) +datatype_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *native_oi) { herr_t ret_value = SUCCEED; @@ -710,12 +710,12 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi) iter->uniq_dtypes++; /* Get object header information */ - iter->dtype_ohdr_info.total_size += oi->hdr.space.total; - iter->dtype_ohdr_info.free_size += oi->hdr.space.free; + iter->dtype_ohdr_info.total_size += native_oi->hdr.space.total; + iter->dtype_ohdr_info.free_size += native_oi->hdr.space.free; /* Update attribute metadata info */ - if((ret_value = attribute_stats(iter, oi)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed"); + if((ret_value = attribute_stats(iter, oi, native_oi)) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed"); done: return ret_value; } /* end datatype_stats() */ @@ -735,32 +735,37 @@ done: *------------------------------------------------------------------------- */ static herr_t -obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited, +obj_stats(const char *path, const H5O_info2_t *oi, const char *already_visited, void *_iter) { + H5O_native_info_t native_info; iter_t *iter = (iter_t *)_iter; herr_t ret_value = SUCCEED; /* If the object has already been seen then just return */ if(NULL == already_visited) { + /* Retrieve the native info for the object */ + if(H5Oget_native_info_by_name(iter->fid, path, &native_info, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_native_info_by_name failed"); + /* Gather some general statistics about the object */ if(oi->rc > iter->max_links) iter->max_links = oi->rc; switch(oi->type) { case H5O_TYPE_GROUP: - if(group_stats(iter, path, oi) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "group_stats failed"); + if(group_stats(iter, path, oi, &native_info) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "group_stats failed"); break; case H5O_TYPE_DATASET: - if(dataset_stats(iter, path, oi) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "dataset_stats failed"); + if(dataset_stats(iter, path, oi, &native_info) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "dataset_stats failed"); break; case H5O_TYPE_NAMED_DATATYPE: - if(datatype_stats(iter, oi) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "datatype_stats failed"); + if(datatype_stats(iter, oi, &native_info) < 0) + H5TOOLS_GOTO_ERROR(FAIL, "datatype_stats failed"); break; case H5O_TYPE_MAP: @@ -792,7 +797,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info_t *li, void *_iter) +lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info2_t *li, void *_iter) { iter_t *iter = (iter_t *)_iter; @@ -1853,7 +1858,7 @@ main(int argc, const char *argv[]) { iter_t iter; const char *fname = NULL; - hid_t fid = -1; + hid_t fid = H5I_INVALID_HID; H5E_auto2_t func; H5E_auto2_t tools_func; void *edata; diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index ae57031..927167b 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -252,8 +252,8 @@ int main (int argc, const char *argv[]) { char *fname = NULL; /* File name */ - hid_t fapl = -1; /* File access property list */ - hid_t fid = -1; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ haddr_t image_addr; hsize_t image_len; unsigned flags = H5F_ACC_RDWR; /* file access flags */ diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index b28457e..a167709 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -249,6 +249,7 @@ int main(int argc, char *argv[]) { hid_t fid, fapl; + H5VL_object_t *vol_obj; H5F_t *f; haddr_t addr = 0, extra = 0, extra2 = 0, extra3 = 0, extra4 = 0; uint8_t sig[H5F_SIGNATURE_LEN]; @@ -297,7 +298,12 @@ main(int argc, char *argv[]) } api_ctx_pushed = TRUE; - if(NULL == (f = (H5F_t *)H5I_object(fid))) { + if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(fid))) { + HDfprintf(stderr, "cannot obtain vol_obj pointer\n"); + HDexit(2); + } /* end if */ + + if(NULL == (f = (H5F_t *)H5VL_object_data(vol_obj))) { HDfprintf(stderr, "cannot obtain H5F_t pointer\n"); HDexit(2); } /* end if */ diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index 1130ea7..028935f 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -43,4 +43,6 @@ if (BUILD_SHARED_LIBS) ) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c index a3acdae..716b0d2 100644 --- a/tools/test/h5copy/h5copygentest.c +++ b/tools/test/h5copy/h5copygentest.c @@ -338,14 +338,14 @@ static void gent_att_compound_vlstr(hid_t loc_id) const char *v; } s1; hsize_t dim[1] = {1}; /* Dimension size */ - hid_t sid = -1; /* Dataspace ID */ - hid_t tid = -1; /* Datatype ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t did = -1; /* Dataset ID */ - hid_t gid = -1; /* Group ID */ - hid_t vl_str_tid = -1; /* Variable length datatype ID */ - hid_t cmpd_tid = -1; /* Compound datatype ID */ - hid_t null_sid = -1; /* Null dataspace ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t tid = H5I_INVALID_HID; /* Datatype ID */ + hid_t aid = H5I_INVALID_HID; /* Attribute ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t vl_str_tid = H5I_INVALID_HID; /* Variable length datatype ID */ + hid_t cmpd_tid = H5I_INVALID_HID; /* Compound datatype ID */ + hid_t null_sid = H5I_INVALID_HID; /* Null dataspace ID */ s1 buf; /* Buffer */ buf.i = 9; @@ -725,7 +725,7 @@ out: *------------------------------------------------------------------------*/ static void Test_Obj_Copy(void) { - hid_t fid = -1; /* File id */ + hid_t fid = H5I_INVALID_HID; /* File id */ hid_t fapl_new = (-1); /* File access property id */ unsigned new_format; /* New format or old format */ diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index cb4397f..82e09c6 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -43,4 +43,6 @@ if (BUILD_SHARED_LIBS) ) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS) + include (CMakeTests.cmake) +endif () diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 57bcd12..88ed62c 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -94,6 +94,17 @@ ${HDF5_TOOLS_DIR}/testfiles/vds/5_vds.h5 # tools/testfiles ${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5 + #STD_REF_OBJ files + ${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_compat.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_ext1.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_ext2.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_grp.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_obj_del.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_obj.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_param.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_reg_1d.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5 ) set (LIST_OTHER_TEST_FILES @@ -201,6 +212,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_56.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_57.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_58.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_58_ref.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_59.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_500.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_501.txt @@ -282,6 +294,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_reg.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt @@ -363,35 +376,37 @@ ############################################################################## macro (ADD_H5_TEST resultfile resultcode) - # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_ext}> ${ARGN}) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (${resultcode}) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") - endif () - if (last_test) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - add_test ( - NAME H5DIFF-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_ext}>" - -D "TEST_ARGS:STRING=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}.txt" - -D "TEST_APPEND=EXIT CODE:" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - if (last_test) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + if (HDF5_TEST_SERIAL) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_ext}> ${ARGN}) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + if (${resultcode}) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (last_test) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + else () + add_test ( + NAME H5DIFF-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_ext}>" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.txt" + -D "TEST_APPEND=EXIT CODE:" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + if (last_test) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () endif () endif () - if (H5_HAVE_PARALLEL) + if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) endif () endmacro () @@ -1044,7 +1059,10 @@ ADD_H5_TEST (h5diff_56 1 -v ${FILE4} ${FILE4} dset6a dset6b) ADD_H5_TEST (h5diff_57 0 -v ${FILE4} ${FILE4} dset7a dset7b) # 5.8 (region reference) -ADD_H5_TEST (h5diff_58 1 -v ${FILE7} ${FILE8} refreg) +ADD_H5_TEST (h5diff_58 1 -v2 ${FILE7} ${FILE8} refreg) +ADD_H5_TEST (h5diff_58_ref 1 -v2 ${FILE7} ${FILE8} /g1/reference2D) +# STD_REF_OBJ +ADD_H5_TEST (h5diff_reg 0 -v2 trefer_attr.h5 trefer_ext2.h5 Dataset3 Dataset3) # test for both dset and attr with same type but with different size # ( HDDFV-7942 ) @@ -1484,8 +1502,6 @@ ADD_H5_TEST (h5diff_485 0 -v --exclude-path "/group1" h5diff_exclude3-1.h5 h5dif ADD_H5_TEST (h5diff_486 0 -v --exclude-path "/group1" h5diff_exclude3-2.h5 h5diff_exclude3-1.h5) ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5) - - # ############################################################################## # # diff various multiple vlen and fixed strings in a compound type dataset # ############################################################################## @@ -1524,7 +1540,7 @@ ADD_H5_TEST (h5diff_800 1 -v ${FILE7} ${FILE8} /g1/array /g1/array) ADD_H5_TEST (h5diff_801 1 -v ${FILE7} ${FILE8A} /g1/array /g1/array) # ############################################################################## -# VDS tests +# # VDS tests # ############################################################################## ADD_H5_TEST (h5diff_v1 0 -v ${FILEV1} ${FILEV2}) ADD_H5_TEST (h5diff_v2 0 -r ${FILEV1} ${FILEV2}) @@ -1533,7 +1549,7 @@ ADD_H5_TEST (h5diff_v3 0 -c ${FILEV1} ${FILEV2}) ############################################################################## ### P L U G I N T E S T S ############################################################################## -if (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS AND HDF5_TEST_SERIAL) ADD_H5_UD_TEST (h5diff_plugin_test 0 h5diff_ud -v tudfilter.h5 tudfilter2.h5) ADD_H5_UD_TEST (h5diff_plugin_fail 2 h5diff_udfail -v tudfilter.h5 tudfilter2.h5) endif () diff --git a/tools/test/h5diff/dynlib_diff.c b/tools/test/h5diff/dynlib_diff.c index 571452e..661a6dc 100644 --- a/tools/test/h5diff/dynlib_diff.c +++ b/tools/test/h5diff/dynlib_diff.c @@ -69,7 +69,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +78,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + *int_ptr = (int8_t)(temp + MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index c711013..98001ff 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -303,8 +303,8 @@ int main(void) static int test_basic(const char *fname1, const char *fname2, const char *fname3) { - hid_t fid1 = -1, fid2 = -1; - hid_t gid1 = -1, gid2 = -1, gid3 = -1; + hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID, gid3 = H5I_INVALID_HID; hsize_t dims1[1] = { 6 }; hsize_t dims2[2] = { 3, 2 }; @@ -662,11 +662,11 @@ out: static int test_types(const char *fname) { - hid_t fid1 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; - hid_t tid1 = -1; - hid_t tid2 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t tid1 = H5I_INVALID_HID; + hid_t tid2 = H5I_INVALID_HID; herr_t status; hsize_t dims[1] = { 1 }; typedef struct s1_t { @@ -787,8 +787,8 @@ int test_types(const char *fname) static int test_datatypes(const char *fname) { - hid_t fid1 = -1; - hid_t dset = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; hsize_t dims[2] = { 3, 2 }; herr_t status; char buf1a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } }; @@ -977,11 +977,11 @@ int test_datatypes(const char *fname) static int test_attributes(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid = -1; - hid_t did = -1; - hid_t gid = -1; - hid_t root_id = -1; - hid_t sid = -1; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t root_id = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; hsize_t dims[1] = { 2 }; herr_t status; @@ -1039,14 +1039,14 @@ int test_attributes(const char *file, int make_diffs /* flag to modify data buff static int test_attributes_verbose_level(const char *fname1, const char *fname2) { herr_t status = SUCCEED; - hid_t fid1 = -1, fid2 = -1; - hid_t f1_gid = -1, f2_gid = -1; - hid_t f1_gid2 = -1, f2_gid2 = -1; - hid_t f1_gid3 = -1, f2_gid3 = -1; - hid_t f1_gid4 = -1, f2_gid4 = -1; - hid_t f1_did = -1, f2_did = -1; - hid_t f1_sid = -1, f2_sid = -1; - hid_t f1_tid = -1, f2_tid = -1; + hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; + hid_t f1_gid = H5I_INVALID_HID, f2_gid = H5I_INVALID_HID; + hid_t f1_gid2 = H5I_INVALID_HID, f2_gid2 = H5I_INVALID_HID; + hid_t f1_gid3 = H5I_INVALID_HID, f2_gid3 = H5I_INVALID_HID; + hid_t f1_gid4 = H5I_INVALID_HID, f2_gid4 = H5I_INVALID_HID; + hid_t f1_did = H5I_INVALID_HID, f2_did = H5I_INVALID_HID; + hid_t f1_sid = H5I_INVALID_HID, f2_sid = H5I_INVALID_HID; + hid_t f1_tid = H5I_INVALID_HID, f2_tid = H5I_INVALID_HID; /* dset */ hsize_t dset_dims[1] = { 3 }; int dset_data[3] = { 0, 1, 2 }; @@ -1304,10 +1304,10 @@ out: static int test_datasets(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid = -1; - hid_t did = -1; - hid_t gid = -1; - hid_t sid = -1; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; hsize_t dims[1] = { 2 }; herr_t status; int buf[2] = { 1, 2 }; @@ -1357,10 +1357,10 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer static int test_special_datasets(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t fid = -1; - hid_t did = -1; - hid_t sid0 = -1; - hid_t sid = -1; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t sid0 = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; hsize_t dims0[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 }; hsize_t dims[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 }; herr_t status; @@ -1413,9 +1413,9 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat *-------------------------------------------------------------------------*/ static int test_link_name(const char *fname1) { - hid_t fid1 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; herr_t status = SUCCEED; /*----------------------------------------------------------------------- @@ -1486,8 +1486,8 @@ out: *-------------------------------------------------------------------------*/ static int test_soft_links(const char *fname1) { - hid_t fid1 = -1; - hid_t gid1 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; hsize_t dims2[2] = { 2, 4 }; int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; @@ -1605,10 +1605,10 @@ out: *-------------------------------------------------------------------------*/ static int test_linked_softlinks(const char *fname1) { - hid_t fid1 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; - hid_t gid3 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t gid3 = H5I_INVALID_HID; hsize_t dims2[2] = { 2, 4 }; int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; @@ -1786,10 +1786,10 @@ out: *-------------------------------------------------------------------------*/ static int test_external_links(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; hsize_t dims2[2] = { 2, 4 }; int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; @@ -1931,9 +1931,9 @@ out: *-------------------------------------------------------------------------*/ static int test_ext2soft_links(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid2 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; hsize_t dims2[2] = { 2, 4 }; int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; @@ -2060,12 +2060,12 @@ out: static int gen_dataset_idx(const char *file, int format) { - hid_t fid = -1; /* file id */ - hid_t did = -1; - hid_t did2 = -1; /* dataset id */ - hid_t sid = -1; /* space id */ - hid_t fapl = -1; /* file access property id */ - hid_t dcpl = -1; /* dataset creation property id */ + hid_t fid = H5I_INVALID_HID; /* file id */ + hid_t did = H5I_INVALID_HID; + hid_t did2 = H5I_INVALID_HID; /* dataset id */ + hid_t sid = H5I_INVALID_HID; /* space id */ + hid_t fapl = H5I_INVALID_HID; /* file access property id */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */ hsize_t dims[1] = { 10 }; /* dataset dimension */ hsize_t c_dims[1] = { 2 }; /* chunk dimension */ herr_t status; /* return status */ @@ -2146,8 +2146,8 @@ int gen_dataset_idx(const char *file, int format) *-------------------------------------------------------------------------*/ static int test_dangle_links(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; hsize_t dims2[2] = { 2, 4 }; int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; @@ -2346,10 +2346,10 @@ out: *-------------------------------------------------------------------------*/ static int test_group_recurse(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid1_f1 = -1, gid2_f1 = -1, gid3_f1 = -1, gid10_f1 = -1; - hid_t gid1_f2 = -1, gid2_f2 = -1, gid3_f2 = -1, gid11_f2 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid1_f1 = H5I_INVALID_HID, gid2_f1 = H5I_INVALID_HID, gid3_f1 = H5I_INVALID_HID, gid10_f1 = H5I_INVALID_HID; + hid_t gid1_f2 = H5I_INVALID_HID, gid2_f2 = H5I_INVALID_HID, gid3_f2 = H5I_INVALID_HID, gid11_f2 = H5I_INVALID_HID; hsize_t dims2[2] = { 2, 4 }; int data1[4][2] = { { 0, 1 }, { 0, 1 }, { 1, 0 }, { 1, 0 } }; int data2[4][2] = { { 0, 2 }, { 0, 2 }, { 2, 0 }, { 2, 0 } }; @@ -2758,18 +2758,18 @@ out: #define GRP_R_DSETNAME2 "dset2" static int test_group_recurse2(void) { - hid_t fileid1 = -1; - hid_t grp1 = -1; - hid_t grp2 = -1; - hid_t grp3 = -1; - hid_t grp4 = -1; - hid_t dset1 = -1; - hid_t dset2 = -1; - hid_t datatype = -1; - hid_t dataspace = -1; - hid_t fileid2 = -1; - hid_t fileid3 = -1; - hid_t fileid4 = -1; + hid_t fileid1 = H5I_INVALID_HID; + hid_t grp1 = H5I_INVALID_HID; + hid_t grp2 = H5I_INVALID_HID; + hid_t grp3 = H5I_INVALID_HID; + hid_t grp4 = H5I_INVALID_HID; + hid_t dset1 = H5I_INVALID_HID; + hid_t dset2 = H5I_INVALID_HID; + hid_t datatype = H5I_INVALID_HID; + hid_t dataspace = H5I_INVALID_HID; + hid_t fileid2 = H5I_INVALID_HID; + hid_t fileid3 = H5I_INVALID_HID; + hid_t fileid4 = H5I_INVALID_HID; hsize_t dimsf[2]; /* dataset dimensions */ herr_t status = 0; int data1[4][2] = { { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 } }; @@ -3069,10 +3069,10 @@ out: *-------------------------------------------------------------------------*/ static int test_exclude_obj1(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; hsize_t dims2[2] = { 2, 4 }; int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; @@ -3189,11 +3189,11 @@ out: *-------------------------------------------------------------------------*/ static int test_exclude_obj2(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; - hid_t gid3 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t gid3 = H5I_INVALID_HID; hsize_t dims2[2] = { 2, 4 }; int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } }; @@ -3320,9 +3320,9 @@ out: *-------------------------------------------------------------------------*/ static int test_exclude_obj3(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t gid1 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; hsize_t dims2[2] = { 2, 4 }; int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; herr_t status = SUCCEED; @@ -3416,8 +3416,8 @@ out: static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new) { int i; - hid_t fid1 = -1; /* file id */ - hid_t gid = -1; + hid_t fid1 = H5I_INVALID_HID; /* file id */ + hid_t gid = H5I_INVALID_HID; /* compound1 datatype */ typedef struct comp1_t { @@ -3534,21 +3534,21 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } comp9_t; /* vlen string */ - hid_t sid_vlen_str = -1; /* dataspace ID */ - hid_t tid_vlen_str = -1; /* datatype ID */ + hid_t sid_vlen_str = H5I_INVALID_HID; /* dataspace ID */ + hid_t tid_vlen_str = H5I_INVALID_HID; /* datatype ID */ char vlen_str_buf[] = { "Variable length string" }; hsize_t dims_vlen_str[] = { VLEN_STR_DIM }; /* fixlen string */ - hid_t sid_fixlen_str = -1; /* dataspace ID */ - hid_t tid_fixlen_str = -1; /* datatype ID */ + hid_t sid_fixlen_str = H5I_INVALID_HID; /* dataspace ID */ + hid_t tid_fixlen_str = H5I_INVALID_HID; /* datatype ID */ const char fixlen_str_buf[FIXLEN_STR_SIZE] = { "Fixed length string" }; hsize_t dims_fixlen_str[] = { FIXLEN_STR_DIM }; /* vlen string array */ - hid_t sid_vlen_str_array = -1; /* dataspace ID */ - hid_t tid_vlen_str_array_pre = -1; /* datatype ID */ - hid_t tid_vlen_str_array = -1; /* datatype ID */ + hid_t sid_vlen_str_array = H5I_INVALID_HID; /* dataspace ID */ + hid_t tid_vlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */ + hid_t tid_vlen_str_array = H5I_INVALID_HID; /* datatype ID */ const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM] = { "1 - Variable length string Array", "2 - Testing variable length string array in compound type", @@ -3556,9 +3556,9 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int hsize_t dims_vlen_str_array[] = { VLEN_STR_ARRY_DIM }; /* fixlen string array */ - hid_t sid_fixlen_str_array = -1; /* dataspace ID */ - hid_t tid_fixlen_str_array_pre = -1; /* datatype ID */ - hid_t tid_fixlen_str_array = -1; /* datatype ID */ + hid_t sid_fixlen_str_array = H5I_INVALID_HID; /* dataspace ID */ + hid_t tid_fixlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */ + hid_t tid_fixlen_str_array = H5I_INVALID_HID; /* datatype ID */ const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM] = { "1 - Fixed length string Array", "2 - Fixed length string Array", "3 - Fixed length string Array" }; @@ -3567,17 +3567,17 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /*------------------------------------------ * compound dataset *------------------------------------------*/ - hid_t sid_comp = -1; /* dataspace ID */ - hid_t tid1_comp = -1; /* datatype ID */ - hid_t tid2_comp = -1; /* datatype ID */ - hid_t tid3_comp = -1; /* datatype ID */ - hid_t tid4_comp = -1; /* datatype ID */ - hid_t tid5_comp = -1; /* datatype ID */ - hid_t tid6_comp = -1; /* datatype ID */ - hid_t tid7_comp = -1; /* datatype ID */ - hid_t tid8_comp = -1; /* datatype ID */ - hid_t tid9_comp = -1; /* datatype ID */ - hid_t did_comp = -1; /* dataset ID */ + hid_t sid_comp = H5I_INVALID_HID; /* dataspace ID */ + hid_t tid1_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid2_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid3_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid4_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid5_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid6_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid7_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid8_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t tid9_comp = H5I_INVALID_HID; /* datatype ID */ + hid_t did_comp = H5I_INVALID_HID; /* dataset ID */ hsize_t dims_comp[] = { COMP_DIM }; herr_t status = SUCCEED; @@ -4020,7 +4020,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int } H5Dclose(did_comp); - did_comp = -1; + did_comp = H5I_INVALID_HID; out: /*----------------------------------------------------------------------- @@ -4091,9 +4091,9 @@ out: static int test_enums(const char *fname) { - hid_t fid = -1; + hid_t fid = H5I_INVALID_HID; - hid_t tid = -1; + hid_t tid = H5I_INVALID_HID; int enum_val = -1; /* The data in the two arrays cover the following cases: @@ -4217,17 +4217,17 @@ static void test_comps_array(const char *fname, const char *dset, const char *at cmpd1_t wdata[SDIM_DSET]; /* dataset with compound1 */ - hid_t fid = -1; /* HDF5 File IDs */ - hid_t did_dset = -1; /* Dataset ID */ - hid_t sid_dset = -1; /* Dataset space ID */ - hid_t tid_cmpd1 = -1; /* Compound1 type ID */ - hid_t tid_arry1 = -1; /* Array type ID in compound1 */ - hid_t tid_cmpd2 = -1; /* Compound2 type ID */ - hid_t tid_attr = -1; + hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */ + hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid_dset = H5I_INVALID_HID; /* Dataset space ID */ + hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 type ID */ + hid_t tid_arry1 = H5I_INVALID_HID; /* Array type ID in compound1 */ + hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 type ID */ + hid_t tid_attr = H5I_INVALID_HID; hsize_t sdims_dset[] = { SDIM_DSET }; hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY }; int i, j; - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for (i = 0; i < SDIM_DSET; i++) { @@ -4326,17 +4326,17 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ - hid_t fid = -1; /* HDF5 File ID */ - hid_t did_dset = -1; /* dataset ID */ - hid_t sid_dset = -1; /* dataset space ID */ - hid_t tid_attr = -1; - hid_t tid_cmpd2 = -1; /* compound2 type ID */ - hid_t tid_cmpd1 = -1; /* compound1 type ID */ - hid_t tid_cmpd1_vlen = -1; + hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */ + hid_t did_dset = H5I_INVALID_HID; /* dataset ID */ + hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */ + hid_t tid_attr = H5I_INVALID_HID; + hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */ + hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */ + hid_t tid_cmpd1_vlen = H5I_INVALID_HID; hsize_t sdims_dset[] = { SDIM_DSET }; unsigned i, j; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for (i = 0; i < SDIM_DSET; i++) { @@ -4442,19 +4442,19 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch } cmpd1_t; cmpd1_t wdata[SDIM_DSET]; /* Information to write */ - hid_t fid = -1; /* HDF5 File IDs */ - hid_t did_dset = -1; /* Dataset ID */ - hid_t sid_dset = -1; /* Dataspace ID */ - hid_t tid_attr = -1; - hid_t tid_cmpd1 = -1; /* Compound1 Datatype ID */ - hid_t tid_arry1 = -1; /* Array Datatype ID */ - hid_t tid_cmpd2 = -1; /* Compound2 Datatype ID */ - hid_t tid_cmpd2_vlen = -1; - hid_t tid_cmpd3 = -1; /* Compound3 Datatype ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */ + hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid_dset = H5I_INVALID_HID; /* Dataspace ID */ + hid_t tid_attr = H5I_INVALID_HID; + hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 Datatype ID */ + hid_t tid_arry1 = H5I_INVALID_HID; /* Array Datatype ID */ + hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 Datatype ID */ + hid_t tid_cmpd2_vlen = H5I_INVALID_HID; + hid_t tid_cmpd3 = H5I_INVALID_HID; /* Compound3 Datatype ID */ hsize_t sdims_dset[] = { SDIM_DSET }; hsize_t sdims_arry[] = { SDIM_CMPD_ARRAY }; unsigned i, j, k; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write in compound1 */ for (i = 0; i < SDIM_DSET; i++) { @@ -4584,20 +4584,20 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */ - hid_t fid = -1; /* HDF5 File ID */ - hid_t did_dset = -1; /* dataset ID */ - hid_t sid_dset = -1; /* dataset space ID */ - hid_t tid_attr = -1; - hid_t tid_cmpd3 = -1; /* compound3 type ID */ - hid_t tid_cmpd2 = -1; /* compound2 type ID */ - hid_t tid_cmpd2_arry = -1; - hid_t tid_cmpd1 = -1; /* compound1 type ID */ - hid_t tid_cmpd1_vlen = -1; + hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */ + hid_t did_dset = H5I_INVALID_HID; /* dataset ID */ + hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */ + hid_t tid_attr = H5I_INVALID_HID; + hid_t tid_cmpd3 = H5I_INVALID_HID; /* compound3 type ID */ + hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */ + hid_t tid_cmpd2_arry = H5I_INVALID_HID; + hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */ + hid_t tid_cmpd1_vlen = H5I_INVALID_HID; hsize_t sdims_dset[] = { SDIM_DSET }; hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY }; unsigned i, j, k; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for (i = 0; i < SDIM_DSET; i++) { @@ -4717,14 +4717,14 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha #define DIM_ARRY 3 static void test_data_nocomparables(const char * fname, int make_diffs) { - hid_t fid = -1; - hid_t gid1 = -1; - hid_t gid2 = -1; - hid_t did1 = -1; - hid_t did2 = -1; - hid_t sid1 = -1; - hid_t tid_dset1 = -1; - hid_t tid_attr1 = -1; + hid_t fid = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t did1 = H5I_INVALID_HID; + hid_t did2 = H5I_INVALID_HID; + hid_t sid1 = H5I_INVALID_HID; + hid_t tid_dset1 = H5I_INVALID_HID; + hid_t tid_attr1 = H5I_INVALID_HID; hsize_t dims1_1[1] = { DIM_ARRY }; hsize_t dims1_2[1] = { DIM_ARRY + 1 }; hsize_t dims2[2] = { DIM_ARRY, 1 }; @@ -4913,14 +4913,14 @@ out: static void test_objs_nocomparables(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t topgid1 = -1; - hid_t topgid2 = -1; - hid_t gid1 = -1; - hid_t tid1 = -1; - hid_t gid2 = -1; - hid_t tid2 = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t topgid1 = H5I_INVALID_HID; + hid_t topgid2 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID; + hid_t tid1 = H5I_INVALID_HID; + hid_t gid2 = H5I_INVALID_HID; + hid_t tid2 = H5I_INVALID_HID; hsize_t dims[1] = { DIM_ARRY }; int data1[DIM_ARRY] = { 1, 1, 1 }; int data2[DIM_ARRY] = { 2, 2, 2 }; @@ -5039,12 +5039,12 @@ static hid_t mkstr(int size, H5T_str_t pad) *-------------------------------------------------------------------------*/ static void test_objs_strings(const char *fname1, const char *fname2) { - hid_t fid1 = -1; - hid_t fid2 = -1; - hid_t dataset = -1; - hid_t space = -1; - hid_t f_type = -1; - hid_t m_type = -1; + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t f_type = H5I_INVALID_HID; + hid_t m_type = H5I_INVALID_HID; hsize_t dims1[] = { 3, 4 }; char string1A[12][3] = { "s1", "s2", "s3", "s4", "s5", "s6", "s", "s", "s9", "s0", "s1", "s2" }; @@ -5211,10 +5211,10 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make RED, GREEN } e_t; - hid_t aid = -1; - hid_t sid = -1; - hid_t tid = -1; - herr_t status; + hid_t aid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + herr_t H5_ATTR_NDEBUG_UNUSED status; int val, i, j, k, l, n; float f; @@ -6202,10 +6202,10 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff RED, GREEN } e_t; - hid_t aid = -1; - hid_t sid = -1; - hid_t tid = -1; - herr_t status; + hid_t aid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + herr_t H5_ATTR_NDEBUG_UNUSED status; int val, i, j, k, l, n; float f; @@ -7193,11 +7193,11 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff RED, GREEN } e_t; - hid_t did = -1; - hid_t sid = -1; - hid_t tid = -1; - hid_t dcpl = -1; - herr_t status; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + herr_t H5_ATTR_NDEBUG_UNUSED status; int val, i, j, k, l, n; float f; int fillvalue = 2; @@ -7417,9 +7417,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff { double *dbuf; /* information to write */ - hid_t ldid = -1; /* dataset ID */ - hid_t lsid = -1; /* dataspace ID */ - hid_t ltid = -1; /* datatype ID */ + hid_t ldid = H5I_INVALID_HID; /* dataset ID */ + hid_t lsid = H5I_INVALID_HID; /* dataspace ID */ + hid_t ltid = H5I_INVALID_HID; /* datatype ID */ size_t size; hsize_t sdims[] = { 1 }; hsize_t tdims[] = { H5TOOLS_MALLOCSIZE / sizeof(double) + 1 }; @@ -7820,19 +7820,19 @@ static void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) { /* data dataset */ - hid_t did1 = -1; /* dataset ID */ - hid_t sid1 = -1; /* dataspace ID */ + hid_t did1 = H5I_INVALID_HID; /* dataset ID */ + hid_t sid1 = H5I_INVALID_HID; /* dataspace ID */ hsize_t dims1[2] = { 10, 10 };/* dimensions */ int *buf; /* dataset buffer */ /* reference dataset */ - hid_t did2 = -1; /* dataset ID */ - hid_t sid2 = -1; /* dataspace ID */ + hid_t did2 = H5I_INVALID_HID; /* dataset ID */ + hid_t sid2 = H5I_INVALID_HID; /* dataspace ID */ hsize_t dims2[] = { 2 }; /* 2 references */ hdset_reg_ref_t *rbuf; /* buffer for write the references */ hsize_t start[10]; /* starting location of hyperslab */ hsize_t count[10]; /* element count of hyperslab */ hsize_t coord[5][2]; /* coordinates for point selection */ - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; int i; /* allocate the buffer for write the references */ @@ -7931,12 +7931,12 @@ void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) static int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */) { - hid_t did = -1; - hid_t fid = -1; - hid_t f_sid = -1; - hid_t m_sid = -1; - hid_t tid = -1; - hid_t dcpl = -1; + hid_t did = H5I_INVALID_HID; + hid_t fid = H5I_INVALID_HID; + hid_t f_sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; hsize_t dims[1] = { GBLL }; /* dataset dimensions */ hsize_t hs_size[1] = { GBLL / (1024 * 1024) }; /* hyperslab dimensions */ hsize_t chunk_dims[1] = { GBLL / 1024 }; /* chunk dimensions */ @@ -8030,8 +8030,8 @@ out: static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { - hid_t aid = -1; - hid_t sid = -1; + hid_t aid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; /* create a space */ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) @@ -8070,8 +8070,8 @@ out: 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; + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; /* create a space */ if((sid = H5Screate_simple(rank, dims, NULL)) < 0) diff --git a/tools/test/h5diff/testfiles/h5diff_58.txt b/tools/test/h5diff/testfiles/h5diff_58.txt index d27a0c9..da147bc 100644 --- a/tools/test/h5diff/testfiles/h5diff_58.txt +++ b/tools/test/h5diff/testfiles/h5diff_58.txt @@ -1,3 +1,4 @@ + dataset: </refreg> and </refreg> Referenced dataset 10784 10784 ------------------------------------------------------------ @@ -8,4 +9,7 @@ point #1 (2,2) (3,3) point #3 (1,6) (2,5) point #4 (2,8) (1,7) 4 differences found + obj1 obj2 + -------------------------------------- +Attributes status: 0 common, 0 only in obj1, 0 only in obj2 EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_58_ref.txt b/tools/test/h5diff/testfiles/h5diff_58_ref.txt new file mode 100644 index 0000000..6fa2299 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_58_ref.txt @@ -0,0 +1,37 @@ + +dataset: </g1/reference2D> and </g1/reference2D> +size: [2] [2] +position difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +size: [2] [2] +position difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +size: [2] [2] +position difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +size: [2] [2] +position difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +size: [2] [2] +position difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +size: [2] [2] +position difference +------------------------------------------------------------ +[ 0 ] 1 0 1 +[ 1 ] 2 0 2 +12 differences found + obj1 obj2 + -------------------------------------- +Attributes status: 0 common, 0 only in obj1, 0 only in obj2 +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_reg.txt b/tools/test/h5diff/testfiles/h5diff_reg.txt new file mode 100644 index 0000000..d4f5415 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_reg.txt @@ -0,0 +1,15 @@ + +dataset: </Dataset3> and </Dataset3> +attribute: <Attr1 of <(null)>> and <Attr1 of <(null)>> +0 differences found +Warning: Cannot open referenced attribute: attribute 1 +Warning: Cannot open referenced attribute: attribute 2 +attribute: <Attr2 of <(null)>> and <Attr2 of <(null)>> +0 differences found +attribute: <Attr3 of <(null)>> and <Attr3 of <(null)>> +0 differences found +0 differences found + obj1 obj2 + -------------------------------------- +Attributes status: 0 common, 0 only in obj1, 0 only in obj2 +EXIT CODE: 0 diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index 557d2ff..2d490a8 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -150,6 +150,19 @@ $SRC_TOOLS_TESTFILES/vds/5_c.h5 $SRC_TOOLS_TESTFILES/vds/5_vds.h5 " +LIST_HDF5_STD_REF_OBJ_TEST_FILES=" +$SRC_TOOLS_TESTFILES/trefer_attr.h5 +$SRC_TOOLS_TESTFILES/trefer_compat.h5 +$SRC_TOOLS_TESTFILES/trefer_ext1.h5 +$SRC_TOOLS_TESTFILES/trefer_ext2.h5 +$SRC_TOOLS_TESTFILES/trefer_grp.h5 +$SRC_TOOLS_TESTFILES/trefer_obj_del.h5 +$SRC_TOOLS_TESTFILES/trefer_obj.h5 +$SRC_TOOLS_TESTFILES/trefer_param.h5 +$SRC_TOOLS_TESTFILES/trefer_reg_1d.h5 +$SRC_TOOLS_TESTFILES/trefer_reg.h5 +" + LIST_OTHER_TEST_FILES=" $SRC_H5DIFF_TESTFILES/h5diff_10.txt $SRC_H5DIFF_TESTFILES/h5diff_100.txt @@ -259,6 +272,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_55.txt $SRC_H5DIFF_TESTFILES/h5diff_56.txt $SRC_H5DIFF_TESTFILES/h5diff_57.txt $SRC_H5DIFF_TESTFILES/h5diff_58.txt +$SRC_H5DIFF_TESTFILES/h5diff_58_ref.txt $SRC_H5DIFF_TESTFILES/h5diff_59.txt $SRC_H5DIFF_TESTFILES/h5diff_500.txt $SRC_H5DIFF_TESTFILES/h5diff_501.txt @@ -338,6 +352,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_80.txt $SRC_H5DIFF_TESTFILES/h5diff_90.txt $SRC_H5DIFF_TESTFILES/h5diff_8625.txt $SRC_H5DIFF_TESTFILES/h5diff_8639.txt +$SRC_H5DIFF_TESTFILES/h5diff_reg.txt $SRC_H5DIFF_TESTFILES/h5diff_v1.txt $SRC_H5DIFF_TESTFILES/h5diff_v2.txt $SRC_H5DIFF_TESTFILES/h5diff_v3.txt @@ -347,7 +362,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_vlstr.txt # # copy test files and expected output files from source dirs to test dir # -COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_HDF5_VDS_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_HDF5_TEST_FILES_XML $LIST_OTHER_TEST_FILES_XML" +COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_HDF5_VDS_TEST_FILES $LIST_HDF5_STD_REF_OBJ_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_HDF5_TEST_FILES_XML $LIST_OTHER_TEST_FILES_XML" COPY_TESTFILES_TO_TESTDIR() { @@ -691,7 +706,10 @@ TOOLTEST h5diff_56.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset6a dset6b TOOLTEST h5diff_57.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset7a dset7b # 5.8 (region reference) -TOOLTEST h5diff_58.txt -v h5diff_dset1.h5 h5diff_dset2.h5 refreg +TOOLTEST h5diff_58.txt -v2 h5diff_dset1.h5 h5diff_dset2.h5 refreg +TOOLTEST h5diff_58_ref.txt -v2 h5diff_dset1.h5 h5diff_dset2.h5 /g1/reference2D +# STD_REF_OBJ +TOOLTEST h5diff_reg.txt -v2 trefer_attr.h5 trefer_ext2.h5 Dataset3 Dataset3 # test for both dset and attr with same type but with different size # ( HDDFV-7942 ) diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 38f4118..b9e4ef5 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -43,10 +43,12 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) #add_test (NAME h5dumpgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dumpgentest>) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) -include (CMakeTestsPBITS.cmake) + include (CMakeTestsPBITS.cmake) -include (CMakeTestsVDS.cmake) + include (CMakeTestsVDS.cmake) -include (CMakeTestsXML.cmake) + include (CMakeTestsXML.cmake) +endif () diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 62b2619..2e731f3 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -198,6 +198,16 @@ ${HDF5_TOOLS_DIR}/testfiles/h5dump-help.txt ${HDF5_TOOLS_DIR}/testfiles/out3.h5import ${HDF5_TOOLS_DIR}/testfiles/zerodim.ddl + #STD_REF_OBJ files + ${HDF5_TOOLS_DIR}/testfiles/trefer_attrR.ddl + ${HDF5_TOOLS_DIR}/testfiles/trefer_compatR.ddl + ${HDF5_TOOLS_DIR}/testfiles/trefer_extR.ddl + ${HDF5_TOOLS_DIR}/testfiles/trefer_grpR.ddl + ${HDF5_TOOLS_DIR}/testfiles/trefer_obj_delR.ddl + ${HDF5_TOOLS_DIR}/testfiles/trefer_objR.ddl + ${HDF5_TOOLS_DIR}/testfiles/trefer_paramR.ddl + ${HDF5_TOOLS_DIR}/testfiles/trefer_reg_1dR.ddl + ${HDF5_TOOLS_DIR}/testfiles/trefer_regR.ddl ) set (HDF5_N_REFERENCE_FILES tall-3 @@ -322,6 +332,18 @@ ${HDF5_TOOLS_DIR}/testfiles/tvms.h5 ${HDF5_TOOLS_DIR}/testfiles/t128bit_float.h5 ${HDF5_TOOLS_DIR}/testfiles/zerodim.h5 + #STD_REF_OBJ files + ${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_compat.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_ext1.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_ext2.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_grp.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_obj_del.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_obj.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_param.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_reg_1d.h5 + ${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5 + ) set (HDF5_ERROR_REFERENCE_TEST_FILES ${PROJECT_SOURCE_DIR}/errfiles/filter_fail.err @@ -1108,6 +1130,17 @@ ADD_H5ERR_MASK_TEST (tattrregR 0 "NULL token size" -R --enable-error-stack tattrreg.h5) ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 --enable-error-stack -d /Dataset1 -s 0 -R -y -o) + # test for 1.12 region references + ADD_H5_TEST (trefer_attrR 0 --enable-error-stack -R trefer_attr.h5) + ADD_H5_TEST (trefer_compatR 0 --enable-error-stack -R trefer_compat.h5) + ADD_H5_TEST (trefer_extR 0 --enable-error-stack -R trefer_ext2.h5) + ADD_H5_TEST (trefer_grpR 0 --enable-error-stack -R trefer_grp.h5) + ADD_H5_TEST (trefer_obj_delR 0 --enable-error-stack -R trefer_obj_del.h5) + ADD_H5_TEST (trefer_objR 0 --enable-error-stack -R trefer_obj.h5) + ADD_H5_TEST (trefer_paramR 0 --enable-error-stack -R trefer_param.h5) + ADD_H5_TEST (trefer_regR 0 --enable-error-stack -R trefer_reg.h5) + ADD_H5_TEST (trefer_reg_1dR 0 --enable-error-stack -R trefer_reg_1d.h5) + # tests for group creation order # "1" tracked, "2" name, root tracked ADD_H5_TEST (tordergr1 0 --enable-error-stack --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5) diff --git a/tools/test/h5dump/dynlib_dump.c b/tools/test/h5dump/dynlib_dump.c index 571452e..661a6dc 100644 --- a/tools/test/h5dump/dynlib_dump.c +++ b/tools/test/h5dump/dynlib_dump.c @@ -69,7 +69,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +78,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + *int_ptr = (int8_t)(temp + MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err index 2d70b35..39bbb0e 100644 --- a/tools/test/h5dump/errfiles/tdset-2.err +++ b/tools/test/h5dump/errfiles/tdset-2.err @@ -27,7 +27,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): 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 + #000: (file name) line (number) in H5Lget_info2(): unable to get link info major: Links minor: Can't get value #001: (file name) line (number) in H5VL_link_get(): link get failed diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err index b0b908b..e2f24c1 100644 --- a/tools/test/h5dump/errfiles/tperror.err +++ b/tools/test/h5dump/errfiles/tperror.err @@ -27,7 +27,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): 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 + #000: (file name) line (number) in H5Lget_info2(): unable to get link info major: Links minor: Can't get value #001: (file name) line (number) in H5VL_link_get(): link get failed diff --git a/tools/test/h5dump/errfiles/tqmarkfile.err b/tools/test/h5dump/errfiles/tqmarkfile.err index 2c4f1ff..4c3b2ef 100644 --- a/tools/test/h5dump/errfiles/tqmarkfile.err +++ b/tools/test/h5dump/errfiles/tqmarkfile.err @@ -15,7 +15,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): 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 + #000: (file name) line (number) in H5Lget_info2(): unable to get link info major: Symbol table minor: Object not found #001: (file name) line (number) in H5L_get_info(): name doesn't exist diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 4ceed73..e68e622 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -463,10 +463,23 @@ gent_dataset(void) { hid_t fid, dataset, space; hsize_t dims[2]; - int dset1[10][20]; - double dset2[30][20]; + int **dset1 = NULL; + int *dset1_data = NULL; + double **dset2 = NULL; + double *dset2_data = NULL; int i, j; + /* Set up data arrays */ + dset1_data = (int *)HDcalloc(10 * 20, sizeof(int)); + dset1 = (int **)HDcalloc(10, sizeof(dset1_data)); + for (i = 0; i < 10; i++) + dset1[i] = dset1_data + (i * 20); + + dset2_data = (double *)HDcalloc(30 * 20, sizeof(double)); + dset2 = (double **)HDcalloc(30, sizeof(dset2_data)); + for (i = 0; i < 30; i++) + dset2[i] = dset2_data + (i * 20); + fid = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* dset1 */ @@ -478,7 +491,7 @@ gent_dataset(void) for(j = 0; j < 20; j++) dset1[i][j] = j + i; - H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1_data); H5Sclose(space); H5Dclose(dataset); @@ -491,11 +504,16 @@ gent_dataset(void) for(j = 0; j < 20; j++) dset2[i][j] = 0.0001F * (float)j + (float)i; - H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); + H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_data); H5Sclose(space); H5Dclose(dataset); H5Fclose(fid); + + HDfree(dset1); + HDfree(dset1_data); + HDfree(dset2); + HDfree(dset2_data); } static void @@ -638,11 +656,11 @@ static void gent_softlink(void) #define NY 2 static int gent_softlink2(void) { - hid_t fileid1 = -1; - hid_t gid1 = -1, gid2 = -1; - hid_t datatype = -1; - hid_t dset1 = -1, dset2 = -1; - hid_t dataspace = -1; + hid_t fileid1 = H5I_INVALID_HID; + hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID; + hid_t datatype = H5I_INVALID_HID; + hid_t dset1 = H5I_INVALID_HID, dset2 = H5I_INVALID_HID; + hid_t dataspace = H5I_INVALID_HID; hsize_t dimsf[2]; /* dataset dimensions */ int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}}; int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}}; @@ -1554,7 +1572,7 @@ gent_many(void) dset1_t dset1[6]; hsize_t dim[4]; - herr_t ret; + herr_t H5_ATTR_NDEBUG_UNUSED ret; fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -1773,9 +1791,17 @@ static void gent_str(void) { int a[8][10]; char s[12][33]; } compound_t; - compound_t comp1[3][6]; + + compound_t **comp1 = NULL; + compound_t *comp1_data = NULL; hsize_t mdims[2]; + /* Set up data array */ + comp1_data = (compound_t *)HDcalloc(3 * 6, sizeof(compound_t)); + comp1 = (compound_t **)HDcalloc(3, sizeof(comp1_data)); + for (i = 0; i < 3; i++) + comp1[i] = comp1_data + (i * 6); + fid = H5Fcreate(FILE13, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* string 1 : nullterm string */ @@ -1861,7 +1887,7 @@ static void gent_str(void) { } dataset = H5Dcreate2(fid, "/comp1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Dwrite(dataset, f_type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, comp1); + H5Dwrite(dataset, f_type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, comp1_data); H5Tclose(f_type); H5Tclose(f_type2); @@ -1869,6 +1895,9 @@ static void gent_str(void) { H5Dclose(dataset); H5Fclose(fid); + + HDfree(comp1); + HDfree(comp1_data); } /* @@ -2548,7 +2577,7 @@ static void gent_opaque(void) static void gent_bitfields(void) { - hid_t file, grp=-1, type=-1, space=-1, dset=-1; + hid_t file, grp=H5I_INVALID_HID, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID; size_t i; hsize_t nelmts; unsigned char buf[32]; @@ -2565,7 +2594,7 @@ static void gent_bitfields(void) goto error; for(i = 0; i < sizeof buf; i++) - buf[i] = (unsigned char)0xff ^ (unsigned char)i; + buf[i] = (uint8_t)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; @@ -2579,7 +2608,7 @@ static void gent_bitfields(void) (dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; for(i = 0; i < sizeof buf; i++) - buf[i] = (unsigned char)0xff ^ (unsigned char)i; + buf[i] = (uint8_t)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; @@ -2603,7 +2632,7 @@ static void gent_vldatatypes(void) hid_t file, dset, space, type; hsize_t dims[] = { SPACE1_DIM1 }; int i; - herr_t ret=0; + herr_t H5_ATTR_NDEBUG_UNUSED ret=0; file = H5Fcreate(FILE21, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2698,7 +2727,7 @@ gent_vldatatypes2(void) hid_t tid1, tid2; /* Datatype IDs */ hsize_t dims1[] = {SPACE1_DIM1}; unsigned i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for(i = 0; i < SPACE1_DIM1; i++) { @@ -2771,7 +2800,7 @@ static void gent_vldatatypes3(void) hid_t tid1, tid2; /* Datatype IDs */ hsize_t dims1[] = {SPACE1_DIM1}; unsigned i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { @@ -2840,7 +2869,7 @@ static void gent_vldatatypes4(void) hid_t tid1, tid2; /* Datatype IDs */ hsize_t dims1[] = {SPACE1_DIM1}; unsigned i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { @@ -2897,14 +2926,14 @@ static void gent_vldatatypes4(void) /* Generate a variable-length dataset with NULL values in it */ static void gent_vldatatypes5(void) { - hvl_t wdata [SPACE1_DIM1]; - hid_t fid1; - hid_t dataset; - hid_t sid1; - hid_t tid1; - hsize_t dims1[] = {SPACE1_DIM1}; - int i,j; /* counting variable */ - herr_t ret; /* Generic return value */ + hvl_t wdata [SPACE1_DIM1]; + hid_t fid1; + hid_t dataset; + hid_t sid1; + hid_t tid1; + hsize_t dims1[] = {SPACE1_DIM1}; + int i,j; /* counting variable */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* initialize data for dataset */ for(i=0; i<SPACE1_DIM1; i++) { @@ -2966,16 +2995,15 @@ static void gent_vldatatypes5(void) static void gent_array1_big(void) { - int *wdata; /* Information to write */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Datatype ID */ - hsize_t sdims1[] = {SPACE_ARRAY1BIG_DIM}; - hsize_t tdims1[] = {ARRAY1BIG_DIM}; - int i,j; /* counting variables */ - herr_t ret; /* Generic return value */ - + int *wdata; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t sdims1[] = {SPACE_ARRAY1BIG_DIM}; + hsize_t tdims1[] = {ARRAY1BIG_DIM}; + int i,j; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* for region reference dataset */ hid_t dset2; @@ -3101,15 +3129,15 @@ static void gent_array1(void) static void gent_array2(void) { - int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */ - hid_t fid; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid; /* Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3}; - int i,j,k,l; /* counting variables */ - herr_t ret; /* Generic return value */ + int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */ + hid_t fid; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3}; + int i,j,k,l; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3147,17 +3175,17 @@ static void gent_array2(void) static void gent_array3(void) { - int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */ - hid_t fid; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid1; /* 1-D array Datatype ID */ - hid_t tid2; /* 2-D array Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2}; - int i,j,k,l; /* counting variables */ - herr_t ret; /* Generic return value */ + int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */ + hid_t fid; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid1; /* 1-D array Datatype ID */ + hid_t tid2; /* 2-D array Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2}; + int i,j,k,l; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Allocate and initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3204,16 +3232,16 @@ static void gent_array4(void) int i; float f; } s2_t; - s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* Compound Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* Compound Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int i,j; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3270,17 +3298,17 @@ static void gent_array5(void) int i; float f[ARRAY1_DIM1]; } s2_t; - s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* Compound Datatype ID */ - hid_t tid3; /* Nested Array Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + s2_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* Compound Datatype ID */ + hid_t tid3; /* Nested Array Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int i,j,k; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3341,16 +3369,16 @@ static void gent_array5(void) static void gent_array6(void) { - hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* VL Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* VL Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int i,j,k; /* counting variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3401,17 +3429,17 @@ static void gent_array6(void) static void gent_array7(void) { - hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* VL Datatype ID */ - hid_t tid3; /* Nested Array Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int i,j,k,l; /* Index variables */ - herr_t ret; /* Generic return value */ + hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* VL Datatype ID */ + hid_t tid3; /* Nested Array Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int i,j,k,l; /* Index variables */ + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */ /* Initialize array data to write */ for(i=0; i<SPACE1_DIM1; i++) @@ -3471,11 +3499,11 @@ static void gent_array7(void) /* Test the boundary of the display output buffer at the reallocation event */ static void gent_array8(void) { - hid_t file = -1; /* Handles */ - hid_t filetype = -1; /* Handles */ - hid_t space = -1; /* Handles */ - hid_t dset = -1; /* Handles */ - herr_t status = -1; + hid_t file = H5I_INVALID_HID; /* Handles */ + hid_t filetype = H5I_INVALID_HID; /* Handles */ + hid_t space = H5I_INVALID_HID; /* Handles */ + hid_t dset = H5I_INVALID_HID; /* Handles */ + herr_t H5_ATTR_NDEBUG_UNUSED status = -1; hsize_t sdims[] = {F64_DIM0}; hsize_t tdims[] = {F64_DIM1}; int *wdata; /* Write buffer */ @@ -3542,7 +3570,7 @@ static void gent_empty(void) } empty_struct; hid_t file, dset, space, type; hsize_t dims[] = { SPACE1_DIM1 }; - herr_t ret=0; + herr_t H5_ATTR_NDEBUG_UNUSED ret=0; file = H5Fcreate(FILE32, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -3748,9 +3776,15 @@ void gent_multi(void) H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; const char *memb_name[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][1024]; + char **sv = NULL; + char *sv_data = NULL; haddr_t memb_addr[H5FD_MEM_NTYPES]; + sv_data = (char *)HDcalloc(H5FD_MEM_NTYPES * 1024, sizeof(char)); + sv = (char **)HDcalloc(H5FD_MEM_NTYPES, sizeof(sv_data)); + for (i = 0; i < H5FD_MEM_NTYPES; i++) + sv[i] = sv_data + (i * 1024); + fapl = H5Pcreate(H5P_FILE_ACCESS); HDmemset(memb_map, 0, sizeof memb_map); @@ -3791,6 +3825,9 @@ void gent_multi(void) H5Dclose(dataset); H5Fclose(fid); H5Pclose(fapl); + + HDfree(sv); + HDfree(sv_data); } static void gent_large_objname(void) @@ -3930,7 +3967,7 @@ static void write_attr_in(hid_t loc_id, hid_t aid; hid_t sid; hid_t tid; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; int val, i, j, k, n; float f; @@ -4371,7 +4408,7 @@ static void write_dset_in(hid_t loc_id, hid_t sid; hid_t tid; hid_t plist_id; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; int val, i, j, k, n; float f; int fillvalue=2; @@ -4809,7 +4846,7 @@ static void gent_attr_all(void) hid_t root_id; hid_t sid; hsize_t dims[1] = {2}; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Create a file and a dataset */ fid = H5Fcreate(FILE40, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -4967,7 +5004,7 @@ static void gent_compound_complex(void) hid_t array4_tid; /* Array datatype handle */ hid_t datafile, dataset; /* Datafile/dataset handles */ hid_t dataspace; /* Dataspace handle */ - herr_t status; /* Error checking variable */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */ hsize_t dim[] = {F41_LENGTH}; /* Dataspace dimensions */ hsize_t array_dimb[] = {F41_DIMb}; /* Array dimensions */ hsize_t array_dimd[]={F41_ARRAY_DIMd1,F41_ARRAY_DIMd2}; /* Array dimensions */ @@ -5116,7 +5153,7 @@ static void gent_named_dtype_attr(void) hid_t aid; hid_t gid; int data=8; - herr_t ret; + herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Create a file */ fid=H5Fcreate(FILE42, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -5338,7 +5375,7 @@ make_external(hid_t fid) hsize_t cur_size[1]; /*data space current size */ hsize_t max_size[1]; /*data space maximum size */ hsize_t size; /*bytes reserved for data in the external file*/ - int ret; + int H5_ATTR_NDEBUG_UNUSED ret; cur_size[0] = max_size[0] = 100; size = (max_size[0]*sizeof(int)/2); @@ -5386,7 +5423,8 @@ static void gent_filters(void) hsize_t dims1[RANK] = {DIM1,DIM2}; hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; int buf1[DIM1][DIM2]; - int i, j, n, ret; + int i, j, n; + int H5_ATTR_NDEBUG_UNUSED ret; for(i=n=0; i<DIM1; i++){ for(j=0; j<DIM2; j++){ @@ -5732,8 +5770,7 @@ static void gent_fcontents(void) hid_t tid; /* datatype ID */ hsize_t dims[1]={4}; int buf[4]={1,2,3,4}; - int ret; - + int H5_ATTR_NDEBUG_UNUSED ret; /* create a file */ fid = H5Fcreate(FILE46, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -5866,7 +5903,7 @@ static void gent_fvalues(void) hvl_t fillval3; /* vlen fill value */ hsize_t dimarray[1]={3}; /* array dimension */ int buf4[2][3]= {{1,2,3},{4,5,6}}; /* array */ - int ret; + int H5_ATTR_NDEBUG_UNUSED ret; /* create a file */ fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -6024,9 +6061,9 @@ static void gent_string(void) c_t buf3 = {24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"}; char buf4[] = {"Four score and seven\n years ago our forefathers brought forth on this continent a new nation"}; hsize_t dims1[] = {1}; - hsize_t dims2[] = {SPACE1_DIM1}; - hsize_t dims4[1]; - int ret; + hsize_t dims2[] = {SPACE1_DIM1}; + hsize_t dims4[1]; + int H5_ATTR_NDEBUG_UNUSED ret; dims4[0] = sizeof(buf4); @@ -6121,7 +6158,8 @@ static void gent_aindices(void) int buf2[10][10]; int buf3[2][10][10]; int buf4[2][2][10][10]; - int i, j, k, l, n, ret; + int i, j, k, l, n; + int H5_ATTR_NDEBUG_UNUSED ret; for(i = n = 0; i < 100; i++) buf1[i] = n++; @@ -6188,11 +6226,11 @@ static void gent_aindices(void) */ static void gent_longlinks(void) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ - char *objname = NULL; /* Name of object [Long] */ - size_t u; /* Local index variable */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t H5_ATTR_NDEBUG_UNUSED gid2 = (-1); /* Datatype ID */ + char *objname = NULL; /* Name of object [Long] */ + size_t u; /* Local index variable */ /* Create files */ fid = H5Fcreate(FILE51, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -6353,12 +6391,12 @@ gent_binary(void) static void gent_bigdims(void) { - hid_t fid = -1; - hid_t did = -1; - hid_t f_sid = -1; - hid_t m_sid = -1; - hid_t tid = -1; - hid_t dcpl = -1; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t f_sid = H5I_INVALID_HID; + hid_t m_sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; hsize_t dims[1]={DIM_4GB}; /* dataset dimensions */ hsize_t chunk_dims[1]={1024}; /* chunk dimensions */ hsize_t hs_start[1]; @@ -6369,7 +6407,7 @@ gent_bigdims(void) hsize_t i; char c; size_t nelmts; - int ret; + int H5_ATTR_NDEBUG_UNUSED ret; /* create a file */ fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -6418,19 +6456,19 @@ gent_bigdims(void) /* close */ if(H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; if(H5Sclose(f_sid) < 0) goto out; - f_sid = -1; + f_sid = H5I_INVALID_HID; if(H5Sclose(m_sid) < 0) goto out; - m_sid = -1; + m_sid = H5I_INVALID_HID; if(H5Pclose(dcpl) < 0) goto out; - dcpl = -1; + dcpl = H5I_INVALID_HID; if(H5Dclose(did) < 0) goto out; - did = -1; + did = H5I_INVALID_HID; ret = H5Fclose(fid); HDassert(ret >= 0); @@ -6465,7 +6503,8 @@ gent_hyperslab(void) hid_t fid; /* file id */ hsize_t dims[2] = {32,4097}; /* big enough data size to force a second stripmine read */ double *buf; - int i, ret; + int i; + int H5_ATTR_NDEBUG_UNUSED ret; buf = (double*) HDmalloc(32 * 4097 * sizeof(double) ); for(i = 0; i < 32 * 4097; i++) @@ -6494,10 +6533,10 @@ gent_hyperslab(void) static void gent_group_creation_order(void) { - hid_t fid = -1; /* file ID */ - hid_t gid = -1; /* group ID */ - hid_t gcpl_id = -1; /* group creation property list ID */ - hid_t fcpl_id = -1; /* file creation property list ID (to set root group order) */ + hid_t fid = H5I_INVALID_HID; /* file ID */ + hid_t gid = H5I_INVALID_HID; /* group ID */ + hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */ + hid_t fcpl_id = H5I_INVALID_HID; /* file creation property list ID (to set root group order) */ if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) goto out; @@ -6523,45 +6562,45 @@ gent_group_creation_order(void) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; /*------------------------------------------------------------------------- @@ -6576,56 +6615,56 @@ gent_group_creation_order(void) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; if(H5Pclose(gcpl_id) < 0) goto out; - gcpl_id = -1; + gcpl_id = H5I_INVALID_HID; if(H5Pclose(fcpl_id) < 0) goto out; - fcpl_id = -1; + fcpl_id = H5I_INVALID_HID; if(H5Fclose(fid) < 0) goto out; - fid = -1; + fid = H5I_INVALID_HID; return; @@ -6653,15 +6692,15 @@ gent_group_creation_order(void) static void gent_attr_creation_order(void) { - hid_t fid = -1; /* file id */ - hid_t gid = -1; /* group id */ - hid_t did = -1; /* dataset id */ - hid_t sid = -1; /* space id */ - hid_t aid = -1; /* attribute id */ - hid_t tid = -1; /* datatype id */ - hid_t gcpl_id = -1; /* group creation property list ID */ - hid_t dcpl_id = -1; /* dataset creation property list ID */ - hid_t tcpl_id = -1; /* datatype creation property list ID */ + hid_t fid = H5I_INVALID_HID; /* file id */ + hid_t gid = H5I_INVALID_HID; /* group id */ + hid_t did = H5I_INVALID_HID; /* dataset id */ + hid_t sid = H5I_INVALID_HID; /* space id */ + hid_t aid = H5I_INVALID_HID; /* attribute id */ + hid_t tid = H5I_INVALID_HID; /* datatype id */ + hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */ + hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */ + hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */ int i; const char *attr_name[3] = {"c", "b", "a" }; @@ -6714,12 +6753,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - aid = -1; + aid = H5I_INVALID_HID; } /* end for */ if(H5Dclose(did) < 0) goto out; - did = -1; + did = H5I_INVALID_HID; /*------------------------------------------------------------------------- @@ -6740,12 +6779,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - aid = -1; + aid = H5I_INVALID_HID; } /* end for */ if(H5Dclose(did) < 0) goto out; - did = -1; + did = H5I_INVALID_HID; @@ -6766,12 +6805,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - aid = -1; + aid = H5I_INVALID_HID; } /* end for */ if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * create a group without creation order tracked for attributes and atributes in it @@ -6790,12 +6829,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - aid = -1; + aid = H5I_INVALID_HID; } /* end for */ if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * create a named datatype with creation order tracked for attributes and atributes in it @@ -6817,12 +6856,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - aid = -1; + aid = H5I_INVALID_HID; } /* end for */ if(H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * create a named datatype without creation order tracked for attributes and atributes in it @@ -6844,12 +6883,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - aid = -1; + aid = H5I_INVALID_HID; } /* end for */ if(H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * add some attributes to the root group @@ -6867,12 +6906,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - aid = -1; + aid = H5I_INVALID_HID; } /* end for */ if(H5Gclose(gid) < 0) goto out; - gid = -1; + gid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * close @@ -6880,19 +6919,19 @@ gent_attr_creation_order(void) */ if(H5Sclose(sid) < 0) goto out; - sid = -1; + sid = H5I_INVALID_HID; if(H5Pclose(dcpl_id) < 0) goto out; - dcpl_id = -1; + dcpl_id = H5I_INVALID_HID; if(H5Pclose(gcpl_id) < 0) goto out; - gcpl_id = -1; + gcpl_id = H5I_INVALID_HID; if(H5Pclose(tcpl_id) < 0) goto out; - tcpl_id = -1; + tcpl_id = H5I_INVALID_HID; if(H5Fclose(fid) < 0) goto out; - fid = -1; + fid = H5I_INVALID_HID; @@ -7091,7 +7130,8 @@ gent_dataset_idx(void) hsize_t dims[2]; hsize_t maxdims[2]; int buf[20][10]; - int i, j, ret; + int i, j; + int H5_ATTR_NDEBUG_UNUSED ret; /* Get a copy of the file aaccess property */ fapl = H5Pcreate(H5P_FILE_ACCESS); @@ -7615,7 +7655,7 @@ static void gent_charsets(void) { hid_t fid, did, sid; - herr_t status; + herr_t H5_ATTR_NDEBUG_UNUSED status; hsize_t dim[] = {1}; /* Dataspace dimensions */ typedef struct CharSetInfo { const char *ascii_p_; @@ -7689,7 +7729,7 @@ static void gent_compound_intsizes(void) { Array1Struct *Array1; hid_t Array1Structid; /* File datatype identifier */ - herr_t status; /* Error checking variable */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */ hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */ int m, n, o; /* Array init loop vars */ @@ -7959,14 +7999,16 @@ static void gent_compound_attr_intsizes(void) { int64_t dset64[F70_XDIM][F70_YDIM64]; double dsetdbl[F70_XDIM][F70_YDIM8]; } Array1Struct; - Array1Struct Array1[F70_LENGTH]; + Array1Struct *Array1 = NULL; hid_t Array1Structid; /* File datatype identifier */ - herr_t status; /* Error checking variable */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */ hsize_t dim[] = { F70_LENGTH }; /* Dataspace dimensions */ int m, n, o; /* Array init loop vars */ + Array1 = (Array1Struct *)HDcalloc(F70_LENGTH, sizeof(Array1Struct)); + /* Initialize the data in the arrays/datastructure */ for (m = 0; m < F70_LENGTH; m++) { @@ -8198,6 +8240,8 @@ static void gent_compound_attr_intsizes(void) { status = H5Fclose(fid); HDassert(status >= 0); + + HDfree(Array1); } static void gent_nested_compound_dt(void) { /* test nested data type */ @@ -8838,7 +8882,7 @@ static void gent_compound_int_array(void) { Cmpd1Struct *Cmpd1; hid_t Cmpd1Structid; /* File datatype identifier */ - herr_t status; /* Error checking variable */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */ hsize_t dim[] = { F76_LENGTH }; /* Dataspace dimensions */ int m, n; /* Array init loop vars */ @@ -9094,7 +9138,7 @@ static void gent_compound_ints(void) { hid_t Cmpd1Structid; /* File datatype identifier */ hid_t Cmpd2Structid; /* File datatype identifier */ - herr_t status; /* Error checking variable */ + herr_t H5_ATTR_NDEBUG_UNUSED status; /* Error checking variable */ hsize_t dim[] = { F77_LENGTH }; /* Dataspace dimensions */ int m; /* Array init loop vars */ @@ -9797,7 +9841,7 @@ static void gent_bitnopaquefields(void) uint64_t d; } s_t; - hid_t file, grp=-1, type=-1, space=-1, dset=-1; + hid_t file_id=H5I_INVALID_HID, grp=H5I_INVALID_HID, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID; size_t i; hsize_t nelmts = F80_DIM32; uint8_t buf[F80_DIM32]; /* bitfield, opaque */ @@ -9806,15 +9850,15 @@ static void gent_bitnopaquefields(void) uint64_t buf4[F80_DIM32]; /* bitfield, opaque */ s_t buf5[F80_DIM32]; /* compound */ - file = H5Fcreate(FILE80, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file_id = H5Fcreate(FILE80, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if ((grp = H5Gcreate2(file, "bittypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if ((grp = H5Gcreate2(file_id, "bittypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { /* bitfield_1 */ if ((type = H5Tcopy(H5T_STD_B8LE)) >= 0) { if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for (i = 0; i < nelmts; i++) { - buf[i] = (uint8_t)0xff ^ (uint8_t)i; + buf[i] = (uint8_t)(0xff ^ i); } H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); H5Dclose(dset); @@ -9829,7 +9873,7 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for (i = 0; i < nelmts; i++) { - buf2[i] = (uint16_t)0xffff ^ (uint16_t)(i * 16); + buf2[i] = (uint16_t)(0xffff ^ (i * 16)); } H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); H5Dclose(dset); @@ -9872,14 +9916,14 @@ static void gent_bitnopaquefields(void) H5Gclose(grp); } - if ((grp = H5Gcreate2(file, "opaquetypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if ((grp = H5Gcreate2(file_id, "opaquetypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { /* opaque_1 */ if ((type = H5Tcreate(H5T_OPAQUE, 1)) >= 0) { if ((H5Tset_tag(type, "1-byte opaque type")) >= 0) { if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) - buf[i] = (uint8_t)0xff ^ (uint8_t)i; + H5_CHECKED_ASSIGN(buf[i], uint8_t, 0xff ^ i, size_t); H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); H5Dclose(dset); } @@ -9895,7 +9939,7 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) - buf2[i] = (uint16_t)0xffff ^ (uint16_t)(i * 16); + H5_CHECKED_ASSIGN(buf2[i], uint16_t, 0xffff ^ (i * 16), size_t); H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); H5Dclose(dset); @@ -9908,7 +9952,7 @@ static void gent_bitnopaquefields(void) H5Gclose(grp); } - if ((grp = H5Gcreate2(file, "cmpdtypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { + if ((grp = H5Gcreate2(file_id, "cmpdtypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { /* compound_1 */ if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) { H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE); @@ -9918,8 +9962,8 @@ static void gent_bitnopaquefields(void) if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) { if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { for(i = 0; i < nelmts; i++) { - buf5[i].a = (uint8_t)0xff ^ (uint8_t)i; - buf5[i].b = (uint16_t)0xffff ^ (uint16_t)(i * 16); + H5_CHECKED_ASSIGN(buf5[i].a, uint8_t, 0xff ^ i, size_t); + H5_CHECKED_ASSIGN(buf5[i].b, uint16_t, 0xffff ^ (i * 16), size_t); buf5[i].c = (uint32_t)0xffffffff ^ (uint32_t)(i * 32); buf5[i].d = (uint64_t)0xffffffffffffffff ^ (uint64_t)(i * 64); } @@ -9934,7 +9978,7 @@ static void gent_bitnopaquefields(void) H5Gclose(grp); } - H5Fclose(file); + H5Fclose(file_id); } /*------------------------------------------------------------------------- @@ -10033,9 +10077,9 @@ static void gent_compound_complex2(void) compound *buf; /* compound */ - hid_t file, type=-1, space=-1, dset=-1; + hid_t file, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID; hid_t dset_array_a, dset_array_b, dset_array_c; - hid_t cmpd_tid1 = -1, cmpd_tid2 = -1, cmpd_tid3 = -1; + hid_t cmpd_tid1 = H5I_INVALID_HID, cmpd_tid2 = H5I_INVALID_HID, cmpd_tid3 = H5I_INVALID_HID; size_t i; size_t j, k; unsigned dset_array_ndims; @@ -10321,7 +10365,7 @@ static void gent_vlenstr_array(void) }; const char *buffer[F83_DIM*F83_ARRAYDIM]; - hid_t file, type=-1, space=-1, dset=-1; + hid_t file, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID; hid_t cmpd_tid1, array_tid; int i, j; @@ -10396,7 +10440,8 @@ static void gent_udfilter(void) hsize_t dims1[RANK] = {DIM1,DIM2}; hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; int buf1[DIM1][DIM2]; - int i, j, n, ret; + int i, j, n; + int H5_ATTR_NDEBUG_UNUSED ret; for(i=n=0; i<DIM1; i++){ for(j=0; j<DIM2; j++){ @@ -10488,7 +10533,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -10497,7 +10542,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + *int_ptr = (int8_t)(temp + MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -10564,10 +10609,10 @@ static void gent_null_space_group(void) static void gent_err_attr_dspace(void) { - hid_t fid = -1; /* File identifier */ - hid_t fcpl = -1; /* File access property list */ - hid_t sid = -1; /* Dataspace identifier */ - hid_t aid = -1; /* Attribute identifier */ + hid_t fid = H5I_INVALID_HID; /* File identifier */ + hid_t fcpl = H5I_INVALID_HID; /* File access property list */ + hid_t sid = H5I_INVALID_HID; /* Dataspace identifier */ + hid_t aid = H5I_INVALID_HID; /* Attribute identifier */ hsize_t dims = 2; /* Dimensino size */ int wdata[2] = {7, 42}; /* The buffer to write */ int fd = -1; /* The file descriptor */ diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 4b85138..53c8927 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -923,7 +923,43 @@ GREPTEST() cd $TESTDIR $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@" ) >$actual 2>$actual_err - if [[ "$txttype" = "ERRTXT" ]]; then + if [ "$txttype" = "ERRTXT" ]; then + $GREP "$expectdata" $actual_err > /dev/null + else + $GREP "$expectdata" $actual > /dev/null + fi + if [ $? -eq 0 ]; then + echo " PASSED" + else + echo " FAILED" + nerrors="`expr $nerrors + 1`" + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi +} + +# Call the h5dump tool and grep for a value but disables plugin filter loading +# txttype ERRTXT greps test error output, otherwise greps test output +GREPTEST2() +{ + txttype=$1 + expectdata=$2 + actual=$TESTDIR/$3 + actual_err="$TESTDIR/`basename $3 .ddl`.oerr" + shift + shift + shift + + # Run test. + TESTING $DUMPER -p $@ + ( + cd $TESTDIR + $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@" + ) >$actual 2>$actual_err + if [ "$txttype" = "ERRTXT" ]; then $GREP "$expectdata" $actual_err > /dev/null else $GREP "$expectdata" $actual > /dev/null @@ -1390,7 +1426,7 @@ TOOLTEST4 textlinkfar.ddl --enable-error-stack textlinkfar.h5 TOOLTEST4 textlink.ddl --enable-error-stack textlink.h5 # test for error stack display (BZ2048) -TOOLTEST5 filter_fail.ddl --enable-error-stack filter_fail.h5 +GREPTEST2 ERRTXT "filter plugins disabled" filter_fail.ddl --enable-error-stack filter_fail.h5 # test for -o -y for dataset with attributes TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 tall.h5 diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index 55d5623..9e49c4f 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -25,4 +25,6 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) #add_test (NAME h5fc_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5fc_gentest>) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/tools/test/h5format_convert/h5fc_chk_idx.c b/tools/test/h5format_convert/h5fc_chk_idx.c index 8369668..ad1742b 100644 --- a/tools/test/h5format_convert/h5fc_chk_idx.c +++ b/tools/test/h5format_convert/h5fc_chk_idx.c @@ -45,8 +45,8 @@ main(int argc, char *argv[]) { char *fname = NULL; char *dname = NULL; - hid_t fid = -1; - hid_t did = -1; + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; H5D_chunk_index_t idx_type; /* h5fc_chk_idx fname dname */ diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c index b482dee..1e9e2cf 100644 --- a/tools/test/h5format_convert/h5fc_gentest.c +++ b/tools/test/h5format_convert/h5fc_gentest.c @@ -77,12 +77,12 @@ const char *FILENAME[] = { 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 */ + hid_t fid = H5I_INVALID_HID; /* file id */ + hid_t fcpl = H5I_INVALID_HID; /* file creation property list */ + hid_t gid = H5I_INVALID_HID; /* group id */ + hid_t sid = H5I_INVALID_HID; /* space id */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */ + hid_t did1 = -1, did2 = H5I_INVALID_HID; /* 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 */ @@ -307,11 +307,11 @@ error: 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 */ + hid_t fid = H5I_INVALID_HID; /* file id */ + hid_t fapl = H5I_INVALID_HID; /* file access property list */ + hid_t sid = H5I_INVALID_HID; /* dataspace id */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */ + hid_t did = H5I_INVALID_HID; /* 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 */ @@ -395,14 +395,14 @@ error: 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 */ + hid_t fid = H5I_INVALID_HID; /* file ID */ + hid_t fapl = H5I_INVALID_HID; /* file access property list */ + hid_t fcpl = H5I_INVALID_HID; /* file creation property list */ + hid_t sid = H5I_INVALID_HID; /* dataspace id */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ + hid_t msid = H5I_INVALID_HID; /* 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 */ @@ -534,13 +534,13 @@ error: 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 */ + hid_t fid = H5I_INVALID_HID; /* file id */ + hid_t fapl = H5I_INVALID_HID; /* file access property list */ + hid_t fcpl = H5I_INVALID_HID; /* file creation property list */ + hid_t gid = H5I_INVALID_HID; /* group id */ + hid_t sid = H5I_INVALID_HID; /* space id */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */ + hid_t did1 = H5I_INVALID_HID, did2 = H5I_INVALID_HID; /* 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 */ diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt index 9364683..a77ba00 100644 --- a/tools/test/h5import/CMakeLists.txt +++ b/tools/test/h5import/CMakeLists.txt @@ -15,4 +15,6 @@ else () endif () set_target_properties (h5importtest PROPERTIES FOLDER tools) -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index 6fdf7b0..f00e781 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -36,4 +36,6 @@ else () endif () set_target_properties (tellub PROPERTIES FOLDER tools) -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index 26a427d..f496a7a 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -81,7 +81,7 @@ parse_command_line(int argc, const char *argv[]) int main(int argc, const char *argv[]) { - int fd = -1; + int fd = H5I_INVALID_HID; unsigned size; char *filename = NULL; long res; diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index 0da03c5..abbe6d0 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -30,6 +30,8 @@ if (BUILD_SHARED_LIBS) ) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) -include (CMakeTestsVDS.cmake) + include (CMakeTestsVDS.cmake) +endif () diff --git a/tools/test/h5ls/dynlib_ls.c b/tools/test/h5ls/dynlib_ls.c index 571452e..661a6dc 100644 --- a/tools/test/h5ls/dynlib_ls.c +++ b/tools/test/h5ls/dynlib_ls.c @@ -69,7 +69,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Subtract the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp - MULTIPLIER; + *int_ptr = (int8_t)(temp - MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ @@ -78,7 +78,7 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, /* Add the original value with MULTIPLIER */ while(buf_left > 0) { char temp = *int_ptr; - *int_ptr = temp + MULTIPLIER; + *int_ptr = (int8_t)(temp + MULTIPLIER); int_ptr++; buf_left -= sizeof(*int_ptr); } /* end while */ diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index f81ce4f..5722354 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -98,4 +98,6 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) #add_test (NAME h5repackgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repackgentest>) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index aaac285..7c0e7f1 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -266,7 +266,7 @@ generate_uint8be(hbool_t external) { for (i = 0, n = 0; i < dims[0]; i++) { for (j = 0; j < dims[1]; j++) { for (k = 0; k < dims[2]; k++, n++) { - wdata[n] = n * ((n & 1) ? (-1) : (1)); + wdata[n] = (uint8_t)((n & 1) ? -n : n); } } } @@ -296,7 +296,7 @@ generate_f32le(hbool_t external) { /* Generate values */ for (i = 0, k = 0, n = 0; i < dims[0]; i++) { for (j = 0; j < dims[1]; j++, k++, n++) { - wdata[k] = n * 801.1 * ((k % 5 == 1) ? (-1) : (1)); + wdata[k] = (float)(n * 801.1 * ((k % 5 == 1) ? (-1) : (1))); } } @@ -314,7 +314,6 @@ generate_f32le(hbool_t external) { int main(void) { int i = 0; - int ret_value = 0; for (i = 0; i < 2; i++) { hbool_t external = (i & 1) ? TRUE : FALSE; diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index f3e6cd3..2654685 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -1779,9 +1779,9 @@ error: static int make_testfiles(void) { - hid_t fid = -1; - hid_t fcpl = -1; /* File creation property list */ - hid_t fapl = -1; /* File access property list */ + hid_t fid = H5I_INVALID_HID; + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ unsigned j; /* Local index variable */ /*------------------------------------------------------------------------- @@ -2210,12 +2210,12 @@ out: static int make_all_objects(hid_t loc_id) { - hid_t did = -1; - hid_t gid = -1; - hid_t tid = -1; - hid_t rid = -1; - hid_t sid = -1; - hid_t gcplid = -1; + hid_t did = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; + hid_t rid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t gcplid = H5I_INVALID_HID; hsize_t dims[1] = {2}; /* compound datatype */ typedef struct s_t @@ -2332,10 +2332,10 @@ out: static int make_attributes(hid_t loc_id) { - hid_t did = -1; - hid_t gid = -1; - hid_t rid = -1; - hid_t sid = -1; + hid_t did = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t rid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; hsize_t dims[1] = {2}; /*------------------------------------------------------------------------- @@ -2403,8 +2403,8 @@ static int make_hlinks(hid_t loc_id) { hid_t g1id =- 1; - hid_t g2id = -1; - hid_t g3id = -1; + hid_t g2id = H5I_INVALID_HID; + hid_t g3id = H5I_INVALID_HID; hsize_t dims[2] = {3,2}; int buf[3][2] = {{1,1}, {1,2}, {2,2}}; @@ -2473,8 +2473,8 @@ out: static int make_szip(hid_t loc_id) { - hid_t dcpl = -1; /* dataset creation property list */ - hid_t sid = -1; /* dataspace ID */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */ + hid_t sid = H5I_INVALID_HID; /* dataspace ID */ unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block = 8; hsize_t dims[RANK] = {DIM1, DIM2}; @@ -2544,8 +2544,8 @@ out: static int make_deflate(hid_t loc_id) { - hid_t dcpl = -1; /* dataset creation property list */ - hid_t sid = -1; /* dataspace ID */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */ + hid_t sid = H5I_INVALID_HID; /* dataspace ID */ hsize_t dims[RANK] = {DIM1,DIM2}; hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; int buf[DIM1][DIM2]; @@ -2684,8 +2684,8 @@ out: static int make_fletcher32(hid_t loc_id) { - hid_t dcpl = -1; /* dataset creation property list */ - hid_t sid = -1; /* dataspace ID */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */ + hid_t sid = H5I_INVALID_HID; /* dataspace ID */ hsize_t dims[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; @@ -2751,10 +2751,10 @@ out: static int make_nbit(hid_t loc_id) { - hid_t dcpl = -1; /* dataset creation property list */ - hid_t sid = -1; /* dataspace ID */ - hid_t dtid = -1; - hid_t dsid = -1; + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */ + hid_t sid = H5I_INVALID_HID; /* dataspace ID */ + hid_t dtid = H5I_INVALID_HID; + hid_t dsid = H5I_INVALID_HID; hsize_t dims[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; @@ -2832,10 +2832,10 @@ out: static int make_scaleoffset(hid_t loc_id) { - hid_t dcpl = -1; /* dataset creation property list */ - hid_t sid = -1; /* dataspace ID */ - hid_t dtid = -1; - hid_t dsid = -1; + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */ + hid_t sid = H5I_INVALID_HID; /* dataspace ID */ + hid_t dtid = H5I_INVALID_HID; + hid_t dsid = H5I_INVALID_HID; hsize_t dims[RANK] = {DIM1,DIM2}; hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; int buf[DIM1][DIM2]; @@ -3077,11 +3077,11 @@ int make_early(void) { hsize_t dims[1] ={3000}; hsize_t cdims[1]={30}; - hid_t fid=-1; - hid_t did=-1; - hid_t sid=-1; - hid_t tid=-1; - hid_t dcpl=-1; + hid_t fid=H5I_INVALID_HID; + hid_t did=H5I_INVALID_HID; + hid_t sid=H5I_INVALID_HID; + hid_t tid=H5I_INVALID_HID; + hid_t dcpl=H5I_INVALID_HID; int i; char name[16]; int iter=100; @@ -3172,8 +3172,8 @@ out: static int make_layout(hid_t loc_id) { - hid_t dcpl=-1; /* dataset creation property list */ - hid_t sid=-1; /* dataspace ID */ + hid_t dcpl=H5I_INVALID_HID; /* dataset creation property list */ + hid_t sid=H5I_INVALID_HID; /* dataspace ID */ hsize_t dims[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; @@ -3286,12 +3286,12 @@ static int make_layout2(hid_t loc_id) { - hid_t contig_dcpl = -1; /* dataset creation property list */ - hid_t chunked_dcpl = -1; /* dataset creation property list */ + hid_t contig_dcpl = H5I_INVALID_HID; /* dataset creation property list */ + hid_t chunked_dcpl = H5I_INVALID_HID; /* dataset creation property list */ int i, j, n; /* Local index variables */ int ret_value = -1; /* Return value */ - hid_t s_sid = -1; /* dataspace ID */ + hid_t s_sid = H5I_INVALID_HID; /* dataspace ID */ hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */ hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */ @@ -3361,11 +3361,11 @@ out: static int make_layout3(hid_t loc_id) { - hid_t dcpl1=-1; /* dataset creation property list */ - hid_t dcpl2=-1; /* dataset creation property list */ - hid_t dcpl3=-1; /* dataset creation property list */ - hid_t sid1=-1; /* dataspace ID */ - hid_t sid2=-1; /* dataspace ID */ + hid_t dcpl1=H5I_INVALID_HID; /* dataset creation property list */ + hid_t dcpl2=H5I_INVALID_HID; /* dataset creation property list */ + hid_t dcpl3=H5I_INVALID_HID; /* dataset creation property list */ + hid_t sid1=H5I_INVALID_HID; /* dataspace ID */ + hid_t sid2=H5I_INVALID_HID; /* dataspace ID */ hsize_t dims1[RANK]={DIM1_L3,DIM2_L3}; hsize_t dims2[RANK]={SDIM1_L3,SDIM2_L3}; hsize_t maxdims[RANK]={H5S_UNLIMITED, H5S_UNLIMITED}; @@ -3494,8 +3494,8 @@ out: static int make_fill(hid_t loc_id) { - hid_t did=-1; - hid_t sid=-1; + hid_t did=H5I_INVALID_HID; + hid_t sid=H5I_INVALID_HID; hid_t dcpl; hsize_t dims[2]={3,2}; int buf[3][2]= {{1,1},{1,2},{2,2}}; @@ -3547,9 +3547,9 @@ out: static int make_big(hid_t loc_id) { - hid_t did=-1; - hid_t f_sid=-1; - hid_t m_sid=-1; + hid_t did=H5I_INVALID_HID; + hid_t f_sid=H5I_INVALID_HID; + hid_t m_sid=H5I_INVALID_HID; hid_t tid; hid_t dcpl; hsize_t dims[1]={ H5TOOLS_MALLOCSIZE + 1}; /* dataset dimensions */ @@ -3628,8 +3628,8 @@ out: static int make_external(hid_t loc_id) { - hid_t did=-1; - hid_t sid=-1; + hid_t did=H5I_INVALID_HID; + hid_t sid=H5I_INVALID_HID; hid_t dcpl; int buf[2]={1,2}; hsize_t cur_size[1]; /* data space current size */ @@ -3682,12 +3682,12 @@ out: static int make_userblock(void) { - hid_t fid = -1; - hid_t fcpl = -1; - int fd = -1; /* File descriptor for writing userblock */ - char ub[USERBLOCK_SIZE]; /* User block data */ - ssize_t nwritten; /* # of bytes written */ - size_t u; /* Local index variable */ + hid_t fid = H5I_INVALID_HID; + hid_t fcpl = H5I_INVALID_HID; + int fd = -1; /* File descriptor for writing userblock */ + char ub[USERBLOCK_SIZE]; /* User block data */ + ssize_t H5_ATTR_NDEBUG_UNUSED nwritten; /* # of bytes written */ + size_t u; /* Local index variable */ /* Create file creation property list with userblock set */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) @@ -3744,12 +3744,12 @@ out: static int verify_userblock( const char* filename) { - hid_t fid = -1; - hid_t fcpl = -1; + hid_t fid = H5I_INVALID_HID; + hid_t fcpl = H5I_INVALID_HID; int fd = -1; /* File descriptor for writing userblock */ char ub[USERBLOCK_SIZE]; /* User block data */ hsize_t ub_size = 0; /* User block size */ - ssize_t nread; /* # of bytes read */ + ssize_t H5_ATTR_NDEBUG_UNUSED nread; /* # of bytes read */ size_t u; /* Local index variable */ /* Open file with userblock */ @@ -3816,7 +3816,7 @@ make_userblock_file(void) { int fd = -1; /* File descriptor for writing userblock */ char ub[USERBLOCK_SIZE]; /* User block data */ - ssize_t nwritten; /* # of bytes written */ + ssize_t H5_ATTR_NDEBUG_UNUSED nwritten; /* # of bytes written */ size_t u; /* Local index variable */ /* initialize userblock data */ @@ -3874,10 +3874,10 @@ int write_dset_in(hid_t loc_id, GREEN } e_t; - hid_t did=-1; - hid_t sid=-1; - hid_t tid=-1; - hid_t pid=-1; + hid_t did=H5I_INVALID_HID; + hid_t sid=H5I_INVALID_HID; + hid_t tid=H5I_INVALID_HID; + hid_t pid=H5I_INVALID_HID; unsigned i, j; int val, k, n; float f; @@ -4620,10 +4620,10 @@ out: static int make_dset_reg_ref(hid_t loc_id) { - hid_t did1=-1; /* Dataset ID */ - hid_t did2=-1; /* Dereferenced dataset ID */ - hid_t sid1=-1; /* Dataspace ID #1 */ - hid_t sid2=-1; /* Dataspace ID #2 */ + hid_t did1=H5I_INVALID_HID; /* Dataset ID */ + hid_t did2=H5I_INVALID_HID; /* Dereferenced dataset ID */ + hid_t sid1=H5I_INVALID_HID; /* Dataspace ID #1 */ + hid_t sid2=H5I_INVALID_HID; /* Dataspace ID #2 */ hsize_t dims1[] = {SPACE1_DIM1}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ @@ -4739,9 +4739,9 @@ int write_attr_in(hid_t loc_id, GREEN } e_t; - hid_t aid = -1; - hid_t sid = -1; - hid_t tid = -1; + hid_t aid = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; int val, j, k, n; unsigned i; float f; @@ -4824,7 +4824,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_BITFIELD @@ -4854,7 +4854,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_OPAQUE @@ -4881,7 +4881,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_COMPOUND @@ -4919,7 +4919,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_REFERENCE @@ -4968,7 +4968,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_VLEN @@ -5013,13 +5013,13 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Aclose(aid) < 0) goto out; - aid = -1; + aid = H5I_INVALID_HID; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; if (H5Sclose(sid) < 0) goto out; - sid = -1; + sid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_ARRAY @@ -5054,7 +5054,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT @@ -5132,7 +5132,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_BITFIELD @@ -5165,7 +5165,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_OPAQUE @@ -5193,7 +5193,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_COMPOUND @@ -5229,7 +5229,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_REFERENCE @@ -5284,7 +5284,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_VLEN @@ -5335,13 +5335,13 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Aclose(aid) < 0) goto out; - aid = -1; + aid = H5I_INVALID_HID; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; if (H5Sclose(sid) < 0) goto out; - sid = -1; + sid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_ARRAY @@ -5384,7 +5384,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT @@ -5504,7 +5504,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_BITFIELD @@ -5558,7 +5558,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_OPAQUE @@ -5572,7 +5572,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_COMPOUND @@ -5658,7 +5658,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_REFERENCE @@ -5743,7 +5743,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_VLEN @@ -5797,13 +5797,13 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Aclose(aid) < 0) goto out; - aid = -1; + aid = H5I_INVALID_HID; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; if (H5Sclose(sid) < 0) goto out; - sid = -1; + sid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_ARRAY @@ -5837,7 +5837,7 @@ int write_attr_in(hid_t loc_id, goto out; if (H5Tclose(tid) < 0) goto out; - tid = -1; + tid = H5I_INVALID_HID; /*------------------------------------------------------------------------- * H5T_INTEGER and H5T_FLOAT @@ -5917,7 +5917,7 @@ int make_dset(hid_t loc_id, hid_t dcpl, void *buf) { - hid_t did=-1; + hid_t did=H5I_INVALID_HID; if ((did = H5Dcreate2(loc_id, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) return -1; @@ -5954,8 +5954,8 @@ int write_dset( hid_t loc_id, hid_t tid, void *buf ) { - hid_t did=-1; - hid_t sid=-1; + hid_t did=H5I_INVALID_HID; + hid_t sid=H5I_INVALID_HID; if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) return -1; @@ -6040,11 +6040,11 @@ static int make_named_dtype(hid_t loc_id) { hsize_t dims[1] ={3}; - hid_t did=-1; - hid_t aid=-1; - hid_t sid=-1; - hid_t tid=-1; - hid_t gid=-1; + hid_t did=H5I_INVALID_HID; + hid_t aid=H5I_INVALID_HID; + hid_t sid=H5I_INVALID_HID; + hid_t tid=H5I_INVALID_HID; + hid_t gid=H5I_INVALID_HID; if ((sid = H5Screate_simple(1, dims, NULL)) < 0) goto out; 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 4e69148..9e83ff8 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 @@ -44,4 +44,4 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): #000: (file name) line (number) in do_copy_objects(): H5Dcreate2 failed major: Failure in tools library - minor: error in function + minor: function info diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt index 5c17fd5..0e2ee5e 100644 --- a/tools/test/h5stat/CMakeLists.txt +++ b/tools/test/h5stat/CMakeLists.txt @@ -14,4 +14,6 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) #add_test (NAME h5stat_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5stat_gentest>) endif () -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL) + include (CMakeTests.cmake) +endif () diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c index 2edfcf6..0bf1001 100644 --- a/tools/test/h5stat/h5stat_gentest.c +++ b/tools/test/h5stat/h5stat_gentest.c @@ -54,14 +54,14 @@ static void gen_newgrat_file(const char *fname) { - hid_t fcpl = -1; /* File creation property */ - hid_t fapl = -1; /* File access property */ - hid_t fid = -1; /* File id */ - hid_t gid = -1; /* Group id */ - hid_t tid = -1; /* Datatype id */ - hid_t sid = -1; /* Dataspace id */ - hid_t attr_id = -1; /* Attribute id */ - hid_t did = -1; /* Dataset id */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property */ + hid_t fapl = H5I_INVALID_HID; /* File access property */ + hid_t fid = H5I_INVALID_HID; /* File id */ + hid_t gid = H5I_INVALID_HID; /* Group id */ + hid_t tid = H5I_INVALID_HID; /* Datatype id */ + hid_t sid = H5I_INVALID_HID; /* Dataspace id */ + hid_t attr_id = H5I_INVALID_HID; /* Attribute id */ + hid_t did = H5I_INVALID_HID; /* Dataset id */ char name[30]; /* Group name */ char attrname[30]; /* Attribute name */ int i; /* Local index variable */ @@ -139,15 +139,15 @@ error: static void gen_threshold_file(const char *fname) { - 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 */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t sid0 = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t sid1 = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t sid2 = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t sid3 = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t sid4 = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t attr_id = H5I_INVALID_HID; /* Attribute ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ hsize_t two_dims[] = {2, 5}; /* Dimension array */ hsize_t one_dims[] = {6}; /* Dimension array */ hsize_t zero_dims[] = {0}; /* Dimension array */ @@ -323,11 +323,11 @@ error: 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 */ + hid_t fapl = H5I_INVALID_HID; /* file access property id */ + hid_t fid = H5I_INVALID_HID; /* file id */ + hid_t sid = H5I_INVALID_HID; /* space id */ + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */ + hid_t did = -1, did2 = H5I_INVALID_HID; /* dataset id */ hsize_t dims[1] = {10}; /* dataset dimension */ hsize_t c_dims[1] = {2}; /* chunk dimension */ int i; /* local index variable */ @@ -413,12 +413,12 @@ error: static void gen_err_refcount(const char *fname) { - hid_t fid = -1; /* File identifier */ - hid_t sid = -1; /* Dataspace message */ - hid_t did = -1; /* Dataset identifier */ - hid_t gid = -1; /* Group identifier */ - hid_t aid1 = -1, aid2 = -1; /* Attribute identifier */ - hid_t tid = -1; /* Datatype identifier */ + hid_t fid = H5I_INVALID_HID; /* File identifier */ + hid_t sid = H5I_INVALID_HID; /* Dataspace message */ + hid_t did = H5I_INVALID_HID; /* Dataset identifier */ + hid_t gid = H5I_INVALID_HID; /* Group identifier */ + hid_t aid1 = -1, aid2 = H5I_INVALID_HID; /* Attribute identifier */ + hid_t tid = H5I_INVALID_HID; /* Datatype identifier */ int i, n; /* Local index variables */ int buf[10]; /* Data buffer */ hsize_t dims[1]; /* Dimension size */ diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index a250222..089a302 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -55,6 +55,8 @@ else () endif () set_target_properties (clear_open_chk PROPERTIES FOLDER tools) -include (CMakeTestsRepart.cmake) -include (CMakeTestsClear.cmake) -include (CMakeTestsMkgrp.cmake) +if (HDF5_TEST_SERIAL) + include (CMakeTestsRepart.cmake) + include (CMakeTestsClear.cmake) + include (CMakeTestsMkgrp.cmake) +endif () diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 96d7e75e7..1411c21 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -56,10 +56,10 @@ const char *FILENAME_ENHANCE[] = { static int gen_cache_image_file(const char *fname) { - hid_t fid = -1; /* File ID */ - hid_t did = -1, sid = -1; /* Dataset ID, dataspace ID */ - hid_t fapl = -1; /* File access property list */ - hid_t dcpl = -1; /* Dataset creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t did = -1, sid = H5I_INVALID_HID; /* Dataset ID, dataspace ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ hsize_t dims[2]; /* Dimension sizes */ hsize_t chunks[2]; /* Chunked dimension sizes */ int buf[50][100]; /* Buffer for data to write */ @@ -164,10 +164,10 @@ error: static int gen_enhance_files(hbool_t user) { - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t sid = -1; /* Dataspace ID */ - hid_t did = -1; /* Dataset ID */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ hsize_t dim[1]; /* Dimension sizes */ int data[NUM_ELMTS]; /* Buffer for data */ int fd = -1; /* The file descriptor ID */ @@ -361,13 +361,13 @@ error: int main(void) { - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t fapl = -1, new_fapl = -1; /* File access property lists */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t fapl = -1, new_fapl = H5I_INVALID_HID; /* File access property lists */ char fname[512]; /* File name */ unsigned new_format; /* To use latest library format or not */ - hid_t sid = -1; /* Dataspace ID */ - hid_t did = -1; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ hsize_t dim[1]; /* Dimension sizes */ int data[NUM_ELMTS]; /* Buffer for data */ int i; /* Local index variables */ diff --git a/tools/test/misc/h5repart_gentest.c b/tools/test/misc/h5repart_gentest.c index 5c1ff87..bd94104 100644 --- a/tools/test/misc/h5repart_gentest.c +++ b/tools/test/misc/h5repart_gentest.c @@ -25,7 +25,8 @@ #define FAMILY_SIZE 1024 #define FILENAME "family_file%05d.h5" -static int buf[FAMILY_NUMBER][FAMILY_SIZE]; +int **buf = NULL; +int *buf_data = NULL; int main(void) { @@ -34,66 +35,82 @@ int main(void) int i, j; hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE}; + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) { + HDperror("HDcalloc"); + HDexit(EXIT_FAILURE); + } + if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) { + HDperror("HDcalloc"); + HDexit(EXIT_FAILURE); + } + for (i = 0; i < FAMILY_NUMBER; i++) + buf[i] = buf_data + (i * FAMILY_SIZE); + /* Set property list and file name for FAMILY driver */ - if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) { - perror ("H5Pcreate"); - exit (EXIT_FAILURE); + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + HDperror("H5Pcreate"); + HDexit(EXIT_FAILURE); } if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) { - perror ("H5Pset_fapl_family"); - exit (EXIT_FAILURE); + HDperror("H5Pset_fapl_family"); + HDexit(EXIT_FAILURE); } if((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { - perror("H5Fcreate"); - exit(EXIT_FAILURE); + HDperror("H5Fcreate"); + HDexit(EXIT_FAILURE); } /* Create and write dataset */ if((space = H5Screate_simple(2, dims, NULL)) < 0) { - perror("H5Screate_simple"); - exit(EXIT_FAILURE); + HDperror("H5Screate_simple"); + HDexit(EXIT_FAILURE); } if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - perror("H5Dcreate2"); - exit(EXIT_FAILURE); + HDperror("H5Dcreate2"); + HDexit(EXIT_FAILURE); } - for(i = 0; i<FAMILY_NUMBER; i++) - for(j = 0; j<FAMILY_SIZE; j++) + for(i = 0; i < FAMILY_NUMBER; i++) + for(j = 0; j < FAMILY_SIZE; j++) buf[i][j] = i * 10000 + j; - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) { - perror("H5Dwrite"); - exit(EXIT_FAILURE); + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) { + HDperror("H5Dwrite"); + HDexit(EXIT_FAILURE); } if(H5Sclose(space) < 0) { - perror ("H5Sclose"); - exit (EXIT_FAILURE); + HDperror("H5Sclose"); + HDexit(EXIT_FAILURE); } if(H5Dclose(dset) < 0) { - perror ("H5Dclose"); - exit (EXIT_FAILURE); + HDperror("H5Dclose"); + HDexit(EXIT_FAILURE); } if(H5Pclose(fapl) < 0) { - perror ("H5Pclose"); - exit (EXIT_FAILURE); + HDperror("H5Pclose"); + HDexit(EXIT_FAILURE); } if(H5Fclose(file) < 0) { - perror ("H5Fclose"); - exit (EXIT_FAILURE); + HDperror("H5Fclose"); + HDexit(EXIT_FAILURE); } - puts(" PASSED"); fflush(stdout); + HDfree(buf); + HDfree(buf_data); + + HDputs(" PASSED"); + HDfflush(stdout); - return 0; + return EXIT_SUCCESS; } diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c index b8e0292..7227de0 100644 --- a/tools/test/misc/repart_test.c +++ b/tools/test/misc/repart_test.c @@ -47,8 +47,8 @@ herr_t test_single_h5repart_opens(void); herr_t test_family_h5repart_opens(void) { - hid_t fid = -1; - hid_t fapl_id = -1; + hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; /* open 1st file(single member file) with correct family size(20000 byte) */ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -102,7 +102,7 @@ error: herr_t test_single_h5repart_opens(void) { - hid_t fid = -1; + hid_t fid = H5I_INVALID_HID; /* open the single file */ if ((fid = H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT)) < 0) diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index 7f1f038..c69d1f7 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -32,11 +32,11 @@ const char *setname = "align"; int main(void) { - hid_t fil=-1, spc=-1, set=-1; - hid_t cs6=-1, cmp=-1, fix=-1; - hid_t cmp1=-1, cmp2=-1, cmp3=-1; - hid_t plist=-1; - hid_t array_dt=-1; + hid_t fil=H5I_INVALID_HID, spc=H5I_INVALID_HID, set=H5I_INVALID_HID; + hid_t cs6=H5I_INVALID_HID, cmp=H5I_INVALID_HID, fix=H5I_INVALID_HID; + hid_t cmp1=H5I_INVALID_HID, cmp2=H5I_INVALID_HID, cmp3=H5I_INVALID_HID; + hid_t plist=H5I_INVALID_HID; + hid_t array_dt=H5I_INVALID_HID; hsize_t dim[2]; hsize_t cdim[4]; diff --git a/tools/test/misc/vds/UC_1_one_dim_gen.c b/tools/test/misc/vds/UC_1_one_dim_gen.c index b997280..b5ddae3 100644 --- a/tools/test/misc/vds/UC_1_one_dim_gen.c +++ b/tools/test/misc/vds/UC_1_one_dim_gen.c @@ -59,16 +59,16 @@ static int UC_1_VDS_FILL_VALUE = -9; int main(void) { - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t src_dcplid = -1; /* source dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ - hid_t msid = -1; /* memory dataspace ID */ - hid_t fsid = -1; /* file dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ + hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ hsize_t extent[RANK]; /* dataset extents */ hsize_t start[RANK]; /* starting point for hyperslab */ diff --git a/tools/test/misc/vds/UC_2_two_dims_gen.c b/tools/test/misc/vds/UC_2_two_dims_gen.c index bd70fda..8e1554b 100644 --- a/tools/test/misc/vds/UC_2_two_dims_gen.c +++ b/tools/test/misc/vds/UC_2_two_dims_gen.c @@ -68,16 +68,16 @@ static int UC_2_VDS_FILL_VALUE = -9; int main(void) { - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t src_dcplid = -1; /* source dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ - hid_t msid = -1; /* memory dataspace ID */ - hid_t fsid = -1; /* file dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ + hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ hsize_t start[RANK]; /* starting point for hyperslab */ hsize_t extent[RANK]; /* dataset extents */ diff --git a/tools/test/misc/vds/UC_3_gaps_gen.c b/tools/test/misc/vds/UC_3_gaps_gen.c index e6e7226..74a23dc 100644 --- a/tools/test/misc/vds/UC_3_gaps_gen.c +++ b/tools/test/misc/vds/UC_3_gaps_gen.c @@ -29,12 +29,12 @@ static herr_t create_3_1_vds(void) { - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ hsize_t start[RANK]; /* source starting point for hyperslab */ hsize_t position[RANK]; /* vds mapping positions */ @@ -136,12 +136,12 @@ error: static herr_t create_3_2_vds(void) { - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ hsize_t start[RANK]; /* source starting point for hyperslab */ diff --git a/tools/test/misc/vds/UC_4_printf_gen.c b/tools/test/misc/vds/UC_4_printf_gen.c index b328046..24451e9 100644 --- a/tools/test/misc/vds/UC_4_printf_gen.c +++ b/tools/test/misc/vds/UC_4_printf_gen.c @@ -27,16 +27,16 @@ int main(void) { - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t src_dcplid = -1; /* source dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ - hid_t msid = -1; /* memory dataspace ID */ - hid_t fsid = -1; /* file dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ + hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ /* Hyperslab arrays */ hsize_t start[RANK] = {0, 0, 0}; diff --git a/tools/test/misc/vds/UC_5_stride_gen.c b/tools/test/misc/vds/UC_5_stride_gen.c index a105bbd..726ce6e 100644 --- a/tools/test/misc/vds/UC_5_stride_gen.c +++ b/tools/test/misc/vds/UC_5_stride_gen.c @@ -27,16 +27,16 @@ int main(void) { - hid_t src_sid = -1; /* source dataset's dataspace ID */ - hid_t src_dcplid = -1; /* source dataset property list ID */ + hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */ + hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */ - hid_t vds_sid = -1; /* VDS dataspace ID */ - hid_t vds_dcplid = -1; /* VDS dataset property list ID */ + hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */ + hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */ - hid_t fid = -1; /* HDF5 file ID */ - hid_t did = -1; /* dataset ID */ - hid_t msid = -1; /* memory dataspace ID */ - hid_t fsid = -1; /* file dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */ + hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */ hsize_t extent[RANK]; /* source dataset extents */ hsize_t start[RANK]; /* starting point for hyperslab */ diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 38dd605..d788ffa 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -21,20 +21,21 @@ endif () set_target_properties (h5perf_serial PROPERTIES FOLDER perform) if (HDF5_BUILD_PERFORM_STANDALONE) - #-- Adding test for h5perf_serial_alone + #-- Adding test for h5perf_serial_alone - io_timer.c includes set (h5perf_serial_alone_SOURCES + ${HDF5_TOOLS_DIR}/lib/io_timer.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_standalone.c ) add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES}) - target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (h5perf_serial_alone STATIC) - target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") else () TARGET_C_PROPERTIES (h5perf_serial_alone SHARED) - target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") endif () set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform) set_property (TARGET h5perf_serial_alone @@ -132,7 +133,7 @@ else () endif () set_target_properties (zip_perf PROPERTIES FOLDER perform) -if (H5_HAVE_PARALLEL AND BUILD_TESTING) +if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) if (UNIX) #-- Adding test for perf - only on unix systems set (perf_SOURCES @@ -169,18 +170,19 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) if (HDF5_BUILD_PERFORM_STANDALONE) #-- Adding test for h5perf set (h5perf_alone_SOURCES + ${HDF5_TOOLS_DIR}/lib/io_timer.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_standalone.c ) add_executable (h5perf_alone ${h5perf_alone_SOURCES}) - target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (h5perf_alone STATIC) - target_link_libraries (h5perf_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") else () TARGET_C_PROPERTIES (h5perf_alone SHARED) - target_link_libraries (h5perf_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>") endif () set_target_properties (h5perf_alone PROPERTIES FOLDER perform) set_property (TARGET h5perf_alone @@ -189,4 +191,6 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) endif () endif () -include (CMakeTests.cmake) +if (HDF5_TEST_TOOLS) + include (CMakeTests.cmake) +endif () diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index f0ae416..5d61f7b 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -22,175 +22,176 @@ add_custom_target(zip_perf_files ALL COMMENT "Copying files needed by zip_perf t #----------------------------------------------------------------------------- # Add Tests #----------------------------------------------------------------------------- +if (HDF5_TEST_SERIAL) + # Remove any output file left over from previous test run + add_test ( + NAME PERFORM_h5perform-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + chunk.h5 + iopipe.h5 + iopipe.raw + x-diag-rd.dat + x-diag-wr.dat + x-rowmaj-rd.dat + x-rowmaj-wr.dat + x-gnuplot + h5perf_serial.txt + h5perf_serial.txt.err + chunk.txt + chunk.txt.err + iopipe.txt + iopipe.txt.err + overhead.txt + overhead.txt.err + perf_meta.txt + perf_meta.txt.err + zip_perf-h.txt + zip_perf-h.txt.err + zip_perf.txt + zip_perf.txt.err + ) -# Remove any output file left over from previous test run -add_test ( - NAME PERFORM_h5perform-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - chunk.h5 - iopipe.h5 - iopipe.raw - x-diag-rd.dat - x-diag-wr.dat - x-rowmaj-rd.dat - x-rowmaj-wr.dat - x-gnuplot - h5perf_serial.txt - h5perf_serial.txt.err - chunk.txt - chunk.txt.err - iopipe.txt - iopipe.txt.err - overhead.txt - overhead.txt.err - perf_meta.txt - perf_meta.txt.err - zip_perf-h.txt - zip_perf-h.txt.err - zip_perf.txt - zip_perf.txt.err -) - -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_h5perf_serial COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial>) -else () - add_test (NAME PERFORM_h5perf_serial COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5perf_serial>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=h5perf_serial.txt" - #-D "TEST_REFERENCE=h5perf_serial.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_h5perf_serial COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial>) + else () + add_test (NAME PERFORM_h5perf_serial COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5perf_serial>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=h5perf_serial.txt" + #-D "TEST_REFERENCE=h5perf_serial.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (PERFORM_h5perf_serial PROPERTIES + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} + DEPENDS "PERFORM_h5perform-clearall-objects" ) -endif () -set_tests_properties (PERFORM_h5perf_serial PROPERTIES - TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} - DEPENDS "PERFORM_h5perform-clearall-objects" -) -if (HDF5_BUILD_PERFORM_STANDALONE) - add_test (NAME PERFORM_h5perf_serial_alone COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial_alone>) -endif () + if (HDF5_BUILD_PERFORM_STANDALONE) + add_test (NAME PERFORM_h5perf_serial_alone COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial_alone>) + endif () -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_chunk COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:chunk>) -else () - add_test (NAME PERFORM_chunk COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:chunk>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=chunk.txt" - #-D "TEST_REFERENCE=chunk.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_chunk COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:chunk>) + else () + add_test (NAME PERFORM_chunk COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:chunk>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=chunk.txt" + #-D "TEST_REFERENCE=chunk.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (PERFORM_chunk PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" ) -endif () -set_tests_properties (PERFORM_chunk PROPERTIES - DEPENDS "PERFORM_h5perform-clearall-objects" -) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_iopipe COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:iopipe>) -else () - add_test (NAME PERFORM_iopipe COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:iopipe>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=iopipe.txt" - #-D "TEST_REFERENCE=iopipe.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_iopipe COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:iopipe>) + else () + add_test (NAME PERFORM_iopipe COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:iopipe>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=iopipe.txt" + #-D "TEST_REFERENCE=iopipe.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (PERFORM_iopipe PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" ) -endif () -set_tests_properties (PERFORM_iopipe PROPERTIES - DEPENDS "PERFORM_h5perform-clearall-objects" -) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_overhead COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:overhead>) -else () - add_test (NAME PERFORM_overhead COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:overhead>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=overhead.txt" - #-D "TEST_REFERENCE=overhead.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_overhead COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:overhead>) + else () + add_test (NAME PERFORM_overhead COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:overhead>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=overhead.txt" + #-D "TEST_REFERENCE=overhead.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (PERFORM_overhead PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" ) -endif () -set_tests_properties (PERFORM_overhead PROPERTIES - DEPENDS "PERFORM_h5perform-clearall-objects" -) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_perf_meta COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:perf_meta>) -else () - add_test (NAME PERFORM_perf_meta COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:perf_meta>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=perf_meta.txt" - #-D "TEST_REFERENCE=perf_meta.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_perf_meta COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:perf_meta>) + else () + add_test (NAME PERFORM_perf_meta COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:perf_meta>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=perf_meta.txt" + #-D "TEST_REFERENCE=perf_meta.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (PERFORM_perf_meta PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" ) -endif () -set_tests_properties (PERFORM_perf_meta PROPERTIES - DEPENDS "PERFORM_h5perform-clearall-objects" -) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_zip_perf_help COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> "-h") -else () - add_test (NAME PERFORM_zip_perf_help COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=zip_perf-h.txt" - #-D "TEST_REFERENCE=zip_perf-h.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_zip_perf_help COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> "-h") + else () + add_test (NAME PERFORM_zip_perf_help COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=zip_perf-h.txt" + #-D "TEST_REFERENCE=zip_perf-h.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (PERFORM_zip_perf_help PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" ) -endif () -set_tests_properties (PERFORM_zip_perf_help PROPERTIES - DEPENDS "PERFORM_h5perform-clearall-objects" -) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_zip_perf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> tfilters.h5) -else () - add_test (NAME PERFORM_zip_perf COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=zip_perf.txt" - #-D "TEST_REFERENCE=zip_perf.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME PERFORM_zip_perf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> tfilters.h5) + else () + add_test (NAME PERFORM_zip_perf COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=zip_perf.txt" + #-D "TEST_REFERENCE=zip_perf.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (PERFORM_zip_perf PROPERTIES + DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects" ) endif () -set_tests_properties (PERFORM_zip_perf PROPERTIES - DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects" -) -if (H5_HAVE_PARALLEL) +if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL) if (UNIX) add_test (NAME MPI_TEST_PERFORM_perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:perf> ${MPIEXEC_POSTFLAGS}) endif () diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index 804f88e..3603c9b 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -72,7 +72,7 @@ /* #define DIAG_NRDCC 521 */ static size_t nio_g; -static hid_t fapl_g = -1; +static hid_t fapl_g = H5I_INVALID_HID; /* Local function prototypes */ static size_t diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c index 2d9c44f..bf4728d 100644 --- a/tools/test/perform/iopipe.c +++ b/tools/test/perform/iopipe.c @@ -133,7 +133,7 @@ synchronize (void) #if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__) _flushall(); #else - int status; + int H5_ATTR_NDEBUG_UNUSED status; status = HDsystem("sync"); HDassert(status >= 0); @@ -168,8 +168,7 @@ main (void) static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS; unsigned char *the_data = NULL; - hid_t file, dset, file_space = -1; - herr_t status; + hid_t file, dset, file_space = H5I_INVALID_HID; #ifdef H5_HAVE_GETRUSAGE struct rusage r_start, r_stop; #else @@ -178,8 +177,9 @@ main (void) struct timeval t_start, t_stop; int fd; unsigned u; - hssize_t n; - off_t offset; + herr_t H5_ATTR_NDEBUG_UNUSED status; + hssize_t H5_ATTR_NDEBUG_UNUSED n; + off_t H5_ATTR_NDEBUG_UNUSED offset; hsize_t start[2]; hsize_t count[2]; @@ -198,15 +198,15 @@ main (void) /* Open the files */ file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert (file>=0); + HDassert (file>=0); fd = HDopen (RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666); - assert (fd>=0); + HDassert (fd>=0); /* Create the dataset */ file_space = H5Screate_simple (2, size, size); - assert(file_space >= 0); + HDassert(file_space >= 0); dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(dset >= 0); + HDassert(dset >= 0); the_data = (unsigned char *)malloc((size_t)(size[0] * size[1])); /* initial fill for lazy malloc */ @@ -268,7 +268,7 @@ main (void) HDfflush(stderr); status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data); - assert (status>=0); + HDassert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -306,9 +306,9 @@ main (void) putc (PROGRESS, stderr); HDfflush(stderr); offset = HDlseek (fd, (off_t)0, SEEK_SET); - assert (0==offset); + HDassert (0==offset); n = HDwrite (fd, the_data, (size_t)(size[0]*size[1])); - assert (n>=0 && (size_t)n==size[0]*size[1]); + HDassert (n>=0 && (size_t)n==size[0]*size[1]); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -347,7 +347,7 @@ main (void) HDfflush(stderr); status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, the_data); - assert (status>=0); + HDassert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -385,9 +385,9 @@ main (void) putc (PROGRESS, stderr); HDfflush(stderr); offset = HDlseek (fd, (off_t)0, SEEK_SET); - assert (0==offset); + HDassert (0==offset); n = HDread (fd, the_data, (size_t)(size[0]*size[1])); - assert (n>=0 && (size_t)n==size[0]*size[1]); + HDassert (n>=0 && (size_t)n==size[0]*size[1]); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -427,7 +427,7 @@ main (void) HDfflush(stderr); status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data); - assert (status>=0); + HDassert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -449,11 +449,11 @@ main (void) (size_t)(nread*size[0]*size[1])); /* Read hyperslab */ - assert (size[0]>20 && size[1]>20); + HDassert (size[0]>20 && size[1]>20); start[0] = start[1] = 10; count[0] = count[1] = size[0]-20; status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, start, NULL, count, NULL); - assert (status>=0); + HDassert (status>=0); synchronize (); #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_start); @@ -471,7 +471,7 @@ main (void) HDfflush(stderr); status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, H5P_DEFAULT, the_data); - assert (status>=0); + HDassert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index 2008a6e..8926d14 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -110,15 +110,13 @@ const char *FILENAME[] = { /* function prototypes */ static int parse_args(int argc, char **argv); -extern int errno; - /* globals needed for getopt */ extern char *optarg; int main(int argc, char **argv) { char *buf, *tmp, *buf2 = NULL, *tmp2 = NULL, *check; - int i, j, mynod=0, nprocs=1, err, my_correct = 1, correct, myerrno; + int i, j, mynod=0, nprocs=1, my_correct = 1, correct, myerrno; double stim, etim; double write_tim = 0; double read_tim = 0; @@ -127,10 +125,6 @@ int main(int argc, char **argv) double min_read_tim, min_write_tim; double ave_read_tim, ave_write_tim; int64_t iter_jump = 0; - int64_t seek_position = 0; - MPI_File fh; - MPI_Status status; - int nchars; char filename[MAX_PATH]; herr_t ret; /* Generic return value */ diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index 77c04ab..f3cb3ec 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -54,24 +54,15 @@ /* sizes of various items. these sizes won't change during program execution */ /* The following three must have the same type */ -#define ELMT_SIZE (sizeof(unsigned char)) /* we're doing bytes */ -#define ELMT_MPI_TYPE MPI_BYTE #define ELMT_H5_TYPE H5T_NATIVE_UCHAR #define GOTOERROR(errcode) { ret_code = errcode; goto done; } -#define GOTODONE { goto done; } #define ERRMSG(mesg) { \ HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \ HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ } -#define MSG(mesg) { \ - HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \ - HDfprintf(stderr, "(%s) at line %4d in %s\n", \ - mesg, (int)__LINE__, __FILE__); \ -} - /* verify: if val is false (0), print mesg. */ #define VRFY(val, mesg) do { \ if (!val) { \ @@ -208,7 +199,7 @@ do_pio(parameters param) bsize = buf_size; /* Actual buffer size */ } else { - snbytes = (off_t)sqrt(nbytes); /* General dataset size */ + snbytes = (off_t)sqrt((double)nbytes); /* General dataset size */ bsize = buf_size * blk_size; /* Actual buffer size */ } @@ -557,16 +548,16 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* HDF5 variables */ herr_t hrc; /*HDF5 return code */ hsize_t h5dims[2]; /*dataset dim sizes */ - hid_t h5dset_space_id = -1; /*dataset space ID */ - hid_t h5mem_space_id = -1; /*memory dataspace ID */ - hid_t h5ds_id = -1; /*dataset handle */ + hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ + hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ + hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ hsize_t h5block[2]; /*dataspace selection */ hsize_t h5stride[2]; hsize_t h5count[2]; hsize_t h5start[2]; hssize_t h5offset[2]; /* Selection offset within dataspace */ - hid_t h5dcpl = -1; /* Dataset creation property list */ - hid_t h5dxpl = -1; /* Dataset transfer property list */ + hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ /* Get the parameters from the parameter block */ blk_size=parms->blk_size; @@ -601,7 +592,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* nbytes is always the number of bytes per dataset (1D or 2D). If the dataspace is 2D, snbytes is the size of a side of the dataset square. */ - snbytes = (off_t)sqrt(nbytes); + snbytes = (off_t)sqrt((double)nbytes); /* Contiguous Pattern: */ if (!parms->interleaved) { @@ -1402,7 +1393,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, GOTOERROR(FAIL); } - h5ds_id = -1; + h5ds_id = H5I_INVALID_HID; } /* end if */ } /* end for */ @@ -1458,7 +1449,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { - h5dset_space_id = -1; + h5dset_space_id = H5I_INVALID_HID; } } @@ -1468,7 +1459,7 @@ done: HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { - h5mem_space_id = -1; + h5mem_space_id = H5I_INVALID_HID; } } @@ -1478,7 +1469,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { - h5dxpl = -1; + h5dxpl = H5I_INVALID_HID; } } @@ -1537,15 +1528,15 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* HDF5 variables */ herr_t hrc; /*HDF5 return code */ hsize_t h5dims[2]; /*dataset dim sizes */ - hid_t h5dset_space_id = -1; /*dataset space ID */ - hid_t h5mem_space_id = -1; /*memory dataspace ID */ - hid_t h5ds_id = -1; /*dataset handle */ + hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ + hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ + hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ hsize_t h5block[2]; /*dataspace selection */ hsize_t h5stride[2]; hsize_t h5count[2]; hsize_t h5start[2]; hssize_t h5offset[2]; /* Selection offset within dataspace */ - hid_t h5dxpl = -1; /* Dataset transfer property list */ + hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ /* Get the parameters from the parameter block */ blk_size=parms->blk_size; @@ -1577,7 +1568,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* nbytes is always the number of bytes per dataset (1D or 2D). If the dataspace is 2D, snbytes is the size of a side of the 'dataset square'. */ - snbytes = (off_t)sqrt(nbytes); + snbytes = (off_t)sqrt((double)nbytes); bsize = buf_size * blk_size; @@ -2357,7 +2348,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, GOTOERROR(FAIL); } - h5ds_id = -1; + h5ds_id = H5I_INVALID_HID; } /* end if */ } /* end for */ @@ -2413,7 +2404,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { - h5dset_space_id = -1; + h5dset_space_id = H5I_INVALID_HID; } } @@ -2423,7 +2414,7 @@ done: HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { - h5mem_space_id = -1; + h5mem_space_id = H5I_INVALID_HID; } } @@ -2433,7 +2424,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { - h5dxpl = -1; + h5dxpl = H5I_INVALID_HID; } } @@ -2451,7 +2442,7 @@ done: do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) { int ret_code = SUCCESS, mrc; - hid_t acc_tpl = -1; /* file access templates */ + hid_t acc_tpl = H5I_INVALID_HID; /* file access templates */ switch (param->io_type) { case POSIXIO: diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index 9f4d116..1a40f44 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -80,8 +80,12 @@ #define PIO_MPI 0x2 #define PIO_HDF5 0x4 +#define DBL_EPSILON 2.2204460492503131e-16 +#define H5_DBL_ABS_EQUAL(X,Y) (fabsf((X)-(Y)) < DBL_EPSILON) + /* report 0.0 in case t is zero too */ #define MB_PER_SEC(bytes,t) (((t)==0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t))) +#define MB_PER_SEC(bytes,t) (H5_DBL_ABS_EQUAL((t), 0.0) ? 0.0 : ((((double)bytes) / ONE_MB) / (t))) #ifndef TRUE #define TRUE 1 @@ -1155,9 +1159,9 @@ report_parameters(struct options *opts) recover_size_and_print((long long)(opts->num_bpp * opts->max_num_procs), "\n"); HDfprintf(output, "rank %d: File size=", rank); - recover_size_and_print((long long)(pow(opts->num_bpp * opts->min_num_procs,2) + recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->min_num_procs),2) * opts->num_dsets), ":"); - recover_size_and_print((long long)(pow(opts->num_bpp * opts->max_num_procs,2) + recover_size_and_print((long long)(pow((double)(opts->num_bpp * opts->max_num_procs),2) * opts->num_dsets), "\n"); HDfprintf(output, "rank %d: Transfer buffer size=", rank); diff --git a/tools/test/perform/pio_perf.h b/tools/test/perform/pio_perf.h index 7605f20..55d721e 100644 --- a/tools/test/perform/pio_perf.h +++ b/tools/test/perform/pio_perf.h @@ -13,12 +13,13 @@ #ifndef PIO_PERF_H__ #define PIO_PERF_H__ -#include "io_timer.h" #ifndef STANDALONE +#include "io_timer.h" #include "h5test.h" #include "h5tools.h" #include "h5tools_utils.h" #else +#include "io_timer.h" #include "pio_standalone.h" #endif diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index 022e390..8cdca85 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -18,6 +18,9 @@ #include "pio_perf.h" +#ifdef STANDALONE +MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ +#endif /** From h5tools_utils.c **/ @@ -162,8 +165,134 @@ print_version(const char *progname) H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE); } -#ifdef H5_HAVE_PARALLEL -MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ -#endif +#ifdef STANDALONE +/* + * Function: h5_set_info_object + * Purpose: Process environment variables setting to set up MPI Info + * object. + * Return: 0 if all is fine; otherwise non-zero. + * Programmer: Albert Cheng, 2002/05/21. + * Modifications: + * Bill Wendling, 2002/05/31 + * Modified so that the HDF5_MPI_INFO environment variable can + * be a semicolon separated list of "key=value" pairings. Most + * of the code is to remove any whitespaces which might be + * surrounding the "key=value" pairs. + */ +int +h5_set_info_object(void) +{ + char *envp; /* environment pointer */ + int ret_value=0; + + /* handle any MPI INFO hints via $HDF5_MPI_INFO */ + if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){ + char *next, *valp; + + valp = envp = next = HDstrdup(envp); + + if (!valp) return 0; + + /* create an INFO object if not created yet */ + if (h5_io_info_g == MPI_INFO_NULL) + MPI_Info_create(&h5_io_info_g); + + do { + size_t len; + char *key_val, *endp, *namep; + + if (*valp == ';') + valp++; + + /* copy key/value pair into temporary buffer */ + len = strcspn(valp, ";"); + next = &valp[len]; + key_val = (char *)HDcalloc(1, len + 1); + + /* increment the next pointer past the terminating semicolon */ + if (*next == ';') + ++next; + + namep = HDstrncpy(key_val, valp, len); + + /* pass up any beginning whitespaces */ + while (*namep && (*namep == ' ' || *namep == '\t')) + namep++; + + if (!*namep) continue; /* was all white space, so move to next k/v pair */ + + /* eat up any ending white spaces */ + endp = &namep[HDstrlen(namep) - 1]; + + while (endp && (*endp == ' ' || *endp == '\t')) + *endp-- = '\0'; + + /* find the '=' */ + valp = HDstrchr(namep, '='); + if (valp != NULL) { /* it's a valid key/value pairing */ + char *tmp_val = valp + 1; + + /* change '=' to \0, move valp down one */ + *valp-- = '\0'; + + /* eat up ending whitespace on the "key" part */ + while (*valp == ' ' || *valp == '\t') + *valp-- = '\0'; + + valp = tmp_val; + + /* eat up beginning whitespace on the "value" part */ + while (*valp == ' ' || *valp == '\t') + *valp++ = '\0'; + + /* actually set the darned thing */ + if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) { + HDprintf("MPI_Info_set failed\n"); + ret_value = -1; + } + } + + valp = next; + HDfree(key_val); + } while (next && *next); + + HDfree(envp); + } + + return ret_value; +} + + +/* + * Function: h5_dump_info_object + * Purpose: Display content of an MPI Info object + * Return: void + * Programmer: Albert Cheng 2002/05/21 + * Modifications: + */ +void +h5_dump_info_object(MPI_Info info) +{ + char key[MPI_MAX_INFO_KEY+1]; + char value[MPI_MAX_INFO_VAL+1]; + int flag; + int i, nkeys; + + HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL); + if (info==MPI_INFO_NULL){ + HDprintf("object is MPI_INFO_NULL\n"); + } + else { + MPI_Info_get_nkeys(info, &nkeys); + HDprintf("object has %d items\n", nkeys); + for (i=0; i<nkeys; i++){ + MPI_Info_get_nthkey(info, i, key); + MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); + HDprintf("%s=%s\n", key, value); + } + + } +} +#endif /* STANDALONE */ diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index e6db2e8..cf6d980 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -483,8 +483,8 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #endif #ifdef H5_HAVE_PARALLEL -H5TEST_DLL int h5_set_info_object(void); -H5TEST_DLL void h5_dump_info_object(MPI_Info info); +int h5_set_info_object(void); +void h5_dump_info_object(MPI_Info info); #endif diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index 4dc4d0b..69409bb 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -114,11 +114,11 @@ static const char *multi_letters = "msbrglo"; /* string for multi driver */ /* HDF5 global variables */ static hsize_t h5count[MAX_DIMS]; /*selection count */ static hssize_t h5offset[MAX_DIMS]; /* Selection offset within dataspace */ -static hid_t h5dset_space_id = -1; /*dataset space ID */ -static hid_t h5mem_space_id = -1; /*memory dataspace ID */ -static hid_t h5ds_id = -1; /*dataset handle */ -static hid_t h5dcpl = -1; /* Dataset creation property list */ -static hid_t h5dxpl = -1; /* Dataset transfer property list */ +static hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ +static hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ +static hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ +static hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */ +static hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ /* * Function: do_sio @@ -575,7 +575,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) GOTOERROR(FAIL); } - h5ds_id = -1; + h5ds_id = H5I_INVALID_HID; } /* end if */ done: @@ -587,7 +587,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { - h5dset_space_id = -1; + h5dset_space_id = H5I_INVALID_HID; } } @@ -597,7 +597,7 @@ done: HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { - h5mem_space_id = -1; + h5mem_space_id = H5I_INVALID_HID; } } @@ -607,7 +607,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { - h5dxpl = -1; + h5dxpl = H5I_INVALID_HID; } } @@ -894,7 +894,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) GOTOERROR(FAIL); } - h5ds_id = -1; + h5ds_id = H5I_INVALID_HID; } /* end if */ done: @@ -906,7 +906,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { - h5dset_space_id = -1; + h5dset_space_id = H5I_INVALID_HID; } } @@ -916,7 +916,7 @@ done: HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { - h5mem_space_id = -1; + h5mem_space_id = H5I_INVALID_HID; } } @@ -926,7 +926,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { - h5dxpl = -1; + h5dxpl = H5I_INVALID_HID; } } @@ -1137,7 +1137,7 @@ done: hid_t set_vfd(parameters *param) { - hid_t my_fapl = -1; + hid_t my_fapl = H5I_INVALID_HID; vfdtype vfd; vfd = param->vfd; diff --git a/tools/test/perform/sio_perf.h b/tools/test/perform/sio_perf.h index 83caf54..d26c78b 100644 --- a/tools/test/perform/sio_perf.h +++ b/tools/test/perform/sio_perf.h @@ -13,12 +13,13 @@ #ifndef SIO_PERF_H__ #define SIO_PERF_H__ -#include "io_timer.h" #ifndef STANDALONE +#include "io_timer.h" #include "h5test.h" #include "h5tools.h" #include "h5tools_utils.h" #else +#include "io_timer.h" #include "sio_standalone.h" #endif diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index 248ef9a..45f6d25 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -498,8 +498,8 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #endif #ifdef H5_HAVE_PARALLEL -H5TEST_DLL int h5_set_info_object(void); -H5TEST_DLL void h5_dump_info_object(MPI_Info info); +int h5_set_info_object(void); +void h5_dump_info_object(MPI_Info info); #endif @@ -527,4 +527,10 @@ typedef struct long_options { extern int get_option(int argc, const char **argv, const char *opt, const struct long_options *l_opt); + +extern int nCols; /*max number of columns for outputting */ + +/* Definitions of useful routines */ +extern void print_version(const char *progname); + #endif diff --git a/tools/testfiles/trefer_attr.h5 b/tools/testfiles/trefer_attr.h5 Binary files differnew file mode 100644 index 0000000..3110ce3 --- /dev/null +++ b/tools/testfiles/trefer_attr.h5 diff --git a/tools/testfiles/trefer_attrR.ddl b/tools/testfiles/trefer_attrR.ddl new file mode 100644 index 0000000..e64c8e6 --- /dev/null +++ b/tools/testfiles/trefer_attrR.ddl @@ -0,0 +1,76 @@ +HDF5 "trefer_attr.h5" { +GROUP "/" { + DATASET "Dataset3" { + DATATYPE H5T_REFERENCE { H5T_STD_REF } + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + ATTRIBUTE "trefer_attr.h5/Group1/Dataset1/Attr1" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 0, 3, 6, 9 + } + } + ATTRIBUTE "trefer_attr.h5/Group1/Dataset2/Attr1" { + NULL + } + ATTRIBUTE "trefer_attr.h5/Group1/Attr2" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 1, 4, 7, 10 + } + } + ATTRIBUTE "trefer_attr.h5/Group1/Datatype1/Attr3" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 2, 5, 8, 11 + } + } + } + } + GROUP "Group1" { + ATTRIBUTE "Attr2" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 1, 4, 7, 10 + } + } + DATASET "Dataset1" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 0, 0, 0, 0 + } + ATTRIBUTE "Attr1" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 0, 3, 6, 9 + } + } + } + DATASET "Dataset2" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 0, 0, 0, 0 + } + } + DATATYPE "Datatype1" H5T_COMPOUND { + H5T_STD_I32LE "a"; + H5T_STD_I32LE "b"; + H5T_IEEE_F32LE "c"; + } + ATTRIBUTE "Attr3" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 2, 5, 8, 11 + } + } + } +} +} diff --git a/tools/testfiles/trefer_compat.h5 b/tools/testfiles/trefer_compat.h5 Binary files differnew file mode 100644 index 0000000..5f6dd60 --- /dev/null +++ b/tools/testfiles/trefer_compat.h5 diff --git a/tools/testfiles/trefer_compatR.ddl b/tools/testfiles/trefer_compatR.ddl new file mode 100644 index 0000000..97c7934 --- /dev/null +++ b/tools/testfiles/trefer_compatR.ddl @@ -0,0 +1,114 @@ +HDF5 "trefer_compat.h5" { +GROUP "/" { + DATASET "Dataset3" { + DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT } + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + DATASET "trefer_compat.h5/Group1/Dataset1" + DATA { + (0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } + DATASET "trefer_compat.h5/Group1/Dataset2" + DATA { + (0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } + GROUP "trefer_compat.h5/Group1" + DATATYPE "trefer_compat.h5/Group1/Datatype1" + } + } + DATASET "Dataset4" { + DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG } + DATASPACE SIMPLE { ( 2 ) / ( 2 ) } + DATA { + DATASET "trefer_compat.h5/Group1/Dataset1" { + REGION_TYPE BLOCK (2,2)-(7,7) + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) } + DATA { + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 + } + } + DATASET "trefer_compat.h5/Group1/Dataset2" { + REGION_TYPE POINT (6,9), (2,2), (8,4), (1,6), (2,8), (3,2), + (0,4), (9,0), (7,1), (3,3) + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) } + DATA { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + } + } + } + } + GROUP "Group1" { + DATASET "Dataset1" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) } + DATA { + (0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } + } + DATASET "Dataset2" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) } + DATA { + (0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } + } + DATATYPE "Datatype1" H5T_COMPOUND { + H5T_STD_I32LE "a"; + H5T_STD_I32LE "b"; + H5T_IEEE_F32LE "c"; + } + } +} +} diff --git a/tools/testfiles/trefer_ext1.h5 b/tools/testfiles/trefer_ext1.h5 Binary files differnew file mode 100644 index 0000000..9fc9741 --- /dev/null +++ b/tools/testfiles/trefer_ext1.h5 diff --git a/tools/testfiles/trefer_ext2.h5 b/tools/testfiles/trefer_ext2.h5 Binary files differnew file mode 100644 index 0000000..fcbb75d --- /dev/null +++ b/tools/testfiles/trefer_ext2.h5 diff --git a/tools/testfiles/trefer_extR.ddl b/tools/testfiles/trefer_extR.ddl new file mode 100644 index 0000000..3d4647d --- /dev/null +++ b/tools/testfiles/trefer_extR.ddl @@ -0,0 +1,34 @@ +HDF5 "trefer_ext2.h5" { +GROUP "/" { + DATASET "Dataset3" { + DATATYPE H5T_REFERENCE { H5T_STD_REF } + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + ATTRIBUTE "trefer_ext1.h5/Group1/Dataset1/Attr1" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 0, 3, 6, 9 + } + } + ATTRIBUTE "trefer_ext1.h5/Group1/Dataset2/Attr1" { + NULL + } + ATTRIBUTE "trefer_ext1.h5/Group1/Attr2" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 1, 4, 7, 10 + } + } + ATTRIBUTE "trefer_ext1.h5/Group1/Datatype1/Attr3" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 2, 5, 8, 11 + } + } + } + } +} +} diff --git a/tools/testfiles/trefer_grp.h5 b/tools/testfiles/trefer_grp.h5 Binary files differnew file mode 100644 index 0000000..d846e75 --- /dev/null +++ b/tools/testfiles/trefer_grp.h5 diff --git a/tools/testfiles/trefer_grpR.ddl b/tools/testfiles/trefer_grpR.ddl new file mode 100644 index 0000000..298b836 --- /dev/null +++ b/tools/testfiles/trefer_grpR.ddl @@ -0,0 +1,15 @@ +HDF5 "trefer_grp.h5" { +GROUP "/" { + DATASET "dset" { + DATATYPE H5T_REFERENCE { H5T_STD_REF } + DATASPACE SCALAR + DATA { + GROUP "trefer_grp.h5/group" + } + } + GROUP "group" { + GROUP "group3" { + } + } +} +} diff --git a/tools/testfiles/trefer_obj.h5 b/tools/testfiles/trefer_obj.h5 Binary files differnew file mode 100644 index 0000000..de4c19d --- /dev/null +++ b/tools/testfiles/trefer_obj.h5 diff --git a/tools/testfiles/trefer_objR.ddl b/tools/testfiles/trefer_objR.ddl new file mode 100644 index 0000000..0d5af28 --- /dev/null +++ b/tools/testfiles/trefer_objR.ddl @@ -0,0 +1,59 @@ +HDF5 "trefer_obj.h5" { +GROUP "/" { + DATASET "Dataset3" { + DATATYPE H5T_REFERENCE { H5T_STD_REF } + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + DATASET "trefer_obj.h5/Group1/Dataset1" + DATA { + (0): 0 + } + } + } + DATASET "Dataset4" { + DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT } + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + DATASET "trefer_obj.h5/Group1/Dataset1" + DATA { + (0): 0 + } + } + } + DATASET "Dataset5" { + DATATYPE H5T_REFERENCE { H5T_STD_REF } + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + DATASET "trefer_obj.h5/Group1/Dataset1" + } + } + DATASET "Dataset6" { + DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG } + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + DATASET "trefer_obj.h5/Group1/Dataset1" + } + } + GROUP "Group1" { + DATASET "Dataset1" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + (0): 0 + } + } + DATASET "Dataset2" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + (0): 0 + } + } + DATATYPE "Datatype1" H5T_COMPOUND { + H5T_STD_I32LE "a"; + H5T_STD_I32LE "b"; + H5T_IEEE_F32LE "c"; + } + } +} +} diff --git a/tools/testfiles/trefer_obj_del.h5 b/tools/testfiles/trefer_obj_del.h5 Binary files differnew file mode 100644 index 0000000..c1710e8 --- /dev/null +++ b/tools/testfiles/trefer_obj_del.h5 diff --git a/tools/testfiles/trefer_obj_delR.ddl b/tools/testfiles/trefer_obj_delR.ddl new file mode 100644 index 0000000..fa238a5 --- /dev/null +++ b/tools/testfiles/trefer_obj_delR.ddl @@ -0,0 +1,11 @@ +HDF5 "trefer_obj_del.h5" { +GROUP "/" { + DATASET "Dataset2" { + DATATYPE H5T_REFERENCE { H5T_STD_REF } + DATASPACE SCALAR + DATA { + UNKNOWN "trefer_obj_del.h5" + } + } +} +} diff --git a/tools/testfiles/trefer_param.h5 b/tools/testfiles/trefer_param.h5 Binary files differnew file mode 100644 index 0000000..234629a --- /dev/null +++ b/tools/testfiles/trefer_param.h5 diff --git a/tools/testfiles/trefer_paramR.ddl b/tools/testfiles/trefer_paramR.ddl new file mode 100644 index 0000000..ce9fa86 --- /dev/null +++ b/tools/testfiles/trefer_paramR.ddl @@ -0,0 +1,43 @@ +HDF5 "trefer_param.h5" { +GROUP "/" { + DATASET "Dataset3" { + DATATYPE H5T_REFERENCE { H5T_STD_REF } + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + NULL + NULL + NULL + NULL + } + } + GROUP "Group1" { + COMMENT "Foo!" + DATASET "Dataset1" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 0, 3, 6, 9 + } + } + DATASET "Dataset2" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 0, 0, 0, 0 + } + ATTRIBUTE "Attr" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + (0): 0, 3, 6, 9 + } + } + } + DATATYPE "Datatype1" H5T_COMPOUND { + H5T_STD_I32LE "a"; + H5T_STD_I32LE "b"; + H5T_IEEE_F32LE "c"; + } + } +} +} diff --git a/tools/testfiles/trefer_reg.h5 b/tools/testfiles/trefer_reg.h5 Binary files differnew file mode 100644 index 0000000..8ed9184 --- /dev/null +++ b/tools/testfiles/trefer_reg.h5 diff --git a/tools/testfiles/trefer_regR.ddl b/tools/testfiles/trefer_regR.ddl new file mode 100644 index 0000000..683c196 --- /dev/null +++ b/tools/testfiles/trefer_regR.ddl @@ -0,0 +1,66 @@ +HDF5 "trefer_reg.h5" { +GROUP "/" { + DATASET "DS_NA" { + DATATYPE H5T_REFERENCE { H5T_STD_REF } + DATASPACE SIMPLE { ( 1 ) / ( 1 ) } + DATA { + NULL + } + } + DATASET "Dataset1" { + DATATYPE H5T_REFERENCE { H5T_STD_REF } + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + DATA { + DATASET "trefer_reg.h5/Dataset2" { + REGION_TYPE BLOCK (2,2)-(7,7) + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) } + DATA { + 66, 69, 72, 75, 78, 81, + 96, 99, 102, 105, 108, 111, + 126, 129, 132, 135, 138, 141, + 156, 159, 162, 165, 168, 171, + 186, 189, 192, 195, 198, 201, + 216, 219, 222, 225, 228, 231 + } + } + DATASET "trefer_reg.h5/Dataset2" { + REGION_TYPE POINT (6,9), (2,2), (8,4), (1,6), (2,8), (3,2), + (0,4), (9,0), (7,1), (3,3) + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) } + DATA { + 207, + 66, + 252, + 48, + 84, + 96, + 12, + 14, + 213, + 99 + } + } + DATASET "trefer_reg.h5/Dataset2" + DATASET "trefer_reg.h5/Dataset2" + } + } + DATASET "Dataset2" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) } + DATA { + (0,0): 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, + (1,0): 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, + (2,0): 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, + (3,0): 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, + (4,0): 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, + (5,0): 150, 153, 156, 159, 162, 165, 168, 171, 174, 177, + (6,0): 180, 183, 186, 189, 192, 195, 198, 201, 204, 207, + (7,0): 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, + (8,0): 240, 243, 246, 249, 252, 255, 2, 5, 8, 11, + (9,0): 14, 17, 20, 23, 26, 29, 32, 35, 38, 41 + } + } +} +} diff --git a/tools/testfiles/trefer_reg_1d.h5 b/tools/testfiles/trefer_reg_1d.h5 Binary files differnew file mode 100644 index 0000000..932454d --- /dev/null +++ b/tools/testfiles/trefer_reg_1d.h5 diff --git a/tools/testfiles/trefer_reg_1dR.ddl b/tools/testfiles/trefer_reg_1dR.ddl new file mode 100644 index 0000000..3e5f652 --- /dev/null +++ b/tools/testfiles/trefer_reg_1dR.ddl @@ -0,0 +1,66 @@ +HDF5 "trefer_reg_1d.h5" { +GROUP "/" { + DATASET "Dataset1" { + DATATYPE H5T_REFERENCE { H5T_STD_REF } + DATASPACE SIMPLE { ( 2 ) / ( 2 ) } + DATA { + DATASET "trefer_reg_1d.h5/Dataset2" { + REGION_TYPE BLOCK (2)-(3), (7)-(8), (12)-(13), (17)-(18), + (22)-(23), (27)-(28), (32)-(33), (37)-(38), (42)-(43), + (47)-(48), (52)-(53), (57)-(58), (62)-(63), (67)-(68), + (72)-(73) + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 100 ) / ( 100 ) } + DATA { + 6, 9, + 21, 24, + 36, 39, + 51, 54, + 66, 69, + 81, 84, + 96, 99, + 111, 114, + 126, 129, + 141, 144, + 156, 159, + 171, 174, + 186, 189, + 201, 204, + 216, 219 + } + } + DATASET "trefer_reg_1d.h5/Dataset2" { + REGION_TYPE POINT (16), (22), (38), (41), (52), (63), (70), + (89), (97), (3) + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 100 ) / ( 100 ) } + DATA { + 48, + 66, + 114, + 123, + 156, + 189, + 210, + 11, + 35, + 9 + } + } + } + } + DATASET "Dataset2" { + DATATYPE H5T_STD_U8LE + DATASPACE SIMPLE { ( 100 ) / ( 100 ) } + DATA { + (0): 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, + (17): 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, + (33): 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, + (46): 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, + (59): 177, 180, 183, 186, 189, 192, 195, 198, 201, 204, 207, 210, 213, + (72): 216, 219, 222, 225, 228, 231, 234, 237, 240, 243, 246, 249, 252, + (85): 255, 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41 + } + } +} +} |